From 1fd097c666be570fedf612ed7caa7e809881e072 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 13 Dec 2019 00:07:25 +0100 Subject: Windows: check "TrueCrypt Mode" in password dialog when mounting a file container with .tc extension --- src/Common/Dlgcode.c | 9 +++++++++ src/Common/Dlgcode.h | 1 + src/Mount/Mount.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 5e2dc39a..350e3f46 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -7392,6 +7392,15 @@ BOOL CheckFileExtension (wchar_t *fileName) return FALSE; } +BOOL IsTrueCryptFileExtension (wchar_t *fileName) +{ + wchar_t *ext = wcsrchr (fileName, L'.'); + if (ext && !_wcsicmp (ext, L".tc")) + return TRUE; + else + return FALSE; +} + void CorrectFileName (wchar_t* fileName) { /* replace '/' by '\' */ diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 5da717fe..f387bf71 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -351,6 +351,7 @@ BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo); BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValue); BOOL CheckCapsLock (HWND hwnd, BOOL quiet); BOOL CheckFileExtension (wchar_t *fileName); +BOOL IsTrueCryptFileExtension (wchar_t *fileName); void CorrectFileName (wchar_t* fileName); void CorrectURL (wchar_t* fileName); void IncreaseWrongPwdRetryCount (int count); diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 9130eaee..ac25ba58 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -5061,7 +5061,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, else if (!Silent) { int GuiPkcs5 = EffectiveVolumePkcs5; - BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode; + BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode || IsTrueCryptFileExtension (szFileName)? TRUE : FALSE; int GuiPim = EffectiveVolumePim; StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName); -- cgit v1.2.3