The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on June 07, 2007, 07:12:37 PM

Title: invoke macro
Post by: ragdog on June 07, 2007, 07:12:37 PM
hi @all

i seach a invoke call function for dll´s  macro
can you me please send a good macro for this??

ProtoDef            typedef proto :dword,:DWORD,:DWORD,:DWORD
lpProc              typedef ptr ProtoDef


.data
szLoadPlugin        db "LoadPlugin", 0
szExecutePlugin   db "ExecutePlugin", 0

.data?

hPlugin                dd ?
ExecutePlugin       lpProc    ?

invoke LoadLibrary,addr szPlugin
mov hPlugin, eax
invoke GetProcAddress,hPlugin,addr szExecutePlugin
mov ExecutePlugin,eax
invoke ExecutePlugin,hWnd

greets
ragdog
Title: Re: invoke macro
Post by: u on June 07, 2007, 07:19:50 PM
http://www.masm32.com/board/index.php?action=dlattach;topic=6228.0;id=3203

it can't be made any easier.
Title: Re: invoke macro
Post by: Vortex on June 07, 2007, 07:36:52 PM
Have a look at sinsi's method, it's nice :

http://www.masm32.com/board/index.php?topic=6686.0
Title: Re: invoke macro
Post by: u on June 07, 2007, 07:45:04 PM
The "nicety" of that is why I created the IFunc macros :). Nothing beats self-documenting code  :toothy
Title: Re: invoke macro
Post by: ragdog on June 07, 2007, 07:51:02 PM
thanks ultrano and vortex

where I get the jump of entries ago??


MsgBox      db 0FFh,025h   ; define manually a jump entry
         dd pMessageBox
Title: Re: invoke macro
Post by: Vortex on June 07, 2007, 07:57:19 PM
FFh & 25h = machine code symbols of  jump DWORD PTR [xxxx]

xxxx = 32-bit address
Title: Re: invoke macro
Post by: u on June 07, 2007, 08:00:38 PM
^^"  these are simply opcodes for a far-jump, and then 4 bytes - the address of the proc. And Vortex accented on Sinsi's method, which is actually what you had already done and wanted to get away from (apart from having the error of specifying 4 :DWORD instead of 1 in ProtoDef).
Oh well, I'm sticking to using macros to save as much trouble, typing and time as possible.
Title: Re: invoke macro
Post by: ragdog on June 07, 2007, 08:02:42 PM
I understand in this way

MsgBox      db 0FFh,025h   ; jump to dword pointer ------- 
                                                                                   -
                                                                                   -
          dd pMessageBox   <<----------------------------------                   

correctly??                                   

Title: Re: invoke macro
Post by: Vortex on June 07, 2007, 08:11:29 PM
Quote from: ragdog on June 07, 2007, 08:02:42 PM
I understand in this way

MsgBox      db 0FFh,025h   ; jump to dword pointer ------- 
                                                                                   -
                                                                                   -
          dd pMessageBox   <<----------------------------------                   

correctly??                                   



Yes, exactly as you said. It's a jump to an address stored in pMessageBox
Title: Re: invoke macro
Post by: ragdog on June 07, 2007, 08:14:32 PM
thanks :U

I experiment with it only times


regards

ragdog