diff --git a/src/xenia/kernel/fs/devices/disc_image_entry.cc b/src/xenia/kernel/fs/devices/disc_image_entry.cc index 493ef7cde..3ec844048 100644 --- a/src/xenia/kernel/fs/devices/disc_image_entry.cc +++ b/src/xenia/kernel/fs/devices/disc_image_entry.cc @@ -46,7 +46,7 @@ X_STATUS DiscImageEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) { return X_STATUS_SUCCESS; } -X_STATUS DiscImageEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length, +X_STATUS DiscImageEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) { assert_not_null(out_info); diff --git a/src/xenia/kernel/fs/devices/disc_image_entry.h b/src/xenia/kernel/fs/devices/disc_image_entry.h index 05bfe6129..2867f408c 100644 --- a/src/xenia/kernel/fs/devices/disc_image_entry.h +++ b/src/xenia/kernel/fs/devices/disc_image_entry.h @@ -31,7 +31,7 @@ class DiscImageEntry : public Entry { GDFXEntry* gdfx_entry() const { return gdfx_entry_; } X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) override; - X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) override; bool can_map() override { return true; } diff --git a/src/xenia/kernel/fs/devices/disc_image_file.cc b/src/xenia/kernel/fs/devices/disc_image_file.cc index d32a434a5..158bf14ff 100644 --- a/src/xenia/kernel/fs/devices/disc_image_file.cc +++ b/src/xenia/kernel/fs/devices/disc_image_file.cc @@ -35,7 +35,7 @@ X_STATUS DiscImageFile::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) { return entry_->QueryInfo(out_info); } -X_STATUS DiscImageFile::QueryDirectory(XDirectoryInfo* out_info, size_t length, +X_STATUS DiscImageFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) { return entry_->QueryDirectory(out_info, length, file_name, restart); } diff --git a/src/xenia/kernel/fs/devices/disc_image_file.h b/src/xenia/kernel/fs/devices/disc_image_file.h index 4be9740d5..510f6f8e1 100644 --- a/src/xenia/kernel/fs/devices/disc_image_file.h +++ b/src/xenia/kernel/fs/devices/disc_image_file.h @@ -30,7 +30,7 @@ class DiscImageFile : public XFile { Device* device() const override; X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) override; - X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) override; X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length) override; X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, diff --git a/src/xenia/kernel/fs/devices/host_path_entry.cc b/src/xenia/kernel/fs/devices/host_path_entry.cc index 8263011d7..fc71d3214 100644 --- a/src/xenia/kernel/fs/devices/host_path_entry.cc +++ b/src/xenia/kernel/fs/devices/host_path_entry.cc @@ -59,7 +59,7 @@ X_STATUS HostPathEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) { return X_STATUS_SUCCESS; } -X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length, +X_STATUS HostPathEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) { assert_not_null(out_info); diff --git a/src/xenia/kernel/fs/devices/host_path_entry.h b/src/xenia/kernel/fs/devices/host_path_entry.h index e5e40914d..ae6682c45 100644 --- a/src/xenia/kernel/fs/devices/host_path_entry.h +++ b/src/xenia/kernel/fs/devices/host_path_entry.h @@ -25,7 +25,7 @@ class HostPathEntry : public Entry { const std::wstring& local_path() { return local_path_; } X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) override; - X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) override; bool can_map() override { return true; } diff --git a/src/xenia/kernel/fs/devices/host_path_file.cc b/src/xenia/kernel/fs/devices/host_path_file.cc index 0fc223936..c88249c92 100644 --- a/src/xenia/kernel/fs/devices/host_path_file.cc +++ b/src/xenia/kernel/fs/devices/host_path_file.cc @@ -35,7 +35,7 @@ X_STATUS HostPathFile::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) { return entry_->QueryInfo(out_info); } -X_STATUS HostPathFile::QueryDirectory(XDirectoryInfo* out_info, size_t length, +X_STATUS HostPathFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) { return entry_->QueryDirectory(out_info, length, file_name, restart); } diff --git a/src/xenia/kernel/fs/devices/host_path_file.h b/src/xenia/kernel/fs/devices/host_path_file.h index 48ac50a7b..998af33b4 100644 --- a/src/xenia/kernel/fs/devices/host_path_file.h +++ b/src/xenia/kernel/fs/devices/host_path_file.h @@ -32,7 +32,7 @@ class HostPathFile : public XFile { Device* device() const override; X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) override; - X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) override; X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length) override; X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, diff --git a/src/xenia/kernel/fs/devices/stfs_container_entry.cc b/src/xenia/kernel/fs/devices/stfs_container_entry.cc index ce1c30d74..b117ef0ab 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_entry.cc +++ b/src/xenia/kernel/fs/devices/stfs_container_entry.cc @@ -37,7 +37,7 @@ X_STATUS STFSContainerEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info return X_STATUS_SUCCESS; } -X_STATUS STFSContainerEntry::QueryDirectory(XDirectoryInfo* out_info, +X_STATUS STFSContainerEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) { diff --git a/src/xenia/kernel/fs/devices/stfs_container_entry.h b/src/xenia/kernel/fs/devices/stfs_container_entry.h index 9d3839764..b6666bf73 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_entry.h +++ b/src/xenia/kernel/fs/devices/stfs_container_entry.h @@ -32,7 +32,7 @@ class STFSContainerEntry : public Entry { STFSEntry* stfs_entry() const { return stfs_entry_; } X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) override; - X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) override; X_STATUS Open(KernelState* kernel_state, Mode desired_access, bool async, diff --git a/src/xenia/kernel/fs/devices/stfs_container_file.cc b/src/xenia/kernel/fs/devices/stfs_container_file.cc index 8ab9e8a33..b3f5213e9 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_file.cc +++ b/src/xenia/kernel/fs/devices/stfs_container_file.cc @@ -35,7 +35,7 @@ X_STATUS STFSContainerFile::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) return entry_->QueryInfo(out_info); } -X_STATUS STFSContainerFile::QueryDirectory(XDirectoryInfo* out_info, +X_STATUS STFSContainerFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) { return entry_->QueryDirectory(out_info, length, file_name, restart); diff --git a/src/xenia/kernel/fs/devices/stfs_container_file.h b/src/xenia/kernel/fs/devices/stfs_container_file.h index 5e37aeff4..63046dbe0 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_file.h +++ b/src/xenia/kernel/fs/devices/stfs_container_file.h @@ -30,7 +30,7 @@ class STFSContainerFile : public XFile { Device* device() const override; X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) override; - X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) override; X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length) override; X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, diff --git a/src/xenia/kernel/fs/entry.h b/src/xenia/kernel/fs/entry.h index 744e9bcf7..f95adf659 100644 --- a/src/xenia/kernel/fs/entry.h +++ b/src/xenia/kernel/fs/entry.h @@ -21,7 +21,7 @@ class KernelState; class XFile; class X_FILE_NETWORK_OPEN_INFORMATION; class XFileSystemAttributeInfo; -class XDirectoryInfo; +class X_FILE_DIRECTORY_INFORMATION; class XVolumeInfo; } // namespace kernel } // namespace xe @@ -64,7 +64,7 @@ class Entry { bool is_read_only() const; virtual X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) = 0; - virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + virtual X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) = 0; virtual bool can_map() { return false; } diff --git a/src/xenia/kernel/objects/xfile.h b/src/xenia/kernel/objects/xfile.h index b085cf882..f6563ef50 100644 --- a/src/xenia/kernel/objects/xfile.h +++ b/src/xenia/kernel/objects/xfile.h @@ -44,7 +44,8 @@ class X_FILE_NETWORK_OPEN_INFORMATION { } }; -class XDirectoryInfo { +// https://msdn.microsoft.com/en-us/library/windows/hardware/ff540248.aspx +class X_FILE_DIRECTORY_INFORMATION { public: // FILE_DIRECTORY_INFORMATION uint32_t next_entry_offset; @@ -62,9 +63,9 @@ class XDirectoryInfo { void Write(uint8_t* base, uint32_t p) { uint8_t* dst = base + p; uint8_t* src = (uint8_t*)this; - XDirectoryInfo* info; + X_FILE_DIRECTORY_INFORMATION* info; do { - info = (XDirectoryInfo*)src; + info = (X_FILE_DIRECTORY_INFORMATION*)src; xe::store_and_swap(dst, info->next_entry_offset); xe::store_and_swap(dst + 4, info->file_index); xe::store_and_swap(dst + 8, info->creation_time); @@ -81,7 +82,7 @@ class XDirectoryInfo { } while (info->next_entry_offset != 0); } }; -static_assert_size(XDirectoryInfo, 72); +static_assert_size(X_FILE_DIRECTORY_INFORMATION, 72); // http://msdn.microsoft.com/en-us/library/windows/hardware/ff540287(v=vs.85).aspx class XVolumeInfo { @@ -155,7 +156,7 @@ class XFile : public XObject { void set_position(size_t value) { position_ = value; } virtual X_STATUS QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) = 0; - virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + virtual X_STATUS QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, size_t length, const char* file_name, bool restart) = 0; virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length) = 0; virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index c5ffd12fc..089ac3ed9 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -701,7 +701,7 @@ SHIM_CALL NtQueryDirectoryFile_shim(PPCContext* ppc_state, KernelState* state) { XFile* file = NULL; result = state->object_table()->GetObject(file_handle, (XObject**)&file); if (XSUCCEEDED(result)) { - XDirectoryInfo* dir_info = (XDirectoryInfo*)calloc(length, 1); + X_FILE_DIRECTORY_INFORMATION* dir_info = (X_FILE_DIRECTORY_INFORMATION*)calloc(length, 1); result = file->QueryDirectory(dir_info, length, file_name, restart_scan != 0); if (XSUCCEEDED(result)) {