Annotation of truecrypt/common/apidrvr.h, revision 1.1.1.14

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
1.1.1.14! root        8:  by the TrueCrypt License 2.5 the full text of which is contained in the
1.1.1.12  root        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.13  root       21: /* WARNING: Modifying the following values or their meanings 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)
1.1.1.13  root       48: #define TC_IOCTL_GET_BOOT_ENCRYPTION_ALGORITHM_NAME            TC_IOCTL (24)
                     49: #define TC_IOCTL_GET_TRAVELER_MODE_STATUS                              TC_IOCTL (25)
                     50: #define TC_IOCTL_SET_TRAVELER_MODE_STATUS                              TC_IOCTL (26)
1.1.1.14! root       51: #define TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING                              TC_IOCTL (27)
        !            52: #define TC_IOCTL_GET_SYSTEM_DRIVE_CONFIG                               TC_IOCTL (28)
        !            53: #define TC_IOCTL_DISK_IS_WRITABLE                                              TC_IOCTL (29)
1.1.1.12  root       54: 
                     55: // Legacy IOCTLs used before version 5.0
                     56: #define TC_IOCTL_LEGACY_GET_DRIVER_VERSION             466968
                     57: #define TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES            466948
1.1       root       58: 
                     59: 
                     60: /* Start of driver interface structures, the size of these structures may
                     61:    change between versions; so make sure you first send DRIVER_VERSION to
                     62:    check that it's the correct device driver */
                     63: 
                     64: #pragma pack (push)
                     65: #pragma pack(1)
                     66: 
                     67: typedef struct
                     68: {
1.1.1.6   root       69:        int nReturnCode;                                        /* Return code back from driver */
                     70:        short wszVolume[TC_MAX_PATH];           /* Volume to be mounted */
                     71:        Password VolumePassword;                        /* User password */
                     72:        BOOL bCache;                                            /* Cache passwords in driver */
                     73:        int nDosDriveNo;                                        /* Drive number to mount */
1.1.1.10  root       74:        int BytesPerSector;
1.1.1.6   root       75:        BOOL bMountReadOnly;                            /* Mount volume in read-only mode */
                     76:        BOOL bMountRemovable;                           /* Mount volume as removable media */
                     77:        BOOL bExclusiveAccess;                          /* Open host file/device in exclusive access mode */
                     78:        BOOL bMountManager;                                     /* Announce volume to mount manager */
                     79:        BOOL bUserContext;                                      /* Mount volume in user process context */
                     80:        BOOL bPreserveTimestamp;                        /* Preserve file container timestamp */
1.1.1.13  root       81:        BOOL bPartitionInInactiveSysEncScope;           /* If TRUE, we are to attempt to mount a partition located on an encrypted system drive without pre-boot authentication. */
                     82:        int nPartitionInInactiveSysEncScopeDriveNo;     /* If bPartitionInInactiveSysEncScope is TRUE, this contains the drive number of the system drive on which the partition is located. */
1.1.1.6   root       83:        // Hidden volume protection
                     84:        BOOL bProtectHiddenVolume;                      /* TRUE if the user wants the hidden volume within this volume to be protected against being overwritten (damaged) */
                     85:        Password ProtectedHidVolPassword;       /* Password to the hidden volume to be protected against overwriting */
1.1.1.14! root       86:        BOOL UseBackupHeader;
1.1       root       87: } MOUNT_STRUCT;
                     88: 
                     89: typedef struct
                     90: {
                     91:        int nDosDriveNo;        /* Drive letter to unmount */
1.1.1.4   root       92:        BOOL ignoreOpenFiles;
1.1.1.14! root       93:        BOOL HiddenVolumeProtectionTriggered;
1.1.1.4   root       94:        int nReturnCode;        /* Return code back from driver */
1.1       root       95: } UNMOUNT_STRUCT;
                     96: 
                     97: typedef struct
                     98: {
1.1.1.6   root       99:        unsigned __int32 ulMountedDrives;       /* Bitfield of all mounted drive letters */
1.1.1.7   root      100:        short wszVolume[26][TC_MAX_PATH];       /* Volume names of mounted volumes */
1.1       root      101:        unsigned __int64 diskLength[26];
1.1.1.4   root      102:        int ea[26];
1.1.1.6   root      103:        int volumeType[26];     /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */
1.1       root      104: } MOUNT_LIST_STRUCT;
                    105: 
                    106: typedef struct
                    107: {
                    108:        int driveNo;
1.1.1.6   root      109:        int uniqueId;
1.1.1.7   root      110:        short wszVolume[TC_MAX_PATH];
1.1       root      111:        unsigned __int64 diskLength;
1.1.1.4   root      112:        int ea;
1.1.1.7   root      113:        int mode;
1.1       root      114:        int pkcs5;
                    115:        int pkcs5Iterations;
1.1.1.4   root      116:        BOOL hiddenVolume;
1.1.1.6   root      117:        BOOL readOnly;
1.1       root      118:        unsigned __int64 volumeCreationTime;
                    119:        unsigned __int64 headerCreationTime;
1.1.1.6   root      120:        unsigned __int64 totalBytesRead;
                    121:        unsigned __int64 totalBytesWritten;
                    122:        int hiddenVolProtection;        /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
1.1.1.14! root      123:        int volFormatVersion;
1.1       root      124: } VOLUME_PROPERTIES_STRUCT;
                    125: 
                    126: typedef struct
                    127: {
1.1.1.4   root      128:        WCHAR symLinkName[TC_MAX_PATH];
                    129:        WCHAR targetName[TC_MAX_PATH];
                    130: } RESOLVE_SYMLINK_STRUCT;
                    131: 
                    132: typedef struct
                    133: {
1.1.1.10  root      134:        WCHAR deviceName[TC_MAX_PATH];
                    135:        PARTITION_INFORMATION partInfo;
1.1.1.12  root      136:        BOOL IsGPT;
1.1.1.10  root      137: }
                    138: DISK_PARTITION_INFO_STRUCT;
                    139: 
                    140: typedef struct
                    141: {
                    142:        WCHAR deviceName[TC_MAX_PATH];
                    143:        DISK_GEOMETRY diskGeometry;
                    144: }
                    145: DISK_GEOMETRY_STRUCT;
                    146: 
                    147: typedef struct
                    148: {
1.1.1.12  root      149:        WCHAR DeviceName[TC_MAX_PATH];
                    150:        LARGE_INTEGER RealDriveSize;
1.1.1.13  root      151:        BOOL TimeOut;
1.1.1.12  root      152: } ProbeRealDriveSizeRequest;
                    153: 
                    154: typedef struct
                    155: {
1.1.1.13  root      156:        short wszFileName[TC_MAX_PATH];         // Volume to be "open tested"
                    157:        BOOL bDetectTCBootLoader;                       // Whether the driver is to determine if the first sector contains a portion of the TrueCrypt Boot Loader
1.1       root      158: } OPEN_TEST_STRUCT;
                    159: 
                    160: 
1.1.1.12  root      161: typedef enum
                    162: {
                    163:        SetupNone = 0,
                    164:        SetupEncryption,
                    165:        SetupDecryption
                    166: } BootEncryptionSetupMode;
                    167: 
                    168: 
                    169: typedef struct
                    170: {
1.1.1.14! root      171:        // New fields must be added at the end of the structure to maintain compatibility with previous versions
1.1.1.12  root      172:        BOOL DeviceFilterActive;
                    173: 
                    174:        uint16 BootLoaderVersion;
                    175: 
                    176:        BOOL DriveMounted;
                    177:        BOOL VolumeHeaderPresent;
                    178:        BOOL DriveEncrypted;
                    179: 
                    180:        LARGE_INTEGER BootDriveLength;
                    181: 
                    182:        int64 ConfiguredEncryptedAreaStart;
                    183:        int64 ConfiguredEncryptedAreaEnd;
                    184:        int64 EncryptedAreaStart;
                    185:        int64 EncryptedAreaEnd;
                    186: 
                    187:        uint32 VolumeHeaderSaltCrc32;
                    188: 
                    189:        BOOL SetupInProgress;
                    190:        BootEncryptionSetupMode SetupMode;
                    191:        BOOL TransformWaitingForIdle;
                    192: 
                    193:        uint32 HibernationPreventionCount;
                    194: 
1.1.1.14! root      195:        BOOL HiddenSystem;
        !           196:        int64 HiddenSystemPartitionStart;
        !           197: 
        !           198:        // Number of times the filter driver answered that an unencrypted volume
        !           199:        // is read-only (or mounted an outer/normal TrueCrypt volume as read only)
        !           200:        uint32 HiddenSysLeakProtectionCount;
        !           201: 
1.1.1.12  root      202: } BootEncryptionStatus;
                    203: 
                    204: 
                    205: typedef struct
                    206: {
                    207:        BootEncryptionSetupMode SetupMode;
                    208:        WipeAlgorithmId WipeAlgorithm;
                    209: } BootEncryptionSetupRequest;
                    210: 
                    211: 
                    212: typedef struct
                    213: {
                    214:        Password VolumePassword;
                    215: } ReopenBootVolumeHeaderRequest;
                    216: 
                    217: 
1.1.1.13  root      218: typedef struct
                    219: {
                    220:        char BootEncryptionAlgorithmName[256];
                    221: } GetBootEncryptionAlgorithmNameRequest;
                    222: 
1.1.1.14! root      223: typedef struct
        !           224: {
        !           225:        wchar_t DevicePath[TC_MAX_PATH];
        !           226:        byte Configuration;
        !           227:        BOOL DriveIsDynamic;
        !           228: } GetSystemDriveConfigurationRequest;
1.1.1.13  root      229: 
1.1       root      230: #pragma pack (pop)
                    231: 
                    232: #ifdef NT4_DRIVER
                    233: #define DRIVER_STR WIDE
                    234: #else
                    235: #define DRIVER_STR
                    236: #endif
                    237: 
                    238: /* NT only */
                    239: 
1.1.1.13  root      240: #define TC_UNIQUE_ID_PREFIX "TrueCryptVolume"
1.1       root      241: #define TC_MOUNT_PREFIX L"\\Device\\TrueCryptVolume"
                    242: 
                    243: #define NT_MOUNT_PREFIX DRIVER_STR("\\Device\\TrueCryptVolume")
                    244: #define NT_ROOT_PREFIX DRIVER_STR("\\Device\\TrueCrypt")
                    245: #define DOS_MOUNT_PREFIX DRIVER_STR("\\DosDevices\\")
                    246: #define DOS_ROOT_PREFIX DRIVER_STR("\\DosDevices\\TrueCrypt")
                    247: #define WIN32_ROOT_PREFIX DRIVER_STR("\\\\.\\TrueCrypt")
1.1.1.6   root      248: 
1.1.1.14! root      249: #define TC_DRIVER_CONFIG_REG_VALUE_NAME DRIVER_STR("TrueCryptConfig")
        !           250: 
1.1.1.6   root      251: #endif         /* _WIN32 */

unix.superglobalmegacorp.com

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