Fungsi WdfRequestWdmFormatUsingStackLocation (wdfrequest.h)
[Berlaku untuk KMDF saja]
Metode WdfRequestWdmFormatUsingStackLocation memformat permintaan I/O dengan menyalin konten struktur lokasi tumpukan I/O WDM tertentu ke lokasi tumpukan berikutnya dalam permintaan.
Sintaks
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.
Nilai kembali
Tidak ada
Keterangan
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
Persyaratan | Nilai |
---|---|
Target Platform | 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), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), RequestFormattedValid(kmdf) |
Lihat juga
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk