mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 03:33:56 +00:00
Fix reading unicode strings
This commit is contained in:
@@ -352,7 +352,7 @@ inline std::u16string read_unicode_string(const emulator& emu,
|
||||
return read_unicode_string(emu, ucs);
|
||||
}
|
||||
|
||||
inline std::u16string read_unicode_string(emulator& emu, const UNICODE_STRING<EmulatorTraits<Emu64>>* uc_string)
|
||||
inline std::u16string read_unicode_string(emulator& emu, const uint64_t uc_string)
|
||||
{
|
||||
return read_unicode_string(emu, emulator_object<UNICODE_STRING<EmulatorTraits<Emu64>>>{emu, uc_string});
|
||||
}
|
||||
|
||||
@@ -62,8 +62,7 @@ namespace syscalls
|
||||
const auto attributes = object_attributes.read();
|
||||
if (attributes.ObjectName)
|
||||
{
|
||||
name = read_unicode_string(
|
||||
c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
name = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +98,7 @@ namespace syscalls
|
||||
const emulator_object<OBJECT_ATTRIBUTES<EmulatorTraits<Emu64>>> object_attributes)
|
||||
{
|
||||
const auto attributes = object_attributes.read();
|
||||
const auto name =
|
||||
read_unicode_string(c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
const auto name = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
c.win_emu.log.print(color::dark_gray, "--> Event name: %s\n", u16_to_u8(name).c_str());
|
||||
|
||||
if (name == u"\\KernelObjects\\SystemErrorPortReady")
|
||||
@@ -133,4 +131,4 @@ namespace syscalls
|
||||
|
||||
return STATUS_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,8 +552,7 @@ namespace syscalls
|
||||
uint64_t ea_buffer, ULONG ea_length)
|
||||
{
|
||||
const auto attributes = object_attributes.read();
|
||||
auto filename =
|
||||
read_unicode_string(c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
auto filename = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
|
||||
auto printer = utils::finally([&] {
|
||||
c.win_emu.log.print(color::dark_gray, "--> Opening file: %s\n", u16_to_u8(filename).c_str()); //
|
||||
@@ -757,8 +756,7 @@ namespace syscalls
|
||||
const emulator_object<OBJECT_ATTRIBUTES<EmulatorTraits<Emu64>>> object_attributes)
|
||||
{
|
||||
const auto attributes = object_attributes.read();
|
||||
const auto object_name =
|
||||
read_unicode_string(c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
const auto object_name = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
|
||||
if (object_name == u"\\KnownDlls")
|
||||
{
|
||||
@@ -780,8 +778,7 @@ namespace syscalls
|
||||
const emulator_object<OBJECT_ATTRIBUTES<EmulatorTraits<Emu64>>> object_attributes)
|
||||
{
|
||||
const auto attributes = object_attributes.read();
|
||||
const auto object_name =
|
||||
read_unicode_string(c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
const auto object_name = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
|
||||
if (object_name == u"KnownDllPath")
|
||||
{
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace syscalls
|
||||
const emulator_object<OBJECT_ATTRIBUTES<EmulatorTraits<Emu64>>> object_attributes)
|
||||
{
|
||||
const auto attributes = object_attributes.read();
|
||||
auto key =
|
||||
read_unicode_string(c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
auto key = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
|
||||
if (attributes.RootDirectory)
|
||||
{
|
||||
@@ -247,4 +246,4 @@ namespace syscalls
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ namespace syscalls
|
||||
const auto attributes = object_attributes.read();
|
||||
if (attributes.ObjectName)
|
||||
{
|
||||
auto name = read_unicode_string(
|
||||
c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
auto name = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
c.win_emu.log.print(color::dark_gray, "--> Section with name %s\n", u16_to_u8(name).c_str());
|
||||
s.name = std::move(name);
|
||||
}
|
||||
@@ -60,8 +59,7 @@ namespace syscalls
|
||||
{
|
||||
const auto attributes = object_attributes.read();
|
||||
|
||||
auto filename =
|
||||
read_unicode_string(c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
auto filename = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
c.win_emu.log.print(color::dark_gray, "--> Opening section: %s\n", u16_to_u8(filename).c_str());
|
||||
|
||||
if (filename == u"\\Windows\\SharedSection")
|
||||
|
||||
@@ -78,8 +78,7 @@ namespace syscalls
|
||||
const auto attributes = object_attributes.read();
|
||||
if (attributes.ObjectName)
|
||||
{
|
||||
s.name = read_unicode_string(
|
||||
c.emu, reinterpret_cast<UNICODE_STRING<EmulatorTraits<Emu64>>*>(attributes.ObjectName));
|
||||
s.name = read_unicode_string(c.emu, attributes.ObjectName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,4 +100,4 @@ namespace syscalls
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user