Forum > General

How to run a EXE (Win32 any) starting from memory

(1/4) > >>

Eric.Developer:
Hi All,

How to run a EXE (Win32 any) starting from memory ?
assuming an EXE was stored in the database or load disk, read and assign the variable, then starting to run (without saving to disk).

LazaruX:
What is the question? I didn't see any question marks in your sentence.
When you lunch an EXE, the operating system mostly copies it to RAM and executes it from there.
Suppose you start an application from a floppy (example ;-) ) and then remove the floppy, the application still run's because its in memory. If this EXE uses external files then the app may crash.
Again please specify the question

LazaruX:
Sorry Eric, I don't understand your question, maybe it me, I don't know.

If your question is:
"Can I run an EXE from memory" then the answer is yes

For the est, I cannot help you, others should answer you sorry

Martin_fr:
He wants to load binary code as data, and then execute it. He doesn't want to load the code from an *.exe file, but a different source

This is what he wants. (But I don't know how to do it)

Var MyCode : Array of byte;

SetLength(MyCode, xxx);
Mycode := LoadCodeFromDB;

asm
 jmp MyCode[0]
end;

Several problems:
- code versus data segment violation (if the architecture/OS support none executable protection of data
- relocation (unless his code is completly written using relative addressing only)


Martin_fr:
No, you misunderstand me.

I do not know the answer. I was explaining you question, because BPsoftware said he did not understand it.


Best idea I can offer is to search (google) for the source (probably in C) of a tool like upx.

Because upx does load, decompress, and then execute => so it does what you need.

Navigation

[0] Message Index

[#] Next page

Go to full version