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

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
                      5:    contained in this file are Copyright (c) 2004-2005 TrueCrypt Foundation and
                      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: /* This structure is used to start new threads */
                     11: typedef struct _THREAD_BLOCK_
                     12: {
                     13:        PDEVICE_OBJECT DeviceObject;
                     14:        NTSTATUS ntCreateStatus;
1.1.1.7 ! root       15:        WCHAR wszMountVolume[TC_MAX_PATH + 8];
1.1       root       16:        MOUNT_STRUCT *mount;
                     17: } THREAD_BLOCK, *PTHREAD_BLOCK;
                     18: 
                     19: /* This structure is allocated for non-root devices! WARNING: bRootDevice
                     20:    must be the first member of the structure! */
                     21: typedef struct EXTENSION
                     22: {
                     23:        BOOL bRootDevice;       /* Is this the root device ? which the
                     24:                                   user-mode apps talk to */
                     25: 
                     26:        ULONG lMagicNumber;     /* To ensure the completion routine is not
                     27:                                   sending us bad IRP's */
                     28: 
1.1.1.6   root       29:        int UniqueVolumeId;
1.1       root       30:        int nDosDriveNo;        /* Drive number this extension is mounted
                     31:                                   against */
                     32:        BOOL bShuttingDown;                     /* Is the driver shutting down ? */
                     33:        BOOL bThreadShouldQuit;         /* Instruct per device worker thread to quit */
                     34:        PETHREAD peThread;                      /* Thread handle */
                     35:        KEVENT keCreateEvent;           /* Device creation event */
                     36:        KSPIN_LOCK ListSpinLock;        /* IRP spinlock */
                     37:        LIST_ENTRY ListEntry;           /* IRP listentry */
                     38:        KSEMAPHORE RequestSemaphore;    /* IRP list request  Semaphore */
                     39: 
                     40: #ifdef USE_KERNEL_MUTEX
                     41:        KMUTEX KernelMutex;                     /* Sync. mutex for entire thread */
                     42: #endif
                     43: 
                     44:        HANDLE hDeviceFile;                     /* Device handle for this device */
                     45:        PFILE_OBJECT pfoDeviceFile;     /* Device fileobject for this device */
                     46:        PDEVICE_OBJECT pFsdDevice;      /* lower level device handle */
                     47: 
1.1.1.6   root       48:        CRYPTO_INFO *cryptoInfo;        /* Cryptographic and other information for this device */
1.1       root       49: 
                     50:        __int64 DiskLength;                     /* The length of the disk referred to by this device */  
                     51:        __int64 NumberOfCylinders;              /* Partition info */
                     52:        ULONG TracksPerCylinder;        /* Partition info */
                     53:        ULONG SectorsPerTrack;          /* Partition info */
                     54:        ULONG BytesPerSector;           /* Partition info */
                     55:        UCHAR PartitionType;            /* Partition info */
                     56: 
                     57:        KEVENT keVolumeEvent;           /* Event structure used when setting up a device */
                     58: 
1.1.1.4   root       59:        BOOL bReadOnly;                         /* Is this device read-only ? */
                     60:        BOOL bRemovable;                        /* Is this device removable media ? */
                     61:        BOOL bRawDevice;                        /* Is this a raw-partition or raw-floppy device ? */
                     62:        BOOL bMountManager;                     /* Mount manager knows about volume */
1.1       root       63: 
1.1.1.7 ! root       64:        WCHAR wszVolume[TC_MAX_PATH];   /*  DONT change this size without also changing MOUNT_LIST_STRUCT! */
1.1       root       65: 
1.1.1.6   root       66:        // Container file date/time (used to reset date and time of file-hosted volumes after dismount or unsuccessful mount attempt, to preserve plausible deniability of hidden volumes).
1.1.1.4   root       67:        LARGE_INTEGER fileCreationTime;
                     68:        LARGE_INTEGER fileLastAccessTime;
                     69:        LARGE_INTEGER fileLastWriteTime;
                     70:        LARGE_INTEGER fileLastChangeTime;
1.1.1.6   root       71:        BOOL bTimeStampValid;
                     72: 
                     73:        unsigned __int64 TotalBytesRead;        // Bytes read from volume
                     74:        unsigned __int64 TotalBytesWritten;     // Bytes written to volume
1.1.1.4   root       75: 
1.1       root       76: } EXTENSION, *PEXTENSION;
                     77: 
                     78: /* Helper macro returning x seconds in units of 100 nanoseconds */
1.1.1.4   root       79: #define WAIT_SECONDS(x) ((x)*10000000)
1.1       root       80: 
                     81: /* In order to see any debug output you will need to run a checked build of
                     82:    NT */
                     83: #ifdef DEBUG
                     84: #define Dump DbgPrint
                     85: #else
                     86: #define Dump
                     87: #endif
                     88: 
                     89: #ifdef USE_KERNEL_MUTEX
                     90: #pragma message ("Compiling " __FILE__ " with USE_KERNEL_MUTEX on")
                     91: #endif
                     92: 
1.1.1.4   root       93: #define FSCTL_LOCK_VOLUME               CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  6, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     94: #define FSCTL_UNLOCK_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  7, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     95: #define FSCTL_DISMOUNT_VOLUME           CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  8, METHOD_BUFFERED, FILE_ANY_ACCESS)
1.1.1.6   root       96: NTKERNELAPI NTSTATUS ObOpenObjectByPointer (IN PVOID Object, IN ULONG HandleAttributes, IN PACCESS_STATE PassedAccessState OPTIONAL, IN ACCESS_MASK DesiredAccess OPTIONAL, IN POBJECT_TYPE ObjectType OPTIONAL, IN KPROCESSOR_MODE AccessMode, OUT PHANDLE Handle);
1.1       root       97: 
                     98: NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
                     99: NTSTATUS TCDispatchQueueIRP (PDEVICE_OBJECT DeviceObject, PIRP Irp);
                    100: NTSTATUS TCCreateRootDeviceObject (PDRIVER_OBJECT DriverObject);
1.1.1.4   root      101: NTSTATUS TCCreateDeviceObject (PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT * ppDeviceObject, MOUNT_STRUCT * mount);
1.1       root      102: NTSTATUS TCDeviceControl (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, PIRP Irp);
                    103: NTSTATUS TCStartThread (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, MOUNT_STRUCT * mount);
                    104: void TCStopThread (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension);
                    105: VOID TCThreadIRP (PVOID Context);
1.1.1.5   root      106: void TCSleep (int milliSeconds);
1.1       root      107: void TCGetNTNameFromNumber (LPWSTR ntname, int nDriveNo);
                    108: void TCGetDosNameFromNumber (LPWSTR dosname, int nDriveNo);
                    109: LPWSTR TCTranslateCode (ULONG ulCode);
                    110: PDEVICE_OBJECT TCDeleteDeviceObject (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension);
                    111: VOID TCUnloadDriver (PDRIVER_OBJECT DriverObject);
1.1.1.4   root      112: NTSTATUS TCDeviceIoControl (PWSTR deviceName, ULONG IoControlCode, void *InputBuffer, int InputBufferSize, void *OutputBuffer, int OutputBufferSize);
                    113: NTSTATUS TCOpenFsVolume (PEXTENSION Extension, PHANDLE volumeHandle, PFILE_OBJECT * fileObject);
                    114: void TCCloseFsVolume (HANDLE volumeHandle, PFILE_OBJECT fileObject);
                    115: NTSTATUS TCFsctlCall (PFILE_OBJECT fileObject, LONG IoControlCode, void *InputBuffer, int InputBufferSize, void *OutputBuffer, int OutputBufferSize);
1.1.1.6   root      116: NTSTATUS CreateDriveLink (int nDosDriveNo);
                    117: NTSTATUS RemoveDriveLink (int nDosDriveNo);
1.1.1.4   root      118: NTSTATUS MountManagerMount (MOUNT_STRUCT *mount);
                    119: NTSTATUS MountManagerUnmount (int nDosDriveNo);
                    120: NTSTATUS MountDevice (PDEVICE_OBJECT deviceObject, MOUNT_STRUCT *mount);
                    121: NTSTATUS UnmountDevice (PDEVICE_OBJECT deviceObject, BOOL ignoreOpenFiles);
                    122: NTSTATUS UnmountAllDevices (PDEVICE_OBJECT DeviceObject, BOOL ignoreOpenFiles);
                    123: NTSTATUS SymbolicLinkToTarget (PWSTR symlinkName, PWSTR targetName, USHORT maxTargetNameLength);
1.1.1.5   root      124: void DriverMutexWait ();
                    125: void DriverMutexRelease ();
1.1.1.6   root      126: BOOL RegionsOverlap (unsigned __int64 start1, unsigned __int64 end1, unsigned __int64 start2, unsigned __int64 end2);

unix.superglobalmegacorp.com

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