[fpc-pascal]Win32 API Call

Gabor DEAK JAHN djg at tramontana.co.hu
Sat Dec 8 01:33:05 CET 2001

At 12/7/2001 03:38 PM, you wrote:


 > But is that why you're using the @ symbol for BytesFree? Somehow I get the
 > feeling you're going to tell me no. And if you do, then how come the Win32
 > Reference says all the values are pularge_integer but only ones need to be
 > referenced by it's address?

That's the error I mentioned in Redef.inc. You are right and your Win32
reference is right, this is an error of the compiler. The original in
Redef.inc looks like this:

function GetDiskFreeSpaceEx(lpDirectoryName: PChar; var
lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes;
lpTotalNumberOfFreeBytes: PLargeInteger): BOOL;external 'kernel32' name

This is not equivalent to what Windows expects: the first two parameters,
lpFreeBytesAvailableToCaller and lpTotalNumberOfBytes are declared as
untyped var parameters (generic pointers), while the third parameter,
lpTotalNumberOfFreeBytes is a pointer to a large integer. The Win32 API, in
contrast to this, specifies all three parameters as pointers to large
integers, hence the need to change the semicolon after lpTotalNumberOfBytes
to a comma.

If this is corrected, you don't have to use the '@' operator before the
third parameter any more.


Gabor DEAK JAHN -- Budapest, Hungary.
E-mail: djg at tramontana.co.hu

More information about the fpc-pascal mailing list