1

I am using ASM first time ever and before i continue i need to know if i understood everything right when i wrote this. The current code looks like this:

push 0xDEADBEEF      ; address of library name
mov eax, 0xDEADBEEF  ; address of LoadLibraryA

call eax        ; call LoadLibraryA

mov esi, eax    ; store returned address

push 0xDEADBEEF      ; address of function name
push esi        
mov eax, 0xDEADBEEF   ; address of GetProcAddress

call eax             ; call GetProcAddress
mov esi, eax         ; store returned address

push 0
push 0
push 0
call esi  ; call the function returned by GetProcAddress

The 0xDEADBEEF's are just dummy addresses that i will patch later. Is there anything wrong? =)

thatoneguy
  • 45
  • 1
  • 3

1 Answers1

0

You don't normally call GetProcAddress directly. This is because it's exported from a DLL. What the linker will do in this case is to synthesize a GetProcAddress function that does a indirect far call to the __imp__GetProcAddress symbol. See http://blogs.msdn.com/b/oldnewthing/archive/2006/07/24/676669.aspx and http://blogs.msdn.com/b/oldnewthing/archive/2010/03/18/9980802.aspx

Neil
  • 54,642
  • 8
  • 60
  • 72