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

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

unix.superglobalmegacorp.com

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