1 #include <precomp.h> 2 #include <ctype.h> 3 #include <direct.h> 4 5 6 /* 7 * @implemented 8 * 9 * _getdrive (MSVCRT.@) 10 * 11 * Get the current drive number. 12 * 13 * PARAMS 14 * None. 15 * 16 * RETURNS 17 * Success: The drive letter number from 1 to 26 ("A:" to "Z:"). 18 * Failure: 0. 19 */ _getdrive(void)20int _getdrive(void) 21 { 22 WCHAR buffer[MAX_PATH]; 23 if (GetCurrentDirectoryW( MAX_PATH, buffer )>=2) 24 { 25 buffer[0]=towupper(buffer[0]); 26 if (buffer[0] >= L'A' && buffer[0] <= L'Z' && buffer[1] == L':') 27 return buffer[0] - L'A' + 1; 28 } 29 return 0; 30 } 31 32 /* 33 * @implemented 34 */ _getdrives(void)35unsigned long _getdrives(void) 36 { 37 return GetLogicalDrives(); 38 } 39