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 版本概觀

規格需求

需求
標頭 acxmisc.h
IRQL PASSIVE_LEVEL

另請參閱