AcxObjectBagRetrieveUI2 函数 (acxmisc.h)

AcxObjectBagRetrieveUI2 函数从包含值的已初始化的现有 AcxObjectBag 中检索无符号的两字节 UI2 (USHORT) 。

语法

NTSTATUS AcxObjectBagRetrieveUI2(
  ACXOBJECTBAG     ObjectBag,
  PCUNICODE_STRING ValueName,
  USHORT           *Value
);

参数

ObjectBag

初始化的 ObjectBag ACX 对象。 有关详细信息,请参阅 ACX - ACX 对象的摘要

ValueName

将用于访问该值的值的名称。

Value

要从 ObjectBag 检索的值。

返回值

STATUS_SUCCESS如果调用成功,则返回 。 否则,它将返回相应的错误代码。 有关详细信息,请参阅 使用 NTSTATUS 值

备注

示例

此示例演示如何使用 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));

ACX 要求

最低 ACX 版本: 1.0

有关 ACX 版本的详细信息,请参阅 ACX 版本概述

要求

要求
Header acxmisc.h
IRQL PASSIVE_LEVEL

另请参阅