// acxmisc.h
NTSTATUS AcxObjectBagRetrieveUI2(
ACXOBJECTBAG ObjectBag,
PCUNICODE_STRING ValueName,
USHORT *Value
);
View the official Windows Driver Kit DDI referenceNo description available.
The AcxObjectBagRetrieveUI2 function retrieves an unsigned int two byte UI2 (USHORT) from an existing, initialized AcxObjectBag that contains values.
ObjectBagAn initialized ObjectBag ACX object. For more information, see ACX - Summary of ACX Objects.
ValueNameThe name of the value that will be used to access the value.
ValueThe Value to be retrieved from the ObjectBag.
Returns STATUS_SUCCESS if the call was successful. Otherwise, it returns an appropriate error code. For more information, see Using NTSTATUS Values.
This example shows the use of AcxObjectBagRetrieveUI2.
ACXOBJECTBAG objBag = NULL;
USHORT ui2Value = 0;
//Initialize an object bag configuration
ACX_OBJECTBAG_CONFIG objBagCfg;
ACX_OBJECTBAG_CONFIG_INIT(&objBagCfg);
// Set the WDF attributes, and create an object bag
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.ParentObject = Circuit;
RETURN_NTSTATUS_IF_FAILED(AcxObjectBagCreate(&attributes, &objBagCfg, &objBag));
// Enable deletion of the object bag when the function completes and goes out of scope
auto objBag_scope = scope_exit([&objBag]() {
if (objBag != NULL)
{
WdfObjectDelete(objBag);
}
});
//Create Properties and add them to an object bag
DECLARE_CONST_ACXOBJECTBAG_DRIVER_PROPERTY_NAME(VendorX, TestUI2);
ui2Value = 0x55;
RETURN_NTSTATUS_IF_FAILED(AcxObjectBagAddUI2(objBag, &TestUI2, ui2Value));
// Retrieve the value from the object bag
ui2Value = 0;
RETURN_NTSTATUS_IF_FAILED(AcxObjectBagRetrieveUI2(objBag, &TestUI2, &ui2Value));
Minimum ACX version: 1.0
For more information about ACX versions, see ACX version overview.