mirror of
https://github.com/momo5502/emulator.git
synced 2026-02-01 00:41:02 +00:00
Move get_apiset_namespace_table to apiset namespace
This commit is contained in:
@@ -175,4 +175,32 @@ namespace apiset
|
||||
|
||||
return api_set_map_obj;
|
||||
}
|
||||
|
||||
std::map<std::u16string, std::u16string> get_namespace_table(const API_SET_NAMESPACE* api_set_map)
|
||||
{
|
||||
std::map<std::u16string, std::u16string> apiset;
|
||||
|
||||
for (size_t i = 0; i < api_set_map->Count; i++)
|
||||
{
|
||||
const auto* entry = reinterpret_cast<const API_SET_NAMESPACE_ENTRY*>(
|
||||
reinterpret_cast<uint64_t>(api_set_map) + api_set_map->EntryOffset + i * sizeof(API_SET_NAMESPACE_ENTRY));
|
||||
|
||||
std::u16string name(reinterpret_cast<const char16_t*>(reinterpret_cast<uint64_t>(api_set_map) + entry->NameOffset),
|
||||
entry->NameLength / sizeof(char16_t));
|
||||
|
||||
if (!entry->ValueCount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto* value = reinterpret_cast<const API_SET_VALUE_ENTRY*>(reinterpret_cast<uint64_t>(api_set_map) + entry->ValueOffset +
|
||||
(entry->ValueCount - 1) * sizeof(API_SET_VALUE_ENTRY));
|
||||
std::u16string base_name(reinterpret_cast<const char16_t*>(reinterpret_cast<uint64_t>(api_set_map) + value->ValueOffset),
|
||||
value->ValueLength / sizeof(char16_t));
|
||||
|
||||
apiset[name + u".dll"] = base_name;
|
||||
}
|
||||
|
||||
return apiset;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user