[wdmaudiodev] Re: Default Format

  • From: NCH Obble Smith <Obble@xxxxxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 29 Oct 2009 13:33:30 +1100

I believe I am catching out the way out. Do I have to MmProbeAndLockPages the Irp->UserBuffer???


NTSTATUS SentToLowerDriversCompletionRoutine(PDEVICE_OBJECT fdo, PIRP Irp, 
PDEVICE_EXTENSION pdx)
{
   if (Irp->PendingReturned)
      IoMarkIrpPending(Irp);

   PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);

   if (stack->MajorFunction == IRP_MJ_DEVICE_CONTROL) {
      GUID* pGuid = (GUID*)stack->Parameters.DeviceIoControl.Type3InputBuffer;

      if (stack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY) 
{
         if ((pKP->Set == KSPROPSETID_Pin)&&  (pKP->Id == 
KSPROPERTY_PIN_DATARANGES)&&  stack->Parameters.DeviceIoControl.OutputBufferLength>  0) {
                // Irp->UserBuffer is ZeroMemoryied ???
         }
      }
   }
   IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
   return STATUS_SUCCESS;
}


NTSTATUS SentToLowerDrivers(PDEVICE_OBJECT fdo, PIRP Irp)
{
   PDEVICE_EXTENSION pdx =  (PDEVICE_EXTENSION) fdo->DeviceExtension;
   NTSTATUS status = IoAcquireRemoveLock(&pdx->RemoveLock, Irp);
   if (!NT_SUCCESS(status))  return CompleteRequest(Irp, status, 0);
   IoCopyCurrentIrpStackLocationToNext(Irp);
   IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) 
SentToLowerDriversCompletionRoutine, pdx, TRUE, TRUE, TRUE);
   return IoCallDriver(pdx->LowerDeviceObject, Irp);
}


NTSTATUS DispatchAny(IN PDEVICE_OBJECT fido, IN PIRP Irp)
{
   // I got some code here.
   // ...
   return SentToLowerDrivers(fido, Irp);
}


Remember that IOCTL_KS_PROPERTY is a METHOD_NEITHER IRP.  The input
buffer is in Type3InputBuffer.

You're catching this on the way back out of the pin, right?

******************

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/

Other related posts: