Condividi tramite


Funzione WdfRegistryAssignMultiString (wdfregistry.h)

[Si applica a KMDF e UMDF]

Il metodo WdfRegistryAssignMultiString assegna un set di stringhe a un nome di valore specificato nel Registro di sistema. Le stringhe sono contenute in una raccolta specificata di oggetti stringa del framework.

Sintassi

NTSTATUS WdfRegistryAssignMultiString(
  [in] WDFKEY           Key,
  [in] PCUNICODE_STRING ValueName,
  [in] WDFCOLLECTION    StringsCollection
);

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] StringsCollection

Handle per un oggetto insieme framework che rappresenta una raccolta di oggetti stringa del framework.

Valore restituito

WdfRegistryAssignMultiString 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

WdfRegistryAssignMultiString non è stato chiamato in IRQL = PASSIVE_LEVEL.

STATUS_INVALID_PARAMETER
È stato specificato un parametro non valido oppure l'insieme in cui il parametro stringsCollection specificato non conteneva oggetti stringa.
STATUS_ACCESS_DENIED
Il driver non ha aperto la chiave del Registro di sistema con accesso KEY_SET_VALUE.
 

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:

Se il nome del valore specificato dal parametro ValueName esiste già, WdfRegistryAssignMultiString aggiorna i dati del valore.

Il framework imposta il tipo di dati del valore su REG_MULTI_SZ.

L'insieme di oggetti che StringsCollection specifica deve contenere solo oggetti stringa framework.

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 e due oggetti stringa, aggiunge gli oggetti stringa all'insieme e quindi assegna le due stringhe a un valore del Registro di sistema.

WDF_OBJECT_ATTRIBUTES attributes;
WDFCOLLECTION col = NULL;
WDFSTRING string1 = NULL, string2 = NULL;
UNICODE_STRING ustring1, ustring2, valueName;
NTSTATUS status;

status = WdfCollectionCreate(
                             WDF_NO_OBJECT_ATTRIBUTES,
                             &col
                             );
if (!NT_SUCCESS(status) {
    return status;
}

RtlInitUnicodeString(
                     &ustring1,
                     L"String1"
                     );
RtlInitUnicodeString(
                     &ustring2,
                     L"String2"
                     );
RtlInitUnicodeString(
                     &valueName,
                     L"ValueName"
                     );

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

status = WdfStringCreate(
                         &ustring1,
                         &attributes,
                         &string1
                         );
if (!NT_SUCCESS(status)) {
    goto exit;
}
status = WdfStringCreate(
                         &ustring2,
                         &attributes,
                         &string2
                         );
if (!NT_SUCCESS(status)) {
    goto exit;
}
status = WdfCollectionAdd(
                          col,
                          string1
                          );
if (!NT_SUCCESS(status)) {
    goto exit;
}
string1 = NULL;

status = WdfCollectionAdd(
                          col,
                          string2
                          );
if (!NT_SUCCESS(status)) {
    goto exit;
}
string2 = NULL;

status = WdfRegistryAssignMultiString(
                                      Key,
                                      &valueName,
                                      col
                                      );
if (!NT_SUCCESS(status)) {
    goto exit;
...
exit:
if (col != NULL) {
    WdfObjectDelete(col);    // This will empty the collection
                             // because the string objects are
                             // child objects of the collection object.
}

Requisiti

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

Vedere anche

RtlInitUnicodeString

UNICODE_STRING

WdfCollectionAdd

WdfCollectionCreare

WdfObjectDelete

WdfRegistryAssignMemory

WdfRegistryAssignString

WdfRegistryAssignULong

WdfRegistryAssignUnicodeString

WdfRegistryAssignValue

WdfStringCreare