RE: GetDiskFreeSpaceA
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Jun 11, 2001
- 346 views
> -----Original Message----- > From: Travis Beaty [mailto:travisbeaty at arn.net] > As I plug along on the installer, I've run into a bit of a > snag when it > comes to calling the API function GetDiskFreeSpace(). I have > linked to the function like this: > > -- start code > include win32lib.ew > > atom aGetDiskFreeSpace > > aGetDiskFreeSpace = define_c_func(kernel32, > "GetDiskFreeSpaceA", > {C_POINTER, C_POINTER, C_POINTER, C_POINTER, > C_POINTER}, > C_ULONG) > > -- end code > > Unfortunately, aGetDiskFreeSpace is getting a value of -1, which > means that the poor installer is backfiring something fierce. You can't use the same values for the dll as win32lib defines with define_c_proc/func. This is because win32lib doesn't actually call open_dll/define... until c_func/proc is called, to avoid loading things into memory. So, what you end up with is an index to the actual value which is stored in a sequence. You'll need to either open the dll yourself, or use the win32lib routines for linking/calling dll routines. Matt Lewis