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
|
void ExploreDrives()
{
char let,szbuf[5];
int nError;
char szRemote[256],*psz;
DWORD l=255;
short int *pt=NULL;
CString str;
UINT ntyp;
for(let='B';let<='Z';let++)
{
sprintf(szbuf,"%c:",let);
if((nError=WNetGetConnection(szbuf,szRemote,&l))==NO_ERROR)
{
psz=strtok(szRemote,"\\\\");
TRACE("\nWnet:%s",szRemote);
}
else
{
str.Format("%c:\\",let);
ntyp=GetDriveType(str);
TRACE("\nDrive :%s :%d"",(const char *)str,ntyp);
if(ntyp==DRIVE_CDROM)
{
//
continue;
}
if(ntyp==DRIVE_REMOVABLE)
{
//
continue;
}
if(ntyp==DRIVE_FIXED)
{
//
continue;
}
else
// tentative de reconnection lettre reseau
if(nError==ERROR_CONNECTION_UNAVAIL)
{
if(WNetAddConnection(szRemote,NULL,szbuf)==NO_ERROR)
{
// si pas d'erreur
}
}
}
}
} |
Partager