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 06 Apr 2009, 14:33
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: 20333
Location: In your JS exploiting you and your system
revolution 06 Apr 2009, 15:04
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 07 Apr 2009, 02:54
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.