Add NtUserGetAtomName syscall

This commit is contained in:
Igor Pissolati
2025-04-20 16:30:48 -03:00
parent 759bd0e9fb
commit 6deefb932f
3 changed files with 32 additions and 0 deletions

View File

@@ -312,3 +312,14 @@ 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 auto it = atoms.find(atom_id);
if (it == atoms.end())
{
return nullptr;
}
return &it->second.name;
}

View File

@@ -68,6 +68,7 @@ struct process_context
uint16_t add_or_find_atom(std::u16string name);
bool delete_atom(const std::u16string& name);
bool delete_atom(uint16_t atom_id);
const std::u16string* get_atom_name(uint16_t atom_id) const;
void serialize(utils::buffer_serializer& buffer) const;
void deserialize(utils::buffer_deserializer& buffer);

View File

@@ -548,6 +548,25 @@ namespace syscalls
return STATUS_SUCCESS;
}
NTSTATUS handle_NtUserGetAtomName(const syscall_context& c, const RTL_ATOM atom, const uint64_t atom_name,
const ULONG length)
{
const auto* name = c.proc.get_atom_name(atom);
if (!name)
{
return STATUS_INVALID_PARAMETER;
}
if (length < name->size())
{
return STATUS_BUFFER_TOO_SMALL;
}
c.emu.write_memory(atom_name, name->data(), name->size());
return STATUS_SUCCESS;
}
NTSTATUS handle_NtQueryDebugFilterState()
{
return FALSE;
@@ -719,6 +738,7 @@ void syscall_dispatcher::add_handlers(std::map<std::string, syscall_handler>& ha
add_handler(NtAddAtomEx);
add_handler(NtAddAtom);
add_handler(NtDeleteAtom);
add_handler(NtUserGetAtomName);
add_handler(NtInitializeNlsFiles);
add_handler(NtUnmapViewOfSection);
add_handler(NtUnmapViewOfSectionEx);