[fpc-pascal] assign code to a method

Marco van de Voort marcov at stack.nl
Fri Feb 18 12:16:32 CET 2011


In our previous episode, Jonas Maebe said:
> > because this is not a problem in Delphi nor it was in an old version  
> > of fpc-Lazarus 32 bits. Please give me a tip.
> > Many thanks in advance.
> 
> You probably have to mark the memory in which you write the code as  
> "executable" first (this has to be done using an OS-specific function;  
> I know next to nothing about Windows programming, but you should be  
> able to find the necessary information in MSDN).
> 
> In fact, you should also do this on 32 bit platforms, since more and  
> more systems mark memory by default as not executable for security  
> purposes.

This is called DEP (Data Execution Protection, which is an amalgam of resp
AMD and Intel hardware protection and some software forms). IIRC it is
always on for 64-bit, and for 32-bit server versions that use a PAE kernel.
(client OSes don't have PAE version on windows afaik)

Afaik it can only be turned on before starting a binary. An executable can't
disable it while running (since then it would be useless, as a virus could
simply disable it)

See e.g.
http://techblissonline.com/enable-disable-dep-in-windows-xp-vista/

Searching for "disable dep" or so will probably yield more results.

Of course, this is not healthy and supportable application behaviour, but I
assume this is already known.




More information about the fpc-pascal mailing list