Understanding/Debugging Driver Error Codes with Windows 7

Discuss Windows Vista/Server 2008 to Windows 10.
Post Reply
Omicron
Posts: 51
Joined: Sun Jan 24, 2016 7:04 pm

Understanding/Debugging Driver Error Codes with Windows 7

Post by Omicron »

I am currently have a driver I am trying to get working on Windows 7 that is throwing a "Code 37" error code. According to MS, it sounds like this is due to some sort of issue when the driver's main function is called (it seems to be called DriverEntry() and returns a GO/FAIL code depending on how it is initialized.) However, as the code is provided as a non-debug symbol binary, I don't think there is any way for me to run some sort of debugger to trace how exactly it fails - meaning it could be anything from the driver not liking the build number of Windows, a dynamic library missing, or perhaps it just doesn't like the weather...

Is there any way for me to get more info as to why a driver fails when initialized, such as perhaps it panicking when files are not found? Maybe there is some sort of debugger that works in this situation?

3155ffGd
User avatar
Posts: 391
Joined: Wed May 02, 2012 12:57 am

Re: Understanding/Debugging Driver Error Codes with Windows

Post by 3155ffGd »

Since all calls a driver can do (including file access etc.) have to go through the Windows kernel, it is possible to use the easily available Windows debug symbols to at least figure out what the driver is trying to do. All you'd need for this is a copy of WinDbg that works with Windows 7. I got mine from the "Debugging Tools for Windows" (google that term and it should come up pretty soon)

voidp
User avatar
Posts: 394
Joined: Fri Jul 01, 2011 3:04 am

Re: Understanding/Debugging Driver Error Codes with Windows

Post by voidp »

Be sure to check the Event Log.

Omicron
Posts: 51
Joined: Sun Jan 24, 2016 7:04 pm

Re: Understanding/Debugging Driver Error Codes with Windows

Post by Omicron »

3155ffGd wrote:Since all calls a driver can do (including file access etc.) have to go through the Windows kernel, it is possible to use the easily available Windows debug symbols to at least figure out what the driver is trying to do. All you'd need for this is a copy of WinDbg that works with Windows 7. I got mine from the "Debugging Tools for Windows" (google that term and it should come up pretty soon)
Okay, thank you - I'll investigate that. Sounds exactly what I was wanting to do.
voidp wrote:Be sure to check the Event Log.
Actually one of the first things I did. It did not seem to give me any more helpful info than what device manager said, just repeated that the driver had failed to initialize due to Error 37 with no additional detail or elaboration.

voidp
User avatar
Posts: 394
Joined: Fri Jul 01, 2011 3:04 am

Re: Understanding/Debugging Driver Error Codes with Windows

Post by voidp »

You can also try using SysInternals' DebugView to see if the driver writes any kind of debug strings. See the Capture menu for different kinds of output.

     https://live.sysinternals.com/Dbgview.exe

But...

Is the driver the /correct/ driver?

Can you see the device ('unknown device') in Device Manager (or HwInfo64, AIDA64, etc.)?

Have you tried automatically downloading a driver?

Have you researched its PnP Hardware ID as a means for locating the correct driver?

Omicron
Posts: 51
Joined: Sun Jan 24, 2016 7:04 pm

Re: Understanding/Debugging Driver Error Codes with Windows

Post by Omicron »

voidp wrote:Is the driver the /correct/ driver?
Yes, it is the correct driver - I'm trying something unconventional though, but the driver and the DEV ID it is being installed onto is definitely right.

Post Reply