I added "mov ["+pReturnBlock.BaseAddress+"], eax " instruction to return the pointer.
But when it tries to read the pReturnBlock.BaseAddress it gives an ArgumentOutofRangeException: The relative address cannot be greater than the main module size.
Any idea?
Thanks for all your help!
var pReturnBlock = sharp.Memory.Allocate(0x4);
sharp.Write<int>(pReturnBlock.BaseAddress,0,false);
var asm = new[]
{
"push 0",
"push -1",
"mov edx, " + Codecave.BaseAddress,
"push edx",
"call " + FrameScript__GetText,
"add esp, 0Ch",
"mov ["+pReturnBlock.BaseAddress+"], eax ",
"retn"
};
sharp.Assembly.InjectAndExecute(asm);
sResult = sharp.ReadString(sharp.Read<IntPtr>(pReturnBlock.BaseAddress));
sharp.Memory.Deallocate(Codecave);