Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
[Hanya berlaku untuk KMDF]
Metode WdfRequestWdmFormatUsingStackLocation memformat permintaan I/O dengan menyalin konten lokasi tumpukan I/O WDM tertentu struktur ke lokasi tumpukan berikutnya dalam permintaan.
Sintaksis
VOID WdfRequestWdmFormatUsingStackLocation(
[in] WDFREQUEST Request,
[in] PIO_STACK_LOCATION Stack
);
Parameter
[in] Request
Handel ke objek permintaan kerangka kerja.
[in] Stack
Penunjuk ke struktur IO_STACK_LOCATION yang berisi informasi yang disediakan driver.
Mengembalikan nilai
Tidak
Komentar
Pemeriksaan bug terjadi jika driver menyediakan handel objek yang tidak valid.
Metode WdfRequestWdmFormatUsingStackLocation menyalin informasi yang disediakan oleh parameter Stack ke lokasi tumpukan IRP berikutnya dalam permintaan.
WdfRequestWdmFormatUsingStackLocation memformat permintaan terlepas dari apakah objek target I/O permintaan bersifat lokal atau jarak jauh.
Jika Anda ingin mengatur rutinitas penyelesaian untuk permintaan, driver Anda harus memanggil WdfRequestSetCompletionRoutine setelah memanggil WdfRequestWdmFormatUsingStackLocation.
Untuk informasi selengkapnya tentang WdfRequestWdmFormatUsingStackLocation, lihat Meneruskan Permintaan I/O.
Contoh
Contoh kode berikut menyediakan struktur IO_STACK_LOCATION untuk permintaan I/O, menetapkan fungsi panggilan balik CompletionRoutine, lalu mengirim permintaan ke target I/O.
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
);
Contoh kode berikut menggambarkan cara mengirim PnP IRP_MN_QUERY_CAPABILITIES IRP ke target IO.
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);
}
Persyaratan
| Syarat | Nilai |
|---|---|
| Platform Target | Universal |
| versi KMDF Minimum | 1.0 |
| Header | wdfrequest.h (termasuk Wdf.h) |
| Pustaka | Wdf01000.sys (lihat Penerapan Versi Pustaka Kerangka Kerja.) |
| IRQL | <=DISPATCH_LEVEL |
| aturan kepatuhan DDI | DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), Km, KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), RequestFormattedValid(kmdf) |