kernel32: Also report empty drives as available in GetLogicalDrives

Alexandre Julliard julliard at winehq.org
Mon Jul 16 11:20:41 CDT 2012


Alexandre Goujon <ale.goujon at gmail.com> writes:

> ---
>  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);
> +        }

You can't do that, the device symlinks don't reflect the availability of
the drive. It would have to go through the mountmgr.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list