|
|
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
1.1.1.10! root 5: contained in this file are Copyright (c) 2004-2006 TrueCrypt Foundation and
1.1.1.8 root 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.10! root 11: #define VERSION_STRING "4.2"
1.1 root 12:
13: // Version number to compare against driver
1.1.1.10! root 14: #define VERSION_NUM 0x0420
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.9 root 18: #define VOL_REQ_PROG_VERSION 0x0410
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.10! root 26: #define BYTES_PER_KB 1024LL
! 27: #define BYTES_PER_MB 1048576LL
! 28: #define BYTES_PER_GB 1073741824LL
! 29: #define BYTES_PER_TB 1099511627776LL
! 30: #define BYTES_PER_PB 1125899906842624LL
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
1.1.1.9 root 62: #define ERR_MODE_INIT_FAILED 39
1.1 root 63:
1.1.1.7 root 64: #define ERR_DONT_REPORT 100
65:
1.1 root 66: #define MIN_VOLUME_SIZE 19456
1.1.1.6 root 67: #define MIN_HIDDEN_VOLUME_HOST_SIZE ( MIN_VOLUME_SIZE * 2 + HIDDEN_VOL_HEADER_OFFSET + HEADER_SIZE )
1.1.1.10! root 68: #define MAX_VOLUME_SIZE 0x7fffFFFFffffFFFFLL
! 69: #define MAX_FAT_VOLUME_SIZE 0xFFFFFFFE00LL // Should be possible to increase up to 0x1FFFFFFFC00LL (untested)
1.1.1.6 root 70: #define MAX_HIDDEN_VOLUME_HOST_SIZE MAX_FAT_VOLUME_SIZE
71: #define MAX_HIDDEN_VOLUME_SIZE ( MAX_HIDDEN_VOLUME_HOST_SIZE - HIDDEN_VOL_HEADER_OFFSET - HEADER_SIZE )
1.1 root 72:
73: #define burn(mem,size) \
74: memset(mem,0xff,size); \
75: memset(mem,0,size);
76:
77: #define WIDE(x) (LPWSTR)L##x
78:
1.1.1.8 root 79: #ifndef LINUX_DRIVER
1.1 root 80: #include <string.h>
81: #pragma intrinsic(memcmp, memcpy, memset, strcat, strcmp, strcpy, strlen)
1.1.1.9 root 82: #endif
1.1 root 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
1.1.1.9 root 144: /* NT4_DRIVER */
145:
146: #elif defined(LINUX_DRIVER)
147:
148: #define TCalloc(size) (kmalloc( size, GFP_KERNEL ))
149: #define TCfree(memblock) kfree( memblock )
1.1 root 150:
1.1.1.9 root 151: #else
1.1 root 152:
153: #define TCalloc malloc
154: #define TCfree free
155:
1.1.1.8 root 156: #ifdef _WIN32
157:
1.1 root 158: #pragma warning( disable : 4201 )
159: #pragma warning( disable : 4214 )
160: #pragma warning( disable : 4115 )
161: #pragma warning( disable : 4514 )
162:
163: #undef _WIN32_WINNT
164: #define _WIN32_WINNT 0x0501
165: #include <windows.h> /* Windows header */
166: #include <commctrl.h> /* The common controls */
167: #include <process.h> /* Process control */
168: #include <winioctl.h>
169: #include <stdio.h> /* For sprintf */
170:
171: #pragma warning( default : 4201 )
172: #pragma warning( default : 4214 )
173: #pragma warning( default : 4115 )
174:
175: /* #pragma warning( default : 4514 ) this warning remains disabled */
176:
177: /* This is needed to fix a bug with VC 5, the TCHAR macro _ttoi64 maps
1.1.1.10! root 178: incorrectly to atoLL when it should be _atoi64 */
1.1 root 179: #define atoi64 _atoi64
180:
1.1.1.8 root 181: #endif /* _WIN32 */
1.1 root 182:
1.1.1.8 root 183: #endif /* NT4_DRIVER */
184:
185: #ifdef _WIN32
1.1 root 186:
187: #pragma hdrstop
1.1.1.8 root 188:
189: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.