Couple of fixes for IO (null pointer deref and improper XctdCompressionInformation)

This commit is contained in:
Dr. Chat 2015-07-24 23:50:02 -05:00
parent 270686a0be
commit 18d8fad098
1 changed files with 6 additions and 1 deletions

View File

@ -433,6 +433,7 @@ dword_result_t NtQueryInformationFile(
assert_true(length == 4); assert_true(length == 4);
// This is wrong and puts files into wrong states for games that use // This is wrong and puts files into wrong states for games that use
// XctdDecompression. // XctdDecompression.
/*
uint32_t magic; uint32_t magic;
size_t bytes_read; size_t bytes_read;
size_t cur_pos = file->position(); size_t cur_pos = file->position();
@ -450,6 +451,9 @@ dword_result_t NtQueryInformationFile(
} }
file->set_position(cur_pos); file->set_position(cur_pos);
info = 4; info = 4;
*/
result = X_STATUS_UNSUCCESSFUL;
info = 0;
} break; } break;
case XFileSectorInformation: case XFileSectorInformation:
@ -611,7 +615,8 @@ dword_result_t NtQueryDirectoryFile(
uint32_t info = 0; uint32_t info = 0;
auto file = kernel_state()->object_table()->LookupObject<XFile>(file_handle); auto file = kernel_state()->object_table()->LookupObject<XFile>(file_handle);
auto name = file_name->to_string(kernel_memory()->virtual_membase()); auto name =
file_name ? file_name->to_string(kernel_memory()->virtual_membase()) : "";
if (file) { if (file) {
X_FILE_DIRECTORY_INFORMATION dir_info = {0}; X_FILE_DIRECTORY_INFORMATION dir_info = {0};
result = file->QueryDirectory( result = file->QueryDirectory(