'BOOL GetDiskFreeSpaceEx(
' LPCTSTR lpDirectoryName, // directory name
' PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
' PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
' PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk
');
dir$="c:\"
struct AB,freebytesLo as ulong,freebytesHi as ulong 'available bytes
struct TB,totalbytesLo as ulong, totalbytesHi as ulong 'total bytes
struct FB,totalfreeLo as ulong, totalfreeHi as ulong 'total free bytes
calldll #kernel32, "GetDiskFreeSpaceExA",_
dir$ as ptr,_ 'directory name
AB as struct,TB as struct,FB as struct,_
ret as boolean 'nonzero=success
avBytes = AB.freebytesHi.struct* HexDec("100000000") + AB.freebytesLo.struct
print "Total available bytes is "; avBytes
print "Total available KB is approximately "; int(avBytes/1024)
print "Total available MB is approximately "; int((avBytes/1024)/1024)
print "Total available GB is approximately "; int(((avBytes/1024)/1024)/1024)
print
totalBytes = TB.totalbytesHi.struct* HexDec("100000000") + TB.totalbytesLo.struct
print "Total bytes is ";totalBytes
print "Total KB is approximately ";int(totalBytes/1024)
print "Total MB is approximately ";int((totalBytes/1024)/1024)
print "Total GB is approximately ";int(((totalBytes/1024)/1024)/1024)
print
freeBytes = FB.totalfreeHi.struct* HexDec("100000000") + FB.totalfreeLo.struct
print "Total free bytes is ";freeBytes
print "Total free KB is approximately ";int(freeBytes/1024)
print "Total free MB is approximately ";int((freeBytes/1024)/1024)
print "Total free GB is approximately ";int(((freeBytes/1024)/1024)/1024)
print
usedkb=int((totalBytes - freeBytes)/1024)
print "Total used KB is approximately ";usedkb
print "Total used MB is approximately ";int(usedkb/1024)
print "Total used GB is approximately ";int((usedkb/1024)/1024)
print
if ret=0 then print "failure" else print "success"
end