News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Get The function parameter

Started by Farabi, August 05, 2005, 12:43:00 PM

Previous topic - Next topic

Farabi


I have a function like this



MyFunction proc x:dword,y:dword,status:dword

ret
MyFunction endp

MyFunction2 proc x:dword,y:dword,status:dword

ret
MyFunction2 endp



And I put the address as a linier value


Mov esi,virtual_table
mov eax,offset MyFunction
mov edc,offset MyFunction2
mov [esi],eax
mov [esi+4],edx


If I want to call the function, how to pass the parameter?
I have try to use pop but it failed.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

hutch--

Unless I have missed something, if the procedures are normal STDCALL, you push them in reverse order then call the procedure if you want manual control of wat you are calling. Get the address from the virtual table for the proc you want to call, push the arguments in reverse order like normal and call the address.


push status
push y
push x
call MyFunctionAddress
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

call DWORD PTR [esi+8]
..or whichever offset you want.

The parameters will go on the stack in reverse order, as usual.

I don't know if there is a way to use invoke with a function pointer.
No snowflake in an avalanche feels responsible.

hutch--

Sure is, I have published a couple of new ones recently but there is an existing on in the masm32 main macro file. They use EXTERNDEF format.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php