AcxObjectBagRetrieveString 函数 (acxmisc.h)

AcxObjectBagRetrieveString 函数从已初始化的现有 AcxObjectBag 检索 WDFSTRING 对象。

语法

NTSTATUS AcxObjectBagRetrieveString(
  ACXOBJECTBAG     ObjectBag,
  PCUNICODE_STRING ValueName,
  WDFSTRING        Value
);

参数

ObjectBag

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

ValueName

一个 ValueName,它将与添加的字符串相关联,并用于检索存储的字符串。

Value

要从 ObjectBag 检索的 WDFSTRING 对象值。

返回值

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

备注

示例

此示例演示如何使用 AcxObjectBagRetrieveString。

    status = RtlUnicodeStringInit(&usName, inParams->ValueName);
    if (!NT_SUCCESS(status))
    {
        DrvLogError(g_RecorderLog, FLAG_DDI, 
                    "WDFDEVICE %p, RtlUnicodeStringInit(%S) failed, %!STATUS!", 
                    m_Device, inParams->ValueName, status);
        goto exit;
    }

    //
    // Set the specified property.
    //
    switch(inParams->ValueType)
    {
    case REG_SZ:
        //
        // Create an empty WDF string to get the value.
        //
        status = WdfStringCreate(nullptr, nullptr, &wsValue);
        if (!NT_SUCCESS(status))
        {
            DrvLogError(g_RecorderLog, FLAG_DDI, 
                        "WDFDEVICE %p, WdfStringCreate failed, %!STATUS!", 
                        m_Device, status);
            goto exit;
        }

        //
        // Get the string value from bag.
        //
        status = AcxObjectBagRetrieveString(objBag, &usName, wsValue);

ACX 要求

最低 ACX 版本: 1.0

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

要求

要求
Header acxmisc.h
IRQL PASSIVE_LEVEL

另请参阅