PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Self modifying code...

Hi!

Has anyone ever played around with self modifying code under WinCE?
I tried to apply some of my old WinNT code to get write access to the code segment but that didn't work :(

Anyone any ideas?

Thanks,

Peter
xPeterx wrote:
Has anyone ever played around with self modifying code under WinCE?
I tried to apply some of my old WinNT code to get write access to the code segment but that didn't work :(

Anyone any ideas?


Hi xPeterx,

I have succesfully used some selfmodifying code, the only thing I had to do was marking the area the code was as readwrite in the area header:

AREA AreaNamexxxx,CODE,READWRITE


once there, just put a label in the instruction you want to modify and make it public thru EXPORT if you wanna use it from external files (i.e. C/C++ files). I haven't used it to modify the asm code from the very same asm code, but should as easy as writting in a variable.

I have succesfully used some selfmodifying code, the only thing I had to do was marking the area the code was as readwrite in the area header:

AREA AreaNamexxxx,CODE,READWRITE


once there, just put a label in the instruction you want to modify and make it public thru EXPORT if you wanna use it from external files (i.e. C/C++ files). I haven't used it to modify the asm code from the very same asm code, but should as easy as writting in a variable.


You're referring to the ARM assembler aren't you?
The code i want to modify is actually in my compiled C/C++ code...

But thanks for your answer anyway...
xPeterx wrote:
You're referring to the ARM assembler aren't you?
The code i want to modify is actually in my compiled C/C++ code...

But thanks for your answer anyway...


uops, I thought you were talking of asm, no idea about c/c++ code, sorry :)
in fact I never heard of somebody modifying C/C++ code during runtime... until today ;) I suppose you could make evc to generate asm code, modify the asm header and then compile that code with the assembler (of course I never tested it)