From fc37cc4a02ed13d1a73b941a9f80975600fd1b99 Mon Sep 17 00:00:00 2001 From: David Foerster Date: Tue, 10 May 2016 20:20:14 +0200 Subject: Normalize all line terminators --- src/ExpandVolume/DlgExpandVolume.cpp | 1552 +++++++++++++-------------- src/ExpandVolume/ExpandVolume.c | 42 +- src/ExpandVolume/ExpandVolume.rc | 596 +++++------ src/ExpandVolume/ExpandVolume.vcproj | 1954 +++++++++++++++++----------------- src/ExpandVolume/InitDataArea.c | 30 +- src/ExpandVolume/InitDataArea.h | 24 +- src/ExpandVolume/WinMain.cpp | 846 +++++++-------- src/ExpandVolume/resource.h | 294 ++--- 8 files changed, 2669 insertions(+), 2669 deletions(-) (limited to 'src/ExpandVolume') diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index 0a24c2c2..e08721b3 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -1,777 +1,777 @@ -/* - 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' +/* + 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh - or Copyright (c) 2012-2013 Josef Schneider - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 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 "Tcdefs.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Apidrvr.h" -#include "Volumes.h" -#include "Crypto.h" -#include "Dlgcode.h" -#include "Language.h" -#include "Pkcs5.h" -#include "Random.h" -// #include "../Mount/Mount.h" - -#include "../Common/Dictionary.h" -#include "../Common/Common.h" -#include "../Common/Resource.h" -#include "../Common/SecurityToken.h" -#include "../Common/Progress.h" - -#include "ExpandVolume.h" -#include "Resource.h" - -// TO DO: display sector sizes different than 512 bytes -#define SECTOR_SIZE_MSG 512 - -#define TIMER_ID_RANDVIEW 0xff -#define TIMER_INTERVAL_RANDVIEW 50 - -// see definition of enum EV_FileSystem -const wchar_t * szFileSystemStr[4] = {L"RAW",L"FAT",L"NTFS",L"EXFAT"}; - -// prototypes for internal functions -BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -namespace VeraCryptExpander -{ -/* defined in WinMain.c, referenced by ExpandVolumeWizard() */ -int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions); -} - - -int GetSpaceString(wchar_t *dest, size_t cbDest, uint64 size, BOOL bDevice) -{ - const wchar_t * szFmtBytes = L"%.0lf %s"; - const wchar_t * szFmtOther = L"%.2lf %s"; - const wchar_t * SuffixStr[] = {L"Byte", L"KB", L"MB", L"GB", L"TB"}; - const uint64 Muliplier[] = {1, BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB}; - const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1; - int i; - - for (i=1; i<=nMaxSuffix && size>Muliplier[i]; i++) ; - - --i; - - if (bDevice) { - wchar_t szTemp[512]; - - if (StringCbPrintfW(szTemp, sizeof(szTemp),i?szFmtOther:szFmtBytes, size/(double)Muliplier[i], SuffixStr[i]) < 0 ) - return -1; - - return StringCbPrintfW(dest, cbDest, L"%I64u sectors (%s)", size/SECTOR_SIZE_MSG , szTemp); - } - - return StringCbPrintfW(dest, cbDest,i?szFmtOther:szFmtBytes, size/(double)Muliplier[i], SuffixStr[i]); -} - -void SetCurrentVolSize(HWND hwndDlg, uint64 size) -{ - const uint64 Muliplier[] = {BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB}; - const int IdRadioBtn[] = {IDC_KB, IDC_MB, IDC_GB, IDC_TB}; - const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1; - int i; - wchar_t szTemp[256]; - - for (i=1; i<=nMaxSuffix && size>Muliplier[i]; i++) ; - - --i; - - SendDlgItemMessage (hwndDlg, IdRadioBtn[i], BM_SETCHECK, BST_CHECKED, 0); - StringCbPrintfW(szTemp,sizeof(szTemp),L"%I64u",size/Muliplier[i]); - SetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTemp); -} - -uint64 GetSizeBoxMultiplier(HWND hwndDlg) -{ - const uint64 Muliplier[] = {BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB}; - const int IdRadioBtn[] = {IDC_KB, IDC_MB, IDC_GB, IDC_TB}; - const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1; - int i; - - for (i=nMaxSuffix; i>0 && !IsButtonChecked (GetDlgItem (hwndDlg, IdRadioBtn[i])); --i) ; - - return Muliplier[i]; -} - -BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static EXPAND_VOL_THREAD_PARAMS *pVolExpandParam; - - WORD lw = LOWORD (wParam); - - switch (msg) - { - case WM_INITDIALOG: - { - wchar_t szTemp[4096]; - - pVolExpandParam = (EXPAND_VOL_THREAD_PARAMS*)lParam; - - EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), !pVolExpandParam->bIsDevice); - EnableWindow (GetDlgItem (hwndDlg, IDC_KB), !pVolExpandParam->bIsDevice); - EnableWindow (GetDlgItem (hwndDlg, IDC_MB), !pVolExpandParam->bIsDevice); - EnableWindow (GetDlgItem (hwndDlg, IDC_GB), !pVolExpandParam->bIsDevice); - EnableWindow (GetDlgItem (hwndDlg, IDC_TB), !pVolExpandParam->bIsDevice); - - EnableWindow (GetDlgItem (hwndDlg, IDC_INIT_NEWSPACE), - !(pVolExpandParam->bIsLegacy && pVolExpandParam->bIsDevice)); - SendDlgItemMessage (hwndDlg, IDC_INIT_NEWSPACE, BM_SETCHECK, - pVolExpandParam->bInitFreeSpace ? BST_CHECKED : BST_UNCHECKED, 0); - - if (!pVolExpandParam->bIsDevice) - SetCurrentVolSize(hwndDlg,pVolExpandParam->oldSize); - - SendMessage (GetDlgItem (hwndDlg, IDC_BOX_HELP), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE); - - GetSpaceString(szTemp,sizeof(szTemp),pVolExpandParam->oldSize,pVolExpandParam->bIsDevice); - - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_OLDSIZE), szTemp); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NAME), pVolExpandParam->szVolumeName); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_FILE_SYSTEM), szFileSystemStr[pVolExpandParam->FileSystem]); - - if (pVolExpandParam->bIsDevice) - { - GetSpaceString(szTemp,sizeof(szTemp),pVolExpandParam->newSize,TRUE); - } - else - { - wchar_t szHostFreeStr[256]; - - SetWindowText (GetDlgItem (hwndDlg, IDT_NEW_SIZE), L""); - GetSpaceString(szHostFreeStr,sizeof(szHostFreeStr),pVolExpandParam->hostSizeFree,FALSE); - StringCbPrintfW (szTemp,sizeof(szTemp),L"%s available on host drive", szHostFreeStr); - } - - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NEWSIZE), szTemp); - - // set help text - if (pVolExpandParam->bIsDevice) - { - StringCbPrintfW (szTemp,sizeof(szTemp),L"This is a device-based VeraCrypt volume.\n\nThe new volume size will be choosen automatically as the size of the host device."); - if (pVolExpandParam->bIsLegacy) - StringCbCatW(szTemp,sizeof(szTemp),L" Note: filling the new space with random data is not supported for legacy volumes."); - } - else - { - StringCbPrintfW (szTemp, sizeof(szTemp),L"Please specify the new size of the VeraCrypt volume (must be at least %I64u KB larger than the current size).",TC_MINVAL_FS_EXPAND/1024); - } - SetWindowText (GetDlgItem (hwndDlg, IDC_BOX_HELP), szTemp); - - } - return 0; - - - case WM_COMMAND: - if (lw == IDCANCEL) - { - EndDialog (hwndDlg, lw); - return 1; - } - - if (lw == IDOK) - { - wchar_t szTemp[4096]; - - pVolExpandParam->bInitFreeSpace = IsButtonChecked (GetDlgItem (hwndDlg, IDC_INIT_NEWSPACE)); - if (!pVolExpandParam->bIsDevice) // for devices new size is set by calling function - { - GetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTemp, ARRAYSIZE (szTemp)); - pVolExpandParam->newSize = _wtoi64(szTemp) * GetSizeBoxMultiplier(hwndDlg); - } - - EndDialog (hwndDlg, lw); - return 1; - } - - return 0; - } - - return 0; -} - - -extern "C" void AddProgressDlgStatus(HWND hwndDlg, const wchar_t* szText) -{ - HWND hwndCtrl; - - hwndCtrl = GetDlgItem (hwndDlg,IDC_BOX_STATUS); - SendMessage(hwndCtrl,EM_REPLACESEL,FALSE,(LPARAM)szText); - SendMessage(hwndCtrl,EM_SCROLLCARET,0,0); -} - - -extern "C" void SetProgressDlgStatus(HWND hwndDlg, const wchar_t* szText) -{ - HWND hwndCtrl; - - hwndCtrl = GetDlgItem (hwndDlg,IDC_BOX_STATUS); - SendMessage(hwndCtrl,EM_SETSEL,0,-1); - SendMessage(hwndCtrl,EM_REPLACESEL,FALSE,(LPARAM)szText); - SendMessage(hwndCtrl,EM_SCROLLCARET,0,0); -} - - -BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static EXPAND_VOL_THREAD_PARAMS *pProgressDlgParam; - static BOOL bVolTransformStarted = FALSE; - static BOOL showRandPool = TRUE; - static unsigned char randPool[16]; - static unsigned char maskRandPool [16]; - static BOOL bUseMask = FALSE; - static DWORD mouseEntropyGathered = 0xFFFFFFFF; - static DWORD mouseEventsInitialCount = 0; - /* max value of entropy needed to fill all random pool = 8 * RNG_POOL_SIZE = 2560 bits */ - static const DWORD maxEntropyLevel = RNG_POOL_SIZE * 8; - static HWND hEntropyBar = NULL; - - WORD lw = LOWORD (wParam); - - switch (msg) - { - case WM_INITDIALOG: - { - wchar_t szOldHostSize[512], szNewHostSize[512]; - HCRYPTPROV hRngProv; - - pProgressDlgParam = (EXPAND_VOL_THREAD_PARAMS*)lParam; - bVolTransformStarted = FALSE; - showRandPool = FALSE; - - hCurPage = hwndDlg; - nPbar = IDC_PROGRESS_BAR; - - VirtualLock (randPool, sizeof(randPool)); - VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered)); - VirtualLock (maskRandPool, sizeof(maskRandPool)); - - mouseEntropyGathered = 0xFFFFFFFF; - mouseEventsInitialCount = 0; - bUseMask = FALSE; - if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) - { - if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool)) - bUseMask = TRUE; - CryptReleaseContext (hRngProv, 0); - } - - GetSpaceString(szOldHostSize,sizeof(szOldHostSize),pProgressDlgParam->oldSize,pProgressDlgParam->bIsDevice); - GetSpaceString(szNewHostSize,sizeof(szNewHostSize),pProgressDlgParam->newSize,pProgressDlgParam->bIsDevice); - - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_OLDSIZE), szOldHostSize); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NEWSIZE), szNewHostSize); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NAME), pProgressDlgParam->szVolumeName); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_FILE_SYSTEM), szFileSystemStr[pProgressDlgParam->FileSystem]); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_INITSPACE), pProgressDlgParam->bInitFreeSpace?L"Yes":L"No"); - - SendMessage (GetDlgItem (hwndDlg, IDC_BOX_STATUS), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE); - - SendMessage (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE); - - // set status text - if ( !pProgressDlgParam->bInitFreeSpace && pProgressDlgParam->bIsLegacy ) - { - showRandPool = FALSE; - EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), FALSE); - SetDlgItemText(hwndDlg, IDC_BOX_STATUS, L"Click 'Continue' to expand the volume."); - } - else - { - SetDlgItemText(hwndDlg, IDC_BOX_STATUS, L"IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the encryption keys. Then click 'Continue' to expand the volume."); - } - - SendMessage (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), BM_SETCHECK, BST_UNCHECKED, 0); - hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR); - SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel); - SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0); - SetTimer (hwndDlg, TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL); - } - return 0; - case TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED: - { - int nStatus = (int)lParam; - - NormalCursor (); - if (nStatus != 0) - { - if ( nStatus != ERR_USER_ABORT ) - AddProgressDlgStatus (hwndDlg, L"Error: volume expansion failed."); - else - AddProgressDlgStatus (hwndDlg, L"Error: operation aborted by user."); - } - else - { - AddProgressDlgStatus (hwndDlg, L"Finished. Volume successfully expanded."); - } - - SetWindowText (GetDlgItem (hwndDlg, IDOK), L"Exit"); - EnableWindow (GetDlgItem (hwndDlg, IDOK), TRUE); - EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE); - } - return 1; - - case WM_TIMER: - - switch (wParam) - { - case TIMER_ID_RANDVIEW: - { - wchar_t szRndPool[64] = {0}; - DWORD mouseEventsCounter; - - RandpeekBytes (hwndDlg, randPool, sizeof (randPool),&mouseEventsCounter); - - ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered); - - if (showRandPool) - StringCbPrintfW (szRndPool, sizeof(szRndPool), L"%08X%08X%08X%08X", - *((DWORD*) (randPool + 12)), *((DWORD*) (randPool + 8)), *((DWORD*) (randPool + 4)), *((DWORD*) (randPool))); - else if (bUseMask) - { - for (int i = 0; i < 16; i++) - { - wchar_t tmp2[3]; - unsigned char tmpByte = randPool[i] ^ maskRandPool[i]; - tmp2[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*'); - tmp2[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*'); - tmp2[2] = 0; - StringCbCatW (szRndPool, sizeof(szRndPool), tmp2); - } - } - else - { - wmemset (szRndPool, L'*', 32); - } - - SetWindowText (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), szRndPool); - - burn (randPool, sizeof(randPool)); - burn (szRndPool, sizeof(szRndPool)); - } - return 1; - } - return 0; - - case WM_COMMAND: - if (lw == IDC_DISPLAY_POOL_CONTENTS) - { - showRandPool = IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS)); - return 1; - } - if (lw == IDCANCEL) - { - if (bVolTransformStarted) - { - if (MessageBoxW (hwndDlg, L"Warning: Volume expansion is in progress!\n\nStopping now may result in a damaged volume.\n\nDo you really want to cancel?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) - return 1; - - // tell the volume transform thread to terminate - bVolTransformThreadCancel = TRUE; - } - EndDialog (hwndDlg, lw); - return 1; - } - - if (lw == IDOK) - { - if (bVolTransformStarted) - { - // TransformThreadFunction finished -> OK button is now exit - EndDialog (hwndDlg, lw); - } - else - { - showRandPool = FALSE; - KillTimer (hwndDlg, TIMER_ID_RANDVIEW); - EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE); - SetProgressDlgStatus (hwndDlg, L"Starting volume expansion ...\r\n"); - bVolTransformStarted = TRUE; - pProgressDlgParam->hwndDlg = hwndDlg; - if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L ) - { - handleError (hwndDlg, ERR_OS_ERROR, SRC_POS); - EndDialog (hwndDlg, lw); - } - WaitCursor(); - } - return 1; - } - - return 0; - - case WM_NCDESTROY: - burn (randPool, sizeof (randPool)); - burn (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount)); - burn (&mouseEntropyGathered, sizeof(mouseEntropyGathered)); - burn (maskRandPool, sizeof(maskRandPool)); - return 0; - } - - return 0; -} - - -typedef struct -{ - OpenVolumeContext *context; - const wchar_t *volumePath; - Password *password; - int pkcs5_prf; - int pim; - BOOL truecryptMode; - BOOL write; - BOOL preserveTimestamps; - BOOL useBackupHeader; - int* nStatus; -} OpenVolumeThreadParam; - -void CALLBACK OpenVolumeWaitThreadProc(void* pArg, HWND hwndDlg) -{ - OpenVolumeThreadParam* pThreadParam = (OpenVolumeThreadParam*) pArg; - - *(pThreadParam)->nStatus = OpenVolume(pThreadParam->context, pThreadParam->volumePath, pThreadParam->password, pThreadParam->pkcs5_prf, - pThreadParam->pim, pThreadParam->truecryptMode, pThreadParam->write, pThreadParam->preserveTimestamps, pThreadParam->useBackupHeader); -} - -/* - ExpandVolumeWizard - - Expands a trucrypt volume (wizard for user interface) - - Parameters: - - hwndDlg : HWND - [in] handle to parent window (if any) - - szVolume : char * - [in] Pointer to a string with the volume name (e.g. '\Device\Harddisk0\Partition1' or 'C:\topsecret.tc') - - Return value: - - none - -*/ -void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume) -{ - int nStatus = ERR_OS_ERROR; - wchar_t szTmp[4096]; - Password VolumePassword; - int VolumePkcs5 = 0, VolumePim = -1; - uint64 hostSize, volSize, hostSizeFree, maxSizeFS; - BOOL bIsDevice, bIsLegacy; - DWORD dwError; - int driveNo; - enum EV_FileSystem volFSType; - wchar_t rootPath[] = L"A:\\"; - - switch (IsSystemDevicePath (lpszVolume, hwndDlg, TRUE)) - { - case 1: - case 2: - MessageBoxW (hwndDlg, L"A VeraCrypt system volume can't be expanded.", lpszTitle, MB_OK|MB_ICONEXCLAMATION); - goto ret; - } - - EnableElevatedCursorChange (hwndDlg); - WaitCursor(); - - if (IsMountedVolume (lpszVolume)) - { - Warning ("DISMOUNT_FIRST", hwndDlg); - goto ret; - } - - if (Randinit() != ERR_SUCCESS) { - if (CryptoAPILastError == ERROR_SUCCESS) - nStatus = ERR_RAND_INIT_FAILED; - else - nStatus = ERR_CAPI_INIT_FAILED; - goto error; - } - - NormalCursor(); - - // Ask the user if there is a hidden volume - char *volTypeChoices[] = {0, "DOES_VOLUME_CONTAIN_HIDDEN", "VOLUME_CONTAINS_HIDDEN", "VOLUME_DOES_NOT_CONTAIN_HIDDEN", "IDCANCEL", 0}; - switch (AskMultiChoice ((void **) volTypeChoices, FALSE, hwndDlg)) - { - case 1: - MessageBoxW (hwndDlg, L"An outer volume containing a hidden volume can't be expanded, because this destroys the hidden volume.", lpszTitle, MB_OK|MB_ICONEXCLAMATION); - goto ret; - - case 2: - break; - - default: - nStatus = ERR_SUCCESS; - goto ret; - } - - WaitCursor(); - - nStatus = QueryVolumeInfo(hwndDlg,lpszVolume,&hostSizeFree,&maxSizeFS); - - if (nStatus!=ERR_SUCCESS) - { - nStatus = ERR_OS_ERROR; - goto error; - } - - NormalCursor(); - - while (TRUE) - { - OpenVolumeContext expandVol; - BOOL truecryptMode = FALSE; - - if (!VeraCryptExpander::ExtcvAskVolumePassword (hwndDlg, lpszVolume, &VolumePassword, &VolumePkcs5, &VolumePim, &truecryptMode, "ENTER_NORMAL_VOL_PASSWORD", FALSE)) - { - goto ret; - } - - EnableElevatedCursorChange (hwndDlg); - WaitCursor(); - - if (KeyFilesEnable && FirstKeyFile) - KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, lpszVolume); - - WaitCursor (); - - OpenVolumeThreadParam threadParam; - threadParam.context = &expandVol; - threadParam.volumePath = lpszVolume; - threadParam.password = &VolumePassword; - threadParam.pkcs5_prf = VolumePkcs5; - threadParam.pim = VolumePim; - threadParam.truecryptMode = FALSE; - threadParam.write = FALSE; - threadParam.preserveTimestamps = bPreserveTimestamp; - threadParam.useBackupHeader = FALSE; - threadParam.nStatus = &nStatus; - - ShowWaitDialog (hwndDlg, TRUE, OpenVolumeWaitThreadProc, &threadParam); - - NormalCursor (); - - dwError = GetLastError(); - - if (nStatus == ERR_SUCCESS) - { - bIsDevice = expandVol.IsDevice; - bIsLegacy = expandVol.CryptoInfo->LegacyVolume; - hostSize = expandVol.HostSize; - VolumePkcs5 = expandVol.CryptoInfo->pkcs5; - if ( bIsLegacy ) - { - if ( bIsDevice ) - volSize = 0; // updated later - else - volSize = hostSize; - } - else - { - volSize = GetVolumeSizeByDataAreaSize (expandVol.CryptoInfo->VolumeSize.Value, bIsLegacy); - } - CloseVolume (&expandVol); - break; - } - else if (nStatus != ERR_PASSWORD_WRONG) - { - SetLastError (dwError); - goto error; - } - - NormalCursor(); - - handleError (hwndDlg, nStatus, SRC_POS); - } - - WaitCursor(); - - // auto mount the volume to check the file system type - nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, &VolumePassword, VolumePkcs5, VolumePim); - - if (nStatus != ERR_SUCCESS) - goto error; - - rootPath[0] += driveNo; - - if ( !GetFileSystemType(rootPath,&volFSType) ) - volFSType = EV_FS_TYPE_RAW; - - if ( bIsLegacy && bIsDevice && volFSType == EV_FS_TYPE_NTFS ) - { - uint64 NumberOfSectors; - DWORD BytesPerSector; - - if ( !GetNtfsNumberOfSectors(rootPath, &NumberOfSectors, &BytesPerSector) ) - nStatus = ERR_OS_ERROR; - - // NTFS reported size does not include boot sector copy at volume end - volSize = ( NumberOfSectors + 1 ) * BytesPerSector; - } - - UnmountVolume (hwndDlg, driveNo, TRUE); - - NormalCursor(); - - if (nStatus != ERR_SUCCESS) - goto error; - - if ( bIsDevice && bIsLegacy && volFSType != EV_FS_TYPE_NTFS ) - { - MessageBoxW (hwndDlg, - L"Expanding a device hosted legacy volume with no NTFS file system\n" - L"is unsupported.\n" - L"Note that expanding the VeraCrypt volume itself is not neccessary\n" - L"for legacy volumes.\n", - lpszTitle, MB_OK|MB_ICONEXCLAMATION); - goto ret; - } - - // check if there is enough free space on host device/drive to expand the volume - if ( (bIsDevice && hostSize < volSize + TC_MINVAL_FS_EXPAND) || (!bIsDevice && hostSizeFree < TC_MINVAL_FS_EXPAND) ) - { - MessageBoxW (hwndDlg, L"Not enough free space to expand the volume", lpszTitle, MB_OK|MB_ICONEXCLAMATION); - goto ret; - } - - if (!bIsDevice && hostSize != volSize ) { - // there is some junk data at the end of the volume - if (MessageBoxW (hwndDlg, L"Warning: The container file is larger than the VeraCrypt volume area. The data after the VeraCrypt volume area will be overwritten.\n\nDo you want to continue?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) - goto ret; - } - - switch (volFSType) - { - case EV_FS_TYPE_NTFS: - break; - case EV_FS_TYPE_FAT: - if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains a FAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?", - lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) - goto ret; - break; - case EV_FS_TYPE_EXFAT: - if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an exFAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?", - lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) - goto ret; - break; - default: - if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an unknown or no file system!\n\nOnly the VeraCrypt volume itself will be expanded, the file system remains unchanged.\n\nDo you want to continue?", - lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) - goto ret; - } - - EXPAND_VOL_THREAD_PARAMS VolExpandParam; - - VolExpandParam.bInitFreeSpace = (bIsLegacy && bIsDevice) ? FALSE:TRUE; - VolExpandParam.szVolumeName = lpszVolume; - VolExpandParam.FileSystem = volFSType; - VolExpandParam.pVolumePassword = &VolumePassword; - VolExpandParam.VolumePkcs5 = VolumePkcs5; - VolExpandParam.VolumePim = VolumePim; - VolExpandParam.bIsDevice = bIsDevice; - VolExpandParam.bIsLegacy = bIsLegacy; - VolExpandParam.oldSize = bIsDevice ? volSize : hostSize; - VolExpandParam.newSize = hostSize; - VolExpandParam.hostSizeFree = hostSizeFree; - - while (1) - { - uint64 newVolumeSize; - - if (IDCANCEL == DialogBoxParamW (hInst, - MAKEINTRESOURCEW (IDD_SIZE_DIALOG), hwndDlg, - (DLGPROC) ExpandVolSizeDlgProc, (LPARAM) &VolExpandParam)) - { - goto ret; - } - - newVolumeSize = VolExpandParam.newSize; - - if ( !bIsDevice ) - { - if ( newVolumeSize < hostSize + TC_MINVAL_FS_EXPAND) - { - StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too small, must be at least %I64u kB larger than the current size.",TC_MINVAL_FS_EXPAND/BYTES_PER_KB); - MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION ); - continue; - } - - if ( newVolumeSize - hostSize > hostSizeFree ) - { - StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too large, not enough space on host drive."); - MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION ); - continue; - } - - if ( newVolumeSize>maxSizeFS ) - { - StringCbPrintfW(szTmp,sizeof(szTmp),L"Maximum file size of %I64u MB on host drive exceeded.",maxSizeFS/BYTES_PER_MB); - MessageBoxW (hwndDlg, L"!\n",lpszTitle, MB_OK | MB_ICONEXCLAMATION ); - continue; - } - } - - if ( newVolumeSize > TC_MAX_VOLUME_SIZE ) - { - // note: current limit TC_MAX_VOLUME_SIZE is 1 PetaByte - StringCbPrintfW(szTmp,sizeof(szTmp),L"Maximum VeraCrypt volume size of %I64u TB exceeded!\n",TC_MAX_VOLUME_SIZE/BYTES_PER_TB); - MessageBoxW (hwndDlg, szTmp,lpszTitle, MB_OK | MB_ICONEXCLAMATION ); - if (bIsDevice) - break; // TODO: ask to limit volume size to TC_MAX_VOLUME_SIZE - continue; - } - - break; - } - - VolExpandParam.oldSize = volSize; - - // start progress dialog - DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_EXPAND_PROGRESS_DLG), hwndDlg, - (DLGPROC) ExpandVolProgressDlgProc, (LPARAM) &VolExpandParam ); - -ret: - nStatus = ERR_SUCCESS; - -error: - - if (nStatus != 0) - handleError (hwndDlg, nStatus, SRC_POS); - - burn (&VolumePassword, sizeof (VolumePassword)); - - RestoreDefaultKeyFilesParam(); - RandStop (FALSE); - NormalCursor(); - - return; -} - + or Copyright (c) 2012-2013 Josef Schneider + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 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 "Tcdefs.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Apidrvr.h" +#include "Volumes.h" +#include "Crypto.h" +#include "Dlgcode.h" +#include "Language.h" +#include "Pkcs5.h" +#include "Random.h" +// #include "../Mount/Mount.h" + +#include "../Common/Dictionary.h" +#include "../Common/Common.h" +#include "../Common/Resource.h" +#include "../Common/SecurityToken.h" +#include "../Common/Progress.h" + +#include "ExpandVolume.h" +#include "Resource.h" + +// TO DO: display sector sizes different than 512 bytes +#define SECTOR_SIZE_MSG 512 + +#define TIMER_ID_RANDVIEW 0xff +#define TIMER_INTERVAL_RANDVIEW 50 + +// see definition of enum EV_FileSystem +const wchar_t * szFileSystemStr[4] = {L"RAW",L"FAT",L"NTFS",L"EXFAT"}; + +// prototypes for internal functions +BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +namespace VeraCryptExpander +{ +/* defined in WinMain.c, referenced by ExpandVolumeWizard() */ +int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions); +} + + +int GetSpaceString(wchar_t *dest, size_t cbDest, uint64 size, BOOL bDevice) +{ + const wchar_t * szFmtBytes = L"%.0lf %s"; + const wchar_t * szFmtOther = L"%.2lf %s"; + const wchar_t * SuffixStr[] = {L"Byte", L"KB", L"MB", L"GB", L"TB"}; + const uint64 Muliplier[] = {1, BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB}; + const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1; + int i; + + for (i=1; i<=nMaxSuffix && size>Muliplier[i]; i++) ; + + --i; + + if (bDevice) { + wchar_t szTemp[512]; + + if (StringCbPrintfW(szTemp, sizeof(szTemp),i?szFmtOther:szFmtBytes, size/(double)Muliplier[i], SuffixStr[i]) < 0 ) + return -1; + + return StringCbPrintfW(dest, cbDest, L"%I64u sectors (%s)", size/SECTOR_SIZE_MSG , szTemp); + } + + return StringCbPrintfW(dest, cbDest,i?szFmtOther:szFmtBytes, size/(double)Muliplier[i], SuffixStr[i]); +} + +void SetCurrentVolSize(HWND hwndDlg, uint64 size) +{ + const uint64 Muliplier[] = {BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB}; + const int IdRadioBtn[] = {IDC_KB, IDC_MB, IDC_GB, IDC_TB}; + const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1; + int i; + wchar_t szTemp[256]; + + for (i=1; i<=nMaxSuffix && size>Muliplier[i]; i++) ; + + --i; + + SendDlgItemMessage (hwndDlg, IdRadioBtn[i], BM_SETCHECK, BST_CHECKED, 0); + StringCbPrintfW(szTemp,sizeof(szTemp),L"%I64u",size/Muliplier[i]); + SetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTemp); +} + +uint64 GetSizeBoxMultiplier(HWND hwndDlg) +{ + const uint64 Muliplier[] = {BYTES_PER_KB, BYTES_PER_MB, BYTES_PER_GB, BYTES_PER_TB}; + const int IdRadioBtn[] = {IDC_KB, IDC_MB, IDC_GB, IDC_TB}; + const int nMaxSuffix = sizeof(Muliplier)/sizeof(uint64) - 1; + int i; + + for (i=nMaxSuffix; i>0 && !IsButtonChecked (GetDlgItem (hwndDlg, IdRadioBtn[i])); --i) ; + + return Muliplier[i]; +} + +BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static EXPAND_VOL_THREAD_PARAMS *pVolExpandParam; + + WORD lw = LOWORD (wParam); + + switch (msg) + { + case WM_INITDIALOG: + { + wchar_t szTemp[4096]; + + pVolExpandParam = (EXPAND_VOL_THREAD_PARAMS*)lParam; + + EnableWindow (GetDlgItem (hwndDlg, IDC_SIZEBOX), !pVolExpandParam->bIsDevice); + EnableWindow (GetDlgItem (hwndDlg, IDC_KB), !pVolExpandParam->bIsDevice); + EnableWindow (GetDlgItem (hwndDlg, IDC_MB), !pVolExpandParam->bIsDevice); + EnableWindow (GetDlgItem (hwndDlg, IDC_GB), !pVolExpandParam->bIsDevice); + EnableWindow (GetDlgItem (hwndDlg, IDC_TB), !pVolExpandParam->bIsDevice); + + EnableWindow (GetDlgItem (hwndDlg, IDC_INIT_NEWSPACE), + !(pVolExpandParam->bIsLegacy && pVolExpandParam->bIsDevice)); + SendDlgItemMessage (hwndDlg, IDC_INIT_NEWSPACE, BM_SETCHECK, + pVolExpandParam->bInitFreeSpace ? BST_CHECKED : BST_UNCHECKED, 0); + + if (!pVolExpandParam->bIsDevice) + SetCurrentVolSize(hwndDlg,pVolExpandParam->oldSize); + + SendMessage (GetDlgItem (hwndDlg, IDC_BOX_HELP), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE); + + GetSpaceString(szTemp,sizeof(szTemp),pVolExpandParam->oldSize,pVolExpandParam->bIsDevice); + + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_OLDSIZE), szTemp); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NAME), pVolExpandParam->szVolumeName); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_FILE_SYSTEM), szFileSystemStr[pVolExpandParam->FileSystem]); + + if (pVolExpandParam->bIsDevice) + { + GetSpaceString(szTemp,sizeof(szTemp),pVolExpandParam->newSize,TRUE); + } + else + { + wchar_t szHostFreeStr[256]; + + SetWindowText (GetDlgItem (hwndDlg, IDT_NEW_SIZE), L""); + GetSpaceString(szHostFreeStr,sizeof(szHostFreeStr),pVolExpandParam->hostSizeFree,FALSE); + StringCbPrintfW (szTemp,sizeof(szTemp),L"%s available on host drive", szHostFreeStr); + } + + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NEWSIZE), szTemp); + + // set help text + if (pVolExpandParam->bIsDevice) + { + StringCbPrintfW (szTemp,sizeof(szTemp),L"This is a device-based VeraCrypt volume.\n\nThe new volume size will be choosen automatically as the size of the host device."); + if (pVolExpandParam->bIsLegacy) + StringCbCatW(szTemp,sizeof(szTemp),L" Note: filling the new space with random data is not supported for legacy volumes."); + } + else + { + StringCbPrintfW (szTemp, sizeof(szTemp),L"Please specify the new size of the VeraCrypt volume (must be at least %I64u KB larger than the current size).",TC_MINVAL_FS_EXPAND/1024); + } + SetWindowText (GetDlgItem (hwndDlg, IDC_BOX_HELP), szTemp); + + } + return 0; + + + case WM_COMMAND: + if (lw == IDCANCEL) + { + EndDialog (hwndDlg, lw); + return 1; + } + + if (lw == IDOK) + { + wchar_t szTemp[4096]; + + pVolExpandParam->bInitFreeSpace = IsButtonChecked (GetDlgItem (hwndDlg, IDC_INIT_NEWSPACE)); + if (!pVolExpandParam->bIsDevice) // for devices new size is set by calling function + { + GetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTemp, ARRAYSIZE (szTemp)); + pVolExpandParam->newSize = _wtoi64(szTemp) * GetSizeBoxMultiplier(hwndDlg); + } + + EndDialog (hwndDlg, lw); + return 1; + } + + return 0; + } + + return 0; +} + + +extern "C" void AddProgressDlgStatus(HWND hwndDlg, const wchar_t* szText) +{ + HWND hwndCtrl; + + hwndCtrl = GetDlgItem (hwndDlg,IDC_BOX_STATUS); + SendMessage(hwndCtrl,EM_REPLACESEL,FALSE,(LPARAM)szText); + SendMessage(hwndCtrl,EM_SCROLLCARET,0,0); +} + + +extern "C" void SetProgressDlgStatus(HWND hwndDlg, const wchar_t* szText) +{ + HWND hwndCtrl; + + hwndCtrl = GetDlgItem (hwndDlg,IDC_BOX_STATUS); + SendMessage(hwndCtrl,EM_SETSEL,0,-1); + SendMessage(hwndCtrl,EM_REPLACESEL,FALSE,(LPARAM)szText); + SendMessage(hwndCtrl,EM_SCROLLCARET,0,0); +} + + +BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static EXPAND_VOL_THREAD_PARAMS *pProgressDlgParam; + static BOOL bVolTransformStarted = FALSE; + static BOOL showRandPool = TRUE; + static unsigned char randPool[16]; + static unsigned char maskRandPool [16]; + static BOOL bUseMask = FALSE; + static DWORD mouseEntropyGathered = 0xFFFFFFFF; + static DWORD mouseEventsInitialCount = 0; + /* max value of entropy needed to fill all random pool = 8 * RNG_POOL_SIZE = 2560 bits */ + static const DWORD maxEntropyLevel = RNG_POOL_SIZE * 8; + static HWND hEntropyBar = NULL; + + WORD lw = LOWORD (wParam); + + switch (msg) + { + case WM_INITDIALOG: + { + wchar_t szOldHostSize[512], szNewHostSize[512]; + HCRYPTPROV hRngProv; + + pProgressDlgParam = (EXPAND_VOL_THREAD_PARAMS*)lParam; + bVolTransformStarted = FALSE; + showRandPool = FALSE; + + hCurPage = hwndDlg; + nPbar = IDC_PROGRESS_BAR; + + VirtualLock (randPool, sizeof(randPool)); + VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered)); + VirtualLock (maskRandPool, sizeof(maskRandPool)); + + mouseEntropyGathered = 0xFFFFFFFF; + mouseEventsInitialCount = 0; + bUseMask = FALSE; + if (CryptAcquireContext (&hRngProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) + { + if (CryptGenRandom (hRngProv, sizeof (maskRandPool), maskRandPool)) + bUseMask = TRUE; + CryptReleaseContext (hRngProv, 0); + } + + GetSpaceString(szOldHostSize,sizeof(szOldHostSize),pProgressDlgParam->oldSize,pProgressDlgParam->bIsDevice); + GetSpaceString(szNewHostSize,sizeof(szNewHostSize),pProgressDlgParam->newSize,pProgressDlgParam->bIsDevice); + + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_OLDSIZE), szOldHostSize); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NEWSIZE), szNewHostSize); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_NAME), pProgressDlgParam->szVolumeName); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_FILE_SYSTEM), szFileSystemStr[pProgressDlgParam->FileSystem]); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPAND_VOLUME_INITSPACE), pProgressDlgParam->bInitFreeSpace?L"Yes":L"No"); + + SendMessage (GetDlgItem (hwndDlg, IDC_BOX_STATUS), WM_SETFONT, (WPARAM) hBoldFont, (LPARAM) TRUE); + + SendMessage (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE); + + // set status text + if ( !pProgressDlgParam->bInitFreeSpace && pProgressDlgParam->bIsLegacy ) + { + showRandPool = FALSE; + EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), FALSE); + SetDlgItemText(hwndDlg, IDC_BOX_STATUS, L"Click 'Continue' to expand the volume."); + } + else + { + SetDlgItemText(hwndDlg, IDC_BOX_STATUS, L"IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the encryption keys. Then click 'Continue' to expand the volume."); + } + + SendMessage (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), BM_SETCHECK, BST_UNCHECKED, 0); + hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR); + SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel); + SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0); + SetTimer (hwndDlg, TIMER_ID_RANDVIEW, TIMER_INTERVAL_RANDVIEW, NULL); + } + return 0; + case TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED: + { + int nStatus = (int)lParam; + + NormalCursor (); + if (nStatus != 0) + { + if ( nStatus != ERR_USER_ABORT ) + AddProgressDlgStatus (hwndDlg, L"Error: volume expansion failed."); + else + AddProgressDlgStatus (hwndDlg, L"Error: operation aborted by user."); + } + else + { + AddProgressDlgStatus (hwndDlg, L"Finished. Volume successfully expanded."); + } + + SetWindowText (GetDlgItem (hwndDlg, IDOK), L"Exit"); + EnableWindow (GetDlgItem (hwndDlg, IDOK), TRUE); + EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE); + } + return 1; + + case WM_TIMER: + + switch (wParam) + { + case TIMER_ID_RANDVIEW: + { + wchar_t szRndPool[64] = {0}; + DWORD mouseEventsCounter; + + RandpeekBytes (hwndDlg, randPool, sizeof (randPool),&mouseEventsCounter); + + ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered); + + if (showRandPool) + StringCbPrintfW (szRndPool, sizeof(szRndPool), L"%08X%08X%08X%08X", + *((DWORD*) (randPool + 12)), *((DWORD*) (randPool + 8)), *((DWORD*) (randPool + 4)), *((DWORD*) (randPool))); + else if (bUseMask) + { + for (int i = 0; i < 16; i++) + { + wchar_t tmp2[3]; + unsigned char tmpByte = randPool[i] ^ maskRandPool[i]; + tmp2[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*'); + tmp2[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*'); + tmp2[2] = 0; + StringCbCatW (szRndPool, sizeof(szRndPool), tmp2); + } + } + else + { + wmemset (szRndPool, L'*', 32); + } + + SetWindowText (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), szRndPool); + + burn (randPool, sizeof(randPool)); + burn (szRndPool, sizeof(szRndPool)); + } + return 1; + } + return 0; + + case WM_COMMAND: + if (lw == IDC_DISPLAY_POOL_CONTENTS) + { + showRandPool = IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS)); + return 1; + } + if (lw == IDCANCEL) + { + if (bVolTransformStarted) + { + if (MessageBoxW (hwndDlg, L"Warning: Volume expansion is in progress!\n\nStopping now may result in a damaged volume.\n\nDo you really want to cancel?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) + return 1; + + // tell the volume transform thread to terminate + bVolTransformThreadCancel = TRUE; + } + EndDialog (hwndDlg, lw); + return 1; + } + + if (lw == IDOK) + { + if (bVolTransformStarted) + { + // TransformThreadFunction finished -> OK button is now exit + EndDialog (hwndDlg, lw); + } + else + { + showRandPool = FALSE; + KillTimer (hwndDlg, TIMER_ID_RANDVIEW); + EnableWindow (GetDlgItem (hwndDlg, IDC_DISPLAY_POOL_CONTENTS), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE); + SetProgressDlgStatus (hwndDlg, L"Starting volume expansion ...\r\n"); + bVolTransformStarted = TRUE; + pProgressDlgParam->hwndDlg = hwndDlg; + if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L ) + { + handleError (hwndDlg, ERR_OS_ERROR, SRC_POS); + EndDialog (hwndDlg, lw); + } + WaitCursor(); + } + return 1; + } + + return 0; + + case WM_NCDESTROY: + burn (randPool, sizeof (randPool)); + burn (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount)); + burn (&mouseEntropyGathered, sizeof(mouseEntropyGathered)); + burn (maskRandPool, sizeof(maskRandPool)); + return 0; + } + + return 0; +} + + +typedef struct +{ + OpenVolumeContext *context; + const wchar_t *volumePath; + Password *password; + int pkcs5_prf; + int pim; + BOOL truecryptMode; + BOOL write; + BOOL preserveTimestamps; + BOOL useBackupHeader; + int* nStatus; +} OpenVolumeThreadParam; + +void CALLBACK OpenVolumeWaitThreadProc(void* pArg, HWND hwndDlg) +{ + OpenVolumeThreadParam* pThreadParam = (OpenVolumeThreadParam*) pArg; + + *(pThreadParam)->nStatus = OpenVolume(pThreadParam->context, pThreadParam->volumePath, pThreadParam->password, pThreadParam->pkcs5_prf, + pThreadParam->pim, pThreadParam->truecryptMode, pThreadParam->write, pThreadParam->preserveTimestamps, pThreadParam->useBackupHeader); +} + +/* + ExpandVolumeWizard + + Expands a trucrypt volume (wizard for user interface) + + Parameters: + + hwndDlg : HWND + [in] handle to parent window (if any) + + szVolume : char * + [in] Pointer to a string with the volume name (e.g. '\Device\Harddisk0\Partition1' or 'C:\topsecret.tc') + + Return value: + + none + +*/ +void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume) +{ + int nStatus = ERR_OS_ERROR; + wchar_t szTmp[4096]; + Password VolumePassword; + int VolumePkcs5 = 0, VolumePim = -1; + uint64 hostSize, volSize, hostSizeFree, maxSizeFS; + BOOL bIsDevice, bIsLegacy; + DWORD dwError; + int driveNo; + enum EV_FileSystem volFSType; + wchar_t rootPath[] = L"A:\\"; + + switch (IsSystemDevicePath (lpszVolume, hwndDlg, TRUE)) + { + case 1: + case 2: + MessageBoxW (hwndDlg, L"A VeraCrypt system volume can't be expanded.", lpszTitle, MB_OK|MB_ICONEXCLAMATION); + goto ret; + } + + EnableElevatedCursorChange (hwndDlg); + WaitCursor(); + + if (IsMountedVolume (lpszVolume)) + { + Warning ("DISMOUNT_FIRST", hwndDlg); + goto ret; + } + + if (Randinit() != ERR_SUCCESS) { + if (CryptoAPILastError == ERROR_SUCCESS) + nStatus = ERR_RAND_INIT_FAILED; + else + nStatus = ERR_CAPI_INIT_FAILED; + goto error; + } + + NormalCursor(); + + // Ask the user if there is a hidden volume + char *volTypeChoices[] = {0, "DOES_VOLUME_CONTAIN_HIDDEN", "VOLUME_CONTAINS_HIDDEN", "VOLUME_DOES_NOT_CONTAIN_HIDDEN", "IDCANCEL", 0}; + switch (AskMultiChoice ((void **) volTypeChoices, FALSE, hwndDlg)) + { + case 1: + MessageBoxW (hwndDlg, L"An outer volume containing a hidden volume can't be expanded, because this destroys the hidden volume.", lpszTitle, MB_OK|MB_ICONEXCLAMATION); + goto ret; + + case 2: + break; + + default: + nStatus = ERR_SUCCESS; + goto ret; + } + + WaitCursor(); + + nStatus = QueryVolumeInfo(hwndDlg,lpszVolume,&hostSizeFree,&maxSizeFS); + + if (nStatus!=ERR_SUCCESS) + { + nStatus = ERR_OS_ERROR; + goto error; + } + + NormalCursor(); + + while (TRUE) + { + OpenVolumeContext expandVol; + BOOL truecryptMode = FALSE; + + if (!VeraCryptExpander::ExtcvAskVolumePassword (hwndDlg, lpszVolume, &VolumePassword, &VolumePkcs5, &VolumePim, &truecryptMode, "ENTER_NORMAL_VOL_PASSWORD", FALSE)) + { + goto ret; + } + + EnableElevatedCursorChange (hwndDlg); + WaitCursor(); + + if (KeyFilesEnable && FirstKeyFile) + KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, lpszVolume); + + WaitCursor (); + + OpenVolumeThreadParam threadParam; + threadParam.context = &expandVol; + threadParam.volumePath = lpszVolume; + threadParam.password = &VolumePassword; + threadParam.pkcs5_prf = VolumePkcs5; + threadParam.pim = VolumePim; + threadParam.truecryptMode = FALSE; + threadParam.write = FALSE; + threadParam.preserveTimestamps = bPreserveTimestamp; + threadParam.useBackupHeader = FALSE; + threadParam.nStatus = &nStatus; + + ShowWaitDialog (hwndDlg, TRUE, OpenVolumeWaitThreadProc, &threadParam); + + NormalCursor (); + + dwError = GetLastError(); + + if (nStatus == ERR_SUCCESS) + { + bIsDevice = expandVol.IsDevice; + bIsLegacy = expandVol.CryptoInfo->LegacyVolume; + hostSize = expandVol.HostSize; + VolumePkcs5 = expandVol.CryptoInfo->pkcs5; + if ( bIsLegacy ) + { + if ( bIsDevice ) + volSize = 0; // updated later + else + volSize = hostSize; + } + else + { + volSize = GetVolumeSizeByDataAreaSize (expandVol.CryptoInfo->VolumeSize.Value, bIsLegacy); + } + CloseVolume (&expandVol); + break; + } + else if (nStatus != ERR_PASSWORD_WRONG) + { + SetLastError (dwError); + goto error; + } + + NormalCursor(); + + handleError (hwndDlg, nStatus, SRC_POS); + } + + WaitCursor(); + + // auto mount the volume to check the file system type + nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, &VolumePassword, VolumePkcs5, VolumePim); + + if (nStatus != ERR_SUCCESS) + goto error; + + rootPath[0] += driveNo; + + if ( !GetFileSystemType(rootPath,&volFSType) ) + volFSType = EV_FS_TYPE_RAW; + + if ( bIsLegacy && bIsDevice && volFSType == EV_FS_TYPE_NTFS ) + { + uint64 NumberOfSectors; + DWORD BytesPerSector; + + if ( !GetNtfsNumberOfSectors(rootPath, &NumberOfSectors, &BytesPerSector) ) + nStatus = ERR_OS_ERROR; + + // NTFS reported size does not include boot sector copy at volume end + volSize = ( NumberOfSectors + 1 ) * BytesPerSector; + } + + UnmountVolume (hwndDlg, driveNo, TRUE); + + NormalCursor(); + + if (nStatus != ERR_SUCCESS) + goto error; + + if ( bIsDevice && bIsLegacy && volFSType != EV_FS_TYPE_NTFS ) + { + MessageBoxW (hwndDlg, + L"Expanding a device hosted legacy volume with no NTFS file system\n" + L"is unsupported.\n" + L"Note that expanding the VeraCrypt volume itself is not neccessary\n" + L"for legacy volumes.\n", + lpszTitle, MB_OK|MB_ICONEXCLAMATION); + goto ret; + } + + // check if there is enough free space on host device/drive to expand the volume + if ( (bIsDevice && hostSize < volSize + TC_MINVAL_FS_EXPAND) || (!bIsDevice && hostSizeFree < TC_MINVAL_FS_EXPAND) ) + { + MessageBoxW (hwndDlg, L"Not enough free space to expand the volume", lpszTitle, MB_OK|MB_ICONEXCLAMATION); + goto ret; + } + + if (!bIsDevice && hostSize != volSize ) { + // there is some junk data at the end of the volume + if (MessageBoxW (hwndDlg, L"Warning: The container file is larger than the VeraCrypt volume area. The data after the VeraCrypt volume area will be overwritten.\n\nDo you want to continue?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) + goto ret; + } + + switch (volFSType) + { + case EV_FS_TYPE_NTFS: + break; + case EV_FS_TYPE_FAT: + if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains a FAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?", + lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) + goto ret; + break; + case EV_FS_TYPE_EXFAT: + if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an exFAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?", + lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) + goto ret; + break; + default: + if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an unknown or no file system!\n\nOnly the VeraCrypt volume itself will be expanded, the file system remains unchanged.\n\nDo you want to continue?", + lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) + goto ret; + } + + EXPAND_VOL_THREAD_PARAMS VolExpandParam; + + VolExpandParam.bInitFreeSpace = (bIsLegacy && bIsDevice) ? FALSE:TRUE; + VolExpandParam.szVolumeName = lpszVolume; + VolExpandParam.FileSystem = volFSType; + VolExpandParam.pVolumePassword = &VolumePassword; + VolExpandParam.VolumePkcs5 = VolumePkcs5; + VolExpandParam.VolumePim = VolumePim; + VolExpandParam.bIsDevice = bIsDevice; + VolExpandParam.bIsLegacy = bIsLegacy; + VolExpandParam.oldSize = bIsDevice ? volSize : hostSize; + VolExpandParam.newSize = hostSize; + VolExpandParam.hostSizeFree = hostSizeFree; + + while (1) + { + uint64 newVolumeSize; + + if (IDCANCEL == DialogBoxParamW (hInst, + MAKEINTRESOURCEW (IDD_SIZE_DIALOG), hwndDlg, + (DLGPROC) ExpandVolSizeDlgProc, (LPARAM) &VolExpandParam)) + { + goto ret; + } + + newVolumeSize = VolExpandParam.newSize; + + if ( !bIsDevice ) + { + if ( newVolumeSize < hostSize + TC_MINVAL_FS_EXPAND) + { + StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too small, must be at least %I64u kB larger than the current size.",TC_MINVAL_FS_EXPAND/BYTES_PER_KB); + MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION ); + continue; + } + + if ( newVolumeSize - hostSize > hostSizeFree ) + { + StringCbPrintfW(szTmp,sizeof(szTmp),L"New volume size too large, not enough space on host drive."); + MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_OK | MB_ICONEXCLAMATION ); + continue; + } + + if ( newVolumeSize>maxSizeFS ) + { + StringCbPrintfW(szTmp,sizeof(szTmp),L"Maximum file size of %I64u MB on host drive exceeded.",maxSizeFS/BYTES_PER_MB); + MessageBoxW (hwndDlg, L"!\n",lpszTitle, MB_OK | MB_ICONEXCLAMATION ); + continue; + } + } + + if ( newVolumeSize > TC_MAX_VOLUME_SIZE ) + { + // note: current limit TC_MAX_VOLUME_SIZE is 1 PetaByte + StringCbPrintfW(szTmp,sizeof(szTmp),L"Maximum VeraCrypt volume size of %I64u TB exceeded!\n",TC_MAX_VOLUME_SIZE/BYTES_PER_TB); + MessageBoxW (hwndDlg, szTmp,lpszTitle, MB_OK | MB_ICONEXCLAMATION ); + if (bIsDevice) + break; // TODO: ask to limit volume size to TC_MAX_VOLUME_SIZE + continue; + } + + break; + } + + VolExpandParam.oldSize = volSize; + + // start progress dialog + DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_EXPAND_PROGRESS_DLG), hwndDlg, + (DLGPROC) ExpandVolProgressDlgProc, (LPARAM) &VolExpandParam ); + +ret: + nStatus = ERR_SUCCESS; + +error: + + if (nStatus != 0) + handleError (hwndDlg, nStatus, SRC_POS); + + burn (&VolumePassword, sizeof (VolumePassword)); + + RestoreDefaultKeyFilesParam(); + RandStop (FALSE); + NormalCursor(); + + return; +} + diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index 0206efbc..9deb3af4 100644 --- a/src/ExpandVolume/ExpandVolume.c +++ b/src/ExpandVolume/ExpandVolume.c @@ -1,17 +1,17 @@ -/* - 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' +/* + 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh - or Copyright (c) 2012-2013 Josef Schneider - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 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 + or Copyright (c) 2012-2013 Josef Schneider + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 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 "Tcdefs.h" @@ -38,8 +38,8 @@ #include "ExpandVolume.h" #include "Resource.h" -#ifndef SRC_POS -#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__)) +#ifndef SRC_POS +#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__)) #endif #define DEBUG_EXPAND_VOLUME @@ -595,9 +595,9 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas if (Randinit ()) { - if (CryptoAPILastError == ERROR_SUCCESS) - nStatus = ERR_RAND_INIT_FAILED; - else + if (CryptoAPILastError == ERROR_SUCCESS) + nStatus = ERR_RAND_INIT_FAILED; + else nStatus = ERR_CAPI_INIT_FAILED; goto error; } @@ -868,9 +868,9 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas LARGE_INTEGER offset; WipeAlgorithmId wipeAlgorithm = TC_WIPE_35_GUTMANN; - if ( !RandgetBytes (hwndDlg, wipeRandChars, TC_WIPE_RAND_CHAR_COUNT, TRUE) - || !RandgetBytes (hwndDlg, wipeRandCharsUpdate, TC_WIPE_RAND_CHAR_COUNT, TRUE) - ) + if ( !RandgetBytes (hwndDlg, wipeRandChars, TC_WIPE_RAND_CHAR_COUNT, TRUE) + || !RandgetBytes (hwndDlg, wipeRandCharsUpdate, TC_WIPE_RAND_CHAR_COUNT, TRUE) + ) { nStatus = ERR_OS_ERROR; goto error; diff --git a/src/ExpandVolume/ExpandVolume.rc b/src/ExpandVolume/ExpandVolume.rc index 897b75b1..31f71d95 100644 --- a/src/ExpandVolume/ExpandVolume.rc +++ b/src/ExpandVolume/ExpandVolume.rc @@ -1,298 +1,298 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" -#include "..\\common\\resource.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_SIZE_DIALOG DIALOGEX 0, 0, 376, 271 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "VeraCrypt Expander" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - EDITTEXT IDC_SIZEBOX,30,102,109,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - CONTROL "&KB",IDC_KB,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,169,105,38,10 - CONTROL "&MB",IDC_MB,"Button",BS_AUTORADIOBUTTON,209,105,38,10 - CONTROL "&GB",IDC_GB,"Button",BS_AUTORADIOBUTTON,248,105,38,10 - CONTROL "&TB",IDC_TB,"Button",BS_AUTORADIOBUTTON,288,105,38,10 - CONTROL "Fill new space with random data",IDC_INIT_NEWSPACE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,127,118,10 - DEFPUSHBUTTON "Continue",IDOK,15,238,84,18 - PUSHBUTTON "Cancel",IDCANCEL,277,238,84,18 - LTEXT "Help Text",IDC_BOX_HELP,15,165,346,58,0,WS_EX_CLIENTEDGE - GROUPBOX "Enter new volume size",IDC_STATIC,15,83,346,63 - RTEXT "Current size: ",IDT_CURRENT_SIZE,27,42,46,8 - CONTROL "",IDC_EXPAND_VOLUME_OLDSIZE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,80,42,275,8,WS_EX_TRANSPARENT - RTEXT "New size: ",IDT_NEW_SIZE,28,54,45,8 - LTEXT "",IDC_EXPAND_VOLUME_NEWSIZE,80,54,275,8,0,WS_EX_TRANSPARENT - RTEXT "Volume: ",IDT_VOL_NAME,31,18,42,8 - GROUPBOX "",IDC_STATIC,15,9,346,59 - CONTROL "",IDC_EXPAND_VOLUME_NAME,"Static",SS_SIMPLE | WS_GROUP,80,18,275,8,WS_EX_TRANSPARENT - RTEXT "File system: ",IDT_FILE_SYS,31,30,42,8 - CONTROL "",IDC_EXPAND_FILE_SYSTEM,"Static",SS_SIMPLE | WS_GROUP,80,30,275,8,WS_EX_TRANSPARENT -END - -IDD_MOUNT_DLG DIALOGEX 0, 0, 376, 271 -STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "VeraCrypt Expander" -MENU IDR_MENU -CLASS "VeraCryptCustomDlg" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - COMBOBOX IDC_VOLUME,56,192,212,74,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Select &File...",IDC_SELECT_FILE,276,192,84,14 - PUSHBUTTON "Select D&evice...",IDC_SELECT_DEVICE,276,211,84,14 - DEFPUSHBUTTON "Mount",IDOK,8,243,84,18,WS_GROUP - PUSHBUTTON "E&xit",IDC_EXIT,284,243,84,18,WS_GROUP - CONTROL 112,IDC_LOGO,"Static",SS_BITMAP | SS_NOTIFY | WS_BORDER,16,192,27,31 - GROUPBOX "Volume",IDT_VOLUME,8,179,360,53 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,1,0,373,147 - GROUPBOX "",IDC_STATIC,282,238,88,24 - GROUPBOX "",IDC_STATIC,6,238,88,24 - GROUPBOX "",IDC_STATIC,1,147,373,123,BS_CENTER - LTEXT "1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button",IDC_STATIC,15,156,293,21 - LTEXT "Static",IDC_INFOEXPAND,8,6,361,134,SS_NOPREFIX | SS_SUNKEN,WS_EX_STATICEDGE -END - -IDD_PASSWORD_DLG DIALOGEX 0, 0, 322, 107 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Enter VeraCrypt Volume Password" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - EDITTEXT IDC_PASSWORD,69,8,166,14,ES_PASSWORD | ES_AUTOHSCROLL - COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP - CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10 - EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE - CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,49,97,10 - CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,62,153,10 - CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,75,83,10 - CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,88,83,11 - PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,171,86,64,14 - PUSHBUTTON "Mount Opti&ons...",IDC_MOUNT_OPTIONS,243,86,64,14 - DEFPUSHBUTTON "OK",IDOK,243,8,64,14 - PUSHBUTTON "Cancel",IDCANCEL,243,25,64,14 - RTEXT "Password:",IDT_PASSWORD,0,10,65,13 - RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,27,65,13 - RTEXT "Volume PIM:",IDT_PIM,0,46,65,13,NOT WS_VISIBLE - LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8,NOT WS_VISIBLE -END - -IDD_EXPAND_PROGRESS_DLG DIALOGEX 0, 0, 376, 283 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "VeraCrypt Expander" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - RTEXT "Current size: ",IDT_CURRENT_SIZE,27,40,46,8 - CONTROL "",IDC_EXPAND_VOLUME_OLDSIZE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,80,40,275,8,WS_EX_TRANSPARENT - RTEXT "New size: ",IDT_NEW_SIZE,28,52,45,8 - LTEXT "",IDC_EXPAND_VOLUME_NEWSIZE,80,52,275,8,0,WS_EX_TRANSPARENT - CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,22,96,332,12 - RTEXT "",IDC_TIMEREMAIN,275,114,42,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE - RTEXT "",IDC_WRITESPEED,178,114,42,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE - LTEXT "",IDC_BYTESWRITTEN,77,114,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE - RTEXT "Done",IDT_DONE,53,115,22,8 - RTEXT "Speed",IDT_SPEED,142,115,34,8 - RTEXT "Left",IDT_LEFT,248,115,25,8 - GROUPBOX "",IDC_STATIC,15,84,346,49 - RTEXT "Volume: ",IDT_VOL_NAME,31,16,42,8 - GROUPBOX "",IDC_STATIC,15,7,346,72 - CONTROL "",IDC_EXPAND_VOLUME_NAME,"Static",SS_SIMPLE | WS_GROUP,80,16,275,8,WS_EX_TRANSPARENT - DEFPUSHBUTTON "Continue",IDOK,15,247,84,18 - PUSHBUTTON "Cancel",IDCANCEL,277,247,84,18 - EDITTEXT IDC_BOX_STATUS,15,176,346,66,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL - CONTROL "",IDC_EXPAND_VOLUME_INITSPACE,"Static",SS_SIMPLE | WS_GROUP,80,64,275,8,WS_EX_TRANSPARENT - RTEXT "Fill new space: ",IDT_INIT_SPACE,20,64,53,8 - RTEXT "File system: ",IDT_FILE_SYS,31,28,42,8 - CONTROL "",IDC_EXPAND_FILE_SYSTEM,"Static",SS_SIMPLE | WS_GROUP,80,28,275,8,WS_EX_TRANSPARENT - RTEXT "Random Pool: ",IDT_RANDOM_POOL2,20,144,53,8 - CONTROL "",IDC_RANDOM_BYTES,"Static",SS_SIMPLE | WS_GROUP,80,144,149,8,WS_EX_TRANSPARENT - CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,236,142,125,12 - GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,20,156,214,18 - CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",WS_BORDER,31,165,193,6 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_SIZE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 15 - RIGHTMARGIN, 361 - VERTGUIDE, 30 - TOPMARGIN, 14 - BOTTOMMARGIN, 256 - END - - IDD_MOUNT_DLG, DIALOG - BEGIN - RIGHTMARGIN, 369 - VERTGUIDE, 8 - BOTTOMMARGIN, 269 - END - - IDD_PASSWORD_DLG, DIALOG - BEGIN - BOTTOMMARGIN, 102 - END - - IDD_EXPAND_PROGRESS_DLG, DIALOG - BEGIN - RIGHTMARGIN, 361 - VERTGUIDE, 15 - VERTGUIDE, 73 - VERTGUIDE, 80 - VERTGUIDE, 355 - TOPMARGIN, 9 - BOTTOMMARGIN, 268 - HORZGUIDE, 176 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// HEADER -// - -IDR_MOUNT_RSRC_HEADER HEADER "resource.h" - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,17,22,0 - PRODUCTVERSION 1,17,22,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "IDRIX" - VALUE "FileDescription", "VeraCrypt Expander" - VALUE "FileVersion", "1.17" - VALUE "LegalTrademarks", "VeraCrypt" - VALUE "OriginalFilename", "VeraCryptExpander.exe" - VALUE "ProductName", "VeraCrypt" - VALUE "ProductVersion", "1.17" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "#include ""..\\\\common\\\\resource.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""..\\\\common\\\\common.rc""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_LOGO_96DPI BITMAP "Logo_96dpi.bmp" -IDB_LOGO_288DPI BITMAP "Logo_288dpi.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MENU MENUEX -BEGIN - MENUITEM "About", IDM_ABOUT,MFT_STRING,MFS_ENABLED - MENUITEM "Homepage", IDM_HOMEPAGE,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED -END - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_UACSTRING "VeraCrypt Expander" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#include "..\\common\\common.rc" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" +#include "..\\common\\resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_SIZE_DIALOG DIALOGEX 0, 0, 376, 271 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "VeraCrypt Expander" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + EDITTEXT IDC_SIZEBOX,30,102,109,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "&KB",IDC_KB,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,169,105,38,10 + CONTROL "&MB",IDC_MB,"Button",BS_AUTORADIOBUTTON,209,105,38,10 + CONTROL "&GB",IDC_GB,"Button",BS_AUTORADIOBUTTON,248,105,38,10 + CONTROL "&TB",IDC_TB,"Button",BS_AUTORADIOBUTTON,288,105,38,10 + CONTROL "Fill new space with random data",IDC_INIT_NEWSPACE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,127,118,10 + DEFPUSHBUTTON "Continue",IDOK,15,238,84,18 + PUSHBUTTON "Cancel",IDCANCEL,277,238,84,18 + LTEXT "Help Text",IDC_BOX_HELP,15,165,346,58,0,WS_EX_CLIENTEDGE + GROUPBOX "Enter new volume size",IDC_STATIC,15,83,346,63 + RTEXT "Current size: ",IDT_CURRENT_SIZE,27,42,46,8 + CONTROL "",IDC_EXPAND_VOLUME_OLDSIZE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,80,42,275,8,WS_EX_TRANSPARENT + RTEXT "New size: ",IDT_NEW_SIZE,28,54,45,8 + LTEXT "",IDC_EXPAND_VOLUME_NEWSIZE,80,54,275,8,0,WS_EX_TRANSPARENT + RTEXT "Volume: ",IDT_VOL_NAME,31,18,42,8 + GROUPBOX "",IDC_STATIC,15,9,346,59 + CONTROL "",IDC_EXPAND_VOLUME_NAME,"Static",SS_SIMPLE | WS_GROUP,80,18,275,8,WS_EX_TRANSPARENT + RTEXT "File system: ",IDT_FILE_SYS,31,30,42,8 + CONTROL "",IDC_EXPAND_FILE_SYSTEM,"Static",SS_SIMPLE | WS_GROUP,80,30,275,8,WS_EX_TRANSPARENT +END + +IDD_MOUNT_DLG DIALOGEX 0, 0, 376, 271 +STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "VeraCrypt Expander" +MENU IDR_MENU +CLASS "VeraCryptCustomDlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + COMBOBOX IDC_VOLUME,56,192,212,74,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Select &File...",IDC_SELECT_FILE,276,192,84,14 + PUSHBUTTON "Select D&evice...",IDC_SELECT_DEVICE,276,211,84,14 + DEFPUSHBUTTON "Mount",IDOK,8,243,84,18,WS_GROUP + PUSHBUTTON "E&xit",IDC_EXIT,284,243,84,18,WS_GROUP + CONTROL 112,IDC_LOGO,"Static",SS_BITMAP | SS_NOTIFY | WS_BORDER,16,192,27,31 + GROUPBOX "Volume",IDT_VOLUME,8,179,360,53 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,1,0,373,147 + GROUPBOX "",IDC_STATIC,282,238,88,24 + GROUPBOX "",IDC_STATIC,6,238,88,24 + GROUPBOX "",IDC_STATIC,1,147,373,123,BS_CENTER + LTEXT "1. Select the VeraCrypt volume to be expanded\n2. Click the 'Mount' button",IDC_STATIC,15,156,293,21 + LTEXT "Static",IDC_INFOEXPAND,8,6,361,134,SS_NOPREFIX | SS_SUNKEN,WS_EX_STATICEDGE +END + +IDD_PASSWORD_DLG DIALOGEX 0, 0, 322, 107 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Enter VeraCrypt Volume Password" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + EDITTEXT IDC_PASSWORD,69,8,166,14,ES_PASSWORD | ES_AUTOHSCROLL + COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP + CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10 + EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_PASSWORD | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + CONTROL "Use P&IM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,49,97,10 + CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,62,153,10 + CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,75,83,10 + CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,88,83,11 + PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,171,86,64,14 + PUSHBUTTON "Mount Opti&ons...",IDC_MOUNT_OPTIONS,243,86,64,14 + DEFPUSHBUTTON "OK",IDOK,243,8,64,14 + PUSHBUTTON "Cancel",IDCANCEL,243,25,64,14 + RTEXT "Password:",IDT_PASSWORD,0,10,65,13 + RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,27,65,13 + RTEXT "Volume PIM:",IDT_PIM,0,46,65,13,NOT WS_VISIBLE + LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8,NOT WS_VISIBLE +END + +IDD_EXPAND_PROGRESS_DLG DIALOGEX 0, 0, 376, 283 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "VeraCrypt Expander" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + RTEXT "Current size: ",IDT_CURRENT_SIZE,27,40,46,8 + CONTROL "",IDC_EXPAND_VOLUME_OLDSIZE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,80,40,275,8,WS_EX_TRANSPARENT + RTEXT "New size: ",IDT_NEW_SIZE,28,52,45,8 + LTEXT "",IDC_EXPAND_VOLUME_NEWSIZE,80,52,275,8,0,WS_EX_TRANSPARENT + CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,22,96,332,12 + RTEXT "",IDC_TIMEREMAIN,275,114,42,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE + RTEXT "",IDC_WRITESPEED,178,114,42,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE + LTEXT "",IDC_BYTESWRITTEN,77,114,39,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT | WS_EX_RIGHT | WS_EX_STATICEDGE + RTEXT "Done",IDT_DONE,53,115,22,8 + RTEXT "Speed",IDT_SPEED,142,115,34,8 + RTEXT "Left",IDT_LEFT,248,115,25,8 + GROUPBOX "",IDC_STATIC,15,84,346,49 + RTEXT "Volume: ",IDT_VOL_NAME,31,16,42,8 + GROUPBOX "",IDC_STATIC,15,7,346,72 + CONTROL "",IDC_EXPAND_VOLUME_NAME,"Static",SS_SIMPLE | WS_GROUP,80,16,275,8,WS_EX_TRANSPARENT + DEFPUSHBUTTON "Continue",IDOK,15,247,84,18 + PUSHBUTTON "Cancel",IDCANCEL,277,247,84,18 + EDITTEXT IDC_BOX_STATUS,15,176,346,66,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL + CONTROL "",IDC_EXPAND_VOLUME_INITSPACE,"Static",SS_SIMPLE | WS_GROUP,80,64,275,8,WS_EX_TRANSPARENT + RTEXT "Fill new space: ",IDT_INIT_SPACE,20,64,53,8 + RTEXT "File system: ",IDT_FILE_SYS,31,28,42,8 + CONTROL "",IDC_EXPAND_FILE_SYSTEM,"Static",SS_SIMPLE | WS_GROUP,80,28,275,8,WS_EX_TRANSPARENT + RTEXT "Random Pool: ",IDT_RANDOM_POOL2,20,144,53,8 + CONTROL "",IDC_RANDOM_BYTES,"Static",SS_SIMPLE | WS_GROUP,80,144,149,8,WS_EX_TRANSPARENT + CONTROL "Display pool content",IDC_DISPLAY_POOL_CONTENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,236,142,125,12 + GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,20,156,214,18 + CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",WS_BORDER,31,165,193,6 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_SIZE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 15 + RIGHTMARGIN, 361 + VERTGUIDE, 30 + TOPMARGIN, 14 + BOTTOMMARGIN, 256 + END + + IDD_MOUNT_DLG, DIALOG + BEGIN + RIGHTMARGIN, 369 + VERTGUIDE, 8 + BOTTOMMARGIN, 269 + END + + IDD_PASSWORD_DLG, DIALOG + BEGIN + BOTTOMMARGIN, 102 + END + + IDD_EXPAND_PROGRESS_DLG, DIALOG + BEGIN + RIGHTMARGIN, 361 + VERTGUIDE, 15 + VERTGUIDE, 73 + VERTGUIDE, 80 + VERTGUIDE, 355 + TOPMARGIN, 9 + BOTTOMMARGIN, 268 + HORZGUIDE, 176 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// HEADER +// + +IDR_MOUNT_RSRC_HEADER HEADER "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,17,22,0 + PRODUCTVERSION 1,17,22,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "IDRIX" + VALUE "FileDescription", "VeraCrypt Expander" + VALUE "FileVersion", "1.17" + VALUE "LegalTrademarks", "VeraCrypt" + VALUE "OriginalFilename", "VeraCryptExpander.exe" + VALUE "ProductName", "VeraCrypt" + VALUE "ProductVersion", "1.17" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "#include ""..\\\\common\\\\resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""..\\\\common\\\\common.rc""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_LOGO_96DPI BITMAP "Logo_96dpi.bmp" +IDB_LOGO_288DPI BITMAP "Logo_288dpi.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENUEX +BEGIN + MENUITEM "About", IDM_ABOUT,MFT_STRING,MFS_ENABLED + MENUITEM "Homepage", IDM_HOMEPAGE,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_UACSTRING "VeraCrypt Expander" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "..\\common\\common.rc" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/ExpandVolume/ExpandVolume.vcproj b/src/ExpandVolume/ExpandVolume.vcproj index 4ca6c9d9..37b6f461 100644 --- a/src/ExpandVolume/ExpandVolume.vcproj +++ b/src/ExpandVolume/ExpandVolume.vcproj @@ -1,977 +1,977 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ExpandVolume/InitDataArea.c b/src/ExpandVolume/InitDataArea.c index 43c7a312..4e6417be 100644 --- a/src/ExpandVolume/InitDataArea.c +++ b/src/ExpandVolume/InitDataArea.c @@ -1,17 +1,17 @@ -/* - 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' +/* + 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh - or Copyright (c) 2012-2013 Josef Schneider - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 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 + or Copyright (c) 2012-2013 Josef Schneider + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 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 @@ -32,8 +32,8 @@ #include "InitDataArea.h" -#ifndef SRC_POS -#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__)) +#ifndef SRC_POS +#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__)) #endif int FormatWriteBufferSize = 1024 * 1024; diff --git a/src/ExpandVolume/InitDataArea.h b/src/ExpandVolume/InitDataArea.h index 7650d00c..35c6bbd5 100644 --- a/src/ExpandVolume/InitDataArea.h +++ b/src/ExpandVolume/InitDataArea.h @@ -1,15 +1,15 @@ -/* - Derived from source code of TrueCrypt 7.1a, which is - Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed - by the TrueCrypt License 3.0, and also derived from source code of extcv which - is Copyright (c) 2009-2010 by Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider - - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 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. +/* + Derived from source code of TrueCrypt 7.1a, which is + Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed + by the TrueCrypt License 3.0, and also derived from source code of extcv which + is Copyright (c) 2009-2010 by Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider + + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 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. */ #ifndef TC_HEADER_InitDataArea diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index fb9d52af..630fc79d 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -1,17 +1,17 @@ -/* - 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' +/* + 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh - or Copyright (c) 2012-2013 Josef Schneider - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 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 + or Copyright (c) 2012-2013 Josef Schneider + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 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 "Tcdefs.h" @@ -383,32 +383,32 @@ static char *PasswordDialogTitleStringId; /* Except in response to the WM_INITDIALOG message, the dialog box procedure should return nonzero if it processes the message, and zero if it does not. - see DialogProc */ -BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - WORD lw = LOWORD (wParam); - static Password *szXPwd; - static int *pkcs5; - static int *pim; - static BOOL* truecryptMode; - - switch (msg) - { - case WM_INITDIALOG: - { - int i, nIndex; - szXPwd = ((PasswordDlgParam *) lParam) -> password; - pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5; - pim = ((PasswordDlgParam *) lParam) -> pim; - truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode; - LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG"); - DragAcceptFiles (hwndDlg, TRUE); - - if (PasswordDialogTitleStringId) - { - SetWindowTextW (hwndDlg, GetString (PasswordDialogTitleStringId)); - } - else if (wcslen (PasswordDlgVolume) > 0) - { +BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + WORD lw = LOWORD (wParam); + static Password *szXPwd; + static int *pkcs5; + static int *pim; + static BOOL* truecryptMode; + + switch (msg) + { + case WM_INITDIALOG: + { + int i, nIndex; + szXPwd = ((PasswordDlgParam *) lParam) -> password; + pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5; + pim = ((PasswordDlgParam *) lParam) -> pim; + truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode; + LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG"); + DragAcceptFiles (hwndDlg, TRUE); + + if (PasswordDialogTitleStringId) + { + SetWindowTextW (hwndDlg, GetString (PasswordDialogTitleStringId)); + } + else if (wcslen (PasswordDlgVolume) > 0) + { wchar_t s[1024]; const int maxVisibleLen = 40; @@ -420,359 +420,359 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else StringCbPrintfW (s, sizeof(s), GetString ("ENTER_PASSWORD_FOR"), PasswordDlgVolume); - SetWindowTextW (hwndDlg, s); - } - - /* Populate the PRF algorithms list */ - HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); - SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); - - nIndex = SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); - - for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++) - { - nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); - } - - /* make autodetection the default */ - SendMessage (hComboBox, CB_SETCURSEL, 0, 0); - - SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_LIMITTEXT, MAX_PASSWORD, 0); - SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0); - SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0); - - SetPim (hwndDlg, IDC_PIM, *pim); - - /* make PIM field visible if a PIM value has been explicitely specified */ - if (*pim > 0) - { - ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); - ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); - ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); - ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); - } - - SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); - - mountOptions.PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode; - - if (bPrebootPasswordDlgMode) - { - SendMessage (hwndDlg, TC_APPMSG_PREBOOT_PASSWORD_MODE, 0, 0); - } - - if (PasswordDialogDisableMountOptions) - { - EnableWindow (GetDlgItem (hwndDlg, IDC_CACHE), FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_OPTIONS), FALSE); - } - - /* No support for mounting TrueCrypt volumes */ - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); - - if (!SetForegroundWindow (hwndDlg) && (FavoriteMountOnArrivalInProgress)) - { - SetWindowPos (hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - - FLASHWINFO flash; - flash.cbSize = sizeof (flash); - flash.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; - flash.dwTimeout = 0; - flash.hwnd = hwndDlg; - flash.uCount = 0; - - FlashWindowEx (&flash); - - SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - } - } - return 0; - - case TC_APPMSG_PREBOOT_PASSWORD_MODE: - { - /* No support for mounting TrueCrypt system partition */ - SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); - - /* Repopulate the PRF algorithms list with algorithms that support system encryption */ - HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); - SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); - - int i, nIndex = SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); - - for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++) - { - if (HashForSystemEncryption(i)) - { - nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); - } - } - - /* make autodetection the default */ - SendMessage (hComboBox, CB_SETCURSEL, 0, 0); - - ToBootPwdField (hwndDlg, IDC_PASSWORD); - - // Attempt to wipe the password stored in the input field buffer - wchar_t tmp[MAX_PASSWORD+1]; - wmemset (tmp, L'X', MAX_PASSWORD); - tmp [MAX_PASSWORD] = 0; - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); - - StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout),L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF); - - DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); - - if (keybLayout != 0x00000409 && keybLayout != 0x04090409) - { - Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); - EndDialog (hwndDlg, IDCANCEL); - return 1; - } - - if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0) - { - Error ("CANNOT_SET_TIMER", hwndDlg); - EndDialog (hwndDlg, IDCANCEL); - return 1; - } - - if (GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD)) - { - // simulate hiding password - SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE); - - HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_PIM); - } - - SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), FALSE); - - SetPim (hwndDlg, IDC_PIM, *pim); - - bPrebootPasswordDlgMode = TRUE; - } - return 1; - - case WM_TIMER: - switch (wParam) - { - case TIMER_ID_KEYB_LAYOUT_GUARD: - if (bPrebootPasswordDlgMode) - { - DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL); - - if (keybLayout != 0x00000409 && keybLayout != 0x04090409) - { - // Keyboard layout is not standard US - - // Attempt to wipe the password stored in the input field buffer - wchar_t tmp[MAX_PASSWORD+1]; - wmemset (tmp, L'X', MAX_PASSWORD); - tmp [MAX_PASSWORD] = 0; - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); - - keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); - - if (keybLayout != 0x00000409 && keybLayout != 0x04090409) - { - KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); - Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); - EndDialog (hwndDlg, IDCANCEL); - return 1; - } - - wchar_t szTmp [4096]; - StringCbCopyW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_CHANGE_PREVENTED")); - StringCbCatW (szTmp, sizeof(szTmp), L"\n\n"); - StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION")); - MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); - } - } - return 1; - } - return 0; - - case WM_COMMAND: - - if (lw == IDC_MOUNT_OPTIONS) - { - DialogBoxParamW (hInst, - MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, - (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions); - - if (!bPrebootPasswordDlgMode && mountOptions.PartitionInInactiveSysEncScope) - SendMessage (hwndDlg, TC_APPMSG_PREBOOT_PASSWORD_MODE, 0, 0); - - return 1; - } - - if (lw == IDC_PIM_ENABLE) - { - ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); - ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); - ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); - ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); - - SetFocus (GetDlgItem (hwndDlg, IDC_PIM)); - return 1; - } - - if (lw == IDC_SHOW_PASSWORD) - { - HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_PIM); - return 1; - } - - if (lw == IDC_KEY_FILES) - { - KeyFilesDlgParam param; - param.EnableKeyFiles = KeyFilesEnable; - param.FirstKeyFile = FirstKeyFile; - - if (IDOK == DialogBoxParamW (hInst, - MAKEINTRESOURCEW (IDD_KEYFILES), hwndDlg, - (DLGPROC) KeyFilesDlgProc, (LPARAM) ¶m)) - { - KeyFilesEnable = param.EnableKeyFiles; - FirstKeyFile = param.FirstKeyFile; - - SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); - } - - return 1; - } - - if (lw == IDC_KEYFILES_ENABLE) - { - KeyFilesEnable = GetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE); - - return 1; - } - - if (lw == IDCANCEL || lw == IDOK) - { - wchar_t tmp[MAX_PASSWORD+1]; - - if (lw == IDOK) - { - if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles) - KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, PasswordDlgVolume); - - if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, MAX_PASSWORD + 1, TRUE)) - szXPwd->Length = strlen ((char *) szXPwd->Text); - else - return 1; - - bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE)); - *pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); - *truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); - - *pim = GetPim (hwndDlg, IDC_PIM); - - /* SHA-256 is not supported by TrueCrypt */ - if ( (*truecryptMode) - && ((*pkcs5 == SHA256) || (mountOptions.ProtectHiddenVolume && mountOptions.ProtectedHidVolPkcs5Prf == SHA256)) - ) - { - Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - return 1; - } - - if ( (*truecryptMode) - && (*pim != 0) - ) - { - Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); - return 1; - } - } - - // Attempt to wipe password stored in the input field buffer - wmemset (tmp, L'X', MAX_PASSWORD); - tmp[MAX_PASSWORD] = 0; - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), tmp); - - if (hidVolProtKeyFilesParam.FirstKeyFile != NULL) - { - KeyFileRemoveAll (&hidVolProtKeyFilesParam.FirstKeyFile); - hidVolProtKeyFilesParam.EnableKeyFiles = FALSE; - } - - if (bPrebootPasswordDlgMode) - { - KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); - - // Restore the original keyboard layout - if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) - Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg); - } - - EndDialog (hwndDlg, lw); - return 1; - } - return 0; - - case WM_CONTEXTMENU: - { - RECT buttonRect; - GetWindowRect (GetDlgItem (hwndDlg, IDC_KEY_FILES), &buttonRect); - - if (LOWORD (lParam) >= buttonRect.left && LOWORD (lParam) <= buttonRect.right - && HIWORD (lParam) >= buttonRect.top && HIWORD (lParam) <= buttonRect.bottom) - { - // The "Keyfiles" button has been right-clicked - - KeyFilesDlgParam param; - param.EnableKeyFiles = KeyFilesEnable; - param.FirstKeyFile = FirstKeyFile; - - POINT popupPos; - popupPos.x = buttonRect.left + 2; - popupPos.y = buttonRect.top + 2; - - if (KeyfilesPopupMenu (hwndDlg, popupPos, ¶m)) - { - KeyFilesEnable = param.EnableKeyFiles; - FirstKeyFile = param.FirstKeyFile; - SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); - } - } - } - break; - - case WM_DROPFILES: - { - HDROP hdrop = (HDROP) wParam; - int i = 0, count = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0); - - while (count-- > 0) - { - KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile)); - if (kf) - { - DragQueryFile (hdrop, i++, kf->FileName, ARRAYSIZE (kf->FileName)); - FirstKeyFile = KeyFileAdd (FirstKeyFile, kf); - KeyFilesEnable = TRUE; - } - } - - SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); - DragFinish (hdrop); - } - return 1; - } - - return 0; + SetWindowTextW (hwndDlg, s); + } + + /* Populate the PRF algorithms list */ + HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); + SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); + + nIndex = SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); + + for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++) + { + nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); + } + + /* make autodetection the default */ + SendMessage (hComboBox, CB_SETCURSEL, 0, 0); + + SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_LIMITTEXT, MAX_PASSWORD, 0); + SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0); + SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0); + + SetPim (hwndDlg, IDC_PIM, *pim); + + /* make PIM field visible if a PIM value has been explicitely specified */ + if (*pim > 0) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + } + + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); + + mountOptions.PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode; + + if (bPrebootPasswordDlgMode) + { + SendMessage (hwndDlg, TC_APPMSG_PREBOOT_PASSWORD_MODE, 0, 0); + } + + if (PasswordDialogDisableMountOptions) + { + EnableWindow (GetDlgItem (hwndDlg, IDC_CACHE), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_OPTIONS), FALSE); + } + + /* No support for mounting TrueCrypt volumes */ + SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); + + if (!SetForegroundWindow (hwndDlg) && (FavoriteMountOnArrivalInProgress)) + { + SetWindowPos (hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + + FLASHWINFO flash; + flash.cbSize = sizeof (flash); + flash.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; + flash.dwTimeout = 0; + flash.hwnd = hwndDlg; + flash.uCount = 0; + + FlashWindowEx (&flash); + + SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + } + } + return 0; + + case TC_APPMSG_PREBOOT_PASSWORD_MODE: + { + /* No support for mounting TrueCrypt system partition */ + SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); + + /* Repopulate the PRF algorithms list with algorithms that support system encryption */ + HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); + SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); + + int i, nIndex = SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); + + for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++) + { + if (HashForSystemEncryption(i)) + { + nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); + } + } + + /* make autodetection the default */ + SendMessage (hComboBox, CB_SETCURSEL, 0, 0); + + ToBootPwdField (hwndDlg, IDC_PASSWORD); + + // Attempt to wipe the password stored in the input field buffer + wchar_t tmp[MAX_PASSWORD+1]; + wmemset (tmp, L'X', MAX_PASSWORD); + tmp [MAX_PASSWORD] = 0; + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); + + StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout),L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF); + + DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + + if (keybLayout != 0x00000409 && keybLayout != 0x04090409) + { + Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); + EndDialog (hwndDlg, IDCANCEL); + return 1; + } + + if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0) + { + Error ("CANNOT_SET_TIMER", hwndDlg); + EndDialog (hwndDlg, IDCANCEL); + return 1; + } + + if (GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD)) + { + // simulate hiding password + SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE); + + HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_PIM); + } + + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), FALSE); + + SetPim (hwndDlg, IDC_PIM, *pim); + + bPrebootPasswordDlgMode = TRUE; + } + return 1; + + case WM_TIMER: + switch (wParam) + { + case TIMER_ID_KEYB_LAYOUT_GUARD: + if (bPrebootPasswordDlgMode) + { + DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL); + + if (keybLayout != 0x00000409 && keybLayout != 0x04090409) + { + // Keyboard layout is not standard US + + // Attempt to wipe the password stored in the input field buffer + wchar_t tmp[MAX_PASSWORD+1]; + wmemset (tmp, L'X', MAX_PASSWORD); + tmp [MAX_PASSWORD] = 0; + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L""); + + keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE); + + if (keybLayout != 0x00000409 && keybLayout != 0x04090409) + { + KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); + Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION", hwndDlg); + EndDialog (hwndDlg, IDCANCEL); + return 1; + } + + wchar_t szTmp [4096]; + StringCbCopyW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_CHANGE_PREVENTED")); + StringCbCatW (szTmp, sizeof(szTmp), L"\n\n"); + StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION")); + MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST); + } + } + return 1; + } + return 0; + + case WM_COMMAND: + + if (lw == IDC_MOUNT_OPTIONS) + { + DialogBoxParamW (hInst, + MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, + (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions); + + if (!bPrebootPasswordDlgMode && mountOptions.PartitionInInactiveSysEncScope) + SendMessage (hwndDlg, TC_APPMSG_PREBOOT_PASSWORD_MODE, 0, 0); + + return 1; + } + + if (lw == IDC_PIM_ENABLE) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + + SetFocus (GetDlgItem (hwndDlg, IDC_PIM)); + return 1; + } + + if (lw == IDC_SHOW_PASSWORD) + { + HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_PIM); + return 1; + } + + if (lw == IDC_KEY_FILES) + { + KeyFilesDlgParam param; + param.EnableKeyFiles = KeyFilesEnable; + param.FirstKeyFile = FirstKeyFile; + + if (IDOK == DialogBoxParamW (hInst, + MAKEINTRESOURCEW (IDD_KEYFILES), hwndDlg, + (DLGPROC) KeyFilesDlgProc, (LPARAM) ¶m)) + { + KeyFilesEnable = param.EnableKeyFiles; + FirstKeyFile = param.FirstKeyFile; + + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); + } + + return 1; + } + + if (lw == IDC_KEYFILES_ENABLE) + { + KeyFilesEnable = GetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE); + + return 1; + } + + if (lw == IDCANCEL || lw == IDOK) + { + wchar_t tmp[MAX_PASSWORD+1]; + + if (lw == IDOK) + { + if (mountOptions.ProtectHiddenVolume && hidVolProtKeyFilesParam.EnableKeyFiles) + KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, PasswordDlgVolume); + + if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, MAX_PASSWORD + 1, TRUE)) + szXPwd->Length = strlen ((char *) szXPwd->Text); + else + return 1; + + bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE)); + *pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); + *truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); + + *pim = GetPim (hwndDlg, IDC_PIM); + + /* SHA-256 is not supported by TrueCrypt */ + if ( (*truecryptMode) + && ((*pkcs5 == SHA256) || (mountOptions.ProtectHiddenVolume && mountOptions.ProtectedHidVolPkcs5Prf == SHA256)) + ) + { + Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); + return 1; + } + + if ( (*truecryptMode) + && (*pim != 0) + ) + { + Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg); + return 1; + } + } + + // Attempt to wipe password stored in the input field buffer + wmemset (tmp, L'X', MAX_PASSWORD); + tmp[MAX_PASSWORD] = 0; + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), tmp); + + if (hidVolProtKeyFilesParam.FirstKeyFile != NULL) + { + KeyFileRemoveAll (&hidVolProtKeyFilesParam.FirstKeyFile); + hidVolProtKeyFilesParam.EnableKeyFiles = FALSE; + } + + if (bPrebootPasswordDlgMode) + { + KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); + + // Restore the original keyboard layout + if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) + Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg); + } + + EndDialog (hwndDlg, lw); + return 1; + } + return 0; + + case WM_CONTEXTMENU: + { + RECT buttonRect; + GetWindowRect (GetDlgItem (hwndDlg, IDC_KEY_FILES), &buttonRect); + + if (LOWORD (lParam) >= buttonRect.left && LOWORD (lParam) <= buttonRect.right + && HIWORD (lParam) >= buttonRect.top && HIWORD (lParam) <= buttonRect.bottom) + { + // The "Keyfiles" button has been right-clicked + + KeyFilesDlgParam param; + param.EnableKeyFiles = KeyFilesEnable; + param.FirstKeyFile = FirstKeyFile; + + POINT popupPos; + popupPos.x = buttonRect.left + 2; + popupPos.y = buttonRect.top + 2; + + if (KeyfilesPopupMenu (hwndDlg, popupPos, ¶m)) + { + KeyFilesEnable = param.EnableKeyFiles; + FirstKeyFile = param.FirstKeyFile; + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); + } + } + } + break; + + case WM_DROPFILES: + { + HDROP hdrop = (HDROP) wParam; + int i = 0, count = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0); + + while (count-- > 0) + { + KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile)); + if (kf) + { + DragQueryFile (hdrop, i++, kf->FileName, ARRAYSIZE (kf->FileName)); + FirstKeyFile = KeyFileAdd (FirstKeyFile, kf); + KeyFilesEnable = TRUE; + } + } + + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); + DragFinish (hdrop); + } + return 1; + } + + return 0; } void SaveSettings (HWND hwndDlg) @@ -792,36 +792,36 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume) return 0; } -int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions) -{ - int result; - PasswordDlgParam dlgParam; - - PasswordDialogTitleStringId = titleStringId; - PasswordDialogDisableMountOptions = !enableMountOptions; - - dlgParam.password = password; - dlgParam.pkcs5 = pkcs5; - dlgParam.pim = pim; - dlgParam.truecryptMode = truecryptMode; - - StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName); - - result = DialogBoxParamW (hInst, - MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg, - (DLGPROC) ExtcvPasswordDlgProc, (LPARAM) &dlgParam); - - if (result != IDOK) - { - password->Length = 0; - *pkcs5 = 0; - *pim = 0; - *truecryptMode = FALSE; - burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); - burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); - } - - return result == IDOK; +int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions) +{ + int result; + PasswordDlgParam dlgParam; + + PasswordDialogTitleStringId = titleStringId; + PasswordDialogDisableMountOptions = !enableMountOptions; + + dlgParam.password = password; + dlgParam.pkcs5 = pkcs5; + dlgParam.pim = pim; + dlgParam.truecryptMode = truecryptMode; + + StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName); + + result = DialogBoxParamW (hInst, + MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg, + (DLGPROC) ExtcvPasswordDlgProc, (LPARAM) &dlgParam); + + if (result != IDOK) + { + password->Length = 0; + *pkcs5 = 0; + *pim = 0; + *truecryptMode = FALSE; + burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword)); + burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf)); + } + + return result == IDOK; } // GUI actions @@ -839,7 +839,7 @@ static BOOL SelectContainer (HWND hwndDlg) static BOOL SelectPartition (HWND hwndDlg) { - RawDevicesDlgParam param; + RawDevicesDlgParam param; param.pszFileName = szFileName; int nResult = DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), hwndDlg, (DLGPROC) RawDevicesDlgProc, (LPARAM) & param); diff --git a/src/ExpandVolume/resource.h b/src/ExpandVolume/resource.h index 741e78ac..42b9f2b4 100644 --- a/src/ExpandVolume/resource.h +++ b/src/ExpandVolume/resource.h @@ -1,147 +1,147 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by ExpandVolume.rc -// -#define IDD_MOUNT_DLG 101 -#define IDD_PASSWORD_DLG 104 -#define IDR_MENU 106 -#define IDD_EXPAND_PROGRESS_DLG 106 -#define IDR_MOUNT_RSRC_HEADER 109 -#define IDS_UACSTRING 110 -#define IDB_LOGO_288DPI 111 -#define IDB_LOGO_96DPI 112 -#define IDD_SIZE_DIALOG 117 -#define IDC_BOX_HELP 1003 -#define IDC_CACHE 1005 -#define IDC_NO_HISTORY 1006 -#define IDC_DRIVELIST 1007 -#define IDC_SPACE_LEFT 1009 -#define IDC_KB 1011 -#define IDC_MB 1013 -#define IDC_PROGRESS_BAR 1014 -#define IDC_GB 1015 -#define IDC_TB 1016 -#define IDC_EXPAND_VOLUME_OLDSIZE 1017 -#define IDC_EXPAND_VOLUME_NEWSIZE 1019 -#define IDC_EXPAND_VOLUME_NAME 1020 -#define IDC_EXPAND_VOLUME_INITSPACE 1021 -#define IDC_EXPAND_FILE_SYSTEM 1022 -#define IDC_RANDOM_BYTES 1023 -#define IDC_BYTESWRITTEN 1024 -#define IDC_WRITESPEED 1025 -#define IDC_MOUNT_OPTIONS 1026 -#define IDC_TIMEREMAIN 1027 -#define IDC_KEY_FILES 1030 -#define IDC_VOLUME 1033 -#define IDC_PASSWORD 1034 -#define IDC_SELECT_DEVICE 1036 -#define IDC_CREATE_VOLUME 1037 -#define IDC_VOLUME_TOOLS 1038 -#define IDC_SIZEBOX 1038 -#define IDC_WIPE_CACHE 1039 -#define IDC_MOUNTALL 1040 -#define IDC_SELECT_FILE 1042 -#define IDC_VOLUME_PROPERTIES 1044 -#define IDT_RANDOM_POOL 1047 -#define IDT_VOL_NAME 1047 -#define IDT_HEADER_KEY 1048 -#define IDT_CURRENT_SIZE 1048 -#define IDT_VOLUME 1049 -#define IDT_MASTER_KEY 1049 -#define IDT_NEW_SIZE 1049 -#define IDT_PASSWORD 1050 -#define IDT_DONE 1050 -#define IDT_SPEED 1051 -#define IDT_LEFT 1052 -#define IDT_INIT_SPACE 1053 -#define IDT_FILE_SYS 1054 -#define IDT_INIT_SPACE2 1055 -#define IDT_RANDOM_POOL2 1055 -#define IDC_EXIT 1060 -#define IDC_UNMOUNTALL 1063 -#define IDC_SHOW_PASSWORD 1094 -#define IDC_LOGO 1095 -#define IDC_SIZEDLG_TITLE 1111 -#define IDC_INIT_NEWSPACE 1112 -#define IDC_INFOEXPAND 1113 -#define IDC_BOX_STATUS 1114 -#define IDC_TRUECRYPT_MODE 1140 -#define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141 -#define IDT_OLD_PIM 1142 -#define IDC_OLD_PIM 1143 -#define IDC_OLD_PIM_HELP 1144 -#define ID_HOMEPAGE 1145 -#define IDM_HELP 40001 -#define IDM_ABOUT 40002 -#define IDM_UNMOUNT_VOLUME 40003 -#define IDM_CLEAR_HISTORY 40004 -#define IDM_FORUMS 40005 -#define IDM_BENCHMARK 40006 -#define IDM_TRAVELER 40007 -#define IDM_MOUNT_VOLUME_OPTIONS 40008 -#define IDM_FAQ 40009 -#define IDM_REFRESH_DRIVE_LETTERS 40010 -#define IDM_DEFAULT_KEYFILES 40011 -#define IDM_WEBSITE 40012 -#define IDM_MOUNTALL 40013 -#define IDM_UNMOUNTALL 40014 -#define IDM_MOUNT_VOLUME 40015 -#define IDM_CHANGE_PASSWORD 40016 -#define IDM_VOLUME_WIZARD 40017 -#define IDM_CREATE_VOLUME 40018 -#define IDM_WIPE_CACHE 40019 -#define IDM_PREFERENCES 40020 -#define IDM_LICENSE 40021 -#define IDM_SELECT_FILE 40022 -#define IDM_SELECT_DEVICE 40023 -#define IDM_VOLUME_PROPERTIES 40024 -#define IDM_LANGUAGE 40025 -#define IDM_MOUNT_FAVORITE_VOLUMES 40026 -#define IDM_SAVE_FAVORITE_VOLUMES 40027 -#define IDM_BACKUP_VOL_HEADER 40028 -#define IDM_RESTORE_VOL_HEADER 40029 -#define IDM_HOTKEY_SETTINGS 40030 -#define IDM_TC_DOWNLOADS 40031 -#define IDM_NEWS 40032 -#define IDM_BUGREPORT 40033 -#define IDM_CONTACT 40034 -#define IDM_VERSION_HISTORY 40035 -#define IDM_HOMEPAGE 40036 -#define IDM_TEST_VECTORS 40037 -#define IDM_ADD_REMOVE_VOL_KEYFILES 40038 -#define IDM_REMOVE_ALL_KEYFILES_FROM_VOL 40039 -#define IDM_GENERATE_KEYFILE 40040 -#define IDM_CHANGE_HEADER_KEY_DERIV_ALGO 40041 -#define IDM_KEYFILE_GENERATOR 40042 -#define IDM_SET_DEFAULT_KEYFILES 40043 -#define IDM_ONLINE_TUTORIAL 40044 -#define IDM_ONLINE_HELP 40045 -#define IDM_DONATIONS 40046 -#define IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO 40047 -#define IDM_CHANGE_SYS_PASSWORD 40048 -#define IDM_CREATE_RESCUE_DISK 40049 -#define IDM_PERMANENTLY_DECRYPT_SYS 40050 -#define IDM_VERIFY_RESCUE_DISK 40051 -#define IDM_SYSTEM_ENCRYPTION_STATUS 40052 -#define IDM_ENCRYPT_SYSTEM_DEVICE 40053 -#define IDM_SYSENC_RESUME 40054 -#define IDM_MOUNT_SYSENC_PART_WITHOUT_PBA 40055 -#define IDM_CREATE_HIDDEN_OS 40056 -#define IDM_TOKEN_PREFERENCES 40057 -#define IDM_CLOSE_ALL_TOKEN_SESSIONS 40058 -#define IDM_SYS_ENC_SETTINGS 40059 -#define IDM_SYSENC_SETTINGS 40060 -#define IDM_RESUME_INTERRUPTED_PROC 40061 -#define IDM_MANAGE_TOKEN_KEYFILES 40062 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 120 -#define _APS_NEXT_COMMAND_VALUE 40064 -#define _APS_NEXT_CONTROL_VALUE 1146 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ExpandVolume.rc +// +#define IDD_MOUNT_DLG 101 +#define IDD_PASSWORD_DLG 104 +#define IDR_MENU 106 +#define IDD_EXPAND_PROGRESS_DLG 106 +#define IDR_MOUNT_RSRC_HEADER 109 +#define IDS_UACSTRING 110 +#define IDB_LOGO_288DPI 111 +#define IDB_LOGO_96DPI 112 +#define IDD_SIZE_DIALOG 117 +#define IDC_BOX_HELP 1003 +#define IDC_CACHE 1005 +#define IDC_NO_HISTORY 1006 +#define IDC_DRIVELIST 1007 +#define IDC_SPACE_LEFT 1009 +#define IDC_KB 1011 +#define IDC_MB 1013 +#define IDC_PROGRESS_BAR 1014 +#define IDC_GB 1015 +#define IDC_TB 1016 +#define IDC_EXPAND_VOLUME_OLDSIZE 1017 +#define IDC_EXPAND_VOLUME_NEWSIZE 1019 +#define IDC_EXPAND_VOLUME_NAME 1020 +#define IDC_EXPAND_VOLUME_INITSPACE 1021 +#define IDC_EXPAND_FILE_SYSTEM 1022 +#define IDC_RANDOM_BYTES 1023 +#define IDC_BYTESWRITTEN 1024 +#define IDC_WRITESPEED 1025 +#define IDC_MOUNT_OPTIONS 1026 +#define IDC_TIMEREMAIN 1027 +#define IDC_KEY_FILES 1030 +#define IDC_VOLUME 1033 +#define IDC_PASSWORD 1034 +#define IDC_SELECT_DEVICE 1036 +#define IDC_CREATE_VOLUME 1037 +#define IDC_VOLUME_TOOLS 1038 +#define IDC_SIZEBOX 1038 +#define IDC_WIPE_CACHE 1039 +#define IDC_MOUNTALL 1040 +#define IDC_SELECT_FILE 1042 +#define IDC_VOLUME_PROPERTIES 1044 +#define IDT_RANDOM_POOL 1047 +#define IDT_VOL_NAME 1047 +#define IDT_HEADER_KEY 1048 +#define IDT_CURRENT_SIZE 1048 +#define IDT_VOLUME 1049 +#define IDT_MASTER_KEY 1049 +#define IDT_NEW_SIZE 1049 +#define IDT_PASSWORD 1050 +#define IDT_DONE 1050 +#define IDT_SPEED 1051 +#define IDT_LEFT 1052 +#define IDT_INIT_SPACE 1053 +#define IDT_FILE_SYS 1054 +#define IDT_INIT_SPACE2 1055 +#define IDT_RANDOM_POOL2 1055 +#define IDC_EXIT 1060 +#define IDC_UNMOUNTALL 1063 +#define IDC_SHOW_PASSWORD 1094 +#define IDC_LOGO 1095 +#define IDC_SIZEDLG_TITLE 1111 +#define IDC_INIT_NEWSPACE 1112 +#define IDC_INFOEXPAND 1113 +#define IDC_BOX_STATUS 1114 +#define IDC_TRUECRYPT_MODE 1140 +#define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141 +#define IDT_OLD_PIM 1142 +#define IDC_OLD_PIM 1143 +#define IDC_OLD_PIM_HELP 1144 +#define ID_HOMEPAGE 1145 +#define IDM_HELP 40001 +#define IDM_ABOUT 40002 +#define IDM_UNMOUNT_VOLUME 40003 +#define IDM_CLEAR_HISTORY 40004 +#define IDM_FORUMS 40005 +#define IDM_BENCHMARK 40006 +#define IDM_TRAVELER 40007 +#define IDM_MOUNT_VOLUME_OPTIONS 40008 +#define IDM_FAQ 40009 +#define IDM_REFRESH_DRIVE_LETTERS 40010 +#define IDM_DEFAULT_KEYFILES 40011 +#define IDM_WEBSITE 40012 +#define IDM_MOUNTALL 40013 +#define IDM_UNMOUNTALL 40014 +#define IDM_MOUNT_VOLUME 40015 +#define IDM_CHANGE_PASSWORD 40016 +#define IDM_VOLUME_WIZARD 40017 +#define IDM_CREATE_VOLUME 40018 +#define IDM_WIPE_CACHE 40019 +#define IDM_PREFERENCES 40020 +#define IDM_LICENSE 40021 +#define IDM_SELECT_FILE 40022 +#define IDM_SELECT_DEVICE 40023 +#define IDM_VOLUME_PROPERTIES 40024 +#define IDM_LANGUAGE 40025 +#define IDM_MOUNT_FAVORITE_VOLUMES 40026 +#define IDM_SAVE_FAVORITE_VOLUMES 40027 +#define IDM_BACKUP_VOL_HEADER 40028 +#define IDM_RESTORE_VOL_HEADER 40029 +#define IDM_HOTKEY_SETTINGS 40030 +#define IDM_TC_DOWNLOADS 40031 +#define IDM_NEWS 40032 +#define IDM_BUGREPORT 40033 +#define IDM_CONTACT 40034 +#define IDM_VERSION_HISTORY 40035 +#define IDM_HOMEPAGE 40036 +#define IDM_TEST_VECTORS 40037 +#define IDM_ADD_REMOVE_VOL_KEYFILES 40038 +#define IDM_REMOVE_ALL_KEYFILES_FROM_VOL 40039 +#define IDM_GENERATE_KEYFILE 40040 +#define IDM_CHANGE_HEADER_KEY_DERIV_ALGO 40041 +#define IDM_KEYFILE_GENERATOR 40042 +#define IDM_SET_DEFAULT_KEYFILES 40043 +#define IDM_ONLINE_TUTORIAL 40044 +#define IDM_ONLINE_HELP 40045 +#define IDM_DONATIONS 40046 +#define IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO 40047 +#define IDM_CHANGE_SYS_PASSWORD 40048 +#define IDM_CREATE_RESCUE_DISK 40049 +#define IDM_PERMANENTLY_DECRYPT_SYS 40050 +#define IDM_VERIFY_RESCUE_DISK 40051 +#define IDM_SYSTEM_ENCRYPTION_STATUS 40052 +#define IDM_ENCRYPT_SYSTEM_DEVICE 40053 +#define IDM_SYSENC_RESUME 40054 +#define IDM_MOUNT_SYSENC_PART_WITHOUT_PBA 40055 +#define IDM_CREATE_HIDDEN_OS 40056 +#define IDM_TOKEN_PREFERENCES 40057 +#define IDM_CLOSE_ALL_TOKEN_SESSIONS 40058 +#define IDM_SYS_ENC_SETTINGS 40059 +#define IDM_SYSENC_SETTINGS 40060 +#define IDM_RESUME_INTERRUPTED_PROC 40061 +#define IDM_MANAGE_TOKEN_KEYFILES 40062 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 120 +#define _APS_NEXT_COMMAND_VALUE 40064 +#define _APS_NEXT_CONTROL_VALUE 1146 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.2.3