Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 20:02

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Calling functions from a dll
PostPosted: 15 Jan 2009 16:39 

Joined: 18 Sep 2008 22:23
Posts: 32
Hello
Here's my question: How can you call functions defined in the main exe file from a loaded DLL?
I want to try creating a dll to add some code to an exe, but I need access to the exe's functions.
Also, would you recommend writing a dll in asm or c?


Top
 Profile  
 
 
 Post subject: Re: Calling functions from a dll
PostPosted: 15 Jan 2009 18:00 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
when the dll is loaded you have access to anything to which the exe has access, so if this function is at offset 0x00401234 you can define it as the following example:

int (*function)(char *arg1, int arg2, int arg3) = 0x00401234;

and then you can use it normally:

ret = function("blahblah", 123, 456);


Top
 Profile  
 
 Post subject: Re: Calling functions from a dll
PostPosted: 16 Jan 2009 15:09 

Joined: 18 Sep 2008 22:23
Posts: 32
Thanks! That looks easy...
So how do you call a function in a dll from the main exe? (In asm)


Top
 Profile  
 
 Post subject: Re: Calling functions from a dll
PostPosted: 16 Jan 2009 15:22 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
in asm I can't help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC [ DST ]


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 post attachments in this forum

Search for: