[Kernel] Implement XFileAllocationInformation

This commit is contained in:
Herman S.
2025-10-07 10:33:17 +09:00
parent 755ef33dd5
commit 568062cf9d
2 changed files with 16 additions and 4 deletions
+6
View File
@@ -101,6 +101,12 @@ struct X_FILE_END_OF_FILE_INFORMATION {
};
static_assert_size(X_FILE_END_OF_FILE_INFORMATION, 8);
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_allocation_information
struct X_FILE_ALLOCATION_INFORMATION {
be<uint64_t> allocation_size;
};
static_assert_size(X_FILE_ALLOCATION_INFORMATION, 8);
struct X_FILE_XCTD_COMPRESSION_INFORMATION {
be<uint32_t> unknown;
};
+10 -4
View File
@@ -158,12 +158,14 @@ uint32_t GetSetFileInfoMinimumLength(uint32_t info_class) {
return sizeof(X_FILE_POSITION_INFORMATION);
case XFileCompletionInformation:
return sizeof(X_FILE_COMPLETION_INFORMATION);
case XFileAllocationInformation:
return sizeof(X_FILE_ALLOCATION_INFORMATION);
case XFileEndOfFileInformation:
return sizeof(X_FILE_END_OF_FILE_INFORMATION);
// TODO(gibbed): structures to get the size of.
case XFileModeInformation:
case XFileIoPriorityInformation:
return 4;
case XFileAllocationInformation:
case XFileEndOfFileInformation:
case XFileMountPartitionInformation:
return 8;
case XFileLinkInformation:
@@ -258,8 +260,12 @@ dword_result_t NtSetInformationFile_entry(
break;
}
case XFileAllocationInformation: {
XELOGW("NtSetInformationFile ignoring alloc");
out_length = 8;
auto info = info_ptr.as<X_FILE_ALLOCATION_INFORMATION*>();
result = file->SetLength(info->allocation_size);
out_length = sizeof(*info);
// Update the files vfs::Entry information
file->entry()->update();
break;
}
case XFileEndOfFileInformation: {