From 504e832b49718b2453607e6c150b1b3f0ecc8986 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Mon, 12 Aug 2024 19:20:59 +0200 Subject: [PATCH] [Kernel] Added dummy XFileBasicInformation for NtSetInformationFile This will prevent assertion spam in some games Mostly games uses it for cache files after renaming to enable writing to file --- src/xenia/kernel/info/file.h | 10 ++++++++++ src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/xenia/kernel/info/file.h b/src/xenia/kernel/info/file.h index 26557bb51..3e5c22785 100644 --- a/src/xenia/kernel/info/file.h +++ b/src/xenia/kernel/info/file.h @@ -58,6 +58,16 @@ enum X_FILE_INFORMATION_CLASS { #pragma pack(push, 1) +// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_file_basic_information +struct X_FILE_BASIC_INFORMATION { + be creation_time; + be last_access_time; + be last_write_time; + be change_time; + be attributes; +}; +static_assert_size(X_FILE_BASIC_INFORMATION, 0x28); + // https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_internal_information struct X_FILE_INTERNAL_INFORMATION { be index_number; diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc index e6aae5d43..81d1013e6 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc @@ -205,6 +205,11 @@ dword_result_t NtSetInformationFile_entry( uint32_t out_length; switch (info_class) { + case XFileBasicInformation: { + auto info = info_ptr.as(); + out_length = sizeof(*info); + break; + } case XFileRenameInformation: { auto info = info_ptr.as(); // Compute path, possibly attrs relative.