Use nonvolatile registers for storage

This commit is contained in:
mkrsym1
2023-06-26 12:18:25 +03:00
parent a0e79dcea0
commit 851ebb5b9a
2 changed files with 35 additions and 29 deletions

View File

@ -1,30 +1,31 @@
BITS 64
main: ; Replacement entry point
push rbp
mov rbp, rsp
sub rsp, 10h + 90h
push rsi
push rdi
sub rsp, 8h
call GetKernel32ModuleHandle
mov [rbp - 8h], rax ; kernel32.dll
mov rsi, rax ; kernel32.dll
mov rcx, rax
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]
mov rax, [rbp - 10h] ; *GetProcAddress
mov rax, rdi ; *GetProcAddress
call rax ; rax = *LoadLibraryA
lea rcx, [rel dllPath]
call rax ; LoadLibraryA(dllPath)
add rsp, 10h + 90h
pop rbp
add rsp, 8h
pop rdi
pop rsi
ret