CloseTrace function
The CloseTrace function closes a trace.
Syntax
ULONG CloseTrace( _In_ TRACEHANDLE TraceHandle );
Parameters
- TraceHandle [in]
-
Handle to the trace to close. The OpenTrace function returns this handle.
Return value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is one of the system error codes. The following table includes some common errors and their causes.
| Return code | Description |
|---|---|
|
One of the following is true:
|
|
Prior to Windows Vista, you cannot close the trace until the ProcessTrace function completes. |
|
The call was successful. The ProcessTrace function will stop after it has processed all real-time events in its buffers (it will not receive any new events). |
Remarks
Consumers call this function.
If you are processing events from a log file, you call this function only after the ProcessTrace function returns. However, if you are processing real-time events, you can call this function before ProcessTrace returns. If you call this function before ProcessTrace returns, the CloseTrace function returns ERROR_CTX_CLOSE_PENDING. The ERROR_CTX_CLOSE_PENDING code indicates that the CloseTrace function call was successful; the ProcessTrace function will stop processing events after it processes all events in its buffers (ProcessTrace will not receive any new events after you call the CloseTrace function). You can call the CloseTrace function from your BufferCallback, EventCallback, or EventClassCallback callback.
Prior to Windows Vista: You can call CloseTrace only after ProcessTrace returns.
Examples
For an example that uses CloseTrace, see Retrieving Event Data Using MOF.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps | Windows Store apps] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also