IoWMIOpenBlock function

The IoWMIOpenBlock routine opens the WMI data block object for the specified WMI class.

Syntax

NTSTATUS IoWMIOpenBlock(
  LPCGUID Guid,
  ULONG   DesiredAccess,
  PVOID   *DataBlockObject
);

Parameters

Guid

DesiredAccess

Specifies the desired access rights to the data block object. The caller must have particular access rights to perform certain operations.

The following is a description of each access right bit and the operations it allows:

WMIGUID_EXECUTE

The data block object can be used to run WMI class methods. This flag must be set to use IoWMIExecuteMethod on the data block object.

WMIGUID_NOTIFICATION

The data block object can be used to register event notification callbacks. This flag must be set to use IoWMISetNotificationCallback, and can only be used for WMI event blocks. Callers that specify this flag must also specify the SYNCHRONIZE flag.

WMIGUID_QUERY

The data block object can be used to query WMI class properties. This flag must be set to use any of the IoWMIQueryXxx routines on the data block object.

WMIGUID_SET

The data block object can be used to set WMI class properties. This flag must be set to use any of the IoWMISetXxx routines on the data block object.

DataBlockObject

Pointer to a memory location where the routine returns a pointer to the data block object.

Return Value

Returns STATUS_SUCCESS on success, or the appropriate NTSTATUS error code on failure.

Remarks

The caller uses IoWMIOpenBlock to create a data block object for the specified WMI class GUID. Subsequently, the caller can use the data block object to read or write WMI class properties, run WMI class methods, and register callbacks for WMI events.

Use the IoWMIQueryXxx and IoWMISetXxx routines to read and write WMI class properties. Use IoWMIExecuteMethod to run WMI class methods, and use IoWMISetNotificationCallback to register a WMI event notification callback.

Use ObDereferenceObject to close the data block object once it is no longer needed.

Requirements

   
Minimum supported client Available in Windows XP and later versions of the Windows operating system.
Target Platform Universal
Header wdm.h (include Ntddk.h, Ntifs.h. The WMIGUID_XXX values are declared in Wmistr.h. To use them, include Wmistr.h.)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL "<= APC_LEVEL"

See Also

IoWMIExecuteMethod

IoWMIQueryAllData

IoWMIQueryAllDataMultiple

IoWMIQuerySingleInstance

IoWMIQuerySingleInstanceMultiple

IoWMISetNotificationCallback

IoWMISetSingleInstance

IoWMISetSingleItem

ZwClose