On 12.02.2023 23:04, J. Gareth Moreton via fpc-devel wrote:
Yeah, of course, since LongInt($80000001), before typecasting to HKEY, is 
specifically a signed constant.  So obvious!!

Declarations like this have been made on purpose:
HKEY_CURRENT_USER = HKEY(longint($80000001));

On Win64 HKEY_CURRENT_USER must be $FFFFFFFF80000001, but on Win32 it must 
remain $80000001.

See commit 2012220aec67494ac34329dabe8b6a05dacbb9c1 for details.

Don't break it if you decide to fix something.

Error "Range check error while evaluating constants (18446744071562067969 must be between -2147483648 and 4294967295)" is wrong here:

property RootKey: HKey read FRootKey write FRootKey default HKEY_CURRENT_USER;

Since HKEY = THandle = QWord on Win64, the reported range for it is incorrect.

Yuriy.

On 12/02/2023 20:43, Bart via fpc-devel wrote:
On Sun, Feb 12, 2023 at 6:26 PM J. Gareth Moreton via fpc-devel
<fpc-devel@lists.freepascal.org> wrote:
If HKey is unsigned, then yes, the definition should be
HKEY(DWORD($80000001)).  I do wonder why Win64 produces that particular
error though because the final destination is an unsigned 64-bit integer.
Because QWord(some not so big negative number) = some large positive number.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to