Annotation of truecrypt/driver/encryptedioqueue.h, revision 1.1.1.4

1.1       root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
1.1.1.4 ! root        4:  Governed by the TrueCrypt License 2.5 the full text of which is contained
1.1       root        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: 
1.1.1.4 ! root       15: #define TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE (128 * 1024)
        !            16: #define TC_ENC_IO_QUEUE_MEM_ALLOC_RETRY_DELAY 10
        !            17: #define TC_ENC_IO_QUEUE_MEM_ALLOC_TIMEOUT (60 * 1000)
1.1       root       18: 
                     19: typedef struct
                     20: {
                     21:        PDEVICE_OBJECT DeviceObject;
                     22:        
                     23:        CRYPTO_INFO *CryptoInfo;
                     24:        
                     25:        // File-handle-based IO
                     26:        HANDLE HostFileHandle;
                     27:        int64 VirtualDeviceLength;
                     28: 
                     29:        // Filter device
                     30:        BOOL IsFilterDevice;
                     31:        PDEVICE_OBJECT LowerDeviceObject;
                     32:        int64 EncryptedAreaStart;
                     33:        int64 EncryptedAreaEnd;
1.1.1.4 ! root       34:        BOOL RemapEncryptedArea;
        !            35:        int64 RemappedAreaOffset;
        !            36:        int64 RemappedAreaDataUnitOffset;
1.1       root       37:        IO_REMOVE_LOCK RemoveLock;
                     38: 
                     39:        // Main tread
                     40:        PKTHREAD MainThread;
                     41:        LIST_ENTRY MainThreadQueue;
                     42:        KSPIN_LOCK MainThreadQueueLock;
                     43:        KEVENT MainThreadQueueNotEmptyEvent;
                     44: 
                     45:        // IO thread
                     46:        PKTHREAD IoThread;
                     47:        LIST_ENTRY IoThreadQueue;
                     48:        KSPIN_LOCK IoThreadQueueLock;
                     49:        KEVENT IoThreadQueueNotEmptyEvent;
                     50: 
                     51:        // Completion thread
                     52:        PKTHREAD CompletionThread;
                     53:        LIST_ENTRY CompletionThreadQueue;
                     54:        KSPIN_LOCK CompletionThreadQueueLock;
                     55:        KEVENT CompletionThreadQueueNotEmptyEvent;
                     56: 
                     57:        byte *FragmentBufferA;
                     58:        byte *FragmentBufferB;
                     59:        KEVENT FragmentBufferAFreeEvent;
                     60:        KEVENT FragmentBufferBFreeEvent;
                     61: 
                     62:        LONG OutstandingIoCount;
                     63:        KEVENT NoOutstandingIoEvent;
                     64:        
1.1.1.3   root       65:        KEVENT RequestCompletedEvent;
                     66: 
1.1       root       67:        __int64 TotalBytesRead;
                     68:        __int64 TotalBytesWritten;
                     69: 
                     70:        volatile BOOL ThreadExitRequested;
                     71:        
                     72:        volatile BOOL Suspended;
                     73:        volatile BOOL SuspendPending;
                     74:        volatile BOOL StopPending;
                     75: 
                     76:        KEVENT QueueResumedEvent;
                     77: 
                     78: }  EncryptedIoQueue;
                     79: 
                     80: 
                     81: typedef struct
                     82: {
                     83:        EncryptedIoQueue *Queue;
                     84:        PIRP OriginalIrp;
                     85:        BOOL Write;
                     86:        ULONG OriginalLength;
                     87:        LARGE_INTEGER OriginalOffset;
1.1.1.3   root       88:        LONG OutstandingRequestCount;
1.1       root       89:        NTSTATUS Status;
                     90: } EncryptedIoQueueItem;
                     91: 
                     92: 
                     93: typedef struct
                     94: {
                     95:        EncryptedIoQueueItem *Item;
                     96: 
                     97:        BOOL CompleteOriginalIrp;
                     98:        LARGE_INTEGER Offset;
                     99:        ULONG Length;
                    100:        int64 EncryptedOffset;
                    101:        ULONG EncryptedLength;
                    102:        byte *Data;
                    103:        byte *OrigDataBufferFragment;
                    104: 
                    105:        LIST_ENTRY ListEntry;
                    106:        LIST_ENTRY CompletionListEntry;
                    107: } EncryptedIoRequest;
                    108: 
                    109: 
                    110: NTSTATUS EncryptedIoQueueAddIrp (EncryptedIoQueue *queue, PIRP irp);
                    111: BOOL EncryptedIoQueueIsRunning (EncryptedIoQueue *queue);
                    112: BOOL EncryptedIoQueueIsSuspended (EncryptedIoQueue *queue);
                    113: NTSTATUS EncryptedIoQueueResumeFromHold (EncryptedIoQueue *queue);
1.1.1.2   root      114: NTSTATUS EncryptedIoQueueStart (EncryptedIoQueue *queue, PEPROCESS process);
1.1       root      115: NTSTATUS EncryptedIoQueueStop (EncryptedIoQueue *queue);
                    116: NTSTATUS EncryptedIoQueueHoldWhenIdle (EncryptedIoQueue *queue, int64 timeout);
                    117: 
                    118: 
                    119: #endif // TC_HEADER_DRIVER_ENCRYPTED_IO_QUEUE

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.