flat assembler
Message board for the users of flat assembler.

Index > Windows > how to invoke a function which is member of a struct?

Author
Thread Post new topic Reply to topic
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha
how to define a pointer to an imported function as member of a struct?
for example, can it be invoked like this?
struct funstruct

func1 rd 1
func2 rd 2
ends

mystruct funstruct MessageBox,ExitProcess

invoke [mystruct+funstruct.func1], NULL, "ok", "ok", MB_OK

_________________
Assembly Asker
Post 06 Apr 2009, 14:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17271
Location: In your JS exploiting you and your system
revolution
invoke will already do the memory lookup for you so you can just do this:
Code:
mov eax, [MessageBox]
mov [mystruct.func1],eax
...
invoke mystruct.func1, NULL, "ok", "ok", MB_OK    
Post 06 Apr 2009, 15:04
View user's profile Send private message Visit poster's website Reply with quote
nazha



Joined: 05 Mar 2009
Posts: 40
Location: Beijing, China
nazha
Great, thank you.
Post 07 Apr 2009, 02:54
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.