[Win32] Remotely execute functions of a D program

alex info at alexanderbothe.com
Sat Sep 15 20:10:54 PDT 2012


On Saturday, 15 September 2012 at 13:34:02 UTC, alex wrote:
> On Saturday, 15 September 2012 at 13:02:32 UTC, Denis 
> Shelomovskij wrote:
>>....
>> Again, Digital Mars C runtime library is the problem for 
>> everything in D language including DLL-s.
>
> Lol okay I think I've also seen it. I've tried to build a 
> hybrid dll with mixed C and D code (just compiled with 
> dmc+dmd), and it's just not working, even if it's raw C 
> exclusively..
>
>
> I'll try an other approach now that is probably way more 
> elegant and doesn't need any LoadLibrary calls:
> I simply create a code cave in the debuggee and inject some 
> assembler into it.
> The method I'll be executing then takes a variable address 
> (that has been stored in an other space), makes an object 
> pointer out of it, and calls the virtual toString() overload - 
> whereas the pointer to that function is stored at a fixed 
> offset, fortunately. The returned string struct/pointer 
> whatever will be stored to the variable address then (so I 
> don't have to allocate another variable space), and the debug 
> engine will finally read out the string.
> That's my theory so far, I hope it'll work somehow :)
>
> @Rainer I'll try my method first, and if that's not working at 
> all, or if it's working, I'll contact you ;)

It's absolutely frickin' awesome - it works! I could inject the 
assembler code, call the object's toString() method, do 
everything as I've just explained...it's awesome!! FUCK YEAH I 
did it..now I can go to sleep :D

@Rainer I'll share it so we both may integrate it into the 
debuggers then :)



More information about the Digitalmars-d mailing list