Add NtRaiseHardError error message logging

This commit is contained in:
66hh
2025-12-27 17:00:26 +08:00
parent 02298e2303
commit 95b17566a0
3 changed files with 18 additions and 4 deletions

View File

@@ -4,10 +4,10 @@
namespace syscalls
{
NTSTATUS handle_NtRaiseHardError(const syscall_context& c, const NTSTATUS error_status, const ULONG /*number_of_parameters*/,
NTSTATUS handle_NtRaiseHardError(const syscall_context& c, const NTSTATUS error_status, const ULONG number_of_parameters,
const emulator_object<UNICODE_STRING<EmulatorTraits<Emu64>>>
/*unicode_string_parameter_mask*/,
const emulator_object<DWORD> /*parameters*/, const HARDERROR_RESPONSE_OPTION /*valid_response_option*/,
/*unicode_string_parameter_mask*/,
const uint64_t parameters, const HARDERROR_RESPONSE_OPTION /*valid_response_option*/,
const emulator_object<HARDERROR_RESPONSE> response)
{
if (response)
@@ -15,6 +15,18 @@ namespace syscalls
response.write(ResponseAbort);
}
if (error_status & STATUS_SERVICE_NOTIFICATION && number_of_parameters >= 3)
{
ULONG_PTR params[3] = {0, 0, 0};
if (c.emu.try_read_memory(parameters, &params, sizeof(params)))
{
std::u16string message =
read_unicode_string(c.emu, emulator_object<UNICODE_STRING<EmulatorTraits<Emu64>>>{c.emu, params[0]});
c.win_emu.log.error("Error Message: %s\n", u16_to_u8(message).c_str());
}
}
c.proc.exit_status = error_status;
c.win_emu.callbacks.on_exception();
c.emu.stop();