Re: get free disk space in win32
- Posted by LarryMiller Dec 20, 2009
- 1228 views
ssallen said...
Hello again,
Another inane question from yours truly. What is the best way to get the amount of free disk space under win32? I checked the msdn reference and found the following function but have no idea how to wrap it. I tried digging through the internals of win32lib but couldn't find a reference to the PULARGE datatype. Any ideas? How does everyone else do it?
BOOL WINAPI GetDiskFreeSpaceEx( __in_opt LPCTSTR lpDirectoryName, __out_opt PULARGE_INTEGER lpFreeBytesAvailable, __out_opt PULARGE_INTEGER lpTotalNumberOfBytes, __out_opt PULARGE_INTEGER lpTotalNumberOfFreeBytes );
As always, your help is always appreciated!
Thanks in advance!
Steve A.
The PULARGE_INTEGER is a structure containing an unsigned 64 bit integer. A 32 bit value could hold only values up to 4GB, much too small for modern drives. You would obtain the value from it like this:
value=peek4u(pAddress) *#100000000 + peek4u(pAddress)