Funzione WdfRegistryQueryUnicodeString (wdfregistry.h)
[Si applica a KMDF e UMDF]
Il metodo WdfRegistryQueryUnicodeString recupera i dati stringa attualmente assegnati a un valore stringa del Registro di sistema specificato e copia la stringa in una struttura UNICODE_STRING specificata.
Sintassi
NTSTATUS WdfRegistryQueryUnicodeString(
[in] WDFKEY Key,
[in] PCUNICODE_STRING ValueName,
[out, optional] PUSHORT ValueByteLength,
[in, out] PUNICODE_STRING Value
);
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 per il valore del Registro di sistema.
[out, optional] ValueByteLength
Puntatore a una posizione che riceve il numero di byte contenuti nella stringa Unicode a cui Valore punta, inclusa la terminazione NULL byte. Questo puntatore è facoltativo e può essere null
[in, out] Value
Puntatore a una struttura UNICODE_STRING che riceve la stringa di dati per la chiave specificata Key. Se questo parametro è NULL e ValueByteLength non èNULL, WdfRegistryQueryUnicodeString restituisce solo le dimensioni della stringa.
Valore restituito
WdfRegistryQueryUnicodeString restituisce STATUS_SUCCESS se l'operazione ha esito positivo. In caso contrario, il metodo potrebbe restituire uno dei valori seguenti:
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
Per altre informazioni sugli oggetti chiave del Registro di sistema, vedere Using the Registry in Framework-Based Drivers.
Esempi
Nell'esempio di codice seguente, tratto dal driver di esempio seriale, viene recuperata la stringa Unicode che rappresenta i dati stringa assegnati al valore PortName sotto la chiave hardware di un dispositivo.
NTSTATUS
SerialReadSymName(
IN WDFDEVICE Device,
__out PWCHAR RegName,
IN OUT PUSHORT LengthOfRegName // In characters
)
{
NTSTATUS status;
WDFKEY hKey;
UNICODE_STRING value;
UNICODE_STRING valueName;
USHORT requiredLength;
value.Buffer = RegName;
value.MaximumLength = *LengthOfRegName;
value.Length = 0;
status = WdfDeviceOpenRegistryKey(
Device,
PLUGPLAY_REGKEY_DEVICE,
STANDARD_RIGHTS_ALL,
WDF_NO_OBJECT_ATTRIBUTES,
&hKey
);
if (NT_SUCCESS (status)) {
RtlInitUnicodeString(
&valueName,
L"PortName"
);
status = WdfRegistryQueryUnicodeString (
hKey,
&valueName,
&requiredLength,
&value
);
WdfRegistryClose(hKey);
}
return status;
}
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) |