Added QuerySizeInfo for FileFsSizeInformation.

This commit is contained in:
gibbed 2015-05-24 04:29:51 -05:00
parent a4ef6e5837
commit 7d5b6920fa
4 changed files with 23 additions and 2 deletions

View File

@ -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);

View File

@ -31,6 +31,7 @@ class Device {
virtual std::unique_ptr<Entry> 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:

View File

@ -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

View File

@ -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