Running files from memory
Hello,
I'm new to ASM and mostly use it inline. What I'm trying to do is run a PE32 executable file from memory using inline ASM in Delphi.
I have the following code;
Quote:
var
FS: TFileStream;
Mem: TMemoryStream;
Addr: Pointer;
begin
FS := TFileStream.Create('e:\TestApp.exe', fmOpenReadWrite or fmShareDenyWrite);
Mem := TMemoryStream.Create();
Mem.CopyFrom(FS, FS.Size);
Mem.Position := 0;
Addr := Mem.Memory;
asm
JMP Addr
end;
end;
One would expect it to work. At the given address the exe really starts. It's just the raw mem address of the executable. Still, I keep getting Access Violations.
Anyone know what I'm doing wrong ?
Thanks,
- Fahr