PDA

View Full Version : About Flag of section header


Frenchy
07-03-2004, 06:25 AM
Is it possible to do that:

during execution of a prog, i would change its flag of section .text. (code) and add write flag..after that i modify coding and put off the write flag after to keep the read flag only...


Thanks for help...

CoDe_InSiDe
07-03-2004, 06:32 AM
Hi Frenchy,

You can use VirtualProtect for that :)

Frenchy
07-03-2004, 07:05 AM
that i have found on google search


VirtualProtect

The VirtualProtect function changes the protection on a region of committed pages in the virtual address space of the calling process.

To change the access protection of any process, use the VirtualProtectEx function


ok i understand ...how could i implement this routine in prog which is reversed?

have you an example of coding in assembly code?

CoDe_InSiDe
07-04-2004, 05:13 AM
Hi Frenchy,

This link will probably help you :)

http://msdn.microsoft.com/library/default....tualprotect.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualprotect.asp)

Devine9
07-08-2004, 06:27 PM
Hi Frenchy,

You would use IIDKing or some other means and add the VirtualProtect API to the import table, then you would stick a jmp in your code to a cave(0'd area) and stick the code in the exe there.. then jmp back to the programs code..

regards,

Devine Right [RET]

kw
08-14-2004, 05:28 AM
If you even need that. The program will run fine with the write flag enabled, so are you sure you need to switch it back? You could just set the flag in the file, and leave it at that.

If you really do need to do it this way, VirtualProtect(Ex) is the way to go. It lets you dynamically change an object's properties, making it very useful for (for example) modifying code at runtime. You can probably find enough examples of its use on the web. If you still have trouble, drop a note.

Kwazy Webbit