IS it possible to do that:
during execution of prog..i would change its flag of section .text. (code) to have read and write..after i modify some instruction in coding..and then put off the flag write of the section....
thanks for help
Frenchy
during execution of prog..i would change its flag of section .text. (code) to have read and write..after i modify some instruction in coding..and then put off the flag write of the section....
thanks for help
Frenchy
You don't have to modify the flag, link your object file with the switch /SECTION:.text,ERW
thks Vortex...but i know that , but i would know if we can change flag section during the execution..i would keep the protect against bad write in section code...
i suppose the flag is loaded in memory but i dont know where exactly ...
i have written a prog in assembly..and i would implement a coding to change flag..i suppose all is possible in programmation, but how resolve this prob..
i suppose the flag is loaded in memory but i dont know where exactly ...
i have written a prog in assembly..and i would implement a coding to change flag..i suppose all is possible in programmation, but how resolve this prob..
To get the writing access to the code section, consider using the OpenProcess function:
I have an old example using this function to modify the code section, you can check the attachment.
HANDLE OpenProcess(
DWORD dwDesiredAccess, // access flag
BOOL bInheritHandle, // handle inheritance flag
DWORD dwProcessId // process identifier
);
I have an old example using this function to modify the code section, you can check the attachment.
thks Vortex i see that...
Try that
C&P from Win32SDK
The VirtualProtect function changes the access protection on a region of committed pages in the virtual address space of the calling process. This function differs from VirtualProtectEx, which changes the access protection of any process.
More ?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualprotect.asp
C&P from Win32SDK
The VirtualProtect function changes the access protection on a region of committed pages in the virtual address space of the calling process. This function differs from VirtualProtectEx, which changes the access protection of any process.
BOOL VirtualProtect(
LPVOID lpAddress, // address of region of committed pages
DWORD dwSize, // size of the region
DWORD flNewProtect, // desired access protection
PDWORD lpflOldProtect // address of variable to get old protection
);
More ?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualprotect.asp