|
|
1.1.1.10 root 1: /* 1.1.1.12! root 2: Legal Notice: Some portions of the source code contained in this file were ! 3: derived from the source code of Encryption for the Masses 2.02a, which is ! 4: Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License ! 5: Agreement for Encryption for the Masses'. Modifications and additions to ! 6: the original source code (contained in this file) and all other portions of ! 7: this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed ! 8: by the TrueCrypt License 2.4 the full text of which is contained in the ! 9: file License.txt included in TrueCrypt binary and source code distribution 1.1.1.10 root 10: packages. */ 1.1 root 11: 1.1.1.6 root 12: #pragma once 13: 14: #include "Tcdefs.h" 15: #include "Common.h" 16: #include "Crypto.h" 1.1.1.12! root 17: #include "Wipe.h" 1.1.1.6 root 18: 19: #ifdef _WIN32 20: 1.1.1.12! root 21: // Modifying the following values can introduce incompatibility with previous versions 1.1 root 22: 1.1.1.12! root 23: #define TC_IOCTL(CODE) (CTL_CODE (FILE_DEVICE_UNKNOWN, 0x800 + (CODE), METHOD_BUFFERED, FILE_ANY_ACCESS)) 1.1 root 24: 1.1.1.12! root 25: #define TC_IOCTL_GET_DRIVER_VERSION TC_IOCTL (1) ! 26: #define TC_IOCTL_GET_BOOT_LOADER_VERSION TC_IOCTL (2) ! 27: #define TC_IOCTL_MOUNT_VOLUME TC_IOCTL (3) ! 28: #define TC_IOCTL_DISMOUNT_VOLUME TC_IOCTL (4) ! 29: #define TC_IOCTL_DISMOUNT_ALL_VOLUMES TC_IOCTL (5) ! 30: #define TC_IOCTL_GET_MOUNTED_VOLUMES TC_IOCTL (6) ! 31: #define TC_IOCTL_GET_VOLUME_PROPERTIES TC_IOCTL (7) ! 32: #define TC_IOCTL_GET_DEVICE_REFCOUNT TC_IOCTL (8) ! 33: #define TC_IOCTL_WAS_REFERENCED_DEVICE_DELETED TC_IOCTL (9) ! 34: #define TC_IOCTL_IS_ANY_VOLUME_MOUNTED TC_IOCTL (10) ! 35: #define TC_IOCTL_GET_PASSWORD_CACHE_STATUS TC_IOCTL (11) ! 36: #define TC_IOCTL_WIPE_PASSWORD_CACHE TC_IOCTL (12) ! 37: #define TC_IOCTL_OPEN_TEST TC_IOCTL (13) ! 38: #define TC_IOCTL_GET_DRIVE_PARTITION_INFO TC_IOCTL (14) ! 39: #define TC_IOCTL_GET_DRIVE_GEOMETRY TC_IOCTL (15) ! 40: #define TC_IOCTL_PROBE_REAL_DRIVE_SIZE TC_IOCTL (16) ! 41: #define TC_IOCTL_GET_RESOLVED_SYMLINK TC_IOCTL (17) ! 42: #define TC_IOCTL_GET_BOOT_ENCRYPTION_STATUS TC_IOCTL (18) ! 43: #define TC_IOCTL_BOOT_ENCRYPTION_SETUP TC_IOCTL (19) ! 44: #define TC_IOCTL_ABORT_BOOT_ENCRYPTION_SETUP TC_IOCTL (20) ! 45: #define TC_IOCTL_GET_BOOT_ENCRYPTION_SETUP_RESULT TC_IOCTL (21) ! 46: #define TC_IOCTL_GET_BOOT_DRIVE_VOLUME_PROPERTIES TC_IOCTL (22) ! 47: #define TC_IOCTL_REOPEN_BOOT_VOLUME_HEADER TC_IOCTL (23) ! 48: ! 49: // Legacy IOCTLs used before version 5.0 ! 50: #define TC_IOCTL_LEGACY_GET_DRIVER_VERSION 466968 ! 51: #define TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES 466948 1.1 root 52: 53: 54: /* Start of driver interface structures, the size of these structures may 55: change between versions; so make sure you first send DRIVER_VERSION to 56: check that it's the correct device driver */ 57: 58: #pragma pack (push) 59: #pragma pack(1) 60: 61: typedef struct 62: { 1.1.1.6 root 63: int nReturnCode; /* Return code back from driver */ 64: short wszVolume[TC_MAX_PATH]; /* Volume to be mounted */ 65: Password VolumePassword; /* User password */ 66: BOOL bCache; /* Cache passwords in driver */ 67: int nDosDriveNo; /* Drive number to mount */ 1.1.1.10 root 68: int BytesPerSector; 1.1.1.6 root 69: BOOL bMountReadOnly; /* Mount volume in read-only mode */ 70: BOOL bMountRemovable; /* Mount volume as removable media */ 71: BOOL bExclusiveAccess; /* Open host file/device in exclusive access mode */ 72: BOOL bMountManager; /* Announce volume to mount manager */ 73: BOOL bUserContext; /* Mount volume in user process context */ 74: BOOL bPreserveTimestamp; /* Preserve file container timestamp */ 75: // Hidden volume protection 76: BOOL bProtectHiddenVolume; /* TRUE if the user wants the hidden volume within this volume to be protected against being overwritten (damaged) */ 77: Password ProtectedHidVolPassword; /* Password to the hidden volume to be protected against overwriting */ 1.1 root 78: } MOUNT_STRUCT; 79: 80: typedef struct 81: { 82: int nDosDriveNo; /* Drive letter to unmount */ 1.1.1.4 root 83: BOOL ignoreOpenFiles; 84: int nReturnCode; /* Return code back from driver */ 1.1 root 85: } UNMOUNT_STRUCT; 86: 87: typedef struct 88: { 1.1.1.6 root 89: unsigned __int32 ulMountedDrives; /* Bitfield of all mounted drive letters */ 1.1.1.7 root 90: short wszVolume[26][TC_MAX_PATH]; /* Volume names of mounted volumes */ 1.1 root 91: unsigned __int64 diskLength[26]; 1.1.1.4 root 92: int ea[26]; 1.1.1.6 root 93: int volumeType[26]; /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */ 1.1 root 94: } MOUNT_LIST_STRUCT; 95: 96: typedef struct 97: { 98: int driveNo; 1.1.1.6 root 99: int uniqueId; 1.1.1.7 root 100: short wszVolume[TC_MAX_PATH]; 1.1 root 101: unsigned __int64 diskLength; 1.1.1.4 root 102: int ea; 1.1.1.7 root 103: int mode; 1.1 root 104: int pkcs5; 105: int pkcs5Iterations; 1.1.1.4 root 106: BOOL hiddenVolume; 1.1.1.6 root 107: BOOL readOnly; 1.1 root 108: unsigned __int64 volumeCreationTime; 109: unsigned __int64 headerCreationTime; 1.1.1.6 root 110: unsigned __int64 totalBytesRead; 111: unsigned __int64 totalBytesWritten; 112: int hiddenVolProtection; /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */ 1.1 root 113: } VOLUME_PROPERTIES_STRUCT; 114: 115: typedef struct 116: { 1.1.1.4 root 117: WCHAR symLinkName[TC_MAX_PATH]; 118: WCHAR targetName[TC_MAX_PATH]; 119: } RESOLVE_SYMLINK_STRUCT; 120: 121: typedef struct 122: { 1.1.1.10 root 123: WCHAR deviceName[TC_MAX_PATH]; 124: PARTITION_INFORMATION partInfo; 1.1.1.12! root 125: BOOL IsGPT; 1.1.1.10 root 126: } 127: DISK_PARTITION_INFO_STRUCT; 128: 129: typedef struct 130: { 131: WCHAR deviceName[TC_MAX_PATH]; 132: DISK_GEOMETRY diskGeometry; 133: } 134: DISK_GEOMETRY_STRUCT; 135: 136: typedef struct 137: { 1.1.1.12! root 138: WCHAR DeviceName[TC_MAX_PATH]; ! 139: LARGE_INTEGER RealDriveSize; ! 140: } ProbeRealDriveSizeRequest; ! 141: ! 142: typedef struct ! 143: { 1.1 root 144: short wszFileName[TC_MAX_PATH]; /* Volume to be "open tested" */ 145: } OPEN_TEST_STRUCT; 146: 147: 1.1.1.12! root 148: typedef enum ! 149: { ! 150: SetupNone = 0, ! 151: SetupEncryption, ! 152: SetupDecryption ! 153: } BootEncryptionSetupMode; ! 154: ! 155: ! 156: typedef struct ! 157: { ! 158: BOOL DeviceFilterActive; ! 159: ! 160: uint16 BootLoaderVersion; ! 161: ! 162: BOOL DriveMounted; ! 163: BOOL VolumeHeaderPresent; ! 164: BOOL DriveEncrypted; ! 165: ! 166: LARGE_INTEGER BootDriveLength; ! 167: ! 168: int64 ConfiguredEncryptedAreaStart; ! 169: int64 ConfiguredEncryptedAreaEnd; ! 170: int64 EncryptedAreaStart; ! 171: int64 EncryptedAreaEnd; ! 172: ! 173: uint32 VolumeHeaderSaltCrc32; ! 174: ! 175: BOOL SetupInProgress; ! 176: BootEncryptionSetupMode SetupMode; ! 177: BOOL TransformWaitingForIdle; ! 178: ! 179: uint32 HibernationPreventionCount; ! 180: ! 181: } BootEncryptionStatus; ! 182: ! 183: ! 184: typedef struct ! 185: { ! 186: BootEncryptionSetupMode SetupMode; ! 187: WipeAlgorithmId WipeAlgorithm; ! 188: } BootEncryptionSetupRequest; ! 189: ! 190: ! 191: typedef struct ! 192: { ! 193: Password VolumePassword; ! 194: } ReopenBootVolumeHeaderRequest; ! 195: ! 196: 1.1 root 197: #pragma pack (pop) 198: 199: #ifdef NT4_DRIVER 200: #define DRIVER_STR WIDE 201: #else 202: #define DRIVER_STR 203: #endif 204: 205: /* NT only */ 206: 207: #define TC_UNIQUE_ID_PREFIX "TrueCrypt" 208: #define TC_MOUNT_PREFIX L"\\Device\\TrueCryptVolume" 209: 210: #define NT_MOUNT_PREFIX DRIVER_STR("\\Device\\TrueCryptVolume") 211: #define NT_ROOT_PREFIX DRIVER_STR("\\Device\\TrueCrypt") 212: #define DOS_MOUNT_PREFIX DRIVER_STR("\\DosDevices\\") 213: #define DOS_ROOT_PREFIX DRIVER_STR("\\DosDevices\\TrueCrypt") 214: #define WIN32_ROOT_PREFIX DRIVER_STR("\\\\.\\TrueCrypt") 1.1.1.6 root 215: 216: #endif /* _WIN32 */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.