"Fossies" - the Fresh Open Source Software Archive

Member "src/Format/Tcformat.h" (10 Oct 2018, 4870 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 "Tcformat.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.22_Source_vs_1.23_Source.

    1 /*
    2  Legal Notice: Some portions of the source code contained in this file were
    3  derived from the source code of TrueCrypt 7.1a, which is
    4  Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
    5  governed by the TrueCrypt License 3.0, also from the source code of
    6  Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
    7  and which is governed by the 'License Agreement for Encryption for the Masses'
    8  Modifications and additions to the original source code (contained in this file)
    9  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
   10  and are governed by the Apache License 2.0 the full text of which is
   11  contained in the file License.txt included in VeraCrypt binary and source
   12  code distribution packages. */
   13 
   14 #include "Common/Common.h"
   15 
   16 #ifdef __cplusplus
   17 extern "C" {
   18 #endif
   19 
   20 #define NBR_KEY_BYTES_TO_DISPLAY    16
   21 #define KEY_GUI_VIEW_SIZE           64      // Max characters of the key hex dump to display
   22 
   23 enum timer_ids
   24 {
   25     TIMER_ID_RANDVIEW = 0xff,
   26     TIMER_ID_SYSENC_PROGRESS,
   27     TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS,
   28     TIMER_ID_WIPE_PROGRESS,
   29     TIMER_ID_SYSENC_DRIVE_ANALYSIS_PROGRESS,
   30     TIMER_ID_KEYB_LAYOUT_GUARD
   31 };
   32 
   33 static void localcleanup ( void );
   34 static void LoadSettings ( HWND hwndDlg );
   35 void SaveSettings ( HWND hwndDlg );
   36 static void EndMainDlg ( HWND hwndDlg );
   37 void ComboSelChangeEA ( HWND hwndDlg );
   38 static void VerifySizeAndUpdate ( HWND hwndDlg , BOOL bUpdate );
   39 static void __cdecl sysEncDriveAnalysisThread (void *hwndDlgArg);
   40 static void __cdecl volTransformThreadFunction ( void *hwndDlg );
   41 static void LoadPage ( HWND hwndDlg , int nPageNo );
   42 __int64 PrintFreeSpace ( HWND hwndTextBox , wchar_t *lpszDrive , PLARGE_INTEGER lDiskFree );
   43 void DisplaySizingErrorText ( HWND hwndTextBox );
   44 void EnableDisableFileNext ( HWND hComboBox , HWND hMainButton );
   45 BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display, LONGLONG *pFreeSpaceValue, BOOL* pbIsSparseFilesSupported);
   46 static BOOL FinalPreTransformPrompts (void);
   47 void UpdateLastDialogId (void);
   48 void HandleOldAssignedDriveLetter (void);
   49 void AddCipher ( HWND hComboBox , char *lpszCipher , int nCipher );
   50 BOOL CALLBACK PageDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
   51 BOOL CALLBACK MainDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
   52 void ExtractCommandLine ( HWND hwndDlg , wchar_t *lpszCommandLine );
   53 void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow);
   54 void DisplayPortionsOfKeys (HWND headerKeyHandle, HWND masterKeyHandle, wchar_t *headerKeyStr, wchar_t *masterKeyStr, BOOL hideKeys);
   55 int DetermineMaxHiddenVolSize (HWND hwndDlg);
   56 BOOL IsSparseFile (HWND hwndDlg);
   57 BOOL GetFileVolSize (HWND hwndDlg, unsigned __int64 *size);
   58 BOOL SwitchWizardToSysEncMode (void);
   59 void SwitchWizardToFileContainerMode (void);
   60 static BOOL ResolveUnknownSysEncDirection (void);
   61 static BOOL WipeHiddenOSCreationConfig (void);
   62 static void AfterWMInitTasks (HWND hwndDlg);
   63 static void AfterSysEncProgressWMInitTasks (HWND hwndDlg);
   64 static void InitSysEncProgressBar (void);
   65 static void InitNonSysInplaceEncProgressBar (void);
   66 static void UpdateNonSysInplaceEncProgressBar (void);
   67 static BOOL SysEncInEffect (void);
   68 static BOOL CreatingHiddenSysVol(void);
   69 static void NonSysInplaceEncPause (void);
   70 static void NonSysInplaceEncResume (void);
   71 void ShowNonSysInPlaceEncUIStatus (void);
   72 void UpdateNonSysInPlaceEncControls (void);
   73 int MountHiddenVolHost ( HWND hwndDlg, wchar_t *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly );
   74 int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters);
   75 int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters);
   76 static void WipeStart (void);
   77 static void WipeAbort (void);
   78 static void UpdateWipeProgressBar (void);
   79 static void InitWipeProgressBar (void);
   80 static void UpdateWipeControls (void);
   81 static DWORD GetFormatSectorSize ();
   82 
   83 extern BOOL showKeys;
   84 extern volatile HWND hMasterKey;
   85 extern volatile HWND hHeaderKey;
   86 extern volatile BOOL bHiddenVolHost;
   87 extern volatile BOOL bHiddenVolDirect;
   88 extern BOOL bRemovableHostDevice;
   89 extern BOOL bWarnDeviceFormatAdvanced;
   90 extern HWND hCurPage;
   91 extern HWND hProgressBar;
   92 extern volatile BOOL bVolTransformThreadCancel;
   93 extern volatile BOOL bInPlaceEncNonSysResumed;
   94 extern volatile BOOL bFirstNonSysInPlaceEncResumeDone;
   95 extern volatile BOOL bInPlaceEncNonSys;
   96 extern volatile BOOL bInPlaceDecNonSys;
   97 extern __int64 NonSysInplaceEncBytesDone;
   98 extern __int64 NonSysInplaceEncTotalSize;
   99 extern int nPbar;
  100 extern volatile int WizardMode;
  101 extern volatile BOOL bInPlaceEncNonSysResumed;
  102 
  103 extern wchar_t HeaderKeyGUIView [KEY_GUI_VIEW_SIZE];
  104 extern wchar_t MasterKeyGUIView [KEY_GUI_VIEW_SIZE];
  105 extern volatile int NonSysInplaceEncStatus;
  106 
  107 #ifdef __cplusplus
  108 }
  109 #endif