Alexandre Goujon ale.goujon@gmail.com writes:
Previous approach was patch #88280
dlls/kernel32/volume.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c index 8377e41..57453bb 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1435,27 +1435,15 @@ DWORD WINAPI QueryDosDeviceA( LPCSTR devname, LPSTR target, DWORD bufsize ) */ DWORD WINAPI GetLogicalDrives(void) {
- const char *config_dir = wine_get_config_dir();
- struct stat st;
- char *buffer, *dev; DWORD ret = 0;
- WCHAR drive; int i;
- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, strlen(config_dir) + sizeof("/dosdevices/a:") )))
- {
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0;
- }
- strcpy( buffer, config_dir );
- strcat( buffer, "/dosdevices/a:" );
- dev = buffer + strlen(buffer) - 2;
- for (i = 0; i < 26; i++) {
*dev = 'a' + i;
if (!stat( buffer, &st )) ret |= (1 << i);
drive = 'A'+i;
}if (get_mountmgr_drive_type(&drive) != DRIVE_UNKNOWN) ret |= (1 << i);
That's very inefficient. There are better way of enumerating drives, check for instance QueryDosDevice.