1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// pour space disque
DWORD dwTotalSpace,dwFreeSpace;
DWORD dwDriveMask = GetLogicalDrives();
DWORD dwFreeClusters, dwTotalClusters;
DWORD dwBytesPerSector, dwSectorsPerCluster;
char szDir[4];
// pour la recherche de drivers
char LxDrv[2048];
int b,c,d;
char provi[128];
DWORD dwDRV,dwRC,dwTemp;
LPTSTR LpLxDrv=LxDrv;
LPTSTR LpDir="?:\\";
dwDRV=GetLogicalDrives();
dwRC=GetLogicalDriveStrings(2048,LpLxDrv);
b=0;
c=0;
d=1;
for(*LpDir='a';*LpDir<='z';(*LpDir)++)
{
dwTemp=dwDRV & 1;
dwDRV >>= 1;
if(dwTemp)
{
dwRC=GetDriveType(LpDir);
sprintf(provi,"%s",LpDir);
lachaine[b]=provi[0]-32;
if(lachaine[b]>'B' && dwRC<4)
{
chaine[c]=lachaine[b];
c++;
xchaine=c;
chaine[c]='\0';
//################# pour space disque
strcpy(szDir,"C:\\");
szDir[3] = 0;
GetDiskFreeSpace (szDir,&dwSectorsPerCluster,&dwBytesPerSector,
&dwFreeClusters,&dwTotalClusters);
dwTotalSpace =(dwTotalClusters
* dwSectorsPerCluster * dwBytesPerSector)/1024000;
dwFreeSpace = (dwFreeClusters
* dwSectorsPerCluster * dwBytesPerSector)/1024000;
if (d<4) SpacLib[d]=(int) dwFreeSpace;
d++;
//###########fin space disque
}
b++;
LpLxDrv=UpdateBuffer(LpLxDrv);
lachaine[b]=' ';
if(dwRC==2) lachaine[b]='r'; // REMOVABLE (ex A ou b)
if(dwRC==3) lachaine[b]='f'; // FIXE
if(dwRC==4) lachaine[b]='l'; // REMOTE
if(dwRC==5) lachaine[b]='c'; // CD-ROM
if(dwRC==6) lachaine[b]='v'; // virtuel RAM-DISK
b++;
lachaine[b]='\0';
}
} |
Partager