Ok, I'm now on a different machine (though still win XP/dev-Cpp setup), and I've done a few more tests. the code seems to run ok on C: but screws up on E and F (E is the system drive in this case)
here's the source
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main(int argc, char *argv[])
{
__int64 total,free;
char Dnames[4];
int n;
for(n=0;argv[1][n]!='\0';n++)
{
sprintf(Dnames,"%c:\\",argv[1][n]);
printf("Drive %s\n",Dnames);
if(GetDriveType(Dnames) !=DRIVE_FIXED)
{
printf("not a fixed drive, skipping");
}else{
GetDiskFreeSpaceEx(Dnames,NULL,(PULARGE_INTEGER)&total,(PULARGE_INTEGER)&free);
printf("TOTAL:%u bytes\n",total);
printf("FREE :%u bytes\n",free);
}
}
return 0;
}
the code takes one argument, a string representing a list of drives to scan, eg
drivereporter.exe "CEF"
and the output when run on this computer, with that command line:
Drive C:\
TOTAL:106670080 bytes
FREE :56360960 bytes
Drive E:\
TOTAL:1254318080 bytes
FREE :1890611200 bytes
Drive F:\
TOTAL:3878248448 bytes
FREE :93036544 bytes
The free values for each drive are correct to an accuracy of a few mb, howevr something very weird is going on with the totals:
C is a 100mb FAT32 partition, which has turned out correct
E is the remaining partition on that drive, 37.1 Gb NTFS, system drive
F is a 16 Gb partition on a 20 Gb drive (FAT 32) the last 4 Gb of this drive is unaccssible to windows (Linux partition).
there's some pretty weird stuff going on there, but I don't really know enough about it to draw much of a conclusion.
I've read the posts from this forum ( and from some google searches) and I've seen nothing that would indicate this kindof behaviour.
thanks for the responses
-mark