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