diff options
| author | auth12 <[email protected]> | 2020-07-27 16:29:29 -0700 |
|---|---|---|
| committer | auth12 <[email protected]> | 2020-07-27 16:29:29 -0700 |
| commit | 9354a3bd08b63fd5f79f47f186876d3f3611828a (patch) | |
| tree | ec7e2d524f61e710c53fd5a45df4faf8a3565d9d /client/src/util/apiset.cpp | |
| parent | Fixed support for colored text. (diff) | |
| download | loader-9354a3bd08b63fd5f79f47f186876d3f3611828a.tar.xz loader-9354a3bd08b63fd5f79f47f186876d3f3611828a.zip | |
Imported modules are now manual mapped.
Diffstat (limited to 'client/src/util/apiset.cpp')
| -rw-r--r-- | client/src/util/apiset.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client/src/util/apiset.cpp b/client/src/util/apiset.cpp new file mode 100644 index 0000000..e47fb51 --- /dev/null +++ b/client/src/util/apiset.cpp @@ -0,0 +1,32 @@ +#include "../include.h" +#include "util.h" +#include "io.h" +#include "apiset.h" + +apiset g_apiset; + +apiset::apiset() { + auto map = *reinterpret_cast<native::API_SET_NAMESPACE_ARRAY**>(uintptr_t(util::peb()) + 0x68); + for (int i = 0; i < map->Count; ++i) { + std::wstring wapi_name(255, 0); + std::wstring wapi_host(255, 0); + + auto entry = reinterpret_cast<native::API_SET_NAMESPACE_ENTRY*>(uintptr_t(map) + map->End + i * sizeof(native::API_SET_NAMESPACE_ENTRY)); + auto array = reinterpret_cast<native::API_SET_VALUE_ARRAY*>(uintptr_t(map) + map->Start + entry->Size * sizeof(native::API_SET_VALUE_ARRAY)); + + auto byte_map = reinterpret_cast<uint8_t*>(map); + std::memcpy(&wapi_name[0], &byte_map[array->NameOffset], array->NameLength); + + auto host = reinterpret_cast<native::API_SET_VALUE_ENTRY*>(&byte_map[array->DataOffset]); + + std::memcpy(&wapi_host[0], &byte_map[host->ValueOffset], host->ValueLength); + + wapi_name.assign(wapi_name.data()); + wapi_host.assign(wapi_host.data()); + + auto api_name = util::wide_to_multibyte(wapi_name); + auto api_host = util::wide_to_multibyte(wapi_host); + + m_apimap[api_name] = api_host; + } +}
\ No newline at end of file |