/* Legal Notice: Some portions of the source code contained in this file were derived from the source code of TrueCrypt 7.1a, which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0, also 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) 2013-2015 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ #include "Common/Common.h" #ifdef __cplusplus extern "C" { #endif #define NBR_KEY_BYTES_TO_DISPLAY 16 #define KEY_GUI_VIEW_SIZE 64 // Max characters of the key hex dump to display enum timer_ids { TIMER_ID_RANDVIEW = 0xff, TIMER_ID_SYSENC_PROGRESS, TIMER_ID_NONSYS_INPLACE_ENC_PROGRESS, TIMER_ID_WIPE_PROGRESS, TIMER_ID_SYSENC_DRIVE_ANALYSIS_PROGRESS, TIMER_ID_KEYB_LAYOUT_GUARD }; static void localcleanup ( void ); static void LoadSettings ( HWND hwndDlg ); static void SaveSettings ( HWND hwndDlg ); static void EndMainDlg ( HWND hwndDlg ); void ComboSelChangeEA ( HWND hwndDlg ); static void VerifySizeAndUpdate ( HWND hwndDlg , BOOL bUpdate ); static void __cdecl sysEncDriveAnalysisThread (void *hwndDlgArg); static void __cdecl volTransformThreadFunction ( void *hwndDlg ); static void LoadPage ( HWND hwndDlg , int nPageNo ); __int64 PrintFreeSpace ( HWND hwndTextBox , wchar_t *lpszDrive , PLARGE_INTEGER lDiskFree ); void DisplaySizingErrorText ( HWND hwndTextBox ); void EnableDisableFileNext ( HWND hComboBox , HWND hMainButton ); BOOL QueryFreeSpace ( HWND hwndDlg , HWND hwndTextBox , BOOL display ); static BOOL FinalPreTransformPrompts (void); void UpdateLastDialogId (void); void HandleOldAssignedDriveLetter (void); void AddCipher ( HWND hComboBox , char *lpszCipher , int nCipher ); BOOL CALLBACK PageDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam ); BOOL CALLBACK MainDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam ); void ExtractCommandLine ( HWND hwndDlg , wchar_t *lpszCommandLine ); void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow); void DisplayPortionsOfKeys (HWND headerKeyHandle, HWND masterKeyHandle, wchar_t *headerKeyStr, wchar_t *masterKeyStr, BOOL hideKeys); int DetermineMaxHiddenVolSize (HWND hwndDlg); BOOL IsSparseFile (HWND hwndDlg); BOOL GetFileVolSize (HWND hwndDlg, unsigned __int64 *size); BOOL SwitchWizardToSysEncMode (void); void SwitchWizardToFileContainerMode (void); static BOOL ResolveUnknownSysEncDirection (void); static BOOL WipeHiddenOSCreationConfig (void); static void AfterWMInitTasks (HWND hwndDlg); static void AfterSysEncProgressWMInitTasks (HWND hwndDlg); static void InitSysEncProgressBar (void); static void InitNonSysInplaceEncProgressBar (void); static void UpdateNonSysInplaceEncProgressBar (void); static BOOL SysEncInEffect (void); static BOOL CreatingHiddenSysVol(void); static void NonSysInplaceEncPause (void); static void NonSysInplaceEncResume (void); void ShowNonSysInPlaceEncUIStatus (void); void UpdateNonSysInPlaceEncControls (void); int MountHiddenVolHost ( HWND hwndDlg, wchar_t *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly ); int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters); int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters); static void WipeStart (void); static void WipeAbort (void); static void UpdateWipeProgressBar (void); static void InitWipeProgressBar (void); static void UpdateWipeControls (void); static DWORD GetFormatSectorSize (); extern BOOL showKeys; extern volatile HWND hMasterKey; extern volatile HWND hHeaderKey; extern volatile BOOL bHiddenVolHost; extern volatile BOOL bHiddenVolDirect; extern BOOL bRemovableHostDevice; extern BOOL bWarnDeviceFormatAdvanced; extern HWND hCurPage; extern HWND hProgressBar; extern volatile BOOL bVolTransformThreadCancel; extern volatile BOOL bInPlaceEncNonSysResumed; extern volatile BOOL bFirstNonSysInPlaceEncResumeDone; extern volatile BOOL bInPlaceEncNonSys; extern volatile BOOL bInPlaceDecNonSys; extern __int64 NonSysInplaceEncBytesDone; extern __int64 NonSysInplaceEncTotalSize; extern int nPbar; extern volatile int WizardMode; extern volatile BOOL bInPlaceEncNonSysResumed; extern wchar_t HeaderKeyGUIView [KEY_GUI_VIEW_SIZE]; extern wchar_t MasterKeyGUIView [KEY_GUI_VIEW_SIZE]; extern volatile int NonSysInplaceEncStatus; #ifdef __cplusplus } #endif a> 42 43 44 45 46 47 48 49 50 51 52
/*
zip_file_add.c -- add file via callback function
Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "zipint.h"
/*
NOTE: Return type is signed so we can return -1 on error.
The index can not be larger than ZIP_INT64_MAX since the size
of the central directory cannot be larger than
ZIP_UINT64_MAX, and each entry is larger than 2 bytes.
*/
ZIP_EXTERN zip_int64_t
zip_file_add(zip_t *za, const char *name, zip_source_t *source, zip_flags_t flags) {
if (name == NULL || source == NULL) {
zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
return _zip_file_replace(za, ZIP_UINT64_MAX, name, source, flags);
}