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