[Kernel] Added Support For: XFileRenameInformation
This commit is contained in:
@@ -91,6 +91,13 @@ dword_result_t NtQueryInformationFile_entry(
|
||||
out_length = sizeof(*info);
|
||||
break;
|
||||
}
|
||||
case XFileAlignmentInformation: {
|
||||
// Requested by XMountUtilityDrive XAM-task
|
||||
auto info = info_ptr.as<uint32_t*>();
|
||||
*info = 0; // FILE_BYTE_ALIGNMENT?
|
||||
out_length = sizeof(*info);
|
||||
break;
|
||||
}
|
||||
case XFileSectorInformation: {
|
||||
// SW that uses this seems to use the output as a way of uniquely
|
||||
// identifying a file for sorting/lookup so we can just give it an
|
||||
@@ -130,13 +137,6 @@ dword_result_t NtQueryInformationFile_entry(
|
||||
out_length = sizeof(*info);
|
||||
break;
|
||||
}
|
||||
case XFileAlignmentInformation: {
|
||||
// Requested by XMountUtilityDrive XAM-task
|
||||
auto info = info_ptr.as<uint32_t*>();
|
||||
*info = 0; // FILE_BYTE_ALIGNMENT?
|
||||
out_length = sizeof(*info);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Unsupported, for now.
|
||||
assert_always();
|
||||
@@ -157,6 +157,8 @@ DECLARE_XBOXKRNL_EXPORT1(NtQueryInformationFile, kFileSystem, kImplemented);
|
||||
|
||||
uint32_t GetSetFileInfoMinimumLength(uint32_t info_class) {
|
||||
switch (info_class) {
|
||||
case XFileRenameInformation:
|
||||
return sizeof(X_FILE_RENAME_INFORMATION);
|
||||
case XFileDispositionInformation:
|
||||
return sizeof(X_FILE_DISPOSITION_INFORMATION);
|
||||
case XFilePositionInformation:
|
||||
@@ -171,7 +173,6 @@ uint32_t GetSetFileInfoMinimumLength(uint32_t info_class) {
|
||||
case XFileEndOfFileInformation:
|
||||
case XFileMountPartitionInformation:
|
||||
return 8;
|
||||
case XFileRenameInformation:
|
||||
case XFileLinkInformation:
|
||||
return 16;
|
||||
case XFileBasicInformation:
|
||||
@@ -204,6 +205,25 @@ dword_result_t NtSetInformationFile_entry(
|
||||
uint32_t out_length;
|
||||
|
||||
switch (info_class) {
|
||||
case XFileRenameInformation: {
|
||||
auto info = info_ptr.as<X_FILE_RENAME_INFORMATION*>();
|
||||
// Compute path, possibly attrs relative.
|
||||
std::filesystem::path target_path =
|
||||
util::TranslateAnsiString(kernel_memory(), &info->ansi_string);
|
||||
|
||||
// Place IsValidPath in path from where it can be accessed everywhere
|
||||
if (!IsValidPath(target_path.string(), false)) {
|
||||
return X_STATUS_OBJECT_NAME_INVALID;
|
||||
}
|
||||
|
||||
if (!target_path.has_filename()) {
|
||||
return X_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
file->Rename(target_path);
|
||||
out_length = sizeof(*info);
|
||||
break;
|
||||
}
|
||||
case XFileDispositionInformation: {
|
||||
// Used to set deletion flag. Which we don't support. Probably?
|
||||
auto info = info_ptr.as<X_FILE_DISPOSITION_INFORMATION*>();
|
||||
|
||||
Reference in New Issue
Block a user