Use nonvolatile registers for storage
This commit is contained in:
parent
a0e79dcea0
commit
851ebb5b9a
@ -1,65 +1,70 @@
|
|||||||
BITS 64
|
BITS 64
|
||||||
|
|
||||||
main: ; Replacement entry point
|
main: ; Replacement entry point
|
||||||
push rbp
|
push rsi
|
||||||
mov rbp, rsp
|
push rdi
|
||||||
sub rsp, 30h + 90h
|
push r12
|
||||||
|
push r13
|
||||||
|
push r14
|
||||||
|
|
||||||
|
|
||||||
call GetKernel32ModuleHandle
|
call GetKernel32ModuleHandle
|
||||||
mov [rbp - 8h], rax ; kernel32.dll
|
mov rsi, rax ; kernel32.dll
|
||||||
|
|
||||||
mov rcx, rax
|
mov rcx, rax
|
||||||
call GetAddressOf_GetProcAddress
|
call GetAddressOf_GetProcAddress
|
||||||
mov [rbp - 10h], rax ; *GetProcAddress
|
mov rdi, rax ; *GetProcAddress
|
||||||
|
|
||||||
|
|
||||||
mov rcx, [rbp - 8h] ; kernel32.dll
|
mov rcx, rsi ; kernel32.dll
|
||||||
lea rdx, [rel s_LoadLibraryA]
|
lea rdx, [rel s_LoadLibraryA]
|
||||||
mov rax, [rbp - 10h] ; *GetProcAddress
|
mov rax, rdi ; *GetProcAddress
|
||||||
call rax ; rax = *LoadLibraryA
|
call rax ; rax = *LoadLibraryA
|
||||||
|
|
||||||
lea rcx, [rel dllPath]
|
lea rcx, [rel dllPath]
|
||||||
call rax ; LoadLibraryA(dllPath)
|
call rax ; LoadLibraryA(dllPath)
|
||||||
|
|
||||||
|
|
||||||
mov rcx, [rbp - 8h] ; kernel32.dll
|
mov rcx, rsi ; kernel32.dll
|
||||||
lea rdx, [rel s_GetModuleHandleA]
|
lea rdx, [rel s_GetModuleHandleA]
|
||||||
mov rax, [rbp - 10h] ; *GetProcAddress
|
mov rax, rdi ; *GetProcAddress
|
||||||
call rax ; rax = *GetModuleHandle
|
call rax ; rax = *GetModuleHandle
|
||||||
mov [rbp - 18h], rax
|
mov r12, rax
|
||||||
|
|
||||||
mov rcx, 0
|
mov rcx, 0
|
||||||
call rax ; rax = .exe base address
|
call rax ; rax = .exe base address
|
||||||
mov [rbp - 20h], rax
|
mov r13, rax
|
||||||
|
|
||||||
mov rcx, [rbp - 8h] ; kernel32.dll
|
mov rcx, rsi ; kernel32.dll
|
||||||
lea rdx, [rel s_GetCommandLineW]
|
lea rdx, [rel s_GetCommandLineW]
|
||||||
mov rax, [rbp - 10h] ; *GetProcAddress
|
mov rax, rdi ; *GetProcAddress
|
||||||
call rax ; rax = *GetCommandLineW
|
call rax ; rax = *GetCommandLineW
|
||||||
|
|
||||||
call rax ; rax = command line
|
call rax ; rax = command line
|
||||||
mov [rbp - 28h], rax
|
mov r14, rax
|
||||||
|
|
||||||
|
|
||||||
lea rcx, [rel s_UnityPlayer.dll]
|
lea rcx, [rel s_UnityPlayer.dll]
|
||||||
mov rax, [rbp - 18h] ; *GetModuleHandleA
|
mov rax, r12 ; *GetModuleHandleA
|
||||||
call rax ; rax = UnityPlayer.dll
|
call rax ; rax = UnityPlayer.dll
|
||||||
|
|
||||||
mov rcx, rax
|
mov rcx, rax
|
||||||
lea rdx, [rel s_UnityMain]
|
lea rdx, [rel s_UnityMain]
|
||||||
mov rax, [rbp - 10h] ; *GetProcAddress
|
mov rax, rdi ; *GetProcAddress
|
||||||
call rax ; rax = *UnityMain
|
call rax ; rax = *UnityMain
|
||||||
|
|
||||||
mov rcx, [rbp - 20h] ; .exe base address
|
mov rcx, r13 ; .exe base address
|
||||||
mov rdx, 0 ; hPrevInstance - 0
|
mov rdx, 0 ; hPrevInstance - 0
|
||||||
mov r8, [rbp - 28h] ; command line
|
mov r8, r14 ; command line
|
||||||
mov r9, 1 ; SW_NORMAL
|
mov r9, 1 ; SW_NORMAL
|
||||||
call rax ; UnityMain(...)
|
call rax ; UnityMain(...)
|
||||||
|
|
||||||
|
|
||||||
add rsp, 30h + 90h
|
pop r14
|
||||||
pop rbp
|
pop r13
|
||||||
|
pop r12
|
||||||
|
pop rdi
|
||||||
|
pop rsi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,30 +1,31 @@
|
|||||||
BITS 64
|
BITS 64
|
||||||
|
|
||||||
main: ; Replacement entry point
|
main: ; Replacement entry point
|
||||||
push rbp
|
push rsi
|
||||||
mov rbp, rsp
|
push rdi
|
||||||
sub rsp, 10h + 90h
|
sub rsp, 8h
|
||||||
|
|
||||||
|
|
||||||
call GetKernel32ModuleHandle
|
call GetKernel32ModuleHandle
|
||||||
mov [rbp - 8h], rax ; kernel32.dll
|
mov rsi, rax ; kernel32.dll
|
||||||
|
|
||||||
mov rcx, rax
|
mov rcx, rax
|
||||||
call GetAddressOf_GetProcAddress
|
call GetAddressOf_GetProcAddress
|
||||||
mov [rbp - 10h], rax ; *GetProcAddress
|
mov rdi, rax ; *GetProcAddress
|
||||||
|
|
||||||
|
|
||||||
mov rcx, [rbp - 8h] ; kernel32.dll
|
mov rcx, rsi ; kernel32.dll
|
||||||
lea rdx, [rel s_LoadLibraryA]
|
lea rdx, [rel s_LoadLibraryA]
|
||||||
mov rax, [rbp - 10h] ; *GetProcAddress
|
mov rax, rdi ; *GetProcAddress
|
||||||
call rax ; rax = *LoadLibraryA
|
call rax ; rax = *LoadLibraryA
|
||||||
|
|
||||||
lea rcx, [rel dllPath]
|
lea rcx, [rel dllPath]
|
||||||
call rax ; LoadLibraryA(dllPath)
|
call rax ; LoadLibraryA(dllPath)
|
||||||
|
|
||||||
|
|
||||||
add rsp, 10h + 90h
|
add rsp, 8h
|
||||||
pop rbp
|
pop rdi
|
||||||
|
pop rsi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user