WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER function

[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

Config [out]

A pointer to a WDF_WMI_INSTANCE_CONFIG structure.

Provider [in]

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

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

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft