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

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
        !             7:  TrueCrypt License 2.2 the full text of which is contained in the file
        !             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 */
                     64: #define MOUNT_LIST             466948  /* Return list of mounted volumes */
                     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.4   root       76: #define UNMOUNT_ALL                    475112  /* Unmount all volumes */
1.1       root       77: 
                     78: #define TC_FIRST_PRIVATE       MOUNT   /* First private control code */
1.1.1.4   root       79: #define TC_LAST_PRIVATE        UNMOUNT_ALL     /* Last private control code */
1.1       root       80: 
                     81: /* Start of driver interface structures, the size of these structures may
                     82:    change between versions; so make sure you first send DRIVER_VERSION to
                     83:    check that it's the correct device driver */
                     84: 
                     85: #pragma pack (push)
                     86: #pragma pack(1)
                     87: 
                     88: typedef struct
                     89: {
1.1.1.6   root       90:        int nReturnCode;                                        /* Return code back from driver */
                     91:        short wszVolume[TC_MAX_PATH];           /* Volume to be mounted */
                     92:        Password VolumePassword;                        /* User password */
                     93:        BOOL bCache;                                            /* Cache passwords in driver */
                     94:        int nDosDriveNo;                                        /* Drive number to mount */
1.1.1.10! root       95:        int BytesPerSector;
1.1.1.8   root       96:        BOOL bSystemVolume;                                     /* Volume is used by system and hidden from user */
                     97:        BOOL bPersistentVolume;                         /* Volume is hidden from user */
1.1.1.6   root       98:        BOOL bMountReadOnly;                            /* Mount volume in read-only mode */
                     99:        BOOL bMountRemovable;                           /* Mount volume as removable media */
                    100:        BOOL bExclusiveAccess;                          /* Open host file/device in exclusive access mode */
                    101:        BOOL bMountManager;                                     /* Announce volume to mount manager */
                    102:        BOOL bUserContext;                                      /* Mount volume in user process context */
                    103:        BOOL bPreserveTimestamp;                        /* Preserve file container timestamp */
                    104:        // Hidden volume protection
                    105:        BOOL bProtectHiddenVolume;                      /* TRUE if the user wants the hidden volume within this volume to be protected against being overwritten (damaged) */
                    106:        Password ProtectedHidVolPassword;       /* Password to the hidden volume to be protected against overwriting */
1.1       root      107: } MOUNT_STRUCT;
                    108: 
                    109: typedef struct
                    110: {
                    111:        int nDosDriveNo;        /* Drive letter to unmount */
1.1.1.4   root      112:        BOOL ignoreOpenFiles;
                    113:        int nReturnCode;        /* Return code back from driver */
1.1       root      114: } UNMOUNT_STRUCT;
                    115: 
                    116: typedef struct
                    117: {
1.1.1.6   root      118:        unsigned __int32 ulMountedDrives;       /* Bitfield of all mounted drive letters */
1.1.1.7   root      119:        short wszVolume[26][TC_MAX_PATH];       /* Volume names of mounted volumes */
1.1       root      120:        unsigned __int64 diskLength[26];
1.1.1.4   root      121:        int ea[26];
1.1.1.6   root      122:        int volumeType[26];     /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */
1.1       root      123: } MOUNT_LIST_STRUCT;
                    124: 
                    125: typedef struct
                    126: {
                    127:        int driveNo;
1.1.1.6   root      128:        int uniqueId;
1.1.1.7   root      129:        short wszVolume[TC_MAX_PATH];
1.1       root      130:        unsigned __int64 diskLength;
1.1.1.4   root      131:        int ea;
1.1.1.7   root      132:        int mode;
1.1       root      133:        int pkcs5;
                    134:        int pkcs5Iterations;
1.1.1.4   root      135:        BOOL hiddenVolume;
1.1.1.6   root      136:        BOOL readOnly;
1.1.1.8   root      137:        BOOL systemVolume;
                    138:        BOOL persistentVolume;
1.1       root      139:        unsigned __int64 volumeCreationTime;
                    140:        unsigned __int64 headerCreationTime;
1.1.1.6   root      141:        unsigned __int64 totalBytesRead;
                    142:        unsigned __int64 totalBytesWritten;
                    143:        int hiddenVolProtection;        /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
1.1       root      144: } VOLUME_PROPERTIES_STRUCT;
                    145: 
                    146: typedef struct
                    147: {
1.1.1.4   root      148:        WCHAR symLinkName[TC_MAX_PATH];
                    149:        WCHAR targetName[TC_MAX_PATH];
                    150: } RESOLVE_SYMLINK_STRUCT;
                    151: 
                    152: typedef struct
                    153: {
1.1.1.10! root      154:        WCHAR deviceName[TC_MAX_PATH];
        !           155:        PARTITION_INFORMATION partInfo;
        !           156: }
        !           157: DISK_PARTITION_INFO_STRUCT;
        !           158: 
        !           159: typedef struct
        !           160: {
        !           161:        WCHAR deviceName[TC_MAX_PATH];
        !           162:        DISK_GEOMETRY diskGeometry;
        !           163: }
        !           164: DISK_GEOMETRY_STRUCT;
        !           165: 
        !           166: typedef struct
        !           167: {
1.1       root      168:        short wszFileName[TC_MAX_PATH]; /* Volume to be "open tested" */
                    169: } OPEN_TEST_STRUCT;
                    170: 
                    171: 
                    172: #pragma pack (pop)
                    173: 
                    174: #ifdef NT4_DRIVER
                    175: #define DRIVER_STR WIDE
                    176: #else
                    177: #define DRIVER_STR
                    178: #endif
                    179: 
                    180: /* NT only */
                    181: 
                    182: #define TC_UNIQUE_ID_PREFIX "TrueCrypt"
                    183: #define TC_MOUNT_PREFIX L"\\Device\\TrueCryptVolume"
                    184: 
                    185: #define NT_MOUNT_PREFIX DRIVER_STR("\\Device\\TrueCryptVolume")
                    186: #define NT_ROOT_PREFIX DRIVER_STR("\\Device\\TrueCrypt")
                    187: #define DOS_MOUNT_PREFIX DRIVER_STR("\\DosDevices\\")
                    188: #define DOS_ROOT_PREFIX DRIVER_STR("\\DosDevices\\TrueCrypt")
                    189: #define WIN32_ROOT_PREFIX DRIVER_STR("\\\\.\\TrueCrypt")
1.1.1.6   root      190: 
                    191: #endif         /* _WIN32 */

unix.superglobalmegacorp.com

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