AcxObjectBagRetrieveString function (acxmisc.h)

The AcxObjectBagRetrieveString function retrieves a WDFSTRING object from an existing, initialized AcxObjectBag.

Syntax

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

Parameters

ObjectBag

An initialized ObjectBag ACX object. For more information, see ACX - Summary of ACX Objects.

ValueName

A ValueName that will be associated with the added string and will be used to retrieve the stored string.

Value

The WDFSTRING object value to be retrieved from the ObjectBag.

Return value

Returns STATUS_SUCCESS if the call was successful. Otherwise, it returns an appropriate error code. For more information, see Using NTSTATUS Values.

Remarks

Example

This example shows the use of 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 requirements

Minimum ACX version: 1.0

For more information about ACX versions, see ACX version overview.

Requirements

Requirement Value
Header acxmisc.h
IRQL PASSIVE_LEVEL

See also