Expand Minimize

IoWMIQuerySingleInstance routine

The IoWMIQuerySingleInstance routine returns the specified instance of a WMI data block.


NTSTATUS IoWMIQuerySingleInstance(
  _In_       PVOID DataBlockObject,
  _In_       PUNICODE_STRING InstanceName,
  _Inout_    ULONG *InOutBufferSize,
  _Out_opt_  PVOID OutBuffer


DataBlockObject [in]

Pointer to a WMI data block object. The caller opens the data block object for the WMI class with the IoWMIOpenBlock routine. The object must be opened with the WMIGUID_QUERY access right.

InstanceName [in]

Specifies the name of the instance of the data block. This value corresponds to the value of the InstanceName property for the block.

InOutBufferSize [in, out]

Pointer to a memory location that specifies the size of the buffer passed in the OutBuffer parameter. If the routine succeeds, it updates the memory location to specify the number of bytes actually stored in OutBuffer. If the routine fails with status code of STATUS_BUFFER_TOO_SMALL, it returns the number of bytes required to return the data.

OutBuffer [out, optional]

Pointer to the buffer where the routine returns the WMI data. The routine returns a variable-sized WNODE_SINGLE_INSTANCE structure. OutBuffer must point to a buffer allocated from nonpaged pool.

Return value

The routine returns an NTSTATUS code. Possible return values include:

Return codeDescription

The operation succeeded. The routine returns the WMI data in the buffer pointed to by the OutBuffer parameter. The routine also returns the size, in bytes, of the returned data in the memory location pointed to by the InOutBufferSize parameter.


No drivers implement the specified WMI class.


No driver implements an instance of the WMI class with InstanceName property equal to the value specified in the InstanceName parameter.


The buffer passed by the caller in the OutBuffer parameter is too small. The routine returns the required buffer size in the memory location pointed to by the InOutBufferSize parameter.



IoWMIQuerySingleInstance determines which drivers might support the specified WMI class with the specified instance name, and issues an IRP_MN_QUERY_SINGLE_INSTANCE request to each such driver. The driver that exports the data block instance with matching InstanceName property returns the appropriate data.

To query for multiple WMI classes and instance names, use the IoWMIQuerySingleInstanceMultiple routine. Drivers can use the IoWMISetSingleInstance routine to update the class instance.



Available in Windows XP and later versions of the Windows operating system.


Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)





See also




Send comments about this topic to Microsoft

© 2014 Microsoft. All rights reserved.