Jump to content
Tom F

Cromis.DirectoryWatch range error

Recommended Posts

I've been using the freeware Cromis.DirectoryWatch for many years. I recently grabbed a much more recent version (from 2018) from here: https://github.com/CPsoftBE/BackupOfCromis.

And reworked my code to use it on Windows 10, Delphi 11.2.

It works great, except when I hit CTRL-ALT-DEL, when I get the range error shown below.

I confess to being a total "script kiddie" when it comes to this kind of deep OS code.  It appears the "if Assigned()"-code block is only done when a user enters CTRL-ALT-DEL. Perhaps this error deliberately caused by Microsoft when someone does CTRL-ALT-DELETE?

I don't want to just ignore this problem, but don't have any idea how to safely fix it. 

Any suggestions?

 

image.thumb.png.e2a760f535c3dff79d1753626f12dacc.png

Share this post


Link to post

The WParam of TMessage is ultimately of type NativeUInt while the WParam parameter is of type Longint.

Since Delphi 11 the default Debug config has Range and Overflow checks enabled which causes any signed to unsigned or vice versa assignment to possibly raise a range check error.

 

Strictly speaking any assignment of signed to unsigned and vice versa is a potential defect - you can reveal them by turning W1071 on with {$WARN IMPLICIT_INTEGER_CAST_LOSS ON}

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×