|
|
1.1.1.3 ! root 1: /* The source code contained in this file has been derived from the source code ! 2: of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and ! 3: additions to that source code contained in this file are Copyright (c) 2004 ! 4: TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified ! 5: parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation ! 6: release. Please see the file license.txt for full license details. */ 1.1 root 7: 8: #include "TCdefs.h" 9: #include "crypto.h" 10: #include "fat.h" 11: #include "volumes.h" 12: 13: #include "apidrvr.h" 14: #include "ntdriver.h" 15: #include "ntvol.h" 16: #include "ntfiledv.h" 17: 18: #pragma warning( disable : 4127 ) 19: 20: TCSendIRP_FileDevice (PDEVICE_OBJECT DeviceObject, 21: PEXTENSION Extension, 22: PVOID pUserBuffer, 23: ULONG uFlags, 24: UCHAR uMajorFunction, 25: PIRP Irp) 26: { 27: PIO_STACK_LOCATION irpOldSp; 28: NTSTATUS ntStatus; 29: PIRP NewIrp; 30: 31: // Dump ("Sending IRP...\n"); 32: 33: NewIrp = IoAllocateIrp ((CCHAR) (Extension->pFsdDevice->StackSize + 1), FALSE); 34: 35: irpOldSp = IoGetCurrentIrpStackLocation (Irp); 36: 37: if (NewIrp != NULL) 38: { 39: PIO_STACK_LOCATION irpSp, irpNextSp; 40: 41: NewIrp->UserEvent = NULL; 42: NewIrp->UserIosb = &Irp->IoStatus; 43: 44: /* Doc's say to copy the Tail.Overlay.Thread from the 45: original Irp but if I do this the user is not prompted on 46: media removed and other user conditions! */ 47: NewIrp->Tail.Overlay.Thread = PsGetCurrentThread (); 48: NewIrp->Tail.Overlay.OriginalFileObject = Extension->pfoDeviceFile; 49: NewIrp->RequestorMode = KernelMode; 50: 51: NewIrp->Flags = uFlags; 52: 53: NewIrp->AssociatedIrp.SystemBuffer = NULL; 54: NewIrp->MdlAddress = NULL; 55: NewIrp->UserBuffer = pUserBuffer; 56: 57: IoSetNextIrpStackLocation (NewIrp); 58: 59: irpSp = IoGetCurrentIrpStackLocation (NewIrp); 60: irpNextSp = IoGetNextIrpStackLocation (NewIrp); 61: 62: irpSp->DeviceObject = DeviceObject; 63: irpSp->FileObject = Extension->pfoDeviceFile; 64: 65: irpNextSp->MajorFunction = irpSp->MajorFunction = uMajorFunction; 66: irpNextSp->MinorFunction = irpSp->MinorFunction = irpSp->MinorFunction; 67: irpNextSp->DeviceObject = Extension->pFsdDevice; 68: irpNextSp->FileObject = Extension->pfoDeviceFile; 69: /* Copy our flags down one level, this is to get the proper 70: removable-media handling */ 71: irpNextSp->Flags = irpSp->Flags = irpOldSp->Flags; 72: /* Copy over io parameters, this is a union, so it handles 73: deviceiocontrol & read/write */ 74: irpNextSp->Parameters.Read.Length = irpSp->Parameters.Read.Length = irpOldSp->Parameters.Read.Length; 75: irpNextSp->Parameters.Read.ByteOffset = irpSp->Parameters.Read.ByteOffset = irpOldSp->Parameters.Read.ByteOffset; 76: irpNextSp->Parameters.Read.Key = irpSp->Parameters.Read.Key = irpOldSp->Parameters.Read.Key; 77: } 78: else 79: { 80: TCfree (pUserBuffer); /* Free the temp buffer we allocated 81: for the IRP */ 82: 83: /* Complete the processing of the original Irp */ 84: return COMPLETE_IRP (DeviceObject, Irp, STATUS_INSUFFICIENT_RESOURCES, 0); 85: } 86: 87: IoSetCompletionRoutine (NewIrp, TCCompletion, Irp, TRUE, TRUE, TRUE); 88: 89: ntStatus = IoCallDriver (Extension->pFsdDevice, NewIrp); 90: //if (ntStatus == STATUS_PENDING) 91: //{ 92: // Dump ("Pending returned!\n"); 93: //} 94: 95: // Dump ("IRP Sent!\n"); 96: return ntStatus; 97: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.