Share via


Função AcxObjectBagRetrieveI4 (acxmisc.h)

A função AcxObjectBagRetrieveI4 recupera um valor int four byte I4 (LONG) de um AcxObjectBag inicializado existente que contém valores.

Sintaxe

NTSTATUS AcxObjectBagRetrieveI4(
  ACXOBJECTBAG     ObjectBag,
  PCUNICODE_STRING ValueName,
  LONG             *Value
);

Parâmetros

ObjectBag

Um objeto ACX ObjectBag inicializado. Para obter mais informações, consulte ACX – Resumo de objetos ACX.

ValueName

O nome do valor que será usado para acessar o valor.

Value

O Valor a ser recuperado do ObjectBag.

Retornar valor

Retorna STATUS_SUCCESS se a chamada foi bem-sucedida. Caso contrário, ele retornará um código de erro apropriado. Para obter mais informações, consulte Usando valores NTSTATUS.

Comentários

Exemplo

Este exemplo mostra o uso de AcxObjectBagRetrieveI4.

    ACXOBJECTBAG objBag     = NULL;
    LONG         i4Value    = 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, TestI4);

    i4Value = 1;
    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagAddI4(objBag, &TestI4, i4Value));

    // Retrieve the value from the object bag
    i4Value = 0;
    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagRetrieveI4(objBag, &TestI4, &i4Value));

Requisitos do ACX

Versão mínima do ACX: 1.0

Para obter mais informações sobre as versões do ACX, consulte Visão geral da versão do ACX.

Requisitos

Requisito Valor
Cabeçalho acxmisc.h
IRQL PASSIVE_LEVEL

Confira também