[Kernel/VFS] Cleanup info query/set+sector size.

[VFS] Device now exposes name, attributes, component name max length.
[VFS] Fix STFS device to return 0x200 sector size. XCTD compression
      userland code appears to always expect a sector size of 0x200.
[Kernel] Move X_FILE_*_INFORMATION structs to new files.
[Kernel] Move NtQueryInformationFile, NtSetInformationFile,
         NtQueryVolumeInformationFile to new file.
[Kernel] Cleanup implementation of NtQueryInformationFile,
         NetSetInformationFile, NtQueryVolumeInformationFile.
[Kernel] Properly validate arguments to NtQueryInformationFile,
         NetSetInformationFile, NtQueryVolumeInformationFile.
[Kernel] Properly implement query of XFileFsVolumeInformation.
[Kernel] Properly implement query of XFileFsSizeInformation.
[Kernel] Properly implement query of XFileFsAttributeInformation.
This commit is contained in:
gibbed
2020-04-20 14:54:04 -05:00
committed by Rick Gibbed
parent 087247184d
commit cf0251cd9f
16 changed files with 620 additions and 401 deletions

View File

@@ -0,0 +1,115 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_INFO_FILE_H_
#define XENIA_KERNEL_INFO_FILE_H_
#include "xenia/xbox.h"
namespace xe {
namespace kernel {
// https://github.com/oukiar/vdash/blob/master/vdash/include/kernel.h
enum X_FILE_INFORMATION_CLASS {
XFileDirectoryInformation = 1,
XFileFullDirectoryInformation,
XFileBothDirectoryInformation,
XFileBasicInformation,
XFileStandardInformation,
XFileInternalInformation,
XFileEaInformation,
XFileAccessInformation,
XFileNameInformation,
XFileRenameInformation,
XFileLinkInformation,
XFileNamesInformation,
XFileDispositionInformation,
XFilePositionInformation,
XFileFullEaInformation,
XFileModeInformation,
XFileAlignmentInformation,
XFileAllInformation,
XFileAllocationInformation,
XFileEndOfFileInformation,
XFileAlternateNameInformation,
XFileStreamInformation,
XFileMountPartitionInformation,
XFileMountPartitionsInformation,
XFilePipeRemoteInformation,
XFileSectorInformation,
XFileXctdCompressionInformation,
XFileCompressionInformation,
XFileObjectIdInformation,
XFileCompletionInformation,
XFileMoveClusterInformation,
XFileIoPriorityInformation,
XFileReparsePointInformation,
XFileNetworkOpenInformation,
XFileAttributeTagInformation,
XFileTrackingInformation,
XFileMaximumInformation
};
#pragma pack(push, 1)
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_internal_information
struct X_FILE_INTERNAL_INFORMATION {
be<uint64_t> index_number;
};
static_assert_size(X_FILE_INTERNAL_INFORMATION, 8);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information
struct X_FILE_DISPOSITION_INFORMATION {
uint8_t delete_file;
};
static_assert_size(X_FILE_DISPOSITION_INFORMATION, 1);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_file_position_information
struct X_FILE_POSITION_INFORMATION {
be<uint64_t> current_byte_offset;
};
static_assert_size(X_FILE_POSITION_INFORMATION, 8);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_end_of_file_information
struct X_FILE_END_OF_FILE_INFORMATION {
be<uint64_t> end_of_file;
};
static_assert_size(X_FILE_END_OF_FILE_INFORMATION, 8);
struct X_FILE_XCTD_COMPRESSION_INFORMATION {
be<uint32_t> unknown;
};
static_assert_size(X_FILE_XCTD_COMPRESSION_INFORMATION, 4);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_completion_information
struct X_FILE_COMPLETION_INFORMATION {
be<uint32_t> handle;
be<uint32_t> key;
};
static_assert_size(X_FILE_COMPLETION_INFORMATION, 8);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_file_network_open_information
struct X_FILE_NETWORK_OPEN_INFORMATION {
be<uint64_t> creation_time;
be<uint64_t> last_access_time;
be<uint64_t> last_write_time;
be<uint64_t> change_time;
be<uint64_t> allocation_size;
be<uint64_t> end_of_file; // size in bytes
be<uint32_t> attributes;
be<uint32_t> pad;
};
static_assert_size(X_FILE_NETWORK_OPEN_INFORMATION, 56);
#pragma pack(pop)
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_INFO_FILE_H_

View File

@@ -0,0 +1,62 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_KERNEL_INFO_VOLUME_H_
#define XENIA_KERNEL_INFO_VOLUME_H_
#include "xenia/xbox.h"
namespace xe {
namespace kernel {
enum X_FILE_FS_INFORMATION_CLASS {
XFileFsVolumeInformation = 1,
XFileFsSizeInformation = 3,
XFileFsDeviceInformation,
XFileFsAttributeInformation = 5,
};
#pragma pack(push, 1)
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_fs_volume_information
struct X_FILE_FS_VOLUME_INFORMATION {
be<uint64_t> creation_time;
be<uint32_t> serial_number;
be<uint32_t> label_length;
uint8_t supports_objects;
char label[1];
uint8_t pad[6];
};
static_assert_size(X_FILE_FS_VOLUME_INFORMATION, 24);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_fs_size_information
struct X_FILE_FS_SIZE_INFORMATION {
be<uint64_t> total_allocation_units;
be<uint64_t> available_allocation_units;
be<uint32_t> sectors_per_allocation_unit;
be<uint32_t> bytes_per_sector;
};
static_assert_size(X_FILE_FS_SIZE_INFORMATION, 24);
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_fs_attribute_information
struct X_FILE_FS_ATTRIBUTE_INFORMATION {
be<uint32_t> attributes;
be<int32_t> component_name_max_length;
be<uint32_t> name_length;
char name[1];
uint8_t pad[3];
};
static_assert_size(X_FILE_FS_ATTRIBUTE_INFORMATION, 16);
#pragma pack(pop)
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_INFO_VOLUME_H_