acxObjectBagAddGuid 函式 (acxmisc.h)

AcxObjectBagAddGuid 函式會將 Guid 數據新增至現有的初始化 AcxObjectBag。

語法

NTSTATUS AcxObjectBagAddGuid(
  ACXOBJECTBAG     ObjectBag,
  PCUNICODE_STRING ValueName,
  GUID             Value
);

參數

ObjectBag

初始化的 ObjectBag ACX 物件。 如需詳細資訊,請參閱 ACX - ACX 物件的摘要

ValueName

將用來存取值的值名稱。

Value

要加入至 ObjectBag 的值。

傳回值

如果呼叫成功,則傳 STATUS_SUCCESS 回 。 否則,它會傳回適當的錯誤碼。 如需詳細資訊,請參閱 使用NTSTATUS值

備註

範例

下列程式代碼顯示 AcxObjectBagAddGuid 的使用。

    // Object bag
    //
    // This obj-bag config setting is shared by all composite/circuit templates.
    ACX_OBJECTBAG_CONFIG objBagCfg;
    ACX_OBJECTBAG_CONFIG_INIT(&objBagCfg);

    WDF_OBJECT_ATTRIBUTES attributes;
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.ParentObject = AcxGetManager(NULL);

    ACXOBJECTBAG objBag = NULL;
    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);
        }
    });

    //
    // Add a test unsigned int 4 bytes to the object bag
    //
    RETURN_NTSTATUS_IF_FAILED(ObjBagAddTestUI4(objBag, 0));

    //
    // Add unique circuit ID to the object bag
    // This unique Id will be picked up by DSP circuit
    //
    DECLARE_CONST_ACXOBJECTBAG_SYSTEM_PROPERTY_NAME(UniqueID);
    GUID uniqueID = { 0 };
    RETURN_NTSTATUS_IF_FAILED(RtlGUIDFromString(&circuit_IDs[compositeType], &uniqueID));

    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagAddGuid(objBag, &UniqueID, uniqueID));

ACX 需求

最低 ACX 版本: 1.0

如需 ACX 版本的詳細資訊,請參閱 ACX 版本概觀

規格需求

需求
標頭 acxmisc.h
IRQL PASSIVE_LEVEL

另請參閱