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

1.1.1.3 ! root        1: /* The source code contained in this file has been derived from the source code
        !             2:    of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
        !             3:    additions to that source code contained in this file are Copyright (c) 2004
        !             4:    TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
        !             5:    parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
        !             6:    release. Please see the file license.txt for full license details. */
1.1       root        7: 
                      8: /* DeviceIoControl values.
                      9: 
                     10: */
                     11: 
                     12: #ifndef CTL_CODE
                     13: 
                     14: /* A macro from the NT DDK */
                     15: 
                     16: #define CTL_CODE( DeviceType, Function, Method, Access ) ( \
                     17:     ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
                     18: )
                     19: 
                     20: #endif
                     21: 
                     22: /* More macros from the NT DDK */
                     23: 
                     24: #ifndef METHOD_BUFFERED
                     25: #define METHOD_BUFFERED 0
                     26: #endif
                     27: 
                     28: #ifndef FILE_ANY_ACCESS
                     29: #define FILE_ANY_ACCESS 0
                     30: #endif
                     31: 
                     32: #ifndef FILE_DEVICE_DISK
                     33: #define FILE_DEVICE_DISK 0x00000007
                     34: #endif
                     35: 
                     36: #ifndef IOCTL_DISK_BASE
                     37: #define IOCTL_DISK_BASE FILE_DEVICE_DISK
                     38: #endif
                     39: 
                     40: /* These values originate from the following NT DDK macro :
                     41: 
                     42: #define ANYNAME CTL_CODE(IOCTL_DISK_BASE, 0x800, METHOD_BUFFERED, \
                     43:    FILE_ANY_ACCESS)
                     44: 
                     45: #define ANYNAME2 CTL_CODE(IOCTL_DISK_BASE, 0x801, METHOD_BUFFERED, \
                     46:    FILE_ANY_ACCESS)
                     47: 
                     48: etc... */
                     49: 
                     50: /* Public driver interface codes */
                     51: 
                     52: #define MOUNT                  466944  /* Mount a volume or partition */
                     53: #define MOUNT_LIST             466948  /* Return list of mounted volumes */
                     54: #define OPEN_TEST              466952  /* Open a file at ring0 */
                     55: #define UNMOUNT                        466956  /* Unmount a volume */
                     56: #define WIPE_CACHE             466960  /* Wipe the driver password cache */
                     57: #define HALT_SYSTEM            466964  /* Halt system; (only NT when compiled with debug) */
                     58: #define DRIVER_VERSION         466968  /* Current driver version */
                     59: #define RELEASE_TIME_SLICE     466972  /* Release time slice on apps behalf (only Win9x) */
                     60: #define MOUNT_LIST_N           466976  /* Get volume info from the device (only Win9x) */
                     61: #define DISKIO                         466980  /* Read/Write at ring0 for win32 gui (only Win9x) */
                     62: #define ALLOW_FAST_SHUTDOWN 466984     /* Fast shutdown under win98 (only Win9x) */
                     63: #define CACHE_STATUS           466988  /* Get password cache status */
                     64: #define VOLUME_PROPERTIES      466992  /* Get mounted volume properties */
                     65: 
                     66: #define UNMOUNT_PENDING                475112  /* Flush the device with this api
                     67:                                           before sending UNMOUNT */
                     68: 
                     69: #define TC_FIRST_PRIVATE       MOUNT   /* First private control code */
                     70: #define TC_LAST_PRIVATE        UNMOUNT_PENDING /* Last private control code */
                     71: 
                     72: /* Start of driver interface structures, the size of these structures may
                     73:    change between versions; so make sure you first send DRIVER_VERSION to
                     74:    check that it's the correct device driver */
                     75: 
                     76: #pragma pack (push)
                     77: #pragma pack(1)
                     78: 
                     79: typedef struct
                     80: {
                     81:        int nReturnCode;        /* Return code back from driver */
                     82:        short wszVolume[TC_MAX_PATH];   /* Volume to be mounted */
                     83:        char szPassword[MAX_PASSWORD + 1];      /* User password or SHA1 hash */
                     84:        int nPasswordLen;       /* User password length */
                     85:        BOOL bCache;            /* Cache passwords in driver */
                     86:        int nDosDriveNo;        /* Drive number to mount */
                     87:        long time;              /* Time when this volume was mounted */
                     88: } MOUNT_STRUCT;
                     89: 
                     90: typedef struct
                     91: {
                     92:        int nReturnCode;        /* Return code back from driver */
                     93:        int nDosDriveNo;        /* Drive letter to unmount */
                     94: } UNMOUNT_STRUCT;
                     95: 
                     96: typedef struct
                     97: {
                     98:        unsigned long ulMountedDrives;  /* Bitfield of all mounted drive letters */
                     99:        short wszVolume[26][64];        /* Volume names of mounted volumes */
                    100:        unsigned __int64 diskLength[26];
                    101:        int cipher[26];
                    102: } MOUNT_LIST_STRUCT;
                    103: 
                    104: typedef struct
                    105: {
                    106:        int driveNo;
                    107:        short wszVolume[64];
                    108:        unsigned __int64 diskLength;
                    109:        int cipher;
                    110:        int pkcs5;
                    111:        int pkcs5Iterations;
                    112:        unsigned __int64 volumeCreationTime;
                    113:        unsigned __int64 headerCreationTime;
                    114:        //int readOnly;
                    115: } VOLUME_PROPERTIES_STRUCT;
                    116: 
                    117: typedef struct
                    118: {
                    119:        short wszFileName[TC_MAX_PATH]; /* Volume to be "open tested" */
                    120:        int nReturnCode;        /* Win9x only */
                    121:        unsigned long secstart; /* Win9x only */
                    122:        unsigned long seclast;  /* Win9x only */
                    123:        unsigned long device;   /* Win9x only */
                    124: } OPEN_TEST_STRUCT;
                    125: 
                    126: /* Win9x only */
                    127: typedef struct
                    128: {
                    129:        int nReturnCode;        /* Return code back from driver */
                    130:        int nDosDriveNo;        /* Drive letter to get info on */
                    131:        short wszVolume[TC_MAX_PATH];   /* Volume names of mounted volumes */
                    132:        unsigned long mountfilehandle;  /* Device file handle or 0 */
                    133: } MOUNT_LIST_N_STRUCT;
                    134: 
                    135: /* Win9x only */
                    136: typedef struct
                    137: {
                    138:        unsigned int devicenum; /* Ptr to dcb for device */
                    139:        unsigned int sectorstart;       /* Start sector */
                    140:        unsigned int sectorlen; /* Number of sectors */
                    141:        char *bufferad;         /* Address of buffer */
                    142:        int mode;               /* Read=0 or Write=1 */
                    143:        int nReturnCode;        /* Return code back from driver */
                    144: } DISKIO_STRUCT;
                    145: 
                    146: 
                    147: #pragma pack (pop)
                    148: 
                    149: #ifdef NT4_DRIVER
                    150: #define DRIVER_STR WIDE
                    151: #else
                    152: #define DRIVER_STR
                    153: #endif
                    154: 
                    155: /* NT only */
                    156: 
                    157: #define TC_UNIQUE_ID_PREFIX "TrueCrypt"
                    158: #define TC_MOUNT_PREFIX L"\\Device\\TrueCryptVolume"
                    159: 
                    160: #define NT_MOUNT_PREFIX DRIVER_STR("\\Device\\TrueCryptVolume")
                    161: #define NT_ROOT_PREFIX DRIVER_STR("\\Device\\TrueCrypt")
                    162: #define DOS_MOUNT_PREFIX DRIVER_STR("\\DosDevices\\")
                    163: #define DOS_ROOT_PREFIX DRIVER_STR("\\DosDevices\\TrueCrypt")
                    164: #define WIN32_ROOT_PREFIX DRIVER_STR("\\\\.\\TrueCrypt")
                    165: 
                    166: /* Win9x only */
                    167: 
                    168: #define WIN9X_DRIVER_NAME "\\\\.\\TRUCRYPT"

unix.superglobalmegacorp.com

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