From cbbe6e59dd1c605c06743b9bc38565e9bb0a008e Mon Sep 17 00:00:00 2001 From: Jianqiu Zhang Date: Sat, 4 Apr 2015 11:59:06 +0800 Subject: [PATCH 3/3] ntdll: Add support for FileFsFullSizeInformation class in NtQueryVolumeInformationFile --- dlls/ntdll/file.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 0dc5c13..f0e1c91 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -3047,7 +3047,59 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io FIXME( "%p: control info not supported\n", handle ); break; case FileFsFullSizeInformation: - FIXME( "%p: full size info not supported\n", handle ); + if(length < sizeof(FILE_FS_FULL_SIZE_INFORMATION)) + io->u.Status = STATUS_BUFFER_TOO_SMALL; + else + { + FILE_FS_FULL_SIZE_INFORMATION *info = buffer; + + if (fstat( fd, &st ) < 0) + { + io->u.Status = FILE_GetNtStatus(); + break; + } + if(!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) + { + io->u.Status = STATUS_INVALID_DEVICE_REQUEST; + } + else + { + ULONGLONG bsize; +#if !defined(linux) || !defined(HAVE_FSTATFS) + struct statvfs stfs; + + if(fstatvfs( fd, &stfs ) < 0) + { + io->u.Status = FILE_GetNtStatus(); + break; + } + bsize = stfs.f_frsize; +#else + struct statfs stfs; + if(fstatfs( fd, &stfs ) < 0) + { + io->u.Status = FILE_GetNtStatus(); + break; + } + bsize = stfs.f_bsize; +#endif + if(bsize == 2048) /* assume CD-ROM */ + { + info->BytesPerSector = 2048; + info->SectorsPerAllocationUnit = 1; + } + else + { + info->BytesPerSector = 512; + info->SectorsPerAllocationUnit = 8; + } + info->TotalAllocationUnits.QuadPart = bsize * stfs.f_blocks / (info->BytesPerSector * info->SectorsPerAllocationUnit); + info->CallerAvailableAllocationUnits.QuadPart = bsize * stfs.f_bavail / (info->BytesPerSector * info->SectorsPerAllocationUnit); + info->ActualAvailableAllocationUnits.QuadPart = bsize * stfs.f_bfree / (info->BytesPerSector * info->SectorsPerAllocationUnit); + io->Information = sizeof(*info); + io->u.Status = STATUS_SUCCESS; + } + } break; case FileFsObjectIdInformation: FIXME( "%p: object id info not supported\n", handle ); -- 1.9.1