[Kernel] Add support for XFileEndOfFileInformation.

This commit is contained in:
gibbed
2018-05-23 04:24:37 -05:00
parent 19f93304c7
commit bc369e43cb
11 changed files with 45 additions and 2 deletions

View File

@@ -393,11 +393,16 @@ dword_result_t NtSetInformationFile(
file->set_position(xe::load_and_swap<uint64_t>(file_info));
break;
case XFileAllocationInformation:
case XFileEndOfFileInformation:
assert_true(length == 8);
info = 8;
XELOGW("NtSetInformationFile ignoring alloc/eof");
XELOGW("NtSetInformationFile ignoring alloc");
break;
case XFileEndOfFileInformation: {
assert_true(length == 8);
auto eof = xe::load_and_swap<uint64_t>(file_info);
result = file->SetLength(eof);
break;
}
case XFileCompletionInformation: {
// Info contains IO Completion handle and completion key
assert_true(length == 8);

View File

@@ -147,6 +147,8 @@ X_STATUS XFile::Write(const void* buffer, size_t buffer_length,
return result;
}
X_STATUS XFile::SetLength(size_t length) { return file_->SetLength(length); }
void XFile::RegisterIOCompletionPort(uint32_t key,
object_ref<XIOCompletion> port) {
std::lock_guard<std::mutex> lock(completion_port_lock_);

View File

@@ -104,6 +104,8 @@ class XFile : public XObject {
X_STATUS Write(const void* buffer, size_t buffer_length, size_t byte_offset,
size_t* out_bytes_written, uint32_t apc_context);
X_STATUS SetLength(size_t length);
void RegisterIOCompletionPort(uint32_t key, object_ref<XIOCompletion> port);
void RemoveIOCompletionPort(uint32_t key);