diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-15 00:42:19 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-15 00:42:19 +0100 |
commit | fc4a54418044263c3173ff9bb793fad698b89cda (patch) | |
tree | 8a43433544fc510ddb81acd8ed9037011a410ca3 /src | |
parent | 43ad4f93eb2c64bb2c278cdbefdfe0250293868e (diff) | |
download | VeraCrypt-fc4a54418044263c3173ff9bb793fad698b89cda.tar.gz VeraCrypt-fc4a54418044263c3173ff9bb793fad698b89cda.zip |
Windows: Use VS builtin __fastfail intrinsic for fatal exception instead of affecting NULL pointerHEADmaster
Diffstat (limited to 'src')
-rw-r--r-- | src/Common/Tcdefs.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h index f88ff582..e7eee177 100644 --- a/src/Common/Tcdefs.h +++ b/src/Common/Tcdefs.h @@ -213,60 +213,63 @@ typedef int LONG; #define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count) #define strlen(str) (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE)) #define strstr AsciiStrStr // #define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) // #define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) // #define rotr64(x,n) (((x) >> n) | ((x) << (64 - n))) // #define rotl64(x,n) (((x) << n) | ((x) >> (64 - n))) // #define bswap_32(x) (rotl32((((x) & 0xFF00FF00) >> 8) | (((x) & 0x00FF00FF) << 8), 16U)) // #define bswap_64(x) rotl64(((((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0xFFFF0000FFFF0000)) >> 16) | (((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0x0000FFFF0000FFFF)) << 16)), 32U) #endif #ifdef TC_WINDOWS_BOOT # ifdef __cplusplus extern "C" # endif void ThrowFatalException (int line); # define TC_THROW_FATAL_EXCEPTION ThrowFatalException (__LINE__) #elif defined (TC_WINDOWS_DRIVER) # define TC_THROW_FATAL_EXCEPTION KeBugCheckEx (SECURITY_SYSTEM, __LINE__, 0, 0, 'VC') #elif defined(_UEFI) void ThrowFatalException(int line); # define TC_THROW_FATAL_EXCEPTION ThrowFatalException (__LINE__) #elif (defined(__clang__) && __has_builtin(__builtin_trap)) \ || (defined(__GNUC__ ) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))) \ || (__has_builtin(__builtin_trap)) # define TC_THROW_FATAL_EXCEPTION __builtin_trap() +#elif defined(_MSC_VER) +#include <intrin.h> +# define TC_THROW_FATAL_EXCEPTION __fastfail(FAST_FAIL_FATAL_APP_EXIT) #else # define TC_THROW_FATAL_EXCEPTION *(char *) 0 = 0 #endif #ifdef __COVERITY__ #undef TC_THROW_FATAL_EXCEPTION #define TC_THROW_FATAL_EXCEPTION __coverity_panic__() #endif #ifdef TC_WINDOWS_DRIVER #include <ntifs.h> #include <ntddk.h> /* Standard header file for nt drivers */ #include <ntdddisk.h> /* Standard I/O control codes */ extern ULONG AllocTag; #define TCalloc(size) ((void *) ExAllocatePool2( POOL_FLAG_NON_PAGED, size, AllocTag )) #define TCfree(memblock) ExFreePoolWithTag( memblock, AllocTag ) #define DEVICE_DRIVER #ifndef BOOL typedef int BOOL; #endif #ifndef WORD typedef USHORT WORD; #endif |