Is it possible to debug UMDF drivers on the windows machine that I am developing them on?
-
Yes. See the following articles: http://msdn.microsoft.com/en-us/library/windows/hardware/ff554580%28VS.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/hardware/ff554473%28v=vs.85%29.aspx – Alex F Oct 30 '14 at 14:25
1 Answers
As for UMDF 2 drivers:
You can attach Visual Studio to the process WUDFhost.exe as soon as the device is installed or enabled. But then you have the problem, that you can't debug the DriverEntry. To be able to debug the DriverEntry you can set this registry value:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WUDF\Services\
set the value
HostProcessDbgBreakOnDriverLoad
to configure the seconds that WDFhost.exe should wait before calling DriverEntry. I set this value to 0xf, so i have 15 seconds after enabling the driver to attach Visual Studio to the WUDFhost.exe process. Then you are able to step through the driver code and you can also see all the DbgPrintEx() log-messages. Works like a charm, but you have to do the following steps each time you want to debug:
- Disable Device in the device manager
- Enable Device int the device manager
- In Visual Studio quickly attach to the process WDFhost.exe: Debug->Attach to process. You have 15 seconds to do this, if you configured the registry like above.
Note: It is not necessary to set "bcdedit /debug on" to debug like this. This is nice, because if you have Secure Boot enabled you won't be able to set the debug mode.

- 114
- 1
- 10