Hey, i would need some help on a dll.

In the dll, let's say i would have a 'something db "blah",0'.
I want to return that "something" when the respective function is called; how would i do that?

Also, in the exe that's calling the dll, i would use loadlibrary and getprocaddress to call the function.
Same as above, how would i call the function with "something" as a param?

Thanks.
Posted on 2003-10-04 02:23:20 by Ghirai
Return the address of the string in eax.



invoke GetProcAddress,hDll,offset functionname
xchg eax, esi
call esi ;call that function


You can store the address of the function in a dword and call it when needed.
Posted on 2003-10-04 02:43:00 by roticv
Pass the the offset of the string in eax then return from the function

In your DLL (the Callee)

MyDllFunction proc
mov eax,OFFSET something
ret
MyDllFunction endp

In your main program (the Caller)

invoke MyDllFunction
mov psomething,eax
Posted on 2003-10-04 02:44:17 by donkey
Hi roticv,

perfectly synchronized :grin:
Posted on 2003-10-04 02:44:54 by donkey
Thanks guys, you're great :)
Posted on 2003-10-04 03:13:26 by Ghirai