The MASM Forum

Microsoft 64 bit MASM => Examples => Topic started by: Vortex on November 06, 2020, 02:14:56 AM

Title: Custum function to get procedure addresses
Post by: Vortex on November 06, 2020, 02:14:56 AM
A custom GetProcAddr function based on binary search :

Code: [Select]
include     \masm32\include64\masm64rt.inc

EXTERN      GetProcAddr:PROC

.data

user32      db 'user32.dll',0
msgbox      db 'MessageBoxA',0

.data?

hDLL        dq ?

.code

start PROC

    invoke  LoadLibrary,ADDR user32
    mov     hDLL,rax

    invoke  GetProcAddr,rax,ADDR msgbox
    cmp     rax,-1
    je      @f

    invoke  rax,0,"GetProcAddr test",\
            "Hello",MB_OK
@@:
    invoke  FreeLibrary,hDLL

    invoke  ExitProcess,0

start ENDP

END
Title: Re: Custum function to get procedure addresses
Post by: stevenxie on November 10, 2020, 12:18:55 AM
Hi ,Vortex. It is very good. I will  work hard on  the code. Thank for you!