This function merges multiple trace files into a single output file.

__in LPCWSTR wszMergedFileName,
__in LPCWSTR wszTraceFileNames[],
__in ULONG cTraceFileNames,
__in DWORD dwExtendedDataFlags


  • wszMergedFileName [in]
    Specifies the name of the output trace file.
  • wszTraceFileNames [in]
    Pointer to an array of trace files to be merged.
  • cTraceFileNames [in]
    Count of the elements in the wszTraceFileNames array.
  • dwExtendedDataFlags [in]
    These flags specify the system information to be injected into the merged trace file. For more information about valid flags, see Custom Injection of System Information.

Return Value

ERROR_SUCCESS indicates success.

Possible error values are described in the following table.

Error Value Description


Possibly indicates that the merged trace does not contain a complete set of events from each file.


Possibly indicates that the trace files being merged contain events with different versions that could not be merged.

If neither of these error values is returned, a system error code is returned.


You can merge two or more trace files from simultaneous sessions that were captured on the same computer into a single trace file. You can also merge trace files from other tracing sessions if those files have the same boot times. Optionally, the merge operation adds metadata concerning the traces.

This function can inject extended data into a single trace file. In this case the wszMergedFileName array contains only a single element, which is the name of the trace file.


An unmerged kernel trace cannot decode symbols correctly.

The API is implemented in Unicode only.


  • Versions: Available beginning in Windows Vista┬«. This structure is distributed with Windows Performance Analyzer.

  • Headers: Declared in KernelTraceControl.h. Include KernelTraceControl.h.

  • Library: Contained in KernelTraceControl.dll.

See Also


Custom Injection of System Information

Other Resources