fix: update documentation of the stub

This commit is contained in:
2025-11-18 20:02:27 +01:00
parent 50fb354983
commit 15f6c7593e

View File

@@ -16,14 +16,19 @@ namespace fxn
void* CreateNativeDispatcher(std::uint64_t nativeHash) void* CreateNativeDispatcher(std::uint64_t nativeHash)
{ {
/*
mov rax, <NativeDispatcher>
mov rdx, <nativeHash>
jmp rax
*/
constexpr auto STUB_SIZE = 22; constexpr auto STUB_SIZE = 22;
constexpr auto STUB_BYTES = std::array<std::uint8_t, STUB_SIZE> constexpr auto STUB_BYTES = std::array<std::uint8_t, STUB_SIZE>
{ {
0x48, 0xB8, 0x48, 0xB8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mov rax, <NativeDispatcher_address> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x48, 0xBA, 0x48, 0xBA,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mov rdx, <NativeHash> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xE0 // jmp rax 0xFF, 0xE0
}; };
auto stub = VirtualAllocEx(GetCurrentProcess(), nullptr, STUB_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); auto stub = VirtualAllocEx(GetCurrentProcess(), nullptr, STUB_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);