AcxObjectBagAddUI8 函数 (acxmisc.h)

AcxObjectBagAddUI8 函数将无符号的八字节 I8 (ULONG64) 值添加到已初始化的现有 AcxObjectBag。

语法

NTSTATUS AcxObjectBagAddUI8(
  ACXOBJECTBAG     ObjectBag,
  PCUNICODE_STRING ValueName,
  ULONG64          Value
);

参数

ObjectBag

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

ValueName

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

Value

要添加到 ObjectBag 的值。

返回值

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

备注

示例

此示例演示如何使用 AcxObjectBagAddUI8。

    ACXOBJECTBAG objBag     = NULL;
    ULONG64      ui8Value   = 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, TestUI8);

    ui8Value = 0x9876543210;
    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagAddUI8(objBag, &TestUI8, ui8Value));

    // Retrieve the value from the object bag
    ui8Value = 0;
    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagRetrieveUI8(objBag, &TestUI8, &ui8Value));

ACX 要求

最低 ACX 版本: 1.0

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

要求

要求
Header acxmisc.h
IRQL PASSIVE_LEVEL

另请参阅