gpa "CreateFileA", "kernel32.dll"
; store address
mov CreateFileA, $RESULT
cmp CreateFileA, 0
je exit
; create a new breakpoint
bp CreateFileA
run
exit:
; create new memory segment to store DLL name
alloc 50
mov pLib, $RESULT
mov [pLib],"//PATH_OF_DLL//"
; Address of API LoadLibraryA(sDllName)
gpa "LoadLibraryA","kernel32.dll"
mov LoadLibraryA, $RESULT
;inject and execute code : LoadLibrary(pLib)
push pLib
exec
call {LoadLibraryA}
ende
; free memory bloc
free pLib
refresh
Note : The REFRESH command is needed if you want to get module informations. OllyDBG doesn't refresh module window automatically.