WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER function (wdfwmi.h)

[Applies to KMDF only]

The WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER function initializes a WDF_WMI_INSTANCE_CONFIG structure and stores a specified handle to a WMI provider object.

Syntax

void WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER(
  [out] PWDF_WMI_INSTANCE_CONFIG Config,
  [in]  WDFWMIPROVIDER           Provider
);

Parameters

[out] Config

A pointer to a WDF_WMI_INSTANCE_CONFIG structure.

[in] Provider

A handle to a WMI provider object that the driver obtained by a previous call to WdfWmiProviderCreate.

Return value

None

Remarks

The WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER function zeros the WDF_WMI_INSTANCE_CONFIG structure that the Config parameter specifies and sets its Size member. This function also sets the structure's Provider member to the handle that the Provider parameter specifies.

Your driver should call WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER to initialize a WDF_WMI_INSTANCE_CONFIG structure if it calls WdfWmiProviderCreate before calling WdfWmiInstanceCreate.

Examples

The following code example initializes a WDF_WMI_PROVIDER_CONFIG structure and calls WdfWmiProviderCreate. Then, the example initializes a WDF_WMI_INSTANCE_CONFIG structure and calls WdfWmiInstanceCreate.

WDF_WMI_PROVIDER_CONFIG  providerConfig;
WDFWMIPROVIDER  provider;
GUID  providerGuid = MY_WMI_DATA_BLOCK_GUID;
WDF_WMI_INSTANCE_CONFIG  instanceConfig;
WDFWMIINSTANCE  instanceHandle;
NTSTATUS  status;

WDF_WMI_PROVIDER_CONFIG_INIT(
                             &providerConfig,
                             providerGuid
                             );
providerConfig.Flags = WdfWmiProviderTracing;
providerConfig.EvtWmiProviderFunctionControl = MyProviderFunctionControl;

status = WdfWmiProviderCreate(
                              Device,
                              &providerConfig,
                              WDF_NO_OBJECT_ATTRIBUTES,
                              &provider
                              );

if (!NT_SUCCESS(status)) {
    return status;
}
WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER(
                                      &instanceConfig,
                                      provider
                                      );
status = WdfWmiInstanceCreate(
                              Device,
                              &instanceConfig,
                              WDF_NO_OBJECT_ATTRIBUTES,
                              &instanceHandle
                              );
if (!NT_SUCCESS(status)) {
    return status;
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfwmi.h (include Wdf.h)

See also

WDF_WMI_INSTANCE_CONFIG

WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER_CONFIG

WDF_WMI_PROVIDER_CONFIG

WDF_WMI_PROVIDER_CONFIG_INIT

WdfWmiInstanceCreate

WdfWmiProviderCreate