Condividi tramite


Funzione WdfRegistryQueryMultiString (wdfregistry.h)

[Si applica a KMDF e UMDF]

Il metodo WdfRegistryQueryMultiString recupera le stringhe attualmente assegnate a un valore del Registro di sistema a più stringhe specificato, crea un oggetto stringa framework per ogni stringa e aggiunge ogni oggetto stringa a un insieme di oggetti specificato.

Sintassi

NTSTATUS WdfRegistryQueryMultiString(
  [in]           WDFKEY                 Key,
  [in]           PCUNICODE_STRING       ValueName,
  [in, optional] PWDF_OBJECT_ATTRIBUTES StringsAttributes,
  [in]           WDFCOLLECTION          Collection
);

Parametri

[in] Key

Handle di un oggetto chiave del Registro di sistema che rappresenta una chiave del Registro di sistema aperta.

[in] ValueName

Puntatore a una struttura UNICODE_STRING che contiene un nome di valore.

[in, optional] StringsAttributes

Puntatore a una struttura WDF_OBJECT_ATTRIBUTES che contiene gli attributi dell'oggetto per ogni nuovo oggetto stringa. Questo parametro è facoltativo e può essere WDF_NO_OBJECT_ATTRIBUTES.

[in] Collection

Handle per un oggetto raccolta framework fornito dal driver.

Valore restituito

WdfRegistryQueryMultiString restituisce STATUS_SUCCESS se l'operazione ha esito positivo. In caso contrario, il metodo potrebbe restituire uno dei valori seguenti:

Codice restituito Descrizione
STATUS_INVALID_DEVICE_REQUEST

WdfRegistryQueryMultiString non è stato chiamato in IRQL = PASSIVE_LEVEL.

STATUS_INVALID_PARAMETER
È stato specificato un parametro non valido.
STATUS_INSUFFICIENT_RESOURCES
Impossibile allocare un oggetto stringa.
STATUS_ACCESS_DENIED
Il driver non ha aperto la chiave del Registro di sistema con accesso KEY_QUERY_VALUE, KEY_READ o KEY_ALL_ACCESS.
STATUS_OBJECT_TYPE_MISMATCH
Tipo di dati del valore del Registro di sistema non REG_MULTI_SZ specificato dal parametro ValueName.
STATUS_OBJECT_NAME_NOT_FOUND
Il valore del Registro di sistema non era disponibile.
STATUS_RESOURCE_DATA_NOT_FOUND
Il valore del Registro di sistema è presente nella chiave specificata, ma è vuoto.
 

Per un elenco di altri valori restituiti che potrebbero essere restituiti dal metodo WdfRegistryQueryMultiString, vedere Framework Object Creation Errors.

Questo metodo potrebbe anche restituire altri valori NTSTATUS .

Se il driver fornisce un handle di oggetto non valido, si verifica un controllo di bug.

Osservazioni

Prima che il driver chiami WdfRegistryQueryMultiString, deve chiamare WdfCollectionCreate per creare un oggetto raccolta.

Se il chiamante non fornisce un parametro StringsAttributes parametro, tutti gli oggetti WDFSTRING creati dal framework sono padre per impostazione predefinita per WDFDRIVER.

Dopo aver restituito WdfRegistryQueryMultiString, il driver può chiamare WdfCollectionGetCount per ottenere il numero di stringhe recuperate e WdfCollectionGetItem per ottenere oggetti stringa dall'insieme.

Se l'insieme contiene oggetti prima che il driver chiami il metodo WdfRegistryQueryMultiString, il metodo non rimuove tali oggetti o modifica i relativi valori di indice. I nuovi oggetti vengono accodati alla fine dell'insieme.

Per ottenere una stringa da un oggetto stringa, il driver può chiamare WdfStringGetUnicodeString.

Per altre informazioni sugli oggetti chiave del Registro di sistema, vedere Using the Registry in Framework-Based Drivers.

Esempi

L'esempio di codice seguente crea un oggetto raccolta, inizializza una struttura WDF_OBJECT_ATTRIBUTES in modo che l'oggetto raccolta sia l'elemento padre di tutti gli oggetti stringa creati dal framework per l'insieme e recupera le stringhe da un valore del Registro di sistema a più stringhe. Infine, l'esempio ottiene il numero di oggetti stringa aggiunti dal framework alla raccolta.

WDF_OBJECT_ATTRIBUTES stringAttributes;
WDFCOLLECTION col;
NTSTATUS status;
ULONG count;
DECLARE_CONST_UNICODE_STRING(valueMultiSz, VALUE_MULTI_SZ);

status = WdfCollectionCreate(
                             NULL,
                             &col
                             );
ASSERT(NT_SUCCESS(status));

WDF_OBJECT_ATTRIBUTES_INIT(&stringAttributes);
stringAttributes.ParentObject = col;

status = WdfRegistryQueryMultiString(
                                     Key,
                                     &valueMultiSzEmpty,
                                     &stringAttributes,
                                     col
                                     );

count = WdfCollectionGetCount(col);

Fabbisogno

Requisito Valore
piattaforma di destinazione Universale
versione minima di KMDF 1.0
versione minima di UMDF 2.0
intestazione wdfregistry.h (include Wdf.h)
libreria Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL PASSIVE_LEVEL
regole di conformità DDI DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

Vedere anche

UNICODE_STRING

WDF_OBJECT_ATTRIBUTES

WdfCollectionCreare

WdfCollectionGetCount

WdfCollectionGetItem

WdfRegistryQueryMemory

WdfRegistryQueryString

WdfRegistryQueryULong

WdfRegistryQueryUnicodeString

WdfRegistryQueryValue

WdfStringGetUnicodeString