Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all

i want to do an inline asm and i want to see if a given location of memory is non-writable-executable code or its writable data; if its data, skip the overwrite.
i want to do it in pure asm + win api.

i partially achieved it by checking if I'm in code section or not. but it seems even there, there are some locations that are meant to be used as data and fiddling with them will cause access violation.
i want to do it in a more advanced, flawless, way.

thanks in advance.

What I have tried:

trying base-offset to detect sections of the target exe file
Updated 8-Oct-22 21:04pm
Richard MacCutchan 18-Sep-22 3:29am    
It is very difficult to figure out such things without access to the source, since you cannot guarantee to find the start of any code section.

1 solution

Access to main memory is usually realized with an MMU. Since the MMU is a critical resource, the operating system takes care of it. Access to the MMU requires operating system rights and good hardware knowledge. If you had access to the MMU, you could certainly also change rights. Furthermore, an MMU manages the memory with a minimum block size.
Share this answer
reverser69 11-Oct-22 12:20pm    
could you please provide some more keywords?
googling MMU is not yielding any related information.
merano99 11-Oct-22 16:16pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900