1 PIO_STACK_LOCATION isl = IoGetCurrentIrpStackLocation(pIrp); 2 3 //Read & Write Length 4 ULONG dwInSize = isl->Parameters.Read.Length; 5 ULONG dwOutSize = isl->Parameters.Write.Length; 6 7 //In & Out Buffer DO_BUFFERED_IO 8 PVOID pInBuffer = pIrp->AssociatedIrp.SystemBuffer; 9 PVOID pOutBuffer = pIrp->AssociatedIrp.SystemBuffer; 10 11 //In & Out Buffer DO_DIRECT_IO 12 pInBuffer = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority); 13 pOutBuffer = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority); 14 15 //In & Out Buffer DO_DIRECT_IO 16 ProbeForRead(pIrp->UserBuffer, dwInSize, 4); 17 pInBuffer = pIrp->UserBuffer; 18 ProbeForWrite(pIrp->UserBuffer, dwOutSize, 4); 19 pOutBuffer = pIrp->UserBuffer; 20 21 //Io control device 22 ULONG dwCtrlCoder = isl->Parameters.DeviceIoControl.IoControlCode; 23 //Read & Write Length 24 dwInSize = isl->Parameters.DeviceIoControl.InputBufferLength; 25 dwOutSize = isl->Parameters.DeviceIoControl.OutputBufferLength; 26 27 //In & Out Buffer METHOD_BUFFERED || METHOD_IN_DIRECT || METHOD_OUT_DIRECT || METHOD_NEITHER I/O 28 pInBuffer = pIrp->AssociatedIrp.SystemBuffer; 29 pOutBuffer = pIrp->AssociatedIrp.SystemBuffer; 30 31 //In & Out Buffer METHOD_IN_DIRECT || METHOD_OUT_DIRECT 32 pInBuffer = pIrp->AssociatedIrp.SystemBuffer; 33 pOutBuffer = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority); 34 35 //In & Out Buffer METHOD_NEITHER I/O 36 37 pInBuffer = isl->Parameters.DeviceIoControl.Type3InputBuffer; 38 ProbeForRead(pInBuffer, dwInSize, 4); 39 pOutBuffer = pIrp->UserBuffer; 40 ProbeForRead(pOutBuffer, dwOutSize, 4);