mmm well, I need your help with this stuff...

I dont know how to use GetModuleHandle and GetProcAddress...

can you tell me how? :)

thanks in advance ;)
Posted on 2009-02-01 14:45:54 by GermainR27
What kind of language do you usually program in?

GetModuleHandle is pretty straight forward...

Retrieves a module handle for the specified module. The module must have been loaded by the calling process.

ModuleName db "user32.dll",0
invoke GetModuleHandle, offset ModuleName
mov hUser32.dll, eax

invoke GetModuleHandle, NULL
mov hWnd, eax

For GetProcAddress you would only retrieve the address of a function inside a loaded dll. For example after loading Kernel32.dll using LoadLibrary you would use GetProcAddress on "GetprocAddress" to retrieve the address of said function. (I formulated that in a confusing manner on purpose :P)

Kernel32 db "Kernel32.dll",0
GPA db "GetProcAddress",0
invoke LoadLibrary, offset Kernel32
invoke GetProcAddress, eax, offset GPA
mov AddressOfGetProcAddress, eax

Now using that address (and after jumping through a few hoops) you would be able to change bytes at said relative address.

As it's a .dll I believe only your process would be affected by said changes but I might be wrong.

Most of this was written by memory and under teh infulence of alcool. Hopefully I was able to help a bit.

Posted on 2009-02-01 20:45:24 by JimmyClif
Hi, thanks JimmyClif  :)

I'm trying to code a dll in masm32, but I needed to call a couple of address from another dll...

With this, I belive I'm ready ^^
Posted on 2009-02-02 12:24:27 by GermainR27