i have offset of some function in variable ie. funcVar
ok so i tryed to call that function using invoke but that didnt work
compiler error was
error INVOKE requires prototype for procedure

but when i tryed with good old call instruction (previously i pushed all parametars on stack in proper order) everything worked fine

so is it posible to to that with invoke statement?

if needed i will post source code
Posted on 2001-10-06 16:09:07 by Mikky
Hi Mikky!

You have to declare a prototype for your function if you want to call it using invoke. You can do that like this:

MyFunction PROTO :DWORD,:DWORD ;2 parameters needed here

I hope it helps!

Posted on 2001-10-06 16:34:29 by Delight
ok well actually what i am trying to do is to call function from dll
and i have only addres of that function in dll
here is the source

.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib

include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib


msgText db "Sucess!",0
msgCap db "win32asm",0

ApiName1 db "MessageBoxA",0
DllName1 db "user32.dll",0


hDllInstance HINSTANCE ?
hApiInstance HINSTANCE ?


invoke LoadLibrary, offset DllName1
mov ,eax ;save handle 2 module

invoke GetProcAddress, hDllInstance, offset ApiName1
mov ,eax

; push MB_OK
; push offset msgCap
; push offset msgText
; push NULL
; call
invoke , NULL,addr msgText, addr msgCap, MB_OK

invoke ExitProcess, NULL ;NULL = 0

end start

Posted on 2001-10-06 17:51:38 by Mikky
I don't think it's possible with Masm.

Besides it it that big a deal, you could always write a macro so that it would look neater.
Posted on 2001-10-06 18:17:50 by Eóin
I'll just (once again) repost some stuff the scalie posted that comrade
told him about...

INVOKE (TYPE MessageBox) PTR eax, NULL, ADDR text, ADDR caption, MB_OK

If this is not what you meant, blame my currnet alcohol percentage ;).
You'll need to set up a proto first, btw.
Posted on 2001-10-06 21:31:06 by f0dder