WdfRequestWdmFormatUsingStackLocation-Funktion (wdfrequest.h)
[Gilt nur für KMDF]
Die WdfRequestWdmFormatUsingStackLocation--Methode formatiert eine E/A-Anforderung, indem der Inhalt eines angegebenen WDM-E/A-Stapelspeicherorts Struktur in die nächste Stapelposition in der Anforderung kopiert wird.
Syntax
void WdfRequestWdmFormatUsingStackLocation(
[in] WDFREQUEST Request,
[in] PIO_STACK_LOCATION Stack
);
Parameter
[in] Request
Ein Handle zu einem Framework-Anforderungsobjekt.
[in] Stack
Ein Zeiger auf eine IO_STACK_LOCATION Struktur, die vom Treiber bereitgestellte Informationen enthält.
Rückgabewert
Nichts
Bemerkungen
Wenn der Treiber ein ungültiges Objekthandle bereitstellt, tritt eine Fehlerüberprüfung auf.
Die WdfRequestWdmFormatUsingStackLocation--Methode kopiert die Informationen, die vom Stack-Parameter an die nächste IRP-Stapelposition in der Anforderung bereitgestellt werden.
WdfRequestWdmFormatUsingStackLocation formatiert die Anforderung unabhängig davon, ob das E/A-Zielobjekt der Anforderung lokal oder remote ist.
Wenn Sie eine Abschlussroutine für die Anforderung festlegen möchten, muss ihr Treiber WdfRequestSetCompletionRoutine aufrufen, nachdem WdfRequestWdmFormatUsingStackLocationaufgerufen wurde.
Weitere Informationen zu WdfRequestWdmFormatUsingStackLocationfinden Sie unter Forwarding I/O Requests.
Beispiele
Das folgende Codebeispiel stellt eine IO_STACK_LOCATION Struktur für eine E/A-Anforderung bereit, legt eine CompletionRoutine Rückruffunktion fest und sendet dann die Anforderung an ein E/A-Ziel.
IO_STACK_LOCATION ioStackLocation;
BOOLEAN sendStatus;
...
//
// Initialize the IO_STACK_LOCATION structure here.
//
...
//
// Assign the IO_STACK_LOCATION structure to the request.
//
WdfRequestWdmFormatUsingStackLocation(
request,
&ioStackLocation
);
//
// Assign a CompletionRoutine callback function.
//
WdfRequestSetCompletionRoutine(
Request,
RequestTimeoutComplete,
NULL
);
//
// Send the request.
//
sendStatus = WdfRequestSend(
Request,
target,
NULL
);
Im folgenden Codebeispiel wird veranschaulicht, wie ein PnP-IRP_MN_QUERY_CAPABILITIES IRP an ein E/A-Ziel gesendet wird.
target = WdfDeviceGetIoTarget(Device);
status = WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES,
target,
&request);
if (!NT_SUCCESS(status)) {
// Log failure and leave
}
//
// PnP IRPs must be initialized with STATUS_NOT_SUPPORTED
//
WDF_REQUEST_REUSE_PARAMS_INIT(&reuse,
WDF_REQUEST_REUSE_NO_FLAGS,
STATUS_NOT_SUPPORTED);
WdfRequestReuse(request, &reuse);
//
// Initialize device capabilities
//
RtlZeroMemory(Capabilities, sizeof(DEVICE_CAPABILITIES));
Capabilities->Size = sizeof(DEVICE_CAPABILITIES);
Capabilities->Version = 1;
Capabilities->Address = (ULONG) -1;
Capabilities->UINumber = (ULONG) -1;
RtlZeroMemory(&stack, sizeof(stack));
stack.MajorFunction = IRP_MJ_PNP;
stack.MinorFunction = IRP_MN_QUERY_CAPABILITIES;
stack.Parameters.DeviceCapabilities.Capabilities = Capabilities;
WdfRequestWdmFormatUsingStackLocation(request, &stack);
WDF_REQUEST_SEND_OPTIONS_INIT(&options,
WDF_REQUEST_SEND_OPTION_SYNCHRONOUS);
if (WdfRequestSend(request, target, &options) == FALSE) {
// Log failure
}
status = WdfRequestGetStatus(request);
if (!NT_SUCCESS(status)) {
// Log failure
}
// Remember to delete the WDFREQUEST after creating it
if (request != NULL) {
WdfObjectDelete(request);
}
Anforderungen
Anforderung | Wert |
---|---|
Zielplattform- | Universal |
Minimale KMDF-Version | 1.0 |
Header- | wdfrequest.h (include Wdf.h) |
Library | Wdf01000.sys (siehe Framework-Bibliotheksversionsverwaltung.) |
IRQL- | <=DISPATCH_LEVEL |
DDI-Complianceregeln | DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIr, KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), RequestFormattedValid(kmdf) |