1
0
mirror of https://github.com/momo5502/hypervisor.git synced 2025-06-14 16:35:47 +00:00

Correct resource extraction

This commit is contained in:
momo5502 2022-06-07 20:33:00 +02:00
parent 6730723d36
commit b266388c55

View File

@ -51,7 +51,11 @@ void remove_hooks(const driver_device& driver_device)
std::vector<uint8_t> load_resource(const int id) std::vector<uint8_t> load_resource(const int id)
{ {
auto* const res = FindResource(GetModuleHandleA(nullptr), MAKEINTRESOURCE(id), RT_RCDATA); HMODULE modhandle = nullptr;
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCSTR>(&load_resource), &modhandle);
auto* const res = FindResource(modhandle, MAKEINTRESOURCE(id), RT_RCDATA);
if (!res) return {}; if (!res) return {};
auto* const handle = LoadResource(nullptr, res); auto* const handle = LoadResource(nullptr, res);
@ -376,7 +380,8 @@ const driver_device& get_driver_device()
return driver_device; return driver_device;
} }
extern "C" __declspec(dllexport) void hyperhook_patch_data(const uint32_t pid, const uint64_t address, const void* data, const size_t length) extern "C" __declspec(dllexport) void hyperhook_patch_data(const uint32_t pid, const uint64_t address, const void* data,
const size_t length)
{ {
patch_data(get_driver_device(), pid, address, static_cast<const uint8_t*>(data), length); patch_data(get_driver_device(), pid, address, static_cast<const uint8_t*>(data), length);
} }