[fpc-pascal]More strangeness...

L D Blake ldblake at sympatico.ca
Fri Aug 29 23:35:05 CEST 2003

In reply to your message of August 29, 2003
> Peter, longint is simply wrong. whist is may work in most circumstances, if
> you are on a system with a lot of handles being allocated, you will get to
> the realms on 32bit unsigned values. As the normal test for a handle
> allocation is :

There's a chance nobody has run into this before...

The SDK says that in 9x versions of windows Handles use only the 16 lsb of the
32 bit value (max 65535 open handles) and this would not cause a range check
error unless the program was run on a true 32 bit system like NT/2k/XP.  In
the latter versions, the full 32 bit value is allocated... and I'm on

> you are simply asking for trouble. A negative handle value is not
> acceptable. I'm guessing the problems have been got around by the shear luck
> of a silent cast when passing an longint to a function expecting a longword.
> However it's possible that L D Blake has stumbled accross somewhere where
> this is not possible.

Yep... using the 32bit compiler on a true 32bit operating system with actual
WinApi calls.

(Sorry for the sarcasm, but I'm sitting her watching a month and a half's work
go right down the drain...)

> It's not actually a Cardinal, it's a DWORD that is the normal Win32 type.
> DWORD is mapped to LongWord in Delphi and therefore Cardinal.

Actually the closest match in the FP system unit is LongWord.

FP defines "Cardinal" to be a dynamically sized possibility of Byte, Word or
Longword... which I also doubt windows is going to handle very well.

 L D Blake

More information about the fpc-pascal mailing list