A question came up today:

Are any event logs produced when you run an application with applied shims? I've tried different variations of shims trying to get the desired results with no luck. It's probably UE, but I can't tell if the shims are erroring out because the syntex is incorrect, the file location is wrong, or if the database is even being read. Can you help?

Yes, there are diagnostics built in to the Windows Shim Infrastructure - but you do have to turn them on.

First, you can enable debug output, which will spit things out if things go wrong. You to this by setting:

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags]
"ShowDebugInfo"=dword:00000009

Now, you can view debug output either in a debugger, or by using DebugView. This is helpful for diagnosing problems with shims.

If you want still more information, you can enable additional log file output via environment variables. You can set them using:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v SHIM_DEBUG_LEVEL /t REG_SZ /d 9 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v SHIM_FILE_LOG /t REG_SZ /d logfile.txt /f

Now, you'll have output showing up in %appdata%\logfile.txt.

This can be helpful in debugging what the problems are.

I will be digging deep into the Windows Shim Infrastructure during my session CLI458: Mitigating Application Issues Using Shims - Part 2 at TechEd 2008.

And remember:

READY, SET, GO! I’m in the running to be a part of a Windows Vista Bloggers’ Panel hosted by Mark Russinovich at TechEd IT Pro week. This is a great opportunity to get answers to all of your Windows Vista deployment questions and find out what your fellow IT pros are encountering in their deployments. If you haven’t registered for TechEd yet, there’s still time. Just visit http://www.microsoft.com/events/teched2008/itpro/registration/regprocess.mspx