Howto Debug an odd problem – “Load Datalogic Scanner XML Settings Failure!”

I had an odd problem today with a USB barcode scanner and its OPOS driver. The scanner in question is a DataLogic 2200VS USB scanner and I’m using its OPOS Driver (USBScanner is the OPOS Device name) on a Windows Vista machine with UAC switched on.

When I lauched the application I was running it kept giving a error when it tried to open the device “Load Datalogic Scanner XML Settings Failure!” No amount of searching online was able to reveal the answer to this error and because its load via the OPOS control which is in my application via COM.Interop there is no easy way to step into the code and see why its going wrong.

After a little testing and debugging I discovered that it works if the application is “Run As Administrator” it’ll work fine so it had to be a permission problem just wasn’t sure which permissions were wrong.

If only there was a way to see which files and registry entries the driver was trying to access and which failed because of a access denied error… Thats where this cool tool called Process Monitor comes in. Lauching the app it’ll show you everything going on in your system, a few quick filters so that it only shows my apps calls then tried to use the scanner, it gave the error again but this time I could track down the cause.

It turned out that it was trying to write to the C:\Program Files\DLSOPOS\ folder and was failing and was trying to access these 2 parts of the registry and getting access denied errors.

HKEY_LOCAL_MACHINE\SOFTWARE\OLEforRetail\ServiceOPOS\Scanner\USBScanner and HKEY_LOCAL_MACHINE\SOFTWARE\DATALOGIC\DL_OPOS_Service

Changing the permissions on those registry keys and the folder fixed the problem.

Debugging Crashes and Hangs using Visual Studio

Found this via the “Start Page” in Visual Studio 2008, its a rather interesting blog post by one of the Visual Studio IDE QA Guys.

It goes into a lot of detail on how to debug application crashes and the same process can be used for hanging applications. For me the most interesting part was the “Load from Microsoft Symbol Servers” option when loading symbols, I didn’t know it was possible to get the symbols for Microsoft applications like that.

I’m not sure how often I’m going to need to debug other people’s applications, but it may come in handy next time I get a weird application hang or crash.