mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 11:43:56 +00:00
Store thread name and ignore guard pages for now
This commit is contained in:
@@ -19,8 +19,10 @@ inline std::string get_permission_string(const memory_permission permission)
|
||||
return res;
|
||||
}
|
||||
|
||||
inline memory_permission map_nt_to_emulator_protection(const uint32_t nt_protection)
|
||||
inline memory_permission map_nt_to_emulator_protection(uint32_t nt_protection)
|
||||
{
|
||||
nt_protection &= ~PAGE_GUARD; // TODO: Implement that
|
||||
|
||||
switch (nt_protection)
|
||||
{
|
||||
case PAGE_NOACCESS:
|
||||
|
||||
@@ -219,6 +219,8 @@ public:
|
||||
|
||||
uint32_t id{};
|
||||
|
||||
std::wstring name{};
|
||||
|
||||
std::optional<uint32_t> exit_status{};
|
||||
std::optional<handle> await_object{};
|
||||
bool waiting_for_alert{false};
|
||||
|
||||
@@ -68,16 +68,41 @@ namespace
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NTSTATUS handle_NtSetInformationThread(const syscall_context& c, const uint64_t /*thread_handle*/,
|
||||
NTSTATUS handle_NtSetInformationThread(const syscall_context& c, const uint64_t thread_handle,
|
||||
const THREADINFOCLASS info_class,
|
||||
const uint64_t /*thread_information*/,
|
||||
const uint32_t /*thread_information_length*/)
|
||||
const uint64_t thread_information,
|
||||
const uint32_t thread_information_length)
|
||||
{
|
||||
auto* thread = thread_handle == ~1ULL
|
||||
? c.proc.active_thread
|
||||
: c.proc.threads.get(thread_handle);
|
||||
|
||||
if (!thread)
|
||||
{
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (info_class == ThreadSchedulerSharedDataSlot)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (info_class == ThreadNameInformation)
|
||||
{
|
||||
if (thread_information_length != sizeof(THREAD_NAME_INFORMATION))
|
||||
{
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
const emulator_object<THREAD_NAME_INFORMATION> info{c.emu, thread_information};
|
||||
const auto i = info.read();
|
||||
thread->name = read_unicode_string(c.emu, i.ThreadName);
|
||||
|
||||
c.win_emu.logger.print(color::blue, "Setting thread (%d) name: %S\n", thread->id, thread->name.c_str());
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
printf("Unsupported thread info class: %X\n", info_class);
|
||||
c.emu.stop();
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
@@ -1485,6 +1510,11 @@ namespace
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NTSTATUS handle_NtUserRegisterWindowMessage()
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NTSTATUS handle_NtUserGetThreadState()
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
@@ -2203,6 +2233,7 @@ void syscall_dispatcher::add_handlers(std::unordered_map<std::string, syscall_ha
|
||||
add_handler(NtAlertThreadByThreadIdEx);
|
||||
add_handler(NtReadFile);
|
||||
add_handler(NtSetInformationFile);
|
||||
add_handler(NtUserRegisterWindowMessage);
|
||||
|
||||
#undef add_handler
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user