Skip to content

Commit

Permalink
refactor(page): load kernel32 instead of kernelbase
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 13, 2024
1 parent 91fba41 commit 66f3d8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/page.win.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "page.hpp"
#include "module.hpp"
#include "constants.hpp"

#include <limits>
Expand Down Expand Up @@ -250,8 +251,8 @@ namespace lime

static const auto VirtualAlloc2 = []()
{
auto *kernel_base = LoadLibraryA("kernelbase.dll");
return reinterpret_cast<decltype(::VirtualAlloc2) *>(GetProcAddress(kernel_base, "VirtualAlloc2"));
auto kernel32 = module::load("kernel32.dll");
return reinterpret_cast<decltype(::VirtualAlloc2) *>(kernel32->symbol("VirtualAlloc2"));
}();

auto *alloc = VirtualAlloc2(GetCurrentProcess(), nullptr, size, MEM_COMMIT | MEM_RESERVE,
Expand Down

0 comments on commit 66f3d8f

Please sign in to comment.