I have a solution for a problem I'm currently facing, but don't know how to do it.
I want to use the equivalents of "VirtualProtect" and "WriteProcessMemory" from kernel space.
More precisely, I run under the context of process A and just before the main thread has started to run (I'm in the context of the main thread, using PsSetCreateThreadNotifyRoutineEx).
I want to make the page where main function resides "Read Write Execute" instead of "Read Execute", and write over few of the first main's opcodes with opcodes given by my driver's data.
What I want to do is actually put the main thread in an infinite loop.