ControlCallback callback function
Providers implement this function to receive enable or disable notification requests from controllers.
The WMIDPREQUEST type defines a pointer to this callback function. ControlCallback is a placeholder for the application-defined function name.
Syntax
ULONG WINAPI ControlCallback( _In_ WMIDPREQUESTCODE RequestCode, _In_ PVOID Context, _In_ ULONG *Reserved, _In_ PVOID Buffer );
Parameters
- RequestCode [in]
-
Request code. Specify one of the following values.
Value Meaning - WMI_ENABLE_EVENTS
Enables the provider.
- WMI_DISABLE_EVENTS
Disables the provider.
- Context [in]
-
Provider-defined context. The provider uses the RequestContext parameter of RegisterTraceGuids to specify the context.
- Reserved [in]
-
Reserved for internal use.
- Buffer [in]
-
Pointer to a WNODE_HEADER structure that contains information about the event tracing session for which the provider is being enabled or disabled.
Return value
You should return ERROR_SUCCESS if the callback succeeds. Note that ETW ignores the return value for this function except when a controller calls EnableTrace to enable a provider and the provider has not yet called RegisterTraceGuids. When this occurs, RegisterTraceGuids will return the return value of this callback if the registration was successful.
Remarks
This function is specified using the RegisterTraceGuids function. When the controller calls the EnableTrace function to enable, disable, or change the enable flags or level, ETW calls this callback. The provider enables or disables itself based the RequestCode value. Typically, the provider uses this value to set a global flag to indicate its enabled state.
The provider defines its interpretation of being enabled or disabled. Generally, if a provider is enabled, it generates events, but while it is disabled, it does not.
ETW does not pass the enable flags and enable level that the controller passes to the EnableTrace function to this callback. To retrieve this information, call the GetTraceEnableFlags and GetTraceEnableLevel functions, respectively.
You also need to retrieve the session handle in this callback for future calls. To retrieve the session handle, call the GetTraceLoggerHandle function.
Your callback function must not call anything that may incur LoadLibrary (more specifically, anything that requires a loader lock).
Examples
For an example implementation of a ControlCallback function, see Writing Classic Events.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps | Windows Store apps] |
|
Header |
|
See also
- EnableTrace
- GetTraceEnableFlags
- GetTraceEnableLevel
- GetTraceLoggerHandle
- RegisterTraceGuids
- WNODE_HEADER