|
|
1.1.1.12 root 1: /*
2: Legal Notice: The source code contained in this file has been derived from
3: the source code of Encryption for the Masses 2.02a, which is Copyright (c)
4: Paul Le Roux and which is covered by the 'License Agreement for Encryption
5: for the Masses'. Modifications and additions to that source code contained
6: in this file are Copyright (c) TrueCrypt Foundation and are covered by the
1.1.1.13! root 7: TrueCrypt License 2.3 the full text of which is contained in the file
1.1.1.12 root 8: License.txt included in TrueCrypt binary and source code distribution
9: packages. */
1.1 root 10:
11: // Version displayed to user
1.1.1.13! root 12: #define VERSION_STRING "4.3a"
1.1 root 13:
14: // Version number to compare against driver
1.1.1.13! root 15: #define VERSION_NUM 0x043a
1.1 root 16:
17: // Version number written to volume header during format,
18: // specifies the minimum program version required to mount the volume
1.1.1.9 root 19: #define VOL_REQ_PROG_VERSION 0x0410
1.1.1.6 root 20:
21: // Volume header version
22: #define VOLUME_HEADER_VERSION 0x0002
1.1 root 23:
1.1.1.13! root 24: // Sector size of encrypted filesystem, which may differ from sector size
! 25: // of host filesystem/device (this is fully supported since v4.3).
1.1.1.12 root 26: #define SECTOR_SIZE 512
1.1 root 27:
1.1.1.10 root 28: #define BYTES_PER_KB 1024LL
29: #define BYTES_PER_MB 1048576LL
30: #define BYTES_PER_GB 1073741824LL
31: #define BYTES_PER_TB 1099511627776LL
32: #define BYTES_PER_PB 1125899906842624LL
1.1 root 33:
34: /* GUI/driver errors */
35:
1.1.1.11 root 36: #define ERR_SUCCESS 0
1.1 root 37: #define ERR_OS_ERROR 1
38: #define ERR_OUTOFMEMORY 2
39: #define ERR_PASSWORD_WRONG 3
40: #define ERR_VOL_FORMAT_BAD 4
41: #define ERR_DRIVE_NOT_FOUND 6
42: #define ERR_FILES_OPEN 7
43: #define ERR_VOL_SIZE_WRONG 8
44: #define ERR_COMPRESSION_NOT_SUPPORTED 9
45: #define ERR_PASSWORD_CHANGE_VOL_TYPE 10
46: #define ERR_PASSWORD_CHANGE_VOL_VERSION 11
47: #define ERR_VOL_SEEKING 12
48: #define ERR_VOL_WRITING 13
49: #define ERR_FILES_OPEN_LOCK 14
50: #define ERR_VOL_READING 15
51: #define ERR_DRIVER_VERSION 16
52: #define ERR_NEW_VERSION_REQUIRED 17
1.1.1.8 root 53: #define ERR_CIPHER_INIT_FAILURE 18
54: #define ERR_CIPHER_INIT_WEAK_KEY 19
55: #define ERR_SELF_TESTS_FAILED 20
1.1.1.12 root 56: #define ERR_SECTOR_SIZE_INCOMPATIBLE 21
1.1 root 57:
58: #define ERR_VOL_ALREADY_MOUNTED 32
59: #define ERR_NO_FREE_DRIVES 34
60: #define ERR_FILE_OPEN_FAILED 35
61: #define ERR_VOL_MOUNT_FAILED 36
62: #define ERR_INVALID_DEVICE 37
63: #define ERR_ACCESS_DENIED 38
1.1.1.9 root 64: #define ERR_MODE_INIT_FAILED 39
1.1 root 65:
1.1.1.7 root 66: #define ERR_DONT_REPORT 100
67:
1.1 root 68: #define MIN_VOLUME_SIZE 19456
1.1.1.6 root 69: #define MIN_HIDDEN_VOLUME_HOST_SIZE ( MIN_VOLUME_SIZE * 2 + HIDDEN_VOL_HEADER_OFFSET + HEADER_SIZE )
1.1.1.10 root 70: #define MAX_VOLUME_SIZE 0x7fffFFFFffffFFFFLL
1.1.1.12 root 71: #define MAX_FAT_VOLUME_SIZE 0x20000000000LL
1.1.1.6 root 72: #define MAX_HIDDEN_VOLUME_HOST_SIZE MAX_FAT_VOLUME_SIZE
73: #define MAX_HIDDEN_VOLUME_SIZE ( MAX_HIDDEN_VOLUME_HOST_SIZE - HIDDEN_VOL_HEADER_OFFSET - HEADER_SIZE )
1.1 root 74:
75: #define WIDE(x) (LPWSTR)L##x
76:
77: #ifdef NT4_DRIVER
78:
79: #pragma warning( disable : 4201 )
80: #pragma warning( disable : 4214 )
81: #pragma warning( disable : 4115 )
82: #pragma warning( disable : 4100 )
83: #pragma warning( disable : 4101 )
84: #pragma warning( disable : 4057 )
85: #pragma warning( disable : 4244 )
86: #pragma warning( disable : 4514 )
87: #pragma warning( disable : 4127 )
88:
89:
90: #include <ntddk.h> /* Standard header file for nt drivers */
91: #undef _WIN32_WINNT
92: #define _WIN32_WINNT 0x0501
93: #include <ntdddisk.h> /* Standard I/O control codes */
94: #include <ntiologc.h>
95:
96: #pragma warning( default : 4201 )
97: #pragma warning( default : 4214 )
98: #pragma warning( default : 4115 )
99: #pragma warning( default : 4100 )
100: #pragma warning( default : 4101 )
101: #pragma warning( default : 4057 )
102: #pragma warning( default : 4244 )
103: #pragma warning( default : 4127 )
104:
105: /* #pragma warning( default : 4514 ) this warning remains disabled */
106:
107: #define TCalloc(size) ((void *) ExAllocatePoolWithTag( NonPagedPool, size, 'MMCT' ))
108: #define TCfree(memblock) ExFreePoolWithTag( memblock, 'MMCT' )
109:
110: #define DEVICE_DRIVER
111:
112: #ifndef BOOL
113: typedef int BOOL;
114: #endif
115:
116: #ifndef TRUE
117: #define TRUE 1
118: #endif
119:
120: #ifndef FALSE
121: #define FALSE !TRUE
122: #endif
123:
124: /* Define dummies for the drivers */
125: typedef int HFILE;
126: typedef unsigned int WPARAM;
1.1.1.8 root 127: typedef unsigned __int32 LPARAM;
1.1 root 128: #define CALLBACK
129:
130: #ifndef UINT
131: typedef unsigned int UINT;
132: #endif
133:
134: #ifndef LRESULT
1.1.1.8 root 135: typedef unsigned __int32 LRESULT;
1.1 root 136: #endif
1.1.1.9 root 137: /* NT4_DRIVER */
138:
139: #elif defined(LINUX_DRIVER)
140:
141: #define TCalloc(size) (kmalloc( size, GFP_KERNEL ))
142: #define TCfree(memblock) kfree( memblock )
1.1 root 143:
1.1.1.9 root 144: #else
1.1 root 145:
146: #define TCalloc malloc
147: #define TCfree free
148:
1.1.1.8 root 149: #ifdef _WIN32
150:
1.1 root 151: #pragma warning( disable : 4201 )
152: #pragma warning( disable : 4214 )
153: #pragma warning( disable : 4115 )
154: #pragma warning( disable : 4514 )
155:
156: #undef _WIN32_WINNT
157: #define _WIN32_WINNT 0x0501
158: #include <windows.h> /* Windows header */
159: #include <commctrl.h> /* The common controls */
160: #include <process.h> /* Process control */
161: #include <winioctl.h>
162: #include <stdio.h> /* For sprintf */
163:
164: #pragma warning( default : 4201 )
165: #pragma warning( default : 4214 )
166: #pragma warning( default : 4115 )
167:
168: /* #pragma warning( default : 4514 ) this warning remains disabled */
169:
170: /* This is needed to fix a bug with VC 5, the TCHAR macro _ttoi64 maps
1.1.1.10 root 171: incorrectly to atoLL when it should be _atoi64 */
1.1 root 172: #define atoi64 _atoi64
173:
1.1.1.8 root 174: #endif /* _WIN32 */
1.1 root 175:
1.1.1.8 root 176: #endif /* NT4_DRIVER */
177:
178: #ifdef _WIN32
1.1.1.12 root 179: #define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; RtlSecureZeroMemory (mem, size); while (burnc--) *burnm++ = 0; } while (0)
180: #else
181: #define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; while (burnc--) *burnm++ = 0; } while (0)
1.1.1.8 root 182: #endif
1.1.1.11 root 183:
184: #ifdef MAX_PATH
1.1.1.12 root 185: #define TC_MAX_PATH MAX_PATH
1.1.1.11 root 186: #else
1.1.1.12 root 187: #define TC_MAX_PATH 260 /* Includes the null terminator */
1.1.1.11 root 188: #endif
1.1.1.12 root 189:
190: #define MAX_URL_LENGTH 2084 /* Internet Explorer limit. Includes the terminating null character. */
191:
192: #define TC_APPLINK "http://www.truecrypt.org/applink.php?version=" VERSION_STRING
193: #define TC_APPLINK_SECURE "https://www.truecrypt.org/applink.php?version=" VERSION_STRING
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.