From 7d5b6920faaadfd57785213745088563d17ec75a Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 24 May 2015 04:29:51 -0500 Subject: [PATCH] Added QuerySizeInfo for FileFsSizeInformation. --- src/xenia/kernel/fs/device.cc | 10 ++++++++++ src/xenia/kernel/fs/device.h | 1 + src/xenia/kernel/fs/entry.h | 3 ++- src/xenia/kernel/xboxkrnl_io.cc | 11 ++++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/fs/device.cc b/src/xenia/kernel/fs/device.cc index fabf9b251..c7ec89c87 100644 --- a/src/xenia/kernel/fs/device.cc +++ b/src/xenia/kernel/fs/device.cc @@ -38,6 +38,16 @@ X_STATUS Device::QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info, size_t return X_STATUS_SUCCESS; } +// TODO(gibbed): make virtual + move implementation into HostPathDevice/etc. +X_STATUS Device::QuerySizeInfo(X_FILE_FS_SIZE_INFORMATION* out_info, size_t length) { + assert_not_null(out_info); + out_info->total_allocation_units = 1234; // TODO(gibbed): actual value + out_info->available_allocation_units = 0; // TODO(gibbed): actual value + out_info->sectors_per_allocation_unit = 1; // TODO(gibbed): actual value + out_info->bytes_per_sector = 1024; // TODO(gibbed): actual value + return X_STATUS_SUCCESS; +} + // TODO(gibbed): make virtual + move implementation into HostPathDevice/etc. X_STATUS Device::QueryAttributeInfo(X_FILE_FS_ATTRIBUTE_INFORMATION* out_info, size_t length) { assert_not_null(out_info); diff --git a/src/xenia/kernel/fs/device.h b/src/xenia/kernel/fs/device.h index 86e86abd8..b54b374a3 100644 --- a/src/xenia/kernel/fs/device.h +++ b/src/xenia/kernel/fs/device.h @@ -31,6 +31,7 @@ class Device { virtual std::unique_ptr ResolvePath(const char* path) = 0; virtual X_STATUS QueryVolumeInfo(X_FILE_FS_VOLUME_INFORMATION* out_info, size_t length); + virtual X_STATUS QuerySizeInfo(X_FILE_FS_SIZE_INFORMATION* out_info, size_t length); virtual X_STATUS QueryAttributeInfo(X_FILE_FS_ATTRIBUTE_INFORMATION* out_info, size_t length); protected: diff --git a/src/xenia/kernel/fs/entry.h b/src/xenia/kernel/fs/entry.h index 3067d5197..d24401377 100644 --- a/src/xenia/kernel/fs/entry.h +++ b/src/xenia/kernel/fs/entry.h @@ -20,8 +20,9 @@ namespace kernel { class KernelState; class XFile; class X_FILE_NETWORK_OPEN_INFORMATION; -class X_FILE_FS_ATTRIBUTE_INFORMATION; class X_FILE_DIRECTORY_INFORMATION; +class X_FILE_FS_ATTRIBUTE_INFORMATION; +class X_FILE_FS_SIZE_INFORMATION; class X_FILE_FS_VOLUME_INFORMATION; } // namespace kernel } // namespace xe diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index 61982fce1..4ebb58fc2 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -625,6 +625,16 @@ SHIM_CALL NtQueryVolumeInformationFile_shim(PPCContext* ppc_state, free(volume_info); break; } + case 3: { // FileFsSizeInformation + auto fs_attribute_info = (X_FILE_FS_SIZE_INFORMATION*)calloc(length, 1); + result = file->device()->QuerySizeInfo(fs_attribute_info, length); + if (XSUCCEEDED(result)) { + fs_attribute_info->Write(SHIM_MEM_BASE, fs_info_ptr); + info = length; + } + free(fs_attribute_info); + break; + } case 5: { // FileFsAttributeInformation auto fs_attribute_info = (X_FILE_FS_ATTRIBUTE_INFORMATION*)calloc(length, 1); result = file->device()->QueryAttributeInfo(fs_attribute_info, length); @@ -636,7 +646,6 @@ SHIM_CALL NtQueryVolumeInformationFile_shim(PPCContext* ppc_state, break; } case 2: // FileFsLabelInformation - case 3: // FileFsSizeInformation case 4: // FileFsDeviceInformation case 6: // FileFsControlInformation case 7: // FileFsFullSizeInformation