Funzione WdfRequestGetRequestorMode (wdfrequest.h)

[Si applica a KMDF e UMDF]

Il metodo WdfRequestGetRequestorMode restituisce la modalità di accesso al processore dell'origine di una richiesta di I/O specificata.

Sintassi

KPROCESSOR_MODE WdfRequestGetRequestorMode(
  [in] WDFREQUEST Request
);

Parametri

[in] Request

Handle per un oggetto richiesta framework.

Valore restituito

WdfRequestGetRequestorMode restituisce KernelMode se l'origine della richiesta di I/O viene eseguita in modalità kernel. In caso contrario, questo metodo restituisce UserMode. Le costanti KernelMode e UserMode sono definite in wdm.h.

Un controllo di bug si verifica se il driver fornisce un handle di oggetti non valido.

Commenti

Per altre informazioni su WdfRequestGetRequestorMode, vedere Recupero di informazioni su una richiesta di I/O.

Esempio

L'esempio di codice seguente è dal driver di esempio NDISProt . In questo esempio viene verificato un indirizzo MAC valido se la richiesta di I/O proviene da un'applicazione in modalità utente.

//
// To prevent applications from sending packets with spoofed MAC address,
// perform the following check to make sure the source address 
// in the packet is the same as the current MAC address of the NIC.
//
if ((WdfRequestGetRequestorMode(Request) == UserMode) && 
    !NPROT_MEM_CMP(pEthHeader->SrcAddr, pOpenContext->CurrentAddress, NPROT_MAC_ADDR_LEN))
{
    DEBUGP(DL_WARN, ("Write: Failing with invalid Source address"));
    NtStatus = STATUS_INVALID_PARAMETER;
    break;
}

Requisiti

Requisito Valore
Piattaforma di destinazione Universale
Versione KMDF minima 1.0
Versione UMDF minima 2,0
Intestazione wdfrequest.h (include Wdf.h)
Libreria Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <=DISPATCH_LEVEL
Regole di conformità DDI DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)