Can anyone give me an example of how to call an injected dll's function with a string argument?
I have tried to do it in the ways I know to do it but have gotten the wrong result. I allocate memory with VirtualAllocEx
, then write string argument to it with WriteProcessMemory
and after that call CreateRemoteThread
passing that string argument as lpParameter
parameter. The DLL function I call has following prototype:
DWORD TestFunction(LPVOID str);
From what I understand when this function is called by CreateRemoteThread
, str
contains a pointer to the passed string. But it doesn't; it contains some trash. It looks like str
parameter points to the wrong address. What am I doing wrong?
Here are the whole project files:
http://pastebin.com/gh4SnhmV
http://pastebin.com/Sq7hpSVx
http://pastebin.com/dvgXpUYz