Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2026-06

windows shlobj SIGDN longint

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

Hi,

Unit shlobj has:

       SIGDN      = longint;

But the constants are for example:

SIGDN_FILESYSPATH               = $80058000;

Maybe SIGDN must be DWord?

Mattias

Reply by email

J. Gareth "Kit" Moreton
to Mattias Gaertner

I think it's deliberately designed that way so such codes are negative numbers in signed 32-bit.

Gareth aka. Kit

Mattias Gaertner wrote 19 lines
Hi, Unit shlobj has:       SIGDN      = longint; But the constants are for example: SIGDN_FILESYSPATH               = $80058000; Maybe SIGDN must be DWord? Mattias _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Mattias Gaertner
to J. Gareth "Kit" Moreton
J. Gareth "Kit" Moreton wrote
I think it's deliberately designed that way so such codes are negative numbers in signed 32-bit.

I spotted it because code fails to compile with a range check error.

Windows docs says these constants are from an enumeration.

Mattias

Show quoted text 25 lines
Gareth aka. Kit On 24/06/2026 20:51, Mattias Gaertner via fpc-devel wrote: > Hi, > > Unit shlobj has: > >       SIGDN      = longint; > > But the constants are for example: > > SIGDN_FILESYSPATH               = $80058000; > > > Maybe SIGDN must be DWord? > > Mattias > > _______________________________________________ > fpc-devel maillist  -  > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth "Kit" Moreton
to Mattias Gaertner

Hmmm, that's a little bit difficult.  What happens if you define the constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"?

Gareth aka. Kit

Mattias Gaertner wrote 43 lines
On 6/24/26 22:35, J. Gareth "Kit" Moreton via fpc-devel wrote: > I think it's deliberately designed that way so such codes are > negative numbers in signed 32-bit. I spotted it because code fails to compile with a range check error. Windows docs says these constants are from an enumeration. Mattias > Gareth aka. Kit > > On 24/06/2026 20:51, Mattias Gaertner via fpc-devel wrote: >> Hi, >> >> Unit shlobj has: >> >>       SIGDN      = longint; >> >> But the constants are for example: >> >> SIGDN_FILESYSPATH               = $80058000; >> >> >> Maybe SIGDN must be DWord? >> >> Mattias >> >> _______________________________________________ >> fpc-devel maillist  -  >> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >> > _______________________________________________ > fpc-devel maillist  -  > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Mattias Gaertner
to J. Gareth "Kit" Moreton
J. Gareth "Kit" Moreton wrote
Hmmm, that's a little bit difficult.  What happens if you define the constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"?

Then it would compile.

But it seems the C code uses DWord, so why should FPC use longint?

Mattias

Show quoted text 50 lines
Gareth aka. Kit On 24/06/2026 21:44, Mattias Gaertner via fpc-devel wrote: > > > On 6/24/26 22:35, J. Gareth "Kit" Moreton via fpc-devel wrote: >> I think it's deliberately designed that way so such codes are >> negative numbers in signed 32-bit. > > I spotted it because code fails to compile with a range check error. > > Windows docs says these constants are from an enumeration. > > Mattias > > >> Gareth aka. Kit >> >> On 24/06/2026 20:51, Mattias Gaertner via fpc-devel wrote: >>> Hi, >>> >>> Unit shlobj has: >>> >>>       SIGDN      = longint; >>> >>> But the constants are for example: >>> >>> SIGDN_FILESYSPATH               = $80058000; >>> >>> >>> Maybe SIGDN must be DWord? >>> >>> Mattias >>> >>> _______________________________________________ >>> fpc-devel maillist  -  >>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >>> >> _______________________________________________ >> fpc-devel maillist  -  >> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > _______________________________________________ > fpc-devel maillist  -  > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth "Kit" Moreton
to Mattias Gaertner

Ah, if you mean that SIGDN is defined as a DWord in its C headers but as a LongInt in FPC, then I think it's due to backwards compatibility back when Turbo Pascal and Delphi didn't have an unsigned 32-bit integer type (LongWord), and so such a hexadecimal constant would default to LongInt.

Gareth aka. Kit

Mattias Gaertner wrote 67 lines
On 6/24/26 22:54, J. Gareth "Kit" Moreton via fpc-devel wrote: > Hmmm, that's a little bit difficult.  What happens if you define the > constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"? Then it would compile. But it seems the C code uses DWord, so why should FPC use longint? Mattias > > Gareth aka. Kit > > On 24/06/2026 21:44, Mattias Gaertner via fpc-devel wrote: >> >> >> On 6/24/26 22:35, J. Gareth "Kit" Moreton via fpc-devel wrote: >>> I think it's deliberately designed that way so such codes are >>> negative numbers in signed 32-bit. >> >> I spotted it because code fails to compile with a range check error. >> >> Windows docs says these constants are from an enumeration. >> >> Mattias >> >> >>> Gareth aka. Kit >>> >>> On 24/06/2026 20:51, Mattias Gaertner via fpc-devel wrote: >>>> Hi, >>>> >>>> Unit shlobj has: >>>> >>>>       SIGDN      = longint; >>>> >>>> But the constants are for example: >>>> >>>> SIGDN_FILESYSPATH               = $80058000; >>>> >>>> >>>> Maybe SIGDN must be DWord? >>>> >>>> Mattias >>>> >>>> _______________________________________________ >>>> fpc-devel maillist  -  >>>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >>>> >>> _______________________________________________ >>> fpc-devel maillist  -  >>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >> >> _______________________________________________ >> fpc-devel maillist  -  >> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >> > _______________________________________________ > fpc-devel maillist  -  > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Van Canneyt
to Mattias Gaertner: Then it would compile. But it seems the C code uses DWord, so why should FPC use longint?…
Mattias Gaertner wrote 9 lines
On 6/24/26 22:54, J. Gareth "Kit" Moreton via fpc-devel wrote: > Hmmm, that's a little bit difficult.  What happens if you define the > constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"? Then it would compile. But it seems the C code uses DWord, so why should FPC use longint?

Historic reasons, most likely.
Of course it should not use longint these days, it must be changed to DWord/Cardinal.

Michael.

Reply by email

gabor
to Mattias Gaertner: Then it would compile. But it seems the C code uses DWord, so why should FPC use longint?…

W dniu 2026-06-25 o 00:51, Mattias Gaertner via fpc-devel pisze:

Show quoted text 9 lines
On 6/24/26 22:54, J. Gareth "Kit" Moreton via fpc-devel wrote: > Hmmm, that's a little bit difficult.  What happens if you define the > constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"? Then it would compile. But it seems the C code uses DWord, so why should FPC use longint? Mattias

This is how it's defined in header file:
enum _SIGDN
{
SIGDN_NORMALDISPLAY = 0,
SIGDN_PARENTRELATIVEPARSING = ( int )0x80018001,
SIGDN_DESKTOPABSOLUTEPARSING = ( int )0x80028000, SIGDN_PARENTRELATIVEEDITING = ( int )0x80031001,
SIGDN_DESKTOPABSOLUTEEDITING = ( int )0x8004c000, SIGDN_FILESYSPATH = ( int )0x80058000,
SIGDN_URL = ( int )0x80068000,
SIGDN_PARENTRELATIVEFORADDRESSBAR = ( int )0x8007c001, SIGDN_PARENTRELATIVE = ( int )0x80080001,
SIGDN_PARENTRELATIVEFORUI = ( int )0x80094001

     } 	SIGDN;

It looks like it's a signed integer.

https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/um/ShObjIdl_core.h#L7904

https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-sigdn#constants

Michał.

Reply by email

Mattias Gaertner
to gabor
gabor wrote 17 lines
[...] This is how it's defined in header file: enum _SIGDN     {         SIGDN_NORMALDISPLAY    = 0,         SIGDN_PARENTRELATIVEPARSING    = ( int  )0x80018001,         SIGDN_DESKTOPABSOLUTEPARSING    = ( int  )0x80028000,         SIGDN_PARENTRELATIVEEDITING    = ( int  )0x80031001,         SIGDN_DESKTOPABSOLUTEEDITING    = ( int  )0x8004c000,         SIGDN_FILESYSPATH    = ( int  )0x80058000,         SIGDN_URL    = ( int  )0x80068000,         SIGDN_PARENTRELATIVEFORADDRESSBAR    = ( int  )0x8007c001,         SIGDN_PARENTRELATIVE    = ( int  )0x80080001,         SIGDN_PARENTRELATIVEFORUI    = ( int  )0x80094001     }     SIGDN; It looks like it's a signed integer.

Ah, thx, so the FPC constants need the typecast.

Mattias

Reply by email

Marco van de Voort
to Mattias Gaertner

Op 25-6-2026 om 11:58 schreef Mattias Gaertner via fpc-devel:

Show quoted text 23 lines
On 6/25/26 11:48, gabor wrote: > [...] > This is how it's defined in header file: > enum _SIGDN >      { >          SIGDN_NORMALDISPLAY    = 0, >          SIGDN_PARENTRELATIVEPARSING    = ( int  )0x80018001, >          SIGDN_DESKTOPABSOLUTEPARSING    = ( int  )0x80028000, >          SIGDN_PARENTRELATIVEEDITING    = ( int  )0x80031001, >          SIGDN_DESKTOPABSOLUTEEDITING    = ( int  )0x8004c000, >          SIGDN_FILESYSPATH    = ( int  )0x80058000, >          SIGDN_URL    = ( int  )0x80068000, >          SIGDN_PARENTRELATIVEFORADDRESSBAR    = ( int )0x8007c001, >          SIGDN_PARENTRELATIVE    = ( int  )0x80080001, >          SIGDN_PARENTRELATIVEFORUI    = ( int  )0x80094001 >      }     SIGDN; > > It looks like it's a signed integer. Ah, thx, so the FPC constants need the typecast.

Shall I change the definition of constants in the header to longint($8000..) ?

Reply by email