reverse of QueryDosDevice
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Hi, I'm looking for function which works reverse of QueryDosDevice. I've got a "\\Device\\HarddiskVolume1" and I want to translate it to drive letter. ----------- Mila
TCHAR GetDriveLetter(LPCTSTR lpDevicePath) { TCHAR d = _T('A'); while(d < = _T('Z')) { TCHAR szDeviceName[3] = {d,_T(':'),_T('\0')}; TCHAR szTarget[512] = {0}; if(QueryDosDevice(szDeviceName, szTarget, 511) != 0) if(_tcscmp(lpDevicePath, szTarget) == 0) return d; d++; } return NULL; }