From bc75b0ab87c9b953d5b95c05cadff5bc8beff466 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 27 Jun 2015 12:55:30 -0700 Subject: [PATCH] Fixing NtQueryDirectoryFile. --- src/xenia/kernel/xboxkrnl_io.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index d3da2aea1..a81cbfc16 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -758,15 +758,14 @@ SHIM_CALL NtQueryDirectoryFile_shim(PPCContext* ppc_context, auto file = kernel_state->object_table()->LookupObject(file_handle); if (file) { - X_FILE_DIRECTORY_INFORMATION* dir_info = - (X_FILE_DIRECTORY_INFORMATION*)calloc(length, 1); - result = file->QueryDirectory(dir_info, length, file_name.c_str(), - restart_scan != 0); + X_FILE_DIRECTORY_INFORMATION dir_info = {0}; + result = file->QueryDirectory( + &dir_info, length, !file_name.empty() ? file_name.c_str() : nullptr, + restart_scan != 0); if (XSUCCEEDED(result)) { - dir_info->Write(SHIM_MEM_BASE, file_info_ptr); + dir_info.Write(SHIM_MEM_BASE, file_info_ptr); info = length; } - free(dir_info); } else { result = X_STATUS_NO_SUCH_FILE; }