If HKey is unsigned, then yes, the definition should be
HKEY(DWORD($8001)). I do wonder why Win64 produces that particular
error though because the final destination is an unsigned 64-bit integer.
Kit
On 12/02/2023 17:17, Bart via fpc-devel wrote:
Hi,
This code compiles happily for
Hi,
This code compiles happily for Win32, but refuses to compile for Win64:
program test;
{$mode objfpc}
{$h+}
uses
Registry;
type
TA = class
private
FRootKey: HKey;
public
//Win64/X86_64 Error: Range check error while evaluating constants
(18446744071562067969 must be
On Sun, Feb 12, 2023 at 6:26 PM J. Gareth Moreton via fpc-devel
wrote:
>
> If HKey is unsigned, then yes, the definition should be
> HKEY(DWORD($8001)). I do wonder why Win64 produces that particular
> error though because the final destination is an unsigned 64-bit integer.
Because
On 12.02.2023 23:04, J. Gareth Moreton via fpc-devel wrote:
Yeah, of course, since LongInt($8001), before typecasting to HKEY, is
specifically a signed constant. So obvious!!
Declarations like this have been made on purpose:
HKEY_CURRENT_USER = HKEY(longint($8001));
On Win64
On 12/02/2023 22:37, Yuriy Sydorov via fpc-devel wrote:
property RootKey: HKey read FRootKey write FRootKey default
HKEY_CURRENT_USER;
Since HKEY = THandle = QWord on Win64, the reported range for it is
incorrect.
Afaik it's because "default" doesn't support qword values, iirc because
of
On Sun, Feb 12, 2023 at 10:43 PM Yuriy Sydorov via fpc-devel
wrote:
> Declarations like this have been made on purpose:
> HKEY_CURRENT_USER = HKEY(longint($8001));
>
> On Win64 HKEY_CURRENT_USER must be $8001, but on Win32 it must
> remain $8001.
>
> See commit
On Sun, Feb 12, 2023 at 10:47 PM Jonas Maebe via fpc-devel
wrote:
> Afaik it's because "default" doesn't support qword values, iirc because
> of (at least old) Delphi compatibility.
OK, I removed the "default".
Theoretically would that lead to problems when storing the value in
lfm and reading
Yeah, of course, since LongInt($8001), before typecasting to HKEY,
is specifically a signed constant. So obvious!!
Kit
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
wrote:
If HKey is unsigned, then yes, the definition
On Sun, Feb 12, 2023 at 10:47 PM Jonas Maebe via fpc-devel
wrote:
> Afaik it's because "default" doesn't support qword values, iirc because
> of (at least old) Delphi compatibility.
Would the original code example compile in a modern 64-bit Delphi
(targeting Win64)?
My old D7 doesn't even know
On Sun, Feb 12, 2023 at 10:49 PM Bart 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
On 12.02.2023 23:08, Bart via fpc-devel wrote:
On Sun, Feb 12, 2023 at 10:47 PM Jonas Maebe via fpc-devel
wrote:
Afaik it's because "default" doesn't support qword values, iirc because
of (at least old) Delphi compatibility.
OK, I removed the "default".
Theoretically would that lead to
11 matches
Mail list logo