--- truecrypt/common/tcdefs.h 2018/04/24 16:53:40 1.1.1.18 +++ truecrypt/common/tcdefs.h 2018/04/24 17:11:20 1.1.1.28 @@ -3,11 +3,11 @@ derived from the source code of Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.5 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ + the original source code (contained in this file) and all other portions + of this file are Copyright (c) 2003-2010 TrueCrypt Developers Association + and are governed by the TrueCrypt License 3.0 the full text of which is + contained in the file License.txt included in TrueCrypt binary and source + code distribution packages. */ #ifndef TCDEFS_H #define TCDEFS_H @@ -15,17 +15,15 @@ #define TC_APP_NAME "TrueCrypt" // Version displayed to user -#define VERSION_STRING "6.0" +#define VERSION_STRING "7.1" // Version number to compare against driver -#define VERSION_NUM 0x0600 +#define VERSION_NUM 0x0710 -// Sector size of encrypted filesystem, which may differ from sector size -// of host filesystem/device (this is fully supported since v4.3). -#define SECTOR_SIZE 512 - -// "Second generation standard" sector size -#define SECTOR_SIZE_GEN2_STANDARD 4096 +// Release date +#define TC_STR_RELEASE_DATE "September 1, 2011" +#define TC_RELEASE_DATE_YEAR 2011 +#define TC_RELEASE_DATE_MONTH 9 #define BYTES_PER_KB 1024LL #define BYTES_PER_MB 1048576LL @@ -37,6 +35,8 @@ #define WIDE(x) (LPWSTR)L##x +#ifdef _MSC_VER + typedef __int8 int8; typedef __int16 int16; typedef __int32 int32; @@ -52,6 +52,45 @@ typedef __int64 int64; typedef unsigned __int64 uint64; #endif +#else // !_MSC_VER + +#include +#include + +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; +typedef uint8_t byte; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +#if UCHAR_MAX != 0xffU +#error UCHAR_MAX != 0xff +#endif +#define __int8 char + +#if USHRT_MAX != 0xffffU +#error USHRT_MAX != 0xffff +#endif +#define __int16 short + +#if UINT_MAX != 0xffffffffU +#error UINT_MAX != 0xffffffff +#endif +#define __int32 int + +typedef uint64 TC_LARGEST_COMPILER_UINT; + +#define BOOL int +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +#endif // !_MSC_VER + #define TC_INT_TYPES_DEFINED // Integer types required by Cryptolib @@ -59,7 +98,7 @@ typedef unsigned __int8 uint_8t; typedef unsigned __int16 uint_16t; typedef unsigned __int32 uint_32t; #ifndef TC_NO_COMPILER_INT64 -typedef unsigned __int64 uint_64t; +typedef uint64 uint_64t; #endif typedef union @@ -70,50 +109,30 @@ typedef union unsigned __int32 HighPart; }; #ifndef TC_NO_COMPILER_INT64 - unsigned __int64 Value; + uint64 Value; #endif } UINT64_STRUCT; #ifdef TC_WINDOWS_BOOT + +# ifdef __cplusplus +extern "C" +# endif +void ThrowFatalException (int line); + # define TC_THROW_FATAL_EXCEPTION ThrowFatalException (__LINE__) -#elif defined (NT4_DRIVER) +#elif defined (TC_WINDOWS_DRIVER) # define TC_THROW_FATAL_EXCEPTION KeBugCheckEx (SECURITY_SYSTEM, __LINE__, 0, 0, 'TC') #else # define TC_THROW_FATAL_EXCEPTION *(char *) 0 = 0 #endif -#ifdef NT4_DRIVER - -#pragma warning( disable : 4201 ) -#pragma warning( disable : 4214 ) -#pragma warning( disable : 4115 ) -#pragma warning( disable : 4100 ) -#pragma warning( disable : 4101 ) -#pragma warning( disable : 4057 ) -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4514 ) -#pragma warning( disable : 4127 ) - +#ifdef TC_WINDOWS_DRIVER #include #include /* Standard header file for nt drivers */ - -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 #include /* Standard I/O control codes */ -#include - -#pragma warning( default : 4201 ) -#pragma warning( default : 4214 ) -#pragma warning( default : 4115 ) -#pragma warning( default : 4100 ) -#pragma warning( default : 4101 ) -#pragma warning( default : 4057 ) -#pragma warning( default : 4244 ) -#pragma warning( default : 4127 ) - -/* #pragma warning( default : 4514 ) this warning remains disabled */ #define TCalloc(size) ((void *) ExAllocatePoolWithTag( NonPagedPool, size, 'MMCT' )) #define TCfree(memblock) ExFreePoolWithTag( memblock, 'MMCT' ) @@ -132,54 +151,27 @@ typedef int BOOL; #define FALSE !TRUE #endif -/* Define dummies for the drivers */ -typedef int HFILE; -typedef unsigned int WPARAM; -typedef unsigned __int32 LPARAM; -#define CALLBACK - -#ifndef UINT -typedef unsigned int UINT; -#endif - -#ifndef LRESULT -typedef unsigned __int32 LRESULT; -#endif -/* NT4_DRIVER */ - -#else +#else /* !TC_WINDOWS_DRIVER */ #define TCalloc malloc #define TCfree free #ifdef _WIN32 -#pragma warning( disable : 4201 ) -#pragma warning( disable : 4214 ) -#pragma warning( disable : 4115 ) -#pragma warning( disable : 4514 ) +#ifndef TC_LOCAL_WIN32_WINNT_OVERRIDE +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 /* Does not apply to the driver */ +#endif -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 #include /* Windows header */ #include /* The common controls */ #include /* Process control */ #include #include /* For sprintf */ -#pragma warning( default : 4201 ) -#pragma warning( default : 4214 ) -#pragma warning( default : 4115 ) - -/* #pragma warning( default : 4514 ) this warning remains disabled */ - -/* This is needed to fix a bug with VC 5, the TCHAR macro _ttoi64 maps - incorrectly to atoLL when it should be _atoi64 */ -#define atoi64 _atoi64 - #endif /* _WIN32 */ -#endif /* NT4_DRIVER */ +#endif /* !TC_WINDOWS_DRIVER */ #ifndef TC_TO_STRING # define TC_TO_STRING2(n) #n @@ -193,10 +185,10 @@ typedef unsigned __int32 LRESULT; # else # define Dump(...) DbgPrintEx (DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, __VA_ARGS__) # endif -# define DumpMem(...) DumpMemory (__VA_ARGS__) +# define DumpMem(...) DumpMemory (__VA_ARGS__) # else -# define Dump(...) ((void) 0) -# define DumpMem(...) ((void) 0) +# define Dump(...) +# define DumpMem(...) # endif #endif @@ -230,7 +222,7 @@ typedef unsigned __int32 LRESULT; // The size of the memory area to wipe is in bytes amd it must be a multiple of 8. #ifndef TC_NO_COMPILER_INT64 -# define FAST_ERASE64(mem,size) do { volatile unsigned __int64 *burnm = (volatile unsigned __int64 *)(mem); int burnc = size >> 3; while (burnc--) *burnm++ = 0; } while (0) +# define FAST_ERASE64(mem,size) do { volatile uint64 *burnm = (volatile uint64 *)(mem); int burnc = size >> 3; while (burnc--) *burnm++ = 0; } while (0) #else # define FAST_ERASE64(mem,size) do { volatile unsigned __int32 *burnm = (volatile unsigned __int32 *)(mem); int burnc = size >> 2; while (burnc--) *burnm++ = 0; } while (0) #endif @@ -239,6 +231,12 @@ typedef unsigned __int32 LRESULT; # ifndef max # define max(a,b) (((a) > (b)) ? (a) : (b)) # endif + +# ifdef __cplusplus +extern "C" +# endif +void EraseMemory (void *memory, int size); + # undef burn # define burn EraseMemory #endif @@ -249,10 +247,13 @@ typedef unsigned __int32 LRESULT; #define TC_MAX_PATH 260 /* Includes the null terminator */ #endif +#define TC_STR_RELEASED_BY "Released by TrueCrypt Foundation on " TC_STR_RELEASE_DATE + #define MAX_URL_LENGTH 2084 /* Internet Explorer limit. Includes the terminating null character. */ -#define TC_APPLINK "http://www.truecrypt.org/applink.php?version=" VERSION_STRING -#define TC_APPLINK_SECURE "https://www.truecrypt.org/applink.php?version=" VERSION_STRING +#define TC_HOMEPAGE "http://www.truecrypt.org/" +#define TC_APPLINK "http://www.truecrypt.org/applink?version=" VERSION_STRING +#define TC_APPLINK_SECURE "https://www.truecrypt.org/applink?version=" VERSION_STRING enum { @@ -286,13 +287,15 @@ enum ERR_NO_FREE_DRIVES = 22, ERR_FILE_OPEN_FAILED = 23, ERR_VOL_MOUNT_FAILED = 24, - ERR_INVALID_DEVICE = 25, + DEPRECATED_ERR_INVALID_DEVICE = 25, ERR_ACCESS_DENIED = 26, ERR_MODE_INIT_FAILED = 27, ERR_DONT_REPORT = 28, ERR_ENCRYPTION_NOT_COMPLETED = 29, ERR_PARAMETER_INCORRECT = 30, - ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG = 31 + ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG = 31, + ERR_NONSYS_INPLACE_ENC_INCOMPLETE = 32, + ERR_USER_ABORT = 33 }; #endif // #ifndef TCDEFS_H