Unable to load Microsoft characters when running cdb in windows service

I have a .NET Windows service that calls cdb.exe to analyze crash dumps. I want to download characters from http://msdl.microsoft.com automatically when necessary, using the argument:

-y srv*c:\symbols*http://msdl.microsoft.com/download/symbols 

If I run the application as a console application, it works as expected, and it loads the necessary characters for each dump.

The problem is that I run the application as a Windows service, the characters do not load and, if I turn on symnoisy on, in the cdb output log, I have an entry for each character saying that the character was not found in http: // msdl .microsoft.com

So, I checked it with a sniffer, and the funny thing is that the Microsoft Character Server does not receive a request when starting as a service.

Googling a little, I found that I am not the only one with this problem, and it seems that the problem is that when the application starts as a Windows service, it uses the winHTTP library for http requests instead of wininet, which I think is the root problems : http://support.microsoft.com/kb/238425

So, I don’t know why, cdb cannot connect to ms symbol server using winHTTP library, and I need a way to force default wind wininet.

Anyone have an idea of ​​a workaround to this problem?

+4
source share
2 answers

Full answer here: http://infopurge.tumblr.com/post/10438913681/how-does-cdb-access-the-microsoft-symbol-server

When launched from the command line, cdb uses WinINet to access Internet resources. When launched from a Windows service, cdb uses WinHTTP to access Internet resources.

For WinHTTP, you need to set some registry settings to stop trying to use a proxy (bogusproxy) to access the character server.

You can force cdb to use WinHttp from the command line and thus emulate what happens in the service for testing purposes by entering the following command before loading cdb.

 SET DBGHELP_WINHTTP=AnythingOtherThanEmpty 

To disable WinHTTP proxy for cdb and symsrv, you need to install one of the following keys in the registry.

For the x32 version of cdb running on an x32-bit machine from the Windows Service environment. HKLM \ Software \ Microsoft \ Symbol Server \ NoInternetProxy DWORD 1.

For the x32 version of cdb running on the x32-bit machine from the command line. HKEY_CURRENT_USER \ Software \ Microsoft \ Server Symbol \ NoInternetProxy DWORD 1.

For the x32 version of cdb running on a 64-bit machine from a Windows environment. HKLM \ Software \ Wow6432Node \ Microsoft \ Symbol Server \ NoInternetProxy DWORD 1.

For the x32 version of cdb running on a 64-bit machine from the command line. HKEY_CURRENT_USER \ Software \ Wow6432Node \ Microsoft \ Symbol Server \ NoInternetProxy DWORD 1.

For x64 version of cdb running on a 64-bit machine from a Windows environment. HKLM \ Software \ Microsoft \ Symbol Server \ NoInternetProxy DWORD 1.

For x64 version of cdb running on a 64-bit machine from the command line. HKEY_CURRENT_USER \ Software \ Microsoft \ Server Symbol \ NoInternetProxy DWORD 1.

+5
source

You can also do the opposite - force dbghelp.dll to use WinInet instead of WinHTTP by adding

 DBGHELP_WININET=1 

for the system environment. It will fix the problem in cdb.exe and other tools that use dbghelp.dll, for example symchk.exe.

0
source

Source: https://habr.com/ru/post/1341019/


All Articles