Support window props

This commit is contained in:
momo5502
2025-05-18 09:51:46 +02:00
parent 0fbd563e8c
commit 6241c10f02
3 changed files with 36 additions and 1 deletions

View File

@@ -42,7 +42,7 @@ struct process_context
std::u16string name;
uint32_t ref_count = 0;
atom_entry(std::u16string n, uint32_t count)
atom_entry(std::u16string n, const uint32_t count)
: name(std::move(n)),
ref_count(count)
{

View File

@@ -770,6 +770,36 @@ namespace syscalls
return c.proc.windows.store(std::move(win)).bits;
}
BOOL handle_NtUserSetProp(const syscall_context& c, const hwnd window, const uint16_t atom, const uint64_t data)
{
auto* win = c.proc.windows.get(window);
auto* prop = c.proc.get_atom_name(atom);
if (!win || !prop)
{
return FALSE;
}
win->props[*prop] = data;
return TRUE;
}
BOOL handle_NtUserSetProp2(const syscall_context& c, const hwnd window,
const emulator_object<UNICODE_STRING<EmulatorTraits<Emu64>>> str, const uint64_t data)
{
auto* win = c.proc.windows.get(window);
if (!win || !str)
{
return FALSE;
}
auto prop = read_unicode_string(c.emu, str);
win->props[std::move(prop)] = data;
return TRUE;
}
ULONG handle_NtUserGetRawInputDeviceList()
{
return 0;
@@ -1012,6 +1042,8 @@ void syscall_dispatcher::add_handlers(std::map<std::string, syscall_handler>& ha
add_handler(NtUserGetRawInputDeviceList);
add_handler(NtUserGetKeyboardType);
add_handler(NtUserEnumDisplayDevices);
add_handler(NtUserSetProp);
add_handler(NtUserSetProp2);
#undef add_handler
}

View File

@@ -48,6 +48,7 @@ struct window : ref_counted_object
int32_t height;
int32_t x;
int32_t y;
std::unordered_map<std::u16string, uint64_t> props;
void serialize_object(utils::buffer_serializer& buffer) const override
{
@@ -58,6 +59,7 @@ struct window : ref_counted_object
buffer.write(this->height);
buffer.write(this->x);
buffer.write(this->y);
buffer.write_map(this->props);
}
void deserialize_object(utils::buffer_deserializer& buffer) override
@@ -69,6 +71,7 @@ struct window : ref_counted_object
buffer.read(this->height);
buffer.read(this->x);
buffer.read(this->y);
buffer.read_map(this->props);
}
};