Add more ui syscall stubs

This commit is contained in:
momo5502
2025-05-17 18:28:53 +02:00
parent ede9bfa403
commit bd4e27469f
4 changed files with 61 additions and 15 deletions

View File

@@ -23,6 +23,7 @@ using DWORD64 = std::uint64_t;
using ULONGLONG = DWORD64;
using LONGLONG = std::int64_t;
using UINT = std::uint32_t;
using BOOL = std::int32_t;
typedef union _ULARGE_INTEGER
{

View File

@@ -363,20 +363,20 @@ handle process_context::create_thread(memory_manager& memory, const uint64_t sta
uint16_t process_context::add_or_find_atom(std::u16string name)
{
uint16_t index = 0;
if (!atoms.empty())
uint16_t index = 1;
if (!this->atoms.empty())
{
auto i = atoms.end();
auto i = this->atoms.end();
--i;
index = i->first + 1;
}
std::optional<uint16_t> last_entry{};
for (auto& entry : atoms)
for (auto& entry : this->atoms)
{
if (entry.second.name == name)
{
entry.second.ref_count++;
++entry.second.ref_count;
return entry.first;
}
@@ -384,7 +384,7 @@ uint16_t process_context::add_or_find_atom(std::u16string name)
{
if (!last_entry)
{
index = 0;
index = 1;
}
else
{
@@ -421,7 +421,7 @@ bool process_context::delete_atom(const std::u16string& name)
return false;
}
bool process_context::delete_atom(uint16_t atom_id)
bool process_context::delete_atom(const uint16_t atom_id)
{
const auto it = atoms.find(atom_id);
if (it == atoms.end())
@@ -437,7 +437,7 @@ bool process_context::delete_atom(uint16_t atom_id)
return true;
}
const std::u16string* process_context::get_atom_name(uint16_t atom_id) const
const std::u16string* process_context::get_atom_name(const uint16_t atom_id) const
{
const auto it = atoms.find(atom_id);
if (it == atoms.end())

View File

@@ -153,7 +153,8 @@ inline void write_syscall_result(const syscall_context& c, const uint64_t result
}
}
inline void forward_syscall(const syscall_context& c, NTSTATUS (*handler)())
template <typename Result>
void forward_syscall(const syscall_context& c, Result (*handler)())
{
const auto ip = c.emu.read_instruction_pointer();

View File

@@ -718,6 +718,21 @@ namespace syscalls
return STATUS_NOT_SUPPORTED;
}
NTSTATUS handle_NtUserMapVirtualKeyEx()
{
return 0;
}
NTSTATUS handle_NtUserToUnicodeEx()
{
return 0;
}
NTSTATUS handle_NtUserSetProcessDpiAwarenessContext()
{
return 0;
}
hwnd handle_NtUserCreateWindowEx(const syscall_context& c, const DWORD ex_style,
const emulator_object<LARGE_STRING> class_name,
const emulator_object<LARGE_STRING> cls_version,
@@ -743,19 +758,29 @@ namespace syscalls
(void)flags;
(void)acbi_buffer;
return STATUS_NOT_SUPPORTED;
return 1;
}
NTSTATUS handle_NtUserShowWindow(const syscall_context& c, const hwnd hwnd, const LONG cmd_show)
ULONG handle_NtUserGetRawInputDeviceList()
{
return 0;
}
ULONG handle_NtUserGetKeyboardType()
{
return 0;
}
BOOL handle_NtUserShowWindow(const syscall_context& c, const hwnd hwnd, const LONG cmd_show)
{
(void)c;
(void)hwnd;
(void)cmd_show;
return STATUS_NOT_SUPPORTED;
return TRUE;
}
NTSTATUS handle_NtUserGetMessage(const syscall_context& c, const emulator_object<msg> message, const hwnd hwnd,
const UINT msg_filter_min, const UINT msg_filter_max)
BOOL handle_NtUserGetMessage(const syscall_context& c, const emulator_object<msg> message, const hwnd hwnd,
const UINT msg_filter_min, const UINT msg_filter_max)
{
(void)c;
(void)message;
@@ -763,7 +788,20 @@ namespace syscalls
(void)msg_filter_min;
(void)msg_filter_max;
return STATUS_NOT_SUPPORTED;
return TRUE;
}
BOOL handle_NtUserPeekMessage(const syscall_context& c, const emulator_object<msg> message, const hwnd hwnd,
const UINT msg_filter_min, const UINT msg_filter_max, const UINT remove_message)
{
(void)c;
(void)message;
(void)hwnd;
(void)msg_filter_min;
(void)msg_filter_max;
(void)remove_message;
return FALSE;
}
}
@@ -929,6 +967,12 @@ void syscall_dispatcher::add_handlers(std::map<std::string, syscall_handler>& ha
add_handler(NtUserCreateWindowEx);
add_handler(NtUserShowWindow);
add_handler(NtUserGetMessage);
add_handler(NtUserPeekMessage);
add_handler(NtUserMapVirtualKeyEx);
add_handler(NtUserToUnicodeEx);
add_handler(NtUserSetProcessDpiAwarenessContext);
add_handler(NtUserGetRawInputDeviceList);
add_handler(NtUserGetKeyboardType);
#undef add_handler
}