[fpc-devel] Unexpected "Range check error while evaluating constants" when compiling for Win64

Bart bartjunk64 at gmail.com
Sun Feb 12 22:56:17 CET 2023


On Sun, Feb 12, 2023 at 10:49 PM Bart <bartjunk64 at gmail.com> wrote:

> For 32-bit builds this results in the final HKEY value being identical
> to the original literal value, but for 64-bit builds, because of the
> intermediate signed LONG cast which is then cast to the larger
> unsigned ULONG_PTR type, the original value is effectively
> sign-extended to 64-bits, resulting in the most significant 32 bits
> being set.  So in 64-bit architectures HKEY_CLASSES_ROOT is
> 0xFFFFFFFF80000000, HKEY_CURRENT_USER is 0xFFFFFFFF80000001, and so
> on.

Notice that it seems that I can use QWord($0000000080000001) for
HKE_CURRENT_USER on Win64 (at least for RegOpenKeyReadOnly).

-- 
Bart


More information about the fpc-devel mailing list