|
|
1.1 ! root 1: /* ! 2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. ! 3: ! 4: Governed by the TrueCrypt License 2.4 the full text of which is contained ! 5: in the file License.txt included in TrueCrypt binary and source code ! 6: distribution packages. ! 7: */ ! 8: ! 9: #ifndef TC_HEADER_DRIVER_ENCRYPTED_IO_QUEUE ! 10: #define TC_HEADER_DRIVER_ENCRYPTED_IO_QUEUE ! 11: ! 12: #include "TCdefs.h" ! 13: #include "Apidrvr.h" ! 14: ! 15: #define TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE (64 * 512) ! 16: ! 17: typedef struct ! 18: { ! 19: PDEVICE_OBJECT DeviceObject; ! 20: ! 21: CRYPTO_INFO *CryptoInfo; ! 22: ! 23: // File-handle-based IO ! 24: HANDLE HostFileHandle; ! 25: int64 VirtualDeviceLength; ! 26: ! 27: // Filter device ! 28: BOOL IsFilterDevice; ! 29: PDEVICE_OBJECT LowerDeviceObject; ! 30: int64 EncryptedAreaStart; ! 31: int64 EncryptedAreaEnd; ! 32: IO_REMOVE_LOCK RemoveLock; ! 33: ! 34: // Main tread ! 35: PKTHREAD MainThread; ! 36: LIST_ENTRY MainThreadQueue; ! 37: KSPIN_LOCK MainThreadQueueLock; ! 38: KEVENT MainThreadQueueNotEmptyEvent; ! 39: ! 40: // IO thread ! 41: PKTHREAD IoThread; ! 42: LIST_ENTRY IoThreadQueue; ! 43: KSPIN_LOCK IoThreadQueueLock; ! 44: KEVENT IoThreadQueueNotEmptyEvent; ! 45: ! 46: // Completion thread ! 47: PKTHREAD CompletionThread; ! 48: LIST_ENTRY CompletionThreadQueue; ! 49: KSPIN_LOCK CompletionThreadQueueLock; ! 50: KEVENT CompletionThreadQueueNotEmptyEvent; ! 51: ! 52: byte *FragmentBufferA; ! 53: byte *FragmentBufferB; ! 54: KEVENT FragmentBufferAFreeEvent; ! 55: KEVENT FragmentBufferBFreeEvent; ! 56: ! 57: LONG OutstandingIoCount; ! 58: KEVENT NoOutstandingIoEvent; ! 59: ! 60: __int64 TotalBytesRead; ! 61: __int64 TotalBytesWritten; ! 62: ! 63: volatile BOOL ThreadExitRequested; ! 64: ! 65: volatile BOOL Suspended; ! 66: volatile BOOL SuspendPending; ! 67: volatile BOOL StopPending; ! 68: ! 69: KEVENT QueueResumedEvent; ! 70: ! 71: } EncryptedIoQueue; ! 72: ! 73: ! 74: typedef struct ! 75: { ! 76: EncryptedIoQueue *Queue; ! 77: PIRP OriginalIrp; ! 78: BOOL Write; ! 79: ULONG OriginalLength; ! 80: LARGE_INTEGER OriginalOffset; ! 81: KEVENT IoRequestCompletedEvent; ! 82: NTSTATUS Status; ! 83: LIST_ENTRY ListEntry; ! 84: __int64 DebugOffset; ! 85: } EncryptedIoQueueItem; ! 86: ! 87: ! 88: typedef struct ! 89: { ! 90: EncryptedIoQueueItem *Item; ! 91: ! 92: BOOL CompleteOriginalIrp; ! 93: LARGE_INTEGER Offset; ! 94: ULONG Length; ! 95: int64 EncryptedOffset; ! 96: ULONG EncryptedLength; ! 97: byte *Data; ! 98: byte *OrigDataBufferFragment; ! 99: ! 100: LIST_ENTRY ListEntry; ! 101: LIST_ENTRY CompletionListEntry; ! 102: } EncryptedIoRequest; ! 103: ! 104: ! 105: NTSTATUS EncryptedIoQueueAddIrp (EncryptedIoQueue *queue, PIRP irp); ! 106: BOOL EncryptedIoQueueIsRunning (EncryptedIoQueue *queue); ! 107: BOOL EncryptedIoQueueIsSuspended (EncryptedIoQueue *queue); ! 108: NTSTATUS EncryptedIoQueueResumeFromHold (EncryptedIoQueue *queue); ! 109: NTSTATUS EncryptedIoQueueStart (EncryptedIoQueue *queue); ! 110: NTSTATUS EncryptedIoQueueStop (EncryptedIoQueue *queue); ! 111: NTSTATUS EncryptedIoQueueHoldWhenIdle (EncryptedIoQueue *queue, int64 timeout); ! 112: ! 113: ! 114: #endif // TC_HEADER_DRIVER_ENCRYPTED_IO_QUEUE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.