From 2930d04e5b2d47f889290ed82bbb27c99f2dd430 Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Sun, 2 Mar 2014 12:07:36 -0500 Subject: [PATCH] windows: fall back for volume info query Wine does not currently support FileFsVolumeInformation: https://github.com/mirrors/wine/blob/0e42fd97c0/dlls/ntdll/file.c#L2679 So check io_status and fall back to previous behavior if not implemented. --- src/win/fs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/win/fs.c b/src/win/fs.c index d997b0ee..e5d878cf 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -861,9 +861,13 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) { FileFsVolumeInformation); /* Buffer overflow (a warning status code) is expected here. */ - if (NT_ERROR(nt_status)) { + if (io_status.Status == STATUS_NOT_IMPLEMENTED) { + statbuf->st_dev = 0; + } else if (NT_ERROR(nt_status)) { SetLastError(pRtlNtStatusToDosError(nt_status)); return -1; + } else { + statbuf->st_dev = volume_info.VolumeSerialNumber; } /* Todo: st_mode should probably always be 0666 for everyone. We might also @@ -920,8 +924,6 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) { statbuf->st_nlink = file_info.StandardInformation.NumberOfLinks; - statbuf->st_dev = volume_info.VolumeSerialNumber; - /* The st_blksize is supposed to be the 'optimal' number of bytes for reading * and writing to the disk. That is, for any definition of 'optimal' - it's * supposed to at least avoid read-update-write behavior when writing to the