MEMORY_BASIC_INFORMATION struct holds a "State" property that is one of the following:
MEM_RESERVE, MEM_COMMIT, MEM_FREE
You can only use VirtualProtect on pages that are actually allocated for use, i.e. the MEM_COMMIT type.
Reserved and free memory pages cannot be read or written to and so you cannot change their protection flags.
A process may take ...
The question is not clear. Are you asking about
an approach to finding a single input that results in "Correct" being printed? or
an approach to deriving a method that will generate correct inputs for you (e.g. keygenning)?
If it is 1, then the answer is as simple as using a calculator.
If it is 2, then many options exist, such as using a constraint ...
Your code basically takes 9 chars, 8 from user input + 1 null terminator.
each one can be between 0-255.
You char array bytes are signed, so maximum value for each is 127 (hex: 7F)
You want the result of those byte values to end up equal to 895.
In order to achieve the result, you need to pass any combination of bytes that sum up to your value.
just modified your source a bit to print Rip prior and post in handler
added another exception and eliminated a warning (empty handler block)
and tested with +1,+2,+3 +4 +5 on the handler Hardware breaks doesn't get hit
I haven't checked by single stepping inside RtlpExecuteHandlerForxxx calls
here is a modified src