Y
Y
Yakov Kravtsov2014-05-26 11:36:30
Delphi
Yakov Kravtsov, 2014-05-26 11:36:30

Generating and Executing RunTime Functions

Good day!
Let's say there is a programmatically generated x86 (or x64) code, let's say it is stored in an array of bytes (TBytes).
If you describe a function prototype, create an appropriate variable and assign it address 0 bytes of the array - the whole thing does not work.
How is it done in this case? Maybe I'm not generating correctly (in the sense that I'm not allocating memory there or not there). Is there anything else that needs to be done first?
Please advise)
Thank you in advance!
PS
I use Delphi, specifically xE6.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Pronin, 2014-05-27
@virus_forever

It is not necessary to select in the code segment, it is necessary to select the area with the PAGE_EXECUTE modifier
in more detail
the area is selected VirtualAlloc
usage example

A
Andrew, 2014-05-26
@OLS

Maybe because your variable is in the data segment, and the code is in the code segment?
Without seeing the code, it's hard to assess the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question