mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-25 22:51:03 +00:00
Improvements to locale syscalls and fix TimeZone query
This commit is contained in:
@@ -4,6 +4,18 @@
|
||||
|
||||
namespace syscalls
|
||||
{
|
||||
struct CSR_API_CONNECTINFO
|
||||
{
|
||||
uint64_t SharedSectionBase;
|
||||
uint64_t SharedStaticServerData;
|
||||
uint64_t SharedSectionHeap;
|
||||
ULONG DebugFlags;
|
||||
ULONG SizeOfPebData;
|
||||
ULONG SizeOfTebData;
|
||||
ULONG NumberOfServerDllNames;
|
||||
EMULATOR_CAST(uint64_t, HANDLE) ServerProcessId;
|
||||
};
|
||||
|
||||
NTSTATUS handle_NtConnectPort(const syscall_context& c, const emulator_object<handle> client_port_handle,
|
||||
const emulator_object<UNICODE_STRING<EmulatorTraits<Emu64>>> server_port_name,
|
||||
const emulator_object<SECURITY_QUALITY_OF_SERVICE> /*security_qos*/,
|
||||
@@ -21,9 +33,34 @@ namespace syscalls
|
||||
|
||||
if (connection_info)
|
||||
{
|
||||
std::vector<uint8_t> zero_mem{};
|
||||
zero_mem.resize(connection_info_length.read(), 0);
|
||||
c.emu.write_memory(connection_info, zero_mem.data(), zero_mem.size());
|
||||
if (p.name == u"\\Windows\\ApiPort")
|
||||
{
|
||||
CSR_API_CONNECTINFO connect_info{};
|
||||
|
||||
const auto expected_connect_length = connection_info_length.read();
|
||||
if (expected_connect_length < sizeof(CSR_API_CONNECTINFO))
|
||||
{
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
// TODO: Use client_shared_memory to get the section entry and get the address from it?
|
||||
connect_info.SharedSectionBase = c.proc.shared_section_address;
|
||||
c.emu.write_memory(c.proc.shared_section_address + 2504,
|
||||
0xFFFFFFFF); // BaseStaticServerData->TermsrvClientTimeZoneId
|
||||
|
||||
const auto static_server_data =
|
||||
c.win_emu.memory.allocate_memory(0x10000, memory_permission::read_write);
|
||||
connect_info.SharedStaticServerData = static_server_data;
|
||||
c.emu.write_memory(static_server_data + 8, connect_info.SharedSectionBase);
|
||||
|
||||
c.emu.write_memory(connection_info, &connect_info, sizeof(connect_info));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<uint8_t> zero_mem{};
|
||||
zero_mem.resize(connection_info_length.read(), 0);
|
||||
c.emu.write_memory(connection_info, zero_mem.data(), zero_mem.size());
|
||||
}
|
||||
}
|
||||
|
||||
client_shared_memory.access([&](PORT_VIEW64& view) {
|
||||
@@ -39,6 +76,20 @@ namespace syscalls
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS handle_NtSecureConnectPort(const syscall_context& c, emulator_object<handle> client_port_handle,
|
||||
emulator_object<UNICODE_STRING<EmulatorTraits<Emu64>>> server_port_name,
|
||||
emulator_object<SECURITY_QUALITY_OF_SERVICE> security_qos,
|
||||
emulator_object<PORT_VIEW64> client_shared_memory,
|
||||
emulator_object<SID> /*server_sid*/,
|
||||
emulator_object<REMOTE_PORT_VIEW64> server_shared_memory,
|
||||
emulator_object<ULONG> maximum_message_length, emulator_pointer connection_info,
|
||||
emulator_object<ULONG> connection_info_length)
|
||||
{
|
||||
return handle_NtConnectPort(c, client_port_handle, server_port_name, security_qos, client_shared_memory,
|
||||
server_shared_memory, maximum_message_length, connection_info,
|
||||
connection_info_length);
|
||||
}
|
||||
|
||||
NTSTATUS handle_NtAlpcSendWaitReceivePort(const syscall_context& c, const handle port_handle, const ULONG /*flags*/,
|
||||
const emulator_object<PORT_MESSAGE64> /*send_message*/,
|
||||
const emulator_object<ALPC_MESSAGE_ATTRIBUTES>
|
||||
|
||||
Reference in New Issue
Block a user