Nopes, you are on the right track. You can override portcls IOCTL interface with user defined calls. If in case you are not interested to perform any operation, you can gracefully pass it to portcls by calling DispatchIRp call. On 4/9/07, Don Bell <0dbell@xxxxxxxxx> wrote:
I am trying to find a way to add some custom IOCTL handling to a miniport audio driver. The driver's DriverEntry() currently looks like this: extern "C" NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPathName) { NTSTATUS ntStatus = PcInitializeAdapterDriver( DriverObject, RegistryPathName, (PDRIVER_ADD_DEVICE)AddDevice); return ntStatus; } And I was thinking of adding a DispatchDeviceControl() like this: extern "C" NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPathName) { NTSTATUS ntStatus = PcInitializeAdapterDriver( DriverObject, RegistryPathName, (PDRIVER_ADD_DEVICE)AddDevice); if(NT_SUCCESS(ntStatus)) { DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DeviceControlHandler; } return ntStatus; } Then, in DeviceControlHandler(): (1) Use IoGetCurrentIrpStackLocation() - to obtain current stack location. (2) Handle it (i.e. the current IRP) if it's "mine" or pass it down the stack for processing by using IoSkipCurrentIrpStackLocation() and then calling IoCallDriver(). My questions is... Is this "legal"? That is, is the PortCls system designed to handle such customization (i.e. mixing PortCls high-level Pc* with Io*)? The main reason I am asking such a trivial question is that while I can make this appear to work, it may be in violation of some fundamental principle in the PortCls system, which will trigger bugs that could be a nightmare to debug. Am I in for trouble in attempting to hack something like this into PortCls? Many thanks in advance, Don ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/