DLL Tool

How to use sxstrace.exe

May 11, 2014

DLL ToolDLL Tool works as sxstrace.exe tool to fix sxstrace.exe problems for computers installed with Microsoft Windows 8.1/8/7/XP/Vista operating systems, both 32 and 64 bits.

Basics of sxstrace.exe

As for the sxstrace.exe utility, it is used to trace the VC++ application's dependency component/libraries binding, just like the .net framework's fusion logviewer that can check how the application load and search the required dependency assemblies. It is also used to launch startup components for system and programs. One case it mentioned is about the VC8 redist package, when application deploy to target machine hasn't correctly VC8 redist package installed, and report error, it can be checked through this tool.

By default, the SXSTRACE.EXE is located in directory of C:\Progam Files\Common Files. The most common size of the SXSTRACE.EXE on Windows system is 108,648 bytes. It is associated with slue.exe, ntkrnlpa.exe, pcalua.exe, dxgkrnl.sys and msvcr90.dll.

This tool helps us for detailed diagnosis such as assembly probing steps. It also help us to identify what all are the previous versions available and loaded by the application and which folder it is currently searching for.

For running sxstrace.exe, go to Visual Studio command prompt and type sxstrace.exe. Usage is as follows:

Before running your application, run sxstrace in trace mode sxstrace.exe Trace -logfile:C:\tmp\MySxSTrace.log

Reproduce the error by starting your application

Now stop the trace by using the below command sxstrace.exe Parse -logfile:C:\tmp\MySxSTrace.log -outfile:C:\tmp\MySxSTrace.txt

Open output file from C:\tmp\MySxSTrace.txt

What are the sxstrace.exe errors?

SXSTRACE.EXE is also known to create the following error messages when the system is shutting down.

Analysis and Solutions

To diagnose an issue you need to use sxstrace, the error you are getting is

Activation context generation failed for C:\jobs\Powershell\xxxxxxx\libssh2.dll. Dependent Assembly Microsoft.VC90.CRT, processorArchitecture=x86, publicKeyToken=1fc8b3b9a1e18e3b, type=win32, version=9.0.21022.8 could not be found. Please use sxstrace.exe for detailed diagnosis.

You will find the tool in C:\Windows\System32, to use it do the following

1. Open up a command prompt (as administrator) and run the following command
c:\windows\system32\sxstrace Trace -logfile: sxstrace.log
2. Open up a new command window and run your command, in this case it is simply curl.exe.
3. Once the error has been thrown, go back to first command prompt and press any key to stop the tracing.
4. Now issue the following command
c:\windows\system32\sxstrace Parse -logfile: sxstrace.log -outfile: sxstraceInfo.txt

The results of the trace will be in readable format within the generated text file.

When you build an .exe file in VS (Visual Studio 2005), go to projects->settings->C/C++->Code Generation and choose Runtime Lib options to be /MTd instead of /MDd.

Microsoft says: /MT causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.

MD causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file. Applications compiled with this option are statically linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR100.DLL, which must be available at run time to applications linked with MSVCRT.lib.

If you have any problem of using sxstrace.exe, please give a shot to DLL TOOL and it will help out in several mouse clicks.