Enabling Gflags or AppVerifier options for a particular service or COM+ package.

I saw the following tip go around on email. Certain debugging options such as PageHeap and AppVerifier setting are set per process name (because they use the ImageFileExecutionOptions key in the registry). That can make it tricky setting them for processes that host other things such as dllhost.exe, svchost.exe and w3wp.exe.

For services hosted in svchost.exe you can try the following:

1) Make a copy of svchost.exe in the System32 directory and call the copy “Mysvchost.exe”.
2) Using regedit, open HKLMSystemCurrentControlSetServicesMyService.
3) Edit the value “ImagePath”, which will be something like “%SystemRoot%system32svchost.exe -k myservice” and change svchost.exe to “Mysvchost.exe”.
4) Add “Mysvchost.exe” to the AppVerifier list and set the settings you wish to set or use gflags to set the options you wish for mysvchost.exe
5) Reboot (if troubleshooting something that goes wrong at startup

 

For things hosted in dllhost.exe (COM+ applications) there is a trick you can use. On the advanced tab of the COM+ package properties page there is a setting called “Enable 3Gb support”:

image

When you set this (which is no often set) your components will get loaded in a process called dllhst3g.exe. You can then set your gflags or AppVerifier settings for that.

I don’t know a way to do it for one particular w3wp.exe. The best I can think of is to set the required ImageFileExecutionOption setting, recycle the application pool, ensure the new w3wp.exe for the application pool has come back up and then revert the ImageFileExecutionOption setting immediately (these settings are read at startup).

HTH

Doug