|
|
1.1.1.8 ! 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: // Version displayed to user 1.1.1.8 ! root 11: #define VERSION_STRING "4.0" 1.1 root 12: 13: // Version number to compare against driver 1.1.1.8 ! root 14: #define VERSION_NUM 0x0400 1.1 root 15: 16: // Version number written to volume header during format, 17: // specifies the minimum program version required to mount the volume 1.1.1.8 ! root 18: #define VOL_REQ_PROG_VERSION 0x0100 1.1.1.6 root 19: 20: // Volume header version 21: #define VOLUME_HEADER_VERSION 0x0002 1.1 root 22: 23: #define TC_MAX_PATH 260 /* Includes the null terminator */ 1.1.1.8 ! root 24: #define SECTOR_SIZE 512 /* Filesystem sector size */ 1.1 root 25: 1.1.1.6 root 26: #define BYTES_PER_KB 1024I64 27: #define BYTES_PER_MB 1048576I64 28: #define BYTES_PER_GB 1073741824I64 29: #define BYTES_PER_TB 1099511627776I64 30: #define BYTES_PER_PB 1125899906842624I64 1.1 root 31: 32: /* GUI/driver errors */ 33: 34: #define ERR_OS_ERROR 1 35: #define ERR_OUTOFMEMORY 2 36: #define ERR_PASSWORD_WRONG 3 37: #define ERR_VOL_FORMAT_BAD 4 38: #define ERR_BAD_DRIVE_LETTER 5 39: #define ERR_DRIVE_NOT_FOUND 6 40: #define ERR_FILES_OPEN 7 41: #define ERR_VOL_SIZE_WRONG 8 42: #define ERR_COMPRESSION_NOT_SUPPORTED 9 43: #define ERR_PASSWORD_CHANGE_VOL_TYPE 10 44: #define ERR_PASSWORD_CHANGE_VOL_VERSION 11 45: #define ERR_VOL_SEEKING 12 46: #define ERR_VOL_WRITING 13 47: #define ERR_FILES_OPEN_LOCK 14 48: #define ERR_VOL_READING 15 49: #define ERR_DRIVER_VERSION 16 50: #define ERR_NEW_VERSION_REQUIRED 17 1.1.1.8 ! root 51: #define ERR_CIPHER_INIT_FAILURE 18 ! 52: #define ERR_CIPHER_INIT_WEAK_KEY 19 ! 53: #define ERR_SELF_TESTS_FAILED 20 1.1 root 54: 55: #define ERR_VOL_ALREADY_MOUNTED 32 56: #define ERR_NO_FREE_SLOTS 33 57: #define ERR_NO_FREE_DRIVES 34 58: #define ERR_FILE_OPEN_FAILED 35 59: #define ERR_VOL_MOUNT_FAILED 36 60: #define ERR_INVALID_DEVICE 37 61: #define ERR_ACCESS_DENIED 38 62: 1.1.1.7 root 63: #define ERR_DONT_REPORT 100 64: 1.1 root 65: #define MIN_VOLUME_SIZE 19456 1.1.1.6 root 66: #define MIN_HIDDEN_VOLUME_HOST_SIZE ( MIN_VOLUME_SIZE * 2 + HIDDEN_VOL_HEADER_OFFSET + HEADER_SIZE ) 1.1 root 67: #define MAX_VOLUME_SIZE 0x7fffFFFFffffFFFFI64 1.1.1.6 root 68: #define MAX_FAT_VOLUME_SIZE 0xFFFFFFFE00I64 // Should be possible to increase up to 0x1FFFFFFFC00I64 (untested) 69: #define MAX_HIDDEN_VOLUME_HOST_SIZE MAX_FAT_VOLUME_SIZE 70: #define MAX_HIDDEN_VOLUME_SIZE ( MAX_HIDDEN_VOLUME_HOST_SIZE - HIDDEN_VOL_HEADER_OFFSET - HEADER_SIZE ) 1.1 root 71: 72: #define burn(mem,size) \ 73: memset(mem,0xff,size); \ 74: memset(mem,0,size); 75: 76: #define WIDE(x) (LPWSTR)L##x 77: 1.1.1.8 ! root 78: #ifndef LINUX_DRIVER 1.1 root 79: #include <string.h> 1.1.1.8 ! root 80: #endif 1.1 root 81: 82: #pragma intrinsic(memcmp, memcpy, memset, strcat, strcmp, strcpy, strlen) 83: 84: #ifdef NT4_DRIVER 85: 86: #pragma warning( disable : 4201 ) 87: #pragma warning( disable : 4214 ) 88: #pragma warning( disable : 4115 ) 89: #pragma warning( disable : 4100 ) 90: #pragma warning( disable : 4101 ) 91: #pragma warning( disable : 4057 ) 92: #pragma warning( disable : 4244 ) 93: #pragma warning( disable : 4514 ) 94: #pragma warning( disable : 4127 ) 95: 96: 97: #include <ntddk.h> /* Standard header file for nt drivers */ 98: #undef _WIN32_WINNT 99: #define _WIN32_WINNT 0x0501 100: #include <ntdddisk.h> /* Standard I/O control codes */ 101: #include <ntiologc.h> 102: 103: #pragma warning( default : 4201 ) 104: #pragma warning( default : 4214 ) 105: #pragma warning( default : 4115 ) 106: #pragma warning( default : 4100 ) 107: #pragma warning( default : 4101 ) 108: #pragma warning( default : 4057 ) 109: #pragma warning( default : 4244 ) 110: #pragma warning( default : 4127 ) 111: 112: /* #pragma warning( default : 4514 ) this warning remains disabled */ 113: 114: #define TCalloc(size) ((void *) ExAllocatePoolWithTag( NonPagedPool, size, 'MMCT' )) 115: #define TCfree(memblock) ExFreePoolWithTag( memblock, 'MMCT' ) 116: 117: #define DEVICE_DRIVER 118: 119: #ifndef BOOL 120: typedef int BOOL; 121: #endif 122: 123: #ifndef TRUE 124: #define TRUE 1 125: #endif 126: 127: #ifndef FALSE 128: #define FALSE !TRUE 129: #endif 130: 131: /* Define dummies for the drivers */ 132: typedef int HFILE; 133: typedef unsigned int WPARAM; 1.1.1.8 ! root 134: typedef unsigned __int32 LPARAM; 1.1 root 135: #define CALLBACK 136: 137: #ifndef UINT 138: typedef unsigned int UINT; 139: #endif 140: 141: #ifndef LRESULT 1.1.1.8 ! root 142: typedef unsigned __int32 LRESULT; 1.1 root 143: #endif 144: 1.1.1.8 ! root 145: #else /* NT4_DRIVER */ 1.1 root 146: 147: #define TCalloc malloc 148: #define TCfree free 149: 1.1.1.8 ! root 150: #ifdef _WIN32 ! 151: 1.1 root 152: #pragma warning( disable : 4201 ) 153: #pragma warning( disable : 4214 ) 154: #pragma warning( disable : 4115 ) 155: #pragma warning( disable : 4514 ) 156: 157: #undef _WIN32_WINNT 158: #define _WIN32_WINNT 0x0501 159: #include <windows.h> /* Windows header */ 160: #include <commctrl.h> /* The common controls */ 161: #include <process.h> /* Process control */ 162: #include <winioctl.h> 163: #include <stdio.h> /* For sprintf */ 164: 165: #pragma warning( default : 4201 ) 166: #pragma warning( default : 4214 ) 167: #pragma warning( default : 4115 ) 168: 169: /* #pragma warning( default : 4514 ) this warning remains disabled */ 170: 171: /* This is needed to fix a bug with VC 5, the TCHAR macro _ttoi64 maps 172: incorrectly to atoi64 when it should be _atoi64 */ 173: #define atoi64 _atoi64 174: 1.1.1.8 ! root 175: #endif /* _WIN32 */ 1.1 root 176: 1.1.1.8 ! root 177: #endif /* NT4_DRIVER */ ! 178: ! 179: #ifdef _WIN32 1.1 root 180: 1.1.1.8 ! root 181: typedef UINT (_stdcall * diskio_f) (int, void *, UINT); 1.1 root 182: #pragma hdrstop 1.1.1.8 ! root 183: ! 184: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.