Condividi tramite


Funzione AcxObjectBagAddUI4 (acxmisc.h)

La funzione AcxObjectBagAddUI4 aggiunge un valore I4 (ULONG) senza segno a un valore AcxObjectBag inizializzato esistente.

Sintassi

NTSTATUS AcxObjectBagAddUI4(
  ACXOBJECTBAG     ObjectBag,
  PCUNICODE_STRING ValueName,
  ULONG            Value
);

Parametri

ObjectBag

Oggetto ACX ObjectBag inizializzato. Per altre informazioni, vedere ACX - Riepilogo degli oggetti ACX.

ValueName

Nome del valore che verrà utilizzato per accedere al valore.

Value

Valore da aggiungere a ObjectBag.

Valore restituito

Restituisce STATUS_SUCCESS se la chiamata ha avuto esito positivo. In caso contrario, restituisce un codice di errore appropriato. Per altre informazioni, vedere Uso di valori NTSTATUS.

Osservazioni

Esempio

Questo esempio mostra l'uso di AcxObjectBagAddUI4.

    ACXOBJECTBAG objBag     = NULL;
    ULONG        ui4Value   = 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, TestUI4);

    ui4Value = 1;
    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagAddUI4(objBag, &TestUI4, ui4Value));

    // Retrieve the value from the object bag
    ui4Value = 0;
    RETURN_NTSTATUS_IF_FAILED(AcxObjectBagRetrieveUI4(objBag, &TestUI4, &ui4Value));

Requisiti ACX

versione minima di ACX: 1.0

Per altre informazioni sulle versioni di ACX, vedere panoramica della versione ACX.

Fabbisogno

Requisito Valore
intestazione acxmisc.h
IRQL PASSIVE_LEVEL

Vedere anche