WPP_SYSTEMCONTROL does not pass the IRP_MJ_SYSTEM control on to the lower level driver.
Please use WPP_SYSTEMCONTROL2
This has the form
WPP_SYSTEMCONTROL2(PDO, offset)
And is used something like
WPP_SYSTEMCONTROL2(DriverObject, FIELD_OFFSET(MY_DEVICE_EXTENSION, MYNextLowerDeviceObjectVariable));
The FIELD_OFFSET() routine gives the offset into the device extension to use for the devobj to forward requests to. If no such device exists, -1 should be passed in.
Or you can handle the IRP yourself and pass it on.
If the driver wishes is also required to handle System_Control IRP’s, the author must include code to call the WPP entry point directly from his own System Control dispatch routine, a convenient macro call WPP_TRACE_CONTROL is provided.
A code fragment might be something like - (an example with lower level driver processing is shown) -
case IRP_MN_REGINFO:
case IRP_MN_ENABLE_EVENTS:
case IRP_MN_DISABLE_EVENTS:
if (pDO == (PDEVICE_OBJECT)irpSp->Parameters.WMI.ProviderId) {
Status = irpSp->MinorFunction),WPP_TRACE_CONTROL(irpSp->MinorFunction),BufferSize,ReturnSize)
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = ReturnSize;
IoCompleteRequest( Irp, IO_NO_INCREMENT );
return Status;
} else if (We have a lower device) {
//
// Set current stack back one.
//
IoSkipCurrentIrpStackLocation( Irp );
//
// Pass the call to the next driver.
//
return IoCallDriver((PDEVICE_OBJECT)LowerDevice,Irp);
} else {
//unable to pass down – what to do?
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
Irp->IoStatus.Information = 0;
return Irp->IoStatus.Status;
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Chris Myers
Sent: Tuesday, April 13, 2004 9:04 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] ETW for 2000 — driver hangs at remove
I am trying to enable ETW in my drivers for a USB device.? I have a single binary that runs on 2000 and XP, and I really want to keep it that way.? After paging through the recent thread here and through the toaster and tracedrv samples, I got the driver to compile with?a few debug prints switched to trace messages.? It loads and spits out those messages.? So far, so good.
?
The frown comes in when I try to unload the driver.? The driver will not unload.? The driver below me (USBHUB) doesn’t return when I pass down the IRP_MN_REMOVE_DEVICE.? I followed the disassembly through a few levels of USBHUB.? It blocks in a call to IoWMIRegistrationControl(WMIREG_ACTION_REREGISTER).? According to the docs, there must be a pending IRP_MJ_SYSTEM_CONTROL somewhere.? But I don’t have an WMI dispatch function.? I used the WPP_SYSTEMCONTROL macro in DriverEntry.?
?
I used the “targeting Win2k” logic in this driver as done in toaster, so I could build it under the XP build environment too.? It works like a charm when built that way, but of course, it won’t run on a Win2000 system.?? If I build in the 2000 environment, the resulting driver hangs at removal on both 2000 and XP.
?
Does this problem ring any bells for anyone?
?
Chris Myers
?
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com