[PATCH 4/5] mountmgr.sys: Add the ability to query filesystem attributes on a file handle.

Zebediah Figura (she/her) zfigura at codeweavers.com
Wed Mar 24 11:48:02 CDT 2021


On 3/18/21 11:54 AM, Erich E. Hoover wrote:
> @@ -2019,6 +2057,30 @@ NTSTATUS query_volume( void *buff, SIZE_T insize, SIZE_T outsize, IO_STATUS_BLOC
>      }
>      LeaveCriticalSection( &device_section );
>  
> +    if (!volume && input->info_class == FileFsAttributeInformation)
> +    {
> +        enum fs_type fs_type = FS_UNKNOWN;
> +        HANDLE hProcess, handle;
> +        BOOL ret;
> +        int fd;
> +
> +        if (!(hProcess = OpenProcess( PROCESS_DUP_HANDLE, FALSE, input->process )))
> +            return status;

This is right, but it looks wrong. I'd recommend returning early in the 
if (volume) block, and explicitly returning STATUS_NO_SUCH_DEVICE 
instead of initializing it at the top.

> +        ret = DuplicateHandle( hProcess, input->handle, GetCurrentProcess(), &handle, 0, FALSE,
> +                               DUPLICATE_SAME_ACCESS );
> +        CloseHandle( hProcess );
> +        if (!ret) return status;
> +        status = wine_server_handle_to_fd( handle, 0, &fd, NULL );
> +        if (!status)
> +        {
> +            fs_type = get_fd_fs_type( fd );
> +            wine_server_release_fd( handle, fd );
> +        }
> +        CloseHandle( handle );
> +        status = fill_volume_info( info_class, fs_type, 0, NULL, buff, outsize,
> +                                   &iosb->Information );
> +    }
> +
>      return status;
>  }
>  



More information about the wine-devel mailing list