Skip to content

Commit

Permalink
Fix issue in log for NtQueryObject when name is not present.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 15, 2024
1 parent 859de4f commit 0601cb8
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/usvfs_dll/hooks/ntdll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,22 +1124,28 @@ DLLEXPORT NTSTATUS WINAPI usvfs::hook_NtQueryObject(

// update the actual unicode string
info->Name.Buffer = unicodeBuffer;
info->Name.Length = buffer.size() * 2;
info->Name.MaximumLength = unicodeBufferLength;
info->Name.Length = static_cast<USHORT>(buffer.size() * 2);
info->Name.MaximumLength = static_cast<USHORT>(unicodeBufferLength);

res = STATUS_SUCCESS;
}
}

LOG_CALL()
.PARAMWRAP(res)
.PARAM(ObjectInformationLength)
.addParam("return_length", ReturnLength ? *ReturnLength : -1)
.addParam("tracker_path", trackerInfo)
.PARAM(ObjectInformationClass)
.PARAM(redir.redirected)
.PARAM(redir.path)
.addParam("name_info", info->Name);
auto logger = LOG_CALL()
.PARAMWRAP(res)
.PARAM(ObjectInformationLength)
.addParam("return_length", ReturnLength ? *ReturnLength : -1)
.addParam("tracker_path", trackerInfo)
.PARAM(ObjectInformationClass)
.PARAM(redir.redirected)
.PARAM(redir.path);

if (res == STATUS_SUCCESS) {
logger.addParam("name_info", info->Name);
}
else {
logger.addParam("name_info", "");
}
}

HOOK_END
Expand Down

0 comments on commit 0601cb8

Please sign in to comment.