Windows kernel driver example exposing IOCTLs to usermode for module base address lookup, process ID resolution, memory read/write, and handle-stripping process protection.
Example on how a Windows Driver and a usermode application can communicate following the Rings Tutorial.
Currently the Driver is able to take IOCTL Requests from the usermode application.
The driver can provide the usermode application a base address of a module, a pid to the process the module is loaded in, read/write operations to/from memory and protect a given pid from being terminated/read (from).
PreOpenProcessOperation strips any newly created handle to the protected process from its (PROCESS_TERMINATE), PROCESS_DUP_HANDLE, PROCESS_VM_READ and PROCESS_VM_OPERATION rights. When OpenProcess is called and a Handle to the protected program is created the Callback interferes.
To test it in your testing environment run those commands with elevated cmd:
bcdedit /set testsigning on
After rebooting, create a service and run the driver:
sc create drivername type= kernel binPath= C:\Path\To\Driver\drivername.sys
sc start drivername
To debug the driver in your testing environment run this command with elevated cmd and reboot your computer:
bcdedit /debug on
After the reboot, you can see the debugging messages in tools such as WinDBG WDK Tool.
Credits