Setup for windows kernel development (development, debugging automation and compiling)
We will use Visual Studio as an IDE and WinDbg as a debugger and VMware Workstation for the test machine. This part highly relies on the previous part which describes how to set up kernel debugging environment.
- Install OpenSSH server on your guest machine: Apps & Feature (In windows windows start) -> Optional features -> OpenSSH Server
- Install PuTTY package on the host machine from here
Open debug.ps1:
- PROJECT_NAME -> the project name (matching with the driver name)
- ARCHITECTURE -> the architecture to use
- BUILD_DIRECOTY -> make sure that you want to debug your debug version
- SOURCE_DIRECOTY -> your source directory (C\C++ files)
- VMWARE_VMRUN -> the path to vmrun.exe application from VMware
- WINDBG -> the path to windbg
- TEST_MACHINE_PATH -> the path to your test machine vmx
- TEST_MACHINE_SNAPSHOT -> the debugging snapshot name
- TEST_MACHINE_USERNAME -> the username to your test machine account (for ssh)
- TEST_MACHINE_PASSWORD -> the password to your test machine account (for ssh)
- TEST_MACHINE_IP -> the ip to your test machine (for ssh)
- REMOTE_DIR_PRODUCT -> the remote directory to upload the driver
- REMOTE_DRIVER_PATH -> the driver remote path
- CREATE_SERVICE -> create a kernel service for the driver
- START_SERVICE -> start the kernel service
- DEBUG_PORT -> the debug port that you choose for your debugging session
- DEBUG_KEY -> the debug key that you choose for your debugging session
The bolded points are needed to be configured and check that the paths are correct (vmrun and windbg).
Now, when you run the powershell script (debug.ps1) it will open a debugging session to your driver.
Breakpoint example: bp `KernelDriverName!Source.cpp:23`
DONE!!!