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

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
        !             5:    contained in this file are Copyright (c) 2004-2005 TrueCrypt Foundation and
        !             6:    Copyright (c) 2004 TrueCrypt Team, and are covered by TrueCrypt License 2.0
        !             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 */
        !            92:        BOOL bMountReadOnly;                            /* Mount volume in read-only mode */
        !            93:        BOOL bMountRemovable;                           /* Mount volume as removable media */
        !            94:        BOOL bExclusiveAccess;                          /* Open host file/device in exclusive access mode */
        !            95:        BOOL bMountManager;                                     /* Announce volume to mount manager */
        !            96:        BOOL bUserContext;                                      /* Mount volume in user process context */
        !            97:        BOOL bPreserveTimestamp;                        /* Preserve file container timestamp */
        !            98:        // Hidden volume protection
        !            99:        BOOL bProtectHiddenVolume;                      /* TRUE if the user wants the hidden volume within this volume to be protected against being overwritten (damaged) */
        !           100:        Password ProtectedHidVolPassword;       /* Password to the hidden volume to be protected against overwriting */
1.1       root      101: } MOUNT_STRUCT;
                    102: 
                    103: typedef struct
                    104: {
                    105:        int nDosDriveNo;        /* Drive letter to unmount */
1.1.1.4   root      106:        BOOL ignoreOpenFiles;
                    107:        int nReturnCode;        /* Return code back from driver */
1.1       root      108: } UNMOUNT_STRUCT;
                    109: 
                    110: typedef struct
                    111: {
1.1.1.6 ! root      112:        unsigned __int32 ulMountedDrives;       /* Bitfield of all mounted drive letters */
1.1       root      113:        short wszVolume[26][64];        /* Volume names of mounted volumes */
                    114:        unsigned __int64 diskLength[26];
1.1.1.4   root      115:        int ea[26];
1.1.1.6 ! root      116:        int volumeType[26];     /* Volume type (e.g. PROP_VOL_TYPE_OUTER, PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED, etc.) */
1.1       root      117: } MOUNT_LIST_STRUCT;
                    118: 
                    119: typedef struct
                    120: {
                    121:        int driveNo;
1.1.1.6 ! root      122:        int uniqueId;
1.1       root      123:        short wszVolume[64];
                    124:        unsigned __int64 diskLength;
1.1.1.4   root      125:        int ea;
1.1       root      126:        int pkcs5;
                    127:        int pkcs5Iterations;
1.1.1.4   root      128:        BOOL hiddenVolume;
1.1.1.6 ! root      129:        BOOL readOnly;
1.1       root      130:        unsigned __int64 volumeCreationTime;
                    131:        unsigned __int64 headerCreationTime;
1.1.1.6 ! root      132:        unsigned __int64 totalBytesRead;
        !           133:        unsigned __int64 totalBytesWritten;
        !           134:        int hiddenVolProtection;        /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
1.1       root      135: } VOLUME_PROPERTIES_STRUCT;
                    136: 
                    137: typedef struct
                    138: {
1.1.1.4   root      139:        WCHAR symLinkName[TC_MAX_PATH];
                    140:        WCHAR targetName[TC_MAX_PATH];
                    141: } RESOLVE_SYMLINK_STRUCT;
                    142: 
                    143: typedef struct
                    144: {
1.1       root      145:        short wszFileName[TC_MAX_PATH]; /* Volume to be "open tested" */
                    146: } OPEN_TEST_STRUCT;
                    147: 
                    148: 
                    149: #pragma pack (pop)
                    150: 
                    151: #ifdef NT4_DRIVER
                    152: #define DRIVER_STR WIDE
                    153: #else
                    154: #define DRIVER_STR
                    155: #endif
                    156: 
                    157: /* NT only */
                    158: 
                    159: #define TC_UNIQUE_ID_PREFIX "TrueCrypt"
                    160: #define TC_MOUNT_PREFIX L"\\Device\\TrueCryptVolume"
                    161: 
                    162: #define NT_MOUNT_PREFIX DRIVER_STR("\\Device\\TrueCryptVolume")
                    163: #define NT_ROOT_PREFIX DRIVER_STR("\\Device\\TrueCrypt")
                    164: #define DOS_MOUNT_PREFIX DRIVER_STR("\\DosDevices\\")
                    165: #define DOS_ROOT_PREFIX DRIVER_STR("\\DosDevices\\TrueCrypt")
                    166: #define WIN32_ROOT_PREFIX DRIVER_STR("\\\\.\\TrueCrypt")
1.1.1.6 ! root      167: 
        !           168: #endif         /* _WIN32 */

unix.superglobalmegacorp.com

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