Skip to content

Latest commit

 

History

History
135 lines (88 loc) · 5.35 KB

nc-wmilib-wmi_set_datablock_callback.md

File metadata and controls

135 lines (88 loc) · 5.35 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NC:wmilib.WMI_SET_DATABLOCK_CALLBACK
WMI_SET_DATABLOCK_CALLBACK (wmilib.h)
The DpWmiSetDataBlock routine changes all data items in a single instance of a data block. This routine is optional.
kernel\dpwmisetdatablock.htm
kernel
04/30/2018
WMI_SET_DATABLOCK_CALLBACK callback function
DpWmiSetDataBlock, DpWmiSetDataBlock callback function [Kernel-Mode Driver Architecture], WMI_SET_DATABLOCK_CALLBACK, WMI_SET_DATABLOCK_CALLBACK callback, k903_bb4a483a-1ffc-4664-930b-13cc3579086e.xml, kernel.dpwmisetdatablock, wmilib/DpWmiSetDataBlock
wmilib.h
Wmilib.h
Desktop
Called at PASSIVE_LEVEL.
Windows
WMI_SET_DATABLOCK_CALLBACK
wmilib/WMI_SET_DATABLOCK_CALLBACK
APIRef
kbSyntax
UserDefined
Wmilib.h
WMI_SET_DATABLOCK_CALLBACK

WMI_SET_DATABLOCK_CALLBACK callback function

-description

The DpWmiSetDataBlock routine changes all data items in a single instance of a data block. This routine is optional.

-parameters

-param DeviceObject [in]

Pointer to the driver's WDM DEVICE_OBJECT structure.

-param Irp [in]

Pointer to the IRP.

-param GuidIndex [in]

Specifies the data block by its zero-based index into the list of GUIDs provided by the driver in the WMILIB_CONTEXT structure it passed to WmiSystemControl.

-param InstanceIndex [in]

If the block specified by GuidIndex has multiple instances, InstanceIndex specifies the instance.

-param BufferSize [in]

Specifies the size in bytes of the buffer at Buffer.

-param Buffer [in]

Pointer to a buffer that contains new values for the instance.

-returns

DpWmiSetDataBlock returns STATUS_SUCCESS or an appropriate error status such as the following:

If the driver cannot complete the request immediately, it can return STATUS_PENDING.

-remarks

WMI calls a driver's DpWmiSetDataBlock routine after the driver calls WmiSystemControl in response to an IRP_MN_CHANGE_SINGLE_INSTANCE request.

The driver is responsible for validating all input arguments. Specifically, the driver must do the following:

  • Verify that the GuidIndex value is between zero and GuidCount-1, based on the GuidCount member of the WMILIB_CONTEXT structure.
  • Verify that the driver has not flagged the specified data block for removal. If the driver recently specified the WMIREG_FLAG_REMOVE_GUID flag in a WMIGUIDREGINFO structure that is contained in a WMILIB_CONTEXT structure, it is possible for a set request to arrive before the removal occurs.
  • Verify that the InstanceIndex value is within the range of instance indexes that are supported by the driver for the data block.
  • Verify that Buffer and BufferSize describe a valid-sized data block, including any padding that exists between data items, and that the contents of the buffer are valid for the data block.
  • Verify that the specified data block is one for which the driver allows caller-initiated modifications. In other words, the driver should not allow modifications to data blocks that you intended to be read-only.
Do not assume the thread context is that of the initiating user-mode application—a higher-level driver might have changed it.

If a driver implements a DpWmiSetDataBlock routine, the driver must place the routine's address in the SetWmiDataBlock member of the WMILIB_CONTEXT structure that it passes to WmiSystemControl. If a driver does not implement a DpWmiSetDataBlock routine, it must set SetWmiDataBlock to NULL. In the latter case, WMI returns STATUS_READ_ONLY to the caller.

This routine can be pageable.

For more information about implementing this routine, see Calling WmiSystemControl to Handle WMI IRPs.

-see-also

IRP_MN_CHANGE_SINGLE_INSTANCE

WMILIB_CONTEXT

WmiSystemControl