"Fossies" - the Fresh Open Source Software Archive

Member "src/Boot/Windows/Platform.h" (10 Oct 2018, 3235 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Platform.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.21_Source_vs_1.22_Source.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    5 
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   12 
   13 #ifndef TC_HEADER_Boot_Platform
   14 #define TC_HEADER_Boot_Platform
   15 
   16 #pragma warning (disable: 4018 4102 4704 4769)
   17 
   18 #include "TCdefs.h"
   19 #include <memory.h>
   20 
   21 typedef char bool;
   22 #define false 0
   23 #define true 1
   24 
   25 #define nullptr 0
   26 #define NULL 0
   27 
   28 typedef UINT64_STRUCT uint64;
   29 
   30 #define array_capacity(arr) (sizeof (arr) / sizeof ((arr)[0]))
   31 
   32 #define TC_TO_STRING2(n) #n
   33 #define TC_TO_STRING(n) TC_TO_STRING2(n)
   34 
   35 
   36 #define TC_X86_CARRY_FLAG 0x1
   37 
   38 #define TC_ASM_EMIT(A,B) __asm _emit 0x##A __asm _emit 0x##B
   39 #define TC_ASM_EMIT3(A,B,C) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C
   40 #define TC_ASM_EMIT4(A,B,C,D) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C __asm _emit 0x##D
   41 
   42 #define TC_ASM_MOV_EAX_DI TC_ASM_EMIT3 (66, 8B, 05)
   43 #define TC_ASM_MOV_EBX_DI TC_ASM_EMIT3 (66, 8B, 1D)
   44 #define TC_ASM_MOV_ECX_DI TC_ASM_EMIT3 (66, 8B, 0D)
   45 #define TC_ASM_MOV_EDX_DI TC_ASM_EMIT3 (66, 8B, 15)
   46 
   47 #define TC_ASM_MOV_DI_EAX TC_ASM_EMIT3 (66, 89, 05)
   48 #define TC_ASM_MOV_DI_EBX TC_ASM_EMIT3 (66, 89, 1D)
   49 #define TC_ASM_MOV_DI_ECX TC_ASM_EMIT3 (66, 89, 0D)
   50 #define TC_ASM_MOV_DI_EDX TC_ASM_EMIT3 (66, 89, 15)
   51 
   52 
   53 #pragma pack(1)
   54 
   55 struct Registers
   56 {
   57     uint16 Flags;
   58 
   59     union
   60     {
   61         uint32 EAX;
   62         struct { uint16 AX; uint16 EAXH; };
   63     };
   64 
   65     union
   66     {
   67         uint32 EBX;
   68         struct { uint16 BX; uint16 EBXH; };
   69     };
   70 
   71     union
   72     {
   73         uint32 ECX;
   74         struct { uint16 CX; uint16 ECXH; };
   75     };
   76 
   77     union
   78     {
   79         uint32 EDX;
   80         struct { uint16 DX; uint16 EDXH; };
   81     };
   82 
   83     uint16 DI;
   84     uint16 SI;
   85     uint16 DS;
   86     uint16 ES;
   87     uint16 SS;
   88 };
   89 
   90 #pragma pack()
   91 
   92 
   93 uint64 operator+ (const uint64 &a, const uint64 &b);
   94 uint64 operator+ (const uint64 &a, uint32 b);
   95 uint64 &operator+= (uint64 &a, const uint64 &b);
   96 uint64 operator- (const uint64 &a, const uint64 &b);
   97 uint64 operator- (const uint64 &a, uint32 b);
   98 uint64 &operator-= (uint64 &a, const uint64 &b);
   99 uint64 operator>> (const uint64 &a, int shiftCount);
  100 uint64 operator<< (const uint64 &a, int shiftCount);
  101 uint64 &operator++ (uint64 &a);
  102 bool operator== (const uint64 &a, const uint64 &b);
  103 bool operator> (const uint64 &a, const uint64 &b);
  104 bool operator< (const uint64 &a, const uint64 &b);
  105 bool operator>= (const uint64 &a, const uint64 &b);
  106 bool operator<= (const uint64 &a, const uint64 &b);
  107 
  108 void CopyMemory (void *source, uint16 destSegment, uint16 destOffset, uint16 blockSize);
  109 void CopyMemory (uint16 sourceSegment, uint16 sourceOffset, void *destination, uint16 blockSize);
  110 extern "C" void EraseMemory (void *memory, int size);
  111 uint32 GetLinearAddress (uint16 segment, uint16 offset);
  112 bool RegionsIntersect (const uint64 &start1, uint32 length1, const uint64 &start2, const uint64 &end2);
  113 #ifdef TC_BOOT_DEBUG_ENABLED
  114 bool TestInt64 ();
  115 #endif
  116 extern "C" void ThrowFatalException (int line);
  117 
  118 #endif // TC_HEADER_Boot_Platform