# Include <stdafx. h>
# Include <windows. h>
# Include <iostream>
# Include <string>
// Using namespace STD;
Void findalldrivers (void)
...{
STD: cout <"all drivers are listed below you can type one of them to see it's ID :"
<STD: Endl;
DWORD dwnumbytesfordriverstrings;
Handle hheap;
Wchar_t * LP;
Dwnumbytesfordriverstrings = getlogicaldrivestrings (0, null) * sizeof (tchar );
If (dwnumbytesfordriverstrings! = 0)
...{
Hheap = getprocessheap ();
Lp = (wchar_t *) heapalloc (hheap, heap_zero_memory, dwnumbytesfordriverstrings );
Getlogicaldrivestrings (heapsize (hheap, 0, LP), LP );
While (* lp! = 0)
...{
STD: wcout <LP <STD: Endl;
Lp = wcschr (LP, 0) + 1;
}
}
Else
STD: cout <"can't use the function getlogicaldrivestrings! "<STD: Endl;
}
Int main (void)
...{
Findalldrivers ();
STD: cout <"Type A rootpathname of the drivers (format X:/) >:" <STD: flush;
STD: wstring strrootpath;
While (STD: wcin> strrootpath)
...{
Lpctstr lprootpath = strrootpath. c_str ();
Lptstr lpvolumenamebuffer = new wchar_t [12];
DWORD nvolumenamesize = 12;
DWORD volumeserialnumber;
DWORD maxinumcomponentlength;
DWORD filesystemflags;
Lptstr lpfilesystemnamebuffer = new wchar_t [10];
DWORD nfilesystemnamesize = 10;
Getvolumeinformation (lprootpath, lpvolumenamebuffer, nvolumenamesize,
& Volumeserialnumber, & maxinumcomponentlength, & filesystemflags,
Lpfilesystemnamebuffer, nfilesystemnamesize );
STD: the serial number of wcout <"Drive" <strrootpath <"is :"
<Volumeserialnumber <STD: Endl;
STD: wcout <"file system type:" <lpfilesystemnamebuffer <STD: Endl;
STD: cout <"Type A rootpathname of the drivers (format X:/) >:" <STD: flush;
}
}