From: Alexandre Goujon Subject: kernel32: Also report empty drives as available in GetLogicalDrives Message-Id: <1342382276-9708-1-git-send-email-ale.goujon@gmail.com> Date: Sun, 15 Jul 2012 21:57:56 +0200 --- dlls/kernel32/volume.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c index 8377e41..67e2eb1 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1441,19 +1441,26 @@ DWORD WINAPI GetLogicalDrives(void) DWORD ret = 0; int i; - if (!(buffer = HeapAlloc( GetProcessHeap(), 0, strlen(config_dir) + sizeof("/dosdevices/a:") ))) + 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; + strcat( buffer, "/dosdevices/a::" ); + dev = buffer + strlen(buffer) - 3; for (i = 0; i < 26; i++) { *dev = 'a' + i; + dev[2] = 0; if (!stat( buffer, &st )) ret |= (1 << i); + /* Windows also report empty drives as available */ + else + { + dev[2] = ':'; + if (!stat( buffer, &st )) ret |= (1 << i); + } } HeapFree( GetProcessHeap(), 0, buffer ); return ret; -- 1.7.9.5