jadeite/injector/src/game_p.asm

79 lines
1.7 KiB
NASM
Raw Normal View History

2023-06-05 21:23:08 +00:00
BITS 64
main: ; Replacement entry point
2023-06-26 09:18:25 +00:00
push rsi
push rdi
push r12
push r13
push r14
2023-06-05 21:23:08 +00:00
call GetKernel32ModuleHandle
2023-06-26 09:18:25 +00:00
mov rsi, rax ; kernel32.dll
2023-06-05 21:23:08 +00:00
mov rcx, rax
call GetAddressOf_GetProcAddress
2023-06-26 09:18:25 +00:00
mov rdi, rax ; *GetProcAddress
2023-06-05 21:23:08 +00:00
2023-06-26 09:18:25 +00:00
mov rcx, rsi ; kernel32.dll
2023-06-05 21:23:08 +00:00
lea rdx, [rel s_LoadLibraryA]
2023-06-26 09:25:44 +00:00
call rdi ; rax = *LoadLibraryA
2023-06-05 21:23:08 +00:00
lea rcx, [rel dllPath]
call rax ; LoadLibraryA(dllPath)
2023-06-26 09:18:25 +00:00
mov rcx, rsi ; kernel32.dll
2023-06-05 21:23:08 +00:00
lea rdx, [rel s_GetModuleHandleA]
2023-06-26 09:25:44 +00:00
call rdi ; rax = *GetModuleHandle
2023-06-26 09:18:25 +00:00
mov r12, rax
2023-06-05 21:23:08 +00:00
mov rcx, 0
call rax ; rax = .exe base address
2023-06-26 09:18:25 +00:00
mov r13, rax
2023-06-05 21:23:08 +00:00
2023-06-26 09:18:25 +00:00
mov rcx, rsi ; kernel32.dll
2023-06-05 21:23:08 +00:00
lea rdx, [rel s_GetCommandLineW]
2023-06-26 09:25:44 +00:00
call rdi ; rax = *GetCommandLineW
2023-06-05 21:23:08 +00:00
call rax ; rax = command line
2023-06-26 09:18:25 +00:00
mov r14, rax
2023-06-05 21:23:08 +00:00
lea rcx, [rel s_UnityPlayer.dll]
2023-06-26 09:25:44 +00:00
call r12 ; rax = UnityPlayer.dll
2023-06-05 21:23:08 +00:00
mov rcx, rax
lea rdx, [rel s_UnityMain]
2023-06-26 09:25:44 +00:00
call rdi ; rax = *UnityMain
2023-06-05 21:23:08 +00:00
2023-06-26 09:18:25 +00:00
mov rcx, r13 ; .exe base address
2023-06-05 21:23:08 +00:00
mov rdx, 0 ; hPrevInstance - 0
2023-06-26 09:18:25 +00:00
mov r8, r14 ; command line
2023-06-05 21:23:08 +00:00
mov r9, 1 ; SW_NORMAL
call rax ; UnityMain(...)
2023-06-26 09:18:25 +00:00
pop r14
pop r13
pop r12
pop rdi
pop rsi
2023-06-05 21:23:08 +00:00
ret
2023-06-25 09:32:19 +00:00
%include "gpa.asm"
2023-06-05 21:23:08 +00:00
; 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