Annotation of truecrypt/driver/ntdriver.h, revision 1.1.1.3

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: /* This structure is used to start new threads */
                      9: typedef struct _THREAD_BLOCK_
                     10: {
                     11:        PDEVICE_OBJECT DeviceObject;
                     12:        NTSTATUS ntCreateStatus;
                     13:        WCHAR wszMountVolume[TC_MAX_PATH];
                     14:        MOUNT_STRUCT *mount;
                     15: } THREAD_BLOCK, *PTHREAD_BLOCK;
                     16: 
                     17: /* This structure is allocated for non-root devices! WARNING: bRootDevice
                     18:    must be the first member of the structure! */
                     19: typedef struct EXTENSION
                     20: {
                     21:        BOOL bRootDevice;       /* Is this the root device ? which the
                     22:                                   user-mode apps talk to */
                     23: 
                     24:        ULONG lMagicNumber;     /* To ensure the completion routine is not
                     25:                                   sending us bad IRP's */
                     26: 
                     27:        int nDosDriveNo;        /* Drive number this extension is mounted
                     28:                                   against */
                     29:        BOOL bShuttingDown;                     /* Is the driver shutting down ? */
                     30:        BOOL bThreadShouldQuit;         /* Instruct per device worker thread to quit */
                     31:        PETHREAD peThread;                      /* Thread handle */
                     32:        KEVENT keCreateEvent;           /* Device creation event */
                     33:        KSPIN_LOCK ListSpinLock;        /* IRP spinlock */
                     34:        LIST_ENTRY ListEntry;           /* IRP listentry */
                     35:        KSEMAPHORE RequestSemaphore;    /* IRP list request  Semaphore */
                     36: 
                     37: #ifdef USE_KERNEL_MUTEX
                     38:        KMUTEX KernelMutex;                     /* Sync. mutex for entire thread */
                     39: #endif
                     40: 
                     41:        HANDLE hDeviceFile;                     /* Device handle for this device */
                     42:        PFILE_OBJECT pfoDeviceFile;     /* Device fileobject for this device */
                     43:        PDEVICE_OBJECT pFsdDevice;      /* lower level device handle */
                     44: 
                     45:        CRYPTO_INFO *cryptoInfo;        /* Cryptographic information for this device */
                     46: 
                     47:        __int64 DiskLength;                     /* The length of the disk referred to by this device */  
                     48:        __int64 NumberOfCylinders;              /* Partition info */
                     49:        ULONG TracksPerCylinder;        /* Partition info */
                     50:        ULONG SectorsPerTrack;          /* Partition info */
                     51:        ULONG BytesPerSector;           /* Partition info */
                     52:        UCHAR PartitionType;            /* Partition info */
                     53: 
                     54:        KEVENT keVolumeEvent;           /* Event structure used when setting up a device */
                     55: 
                     56:        BOOL bReadOnly;         /* Is this device readonly ? */
                     57:        BOOL bRawDevice;        /* Is this a raw-partition or raw-floppy device ? */
                     58: 
                     59:        WCHAR wszVolume[64];    /* For the tree view in the user-mode
                     60:                                   application, here we only store 64
                     61:                                   characters rather than TC_MAX_PATH to try
                     62:                                   to keep this structures size down - DONT
                     63:                                   change this size without also changing
                     64:                                   MOUNT_LIST_STRUCT! */
                     65: 
                     66:        long mountTime;         /* The time this volume was last mounted, for
                     67:                                   the user-mode application */
                     68: 
                     69: } EXTENSION, *PEXTENSION;
                     70: 
                     71: /* Helper macro returning x seconds in units of 100 nanoseconds */
                     72: #define WAIT_SECONDS(x) (x*10000000)
                     73: 
                     74: /* In order to see any debug output you will need to run a checked build of
                     75:    NT */
                     76: #ifdef DEBUG
                     77: #define Dump DbgPrint
                     78: #else
                     79: #define Dump
                     80: #endif
                     81: 
                     82: /* Sync. mutex for entire driver */
                     83: extern KMUTEX driverMutex;
                     84: 
                     85: #ifdef USE_KERNEL_MUTEX
                     86: #pragma message ("Compiling " __FILE__ " with USE_KERNEL_MUTEX on")
                     87: #endif
                     88: 
                     89: /* Everything below this line is automatically updated by the -mkproto-tool- */
                     90: 
                     91: NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
                     92: NTSTATUS TCDispatchQueueIRP (PDEVICE_OBJECT DeviceObject, PIRP Irp);
                     93: NTSTATUS TCCreateRootDeviceObject (PDRIVER_OBJECT DriverObject);
                     94: NTSTATUS TCCreateDeviceObject (PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT * ppDeviceObject, int nDosDriveNo);
                     95: NTSTATUS TCDeviceControl (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, PIRP Irp);
                     96: NTSTATUS TCStartThread (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, MOUNT_STRUCT * mount);
                     97: void TCStopThread (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension);
                     98: VOID TCThreadIRP (PVOID Context);
                     99: void TCGetNTNameFromNumber (LPWSTR ntname, int nDriveNo);
                    100: void TCGetDosNameFromNumber (LPWSTR dosname, int nDriveNo);
                    101: LPWSTR TCTranslateCode (ULONG ulCode);
                    102: PDEVICE_OBJECT TCDeleteDeviceObject (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension);
                    103: VOID TCUnloadDriver (PDRIVER_OBJECT DriverObject);

unix.superglobalmegacorp.com

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