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

1.1.1.10  root        1: /*
                      2:  Legal Notice: The source code contained in this file has been derived from
                      3:  the source code of Encryption for the Masses 2.02a, which is Copyright (c)
                      4:  Paul Le Roux and which is covered by the 'License Agreement for Encryption
                      5:  for the Masses'. Modifications and additions to that source code contained
                      6:  in this file are Copyright (c) TrueCrypt Foundation and are covered by the
1.1.1.11! root        7:  TrueCrypt License 2.3 the full text of which is contained in the file
1.1.1.10  root        8:  License.txt included in TrueCrypt binary and source code distribution
                      9:  packages. */
1.1       root       10: 
                     11: /* DeviceIoControl values.
                     12: 
                     13: */
                     14: 
1.1.1.6   root       15: #pragma once
                     16: 
                     17: #include "Tcdefs.h"
                     18: #include "Common.h"
                     19: #include "Crypto.h"
                     20: 
                     21: #ifdef _WIN32
                     22: 
1.1       root       23: #ifndef CTL_CODE
                     24: 
                     25: /* A macro from the NT DDK */
                     26: 
                     27: #define CTL_CODE( DeviceType, Function, Method, Access ) ( \
                     28:     ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
                     29: )
                     30: 
                     31: #endif
                     32: 
                     33: /* More macros from the NT DDK */
                     34: 
                     35: #ifndef METHOD_BUFFERED
                     36: #define METHOD_BUFFERED 0
                     37: #endif
                     38: 
                     39: #ifndef FILE_ANY_ACCESS
                     40: #define FILE_ANY_ACCESS 0
                     41: #endif
                     42: 
                     43: #ifndef FILE_DEVICE_DISK
                     44: #define FILE_DEVICE_DISK 0x00000007
                     45: #endif
                     46: 
                     47: #ifndef IOCTL_DISK_BASE
                     48: #define IOCTL_DISK_BASE FILE_DEVICE_DISK
                     49: #endif
                     50: 
                     51: /* These values originate from the following NT DDK macro :
                     52: 
                     53: #define ANYNAME CTL_CODE(IOCTL_DISK_BASE, 0x800, METHOD_BUFFERED, \
                     54:    FILE_ANY_ACCESS)
                     55: 
                     56: #define ANYNAME2 CTL_CODE(IOCTL_DISK_BASE, 0x801, METHOD_BUFFERED, \
                     57:    FILE_ANY_ACCESS)
                     58: 
                     59: etc... */
                     60: 
                     61: /* Public driver interface codes */
                     62: 
                     63: #define MOUNT                  466944  /* Mount a volume or partition */
1.1.1.11! root       64: #define MOUNT_LIST_ALL 466948  /* Return list of mounted volumes */
1.1       root       65: #define OPEN_TEST              466952  /* Open a file at ring0 */
                     66: #define UNMOUNT                        466956  /* Unmount a volume */
                     67: #define WIPE_CACHE             466960  /* Wipe the driver password cache */
                     68: #define HALT_SYSTEM            466964  /* Halt system; (only NT when compiled with debug) */
                     69: #define DRIVER_VERSION         466968  /* Current driver version */
                     70: #define CACHE_STATUS           466988  /* Get password cache status */
                     71: #define VOLUME_PROPERTIES      466992  /* Get mounted volume properties */
1.1.1.4   root       72: #define RESOLVE_SYMLINK                466996  /* Resolve symbolic link to target */
1.1.1.6   root       73: #define DEVICE_REFCOUNT                467000  /* Return reference count of root device object */
1.1.1.10  root       74: #define DISK_GET_PARTITION_INFO                467004
                     75: #define DISK_GET_GEOMETRY                      467008
1.1.1.11! root       76: #define REFERENCED_DEV_DELETED         467012
        !            77: #define MOUNT_LIST                                     467016
1.1.1.4   root       78: #define UNMOUNT_ALL                    475112  /* Unmount all volumes */
1.1       root       79: 
                     80: #define TC_FIRST_PRIVATE       MOUNT   /* First private control code */
1.1.1.4   root       81: #define TC_LAST_PRIVATE        UNMOUNT_ALL     /* Last private control code */
1.1       root       82: 
                     83: /* Start of driver interface structures, the size of these structures may
                     84:    change between versions; so make sure you first send DRIVER_VERSION to
                     85:    check that it's the correct device driver */
                     86: 
                     87: #pragma pack (push)
                     88: #pragma pack(1)
                     89: 
                     90: typedef struct
                     91: {
1.1.1.6   root       92:        int nReturnCode;                                        /* Return code back from driver */
                     93:        short wszVolume[TC_MAX_PATH];           /* Volume to be mounted */
                     94:        Password VolumePassword;                        /* User password */
                     95:        BOOL bCache;                                            /* Cache passwords in driver */
                     96:        int nDosDriveNo;                                        /* Drive number to mount */
1.1.1.10  root       97:        int BytesPerSector;
1.1.1.8   root       98:        BOOL bSystemVolume;                                     /* Volume is used by system and hidden from user */
                     99:        BOOL bPersistentVolume;                         /* Volume is hidden from user */
1.1.1.6   root      100:        BOOL bMountReadOnly;                            /* Mount volume in read-only mode */
                    101:        BOOL bMountRemovable;                           /* Mount volume as removable media */
                    102:        BOOL bExclusiveAccess;                          /* Open host file/device in exclusive access mode */
                    103:        BOOL bMountManager;                                     /* Announce volume to mount manager */
                    104:        BOOL bUserContext;                                      /* Mount volume in user process context */
                    105:        BOOL bPreserveTimestamp;                        /* Preserve file container timestamp */
                    106:        // Hidden volume protection
                    107:        BOOL bProtectHiddenVolume;                      /* TRUE if the user wants the hidden volume within this volume to be protected against being overwritten (damaged) */
                    108:        Password ProtectedHidVolPassword;       /* Password to the hidden volume to be protected against overwriting */
1.1       root      109: } MOUNT_STRUCT;
                    110: 
                    111: typedef struct
                    112: {
                    113:        int nDosDriveNo;        /* Drive letter to unmount */
1.1.1.4   root      114:        BOOL ignoreOpenFiles;
                    115:        int nReturnCode;        /* Return code back from driver */
1.1       root      116: } UNMOUNT_STRUCT;
                    117: 
                    118: typedef struct
                    119: {
1.1.1.6   root      120:        unsigned __int32 ulMountedDrives;       /* Bitfield of all mounted drive letters */
1.1.1.7   root      121:        short wszVolume[26][TC_MAX_PATH];       /* Volume names of mounted volumes */
1.1       root      122:        unsigned __int64 diskLength[26];
1.1.1.4   root      123:        int ea[26];
1.1.1.6   root      124:        int volumeType[26];     /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */
1.1       root      125: } MOUNT_LIST_STRUCT;
                    126: 
                    127: typedef struct
                    128: {
                    129:        int driveNo;
1.1.1.6   root      130:        int uniqueId;
1.1.1.7   root      131:        short wszVolume[TC_MAX_PATH];
1.1       root      132:        unsigned __int64 diskLength;
1.1.1.4   root      133:        int ea;
1.1.1.7   root      134:        int mode;
1.1       root      135:        int pkcs5;
                    136:        int pkcs5Iterations;
1.1.1.4   root      137:        BOOL hiddenVolume;
1.1.1.6   root      138:        BOOL readOnly;
1.1.1.8   root      139:        BOOL systemVolume;
                    140:        BOOL persistentVolume;
1.1       root      141:        unsigned __int64 volumeCreationTime;
                    142:        unsigned __int64 headerCreationTime;
1.1.1.6   root      143:        unsigned __int64 totalBytesRead;
                    144:        unsigned __int64 totalBytesWritten;
                    145:        int hiddenVolProtection;        /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
1.1       root      146: } VOLUME_PROPERTIES_STRUCT;
                    147: 
                    148: typedef struct
                    149: {
1.1.1.4   root      150:        WCHAR symLinkName[TC_MAX_PATH];
                    151:        WCHAR targetName[TC_MAX_PATH];
                    152: } RESOLVE_SYMLINK_STRUCT;
                    153: 
                    154: typedef struct
                    155: {
1.1.1.10  root      156:        WCHAR deviceName[TC_MAX_PATH];
                    157:        PARTITION_INFORMATION partInfo;
                    158: }
                    159: DISK_PARTITION_INFO_STRUCT;
                    160: 
                    161: typedef struct
                    162: {
                    163:        WCHAR deviceName[TC_MAX_PATH];
                    164:        DISK_GEOMETRY diskGeometry;
                    165: }
                    166: DISK_GEOMETRY_STRUCT;
                    167: 
                    168: typedef struct
                    169: {
1.1       root      170:        short wszFileName[TC_MAX_PATH]; /* Volume to be "open tested" */
                    171: } OPEN_TEST_STRUCT;
                    172: 
                    173: 
                    174: #pragma pack (pop)
                    175: 
                    176: #ifdef NT4_DRIVER
                    177: #define DRIVER_STR WIDE
                    178: #else
                    179: #define DRIVER_STR
                    180: #endif
                    181: 
                    182: /* NT only */
                    183: 
                    184: #define TC_UNIQUE_ID_PREFIX "TrueCrypt"
                    185: #define TC_MOUNT_PREFIX L"\\Device\\TrueCryptVolume"
                    186: 
                    187: #define NT_MOUNT_PREFIX DRIVER_STR("\\Device\\TrueCryptVolume")
                    188: #define NT_ROOT_PREFIX DRIVER_STR("\\Device\\TrueCrypt")
                    189: #define DOS_MOUNT_PREFIX DRIVER_STR("\\DosDevices\\")
                    190: #define DOS_ROOT_PREFIX DRIVER_STR("\\DosDevices\\TrueCrypt")
                    191: #define WIN32_ROOT_PREFIX DRIVER_STR("\\\\.\\TrueCrypt")
1.1.1.6   root      192: 
                    193: #endif         /* _WIN32 */

unix.superglobalmegacorp.com

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