Repository navigation
Description
Hi,
@janwilmans I ran into a regression in kernel message capture in a recent build. One immediate issue is that the extracted driver path uses System32\driver instead of System32\drivers, so the driver file can be written to the wrong location. Even after fixing that typo locally, enabling "Capture Kernel Messages" can still fail when the previous SCM service entry or driver state is stale, disabled, or otherwise not cleanly removable. In that state, the application may fail before it gets a chance to reuse an already loaded compatible driver.
The attached patch changes the kernel driver loading path to be more tolerant of that situation:
- First try to open the existing
\\.\dbgvdevice and reuse it if it is already loaded and available. - If the device is already held by another process, fail with a clear "already in use by another process" error instead of trying to load another instance.
- If the device does not exist, create a temporary registry service key and load the driver with
NtLoadDriver. - Delete the temporary registry key immediately after the load attempt.
- Do not use SCM
CreateService/StartService/StopService/DeleteServicefor this path. - On shutdown, only stop kernel capture through the existing IOCTL and close the device handle.
The driver does not appear to provide a normal unload path, so the patch does not try to unload it during normal shutdown. Instead, the intended behavior is to stop capture, close the device handle, and let the driver remain loaded until the next reboot. The temporary registry key is created with Start=3, so it is not configured for automatic boot loading. The key name is separate from the original DebugView service name:
HKLM\System\CurrentControlSet\Services\DebugViewPP_Dbgv
Please treat this as a suggested patch rather than a PR. If this approach looks reasonable for the project, feel free to adapt or merge the code in whatever form you prefer.
The patch was generated against:
- Repository:
CobaltFusion/DebugViewPP - Branch:
develop - Base commit:
31e2e05
Apply from the repository root with:
git checkout develop
git pull origin develop
git apply debugviewpp-kernel-driver-loading-fix.patchLocal functional testing passed for kernel message capture after this change.
Activity
x64bugreport commentedon Aug 11, 2026
The original DbgView behaves the same way.
janwilmans commentedon Aug 11, 2026
Thanks again for your contribution, I have some more work cut out for me I see. 😋👍
janwilmans commentedon Oct 17, 2026
merged !