BITS 64 main: ; Replacement entry point push rsi push rdi push r12 push r13 push r14 call GetKernel32ModuleHandle mov rsi, rax ; kernel32.dll mov rcx, rax call GetAddressOf_GetProcAddress mov rdi, rax ; *GetProcAddress mov rcx, rsi ; kernel32.dll lea rdx, [rel s_LoadLibraryA] call rdi ; rax = *LoadLibraryA lea rcx, [rel dllPath] call rax ; LoadLibraryA(dllPath) mov rcx, rsi ; kernel32.dll lea rdx, [rel s_GetModuleHandleA] call rdi ; rax = *GetModuleHandle mov r12, rax mov rcx, 0 call rax ; rax = .exe base address mov r13, rax mov rcx, rsi ; kernel32.dll lea rdx, [rel s_GetCommandLineW] call rdi ; rax = *GetCommandLineW call rax ; rax = command line mov r14, rax lea rcx, [rel s_UnityPlayer.dll] call r12 ; rax = UnityPlayer.dll mov rcx, rax lea rdx, [rel s_UnityMain] call rdi ; rax = *UnityMain mov rcx, r13 ; .exe base address mov rdx, 0 ; hPrevInstance - 0 mov r8, r14 ; command line mov r9, 1 ; SW_NORMAL call rax ; UnityMain(...) pop r14 pop r13 pop r12 pop rdi pop rsi ret %include "gpa.asm" ; Strings s_LoadLibraryA: db "LoadLibraryA", 0 s_GetModuleHandleA: db "GetModuleHandleA", 0 s_GetCommandLineW: db "GetCommandLineW", 0 s_UnityPlayer.dll: db "UnityPlayer.dll", 0 s_UnityMain: db "UnityMain", 0 dllPath: ; This will be filled out by the launcher payload dll ; Path to the dll to inject into the game