diff options
Diffstat (limited to 'src/Setup')
-rw-r--r-- | src/Setup/Setup.c | 54 | ||||
-rw-r--r-- | src/Setup/Setup.h | 18 |
2 files changed, 49 insertions, 23 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index 705ff5eb..bb7eef04 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -557,7 +557,7 @@ void StatusMessage (HWND hwndDlg, char *stringId) SendDlgItemMessage (hwndDlg, IDC_LOG_WINDOW, LB_GETCOUNT, 0, 0) - 1, 0); } -void StatusMessageParam (HWND hwndDlg, char *stringId, wchar_t *param) +void StatusMessageParam (HWND hwndDlg, char *stringId, const wchar_t *param) { wchar_t szTmp[1024]; @@ -576,23 +576,23 @@ void ClearLogWindow (HWND hwndDlg) SendMessage (GetDlgItem (hwndDlg, IDC_LOG_WINDOW), LB_RESETCONTENT, 0, 0); } -void RegMessage (HWND hwndDlg, wchar_t *txt) +void RegMessage (HWND hwndDlg, const wchar_t *txt) { StatusMessageParam (hwndDlg, "ADDING_REG", txt); } -void CopyMessage (HWND hwndDlg, wchar_t *txt) +void _cdecl CopyMessage (HWND hwndDlg, const wchar_t *txt) { StatusMessageParam (hwndDlg, "INSTALLING", txt); } -void RemoveMessage (HWND hwndDlg, wchar_t *txt) +void RemoveMessage (HWND hwndDlg, const wchar_t *txt) { if (!Rollback) StatusMessageParam (hwndDlg, "REMOVING", txt); } -void IconMessage (HWND hwndDlg, wchar_t *txt) +void IconMessage (HWND hwndDlg, const wchar_t *txt) { StatusMessageParam (hwndDlg, "ADDING_ICON", txt); } @@ -672,7 +672,7 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir) for (i = 0; i < sizeof (szFiles) / sizeof (szFiles[0]); i++) { - BOOL bResult, driver64 = FALSE; + BOOL bResult, driver64 = FALSE, zipFile = FALSE; wchar_t szDir[TC_MAX_PATH]; if (wcsstr (szFiles[i], L"VeraCrypt Setup") != 0) @@ -696,7 +696,7 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir) continue; } - if (*szFiles[i] == L'A') + if ((*szFiles[i] == L'A') || (*szFiles[i] == L'X')) StringCbCopyW (szDir, sizeof(szDir), szDestDir); else if (*szFiles[i] == L'D') { @@ -717,7 +717,17 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir) if (*szFiles[i] == L'I') continue; + if (*szFiles[i] == L'X') + zipFile = TRUE; + StringCbPrintfW (szTmp, sizeof(szTmp), L"%s%s", szDir, szFiles[i] + 1); + if (zipFile) + { + // build folder name by removing .zip extension + wchar_t* ptr = wcsrchr (szTmp, L'.'); + if (ptr) + *ptr = 0; + } if (bUninstall == FALSE) CopyMessage (hwndDlg, szTmp); @@ -805,13 +815,24 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir) bResult = FALSE; goto err; } - - bResult = SaveBufferToFile ( - (char *) Decompressed_Files[fileNo].fileContent, - szTmp, - Decompressed_Files[fileNo].fileLength, - FALSE, - TRUE); + if (zipFile) + { + bResult = DecompressZipToDir ( + Decompressed_Files[fileNo].fileContent, + Decompressed_Files[fileNo].fileLength, + szDir, + CopyMessage, + hwndDlg); + } + else + { + bResult = SaveBufferToFile ( + (char *) Decompressed_Files[fileNo].fileContent, + szTmp, + Decompressed_Files[fileNo].fileLength, + FALSE, + TRUE); + } if (driver64) { @@ -907,7 +928,10 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir) { if (driver64) EnableWow64FsRedirection (FALSE); - bResult = StatDeleteFile (szTmp, TRUE); + if (zipFile) + bResult = StatRemoveDirectory (szTmp); + else + bResult = StatDeleteFile (szTmp, TRUE); if (driver64) EnableWow64FsRedirection (TRUE); diff --git a/src/Setup/Setup.h b/src/Setup/Setup.h index 76cc7e9a..c4f3fb22 100644 --- a/src/Setup/Setup.h +++ b/src/Setup/Setup.h @@ -74,7 +74,8 @@ static wchar_t *szFiles[]= L"ALanguage.vi.xml", L"ALanguage.zh-cn.xml", L"ALanguage.zh-hk.xml", - L"ALanguage.zh-tw.xml" + L"ALanguage.zh-tw.xml", + L"Xdocs.zip", }; // Specifies what files are included in self-extracting packages (no other files will be packaged or extracted). @@ -128,7 +129,8 @@ static wchar_t *szCompressedFiles[]= L"Language.vi.xml", L"Language.zh-cn.xml", L"Language.zh-hk.xml", - L"Language.zh-tw.xml" + L"Language.zh-tw.xml", + L"docs.zip" }; #define FILENAME_64BIT_DRIVER L"veracrypt-x64.sys" @@ -140,13 +142,13 @@ BOOL StatRemoveDirectory ( wchar_t *lpszDir ); HRESULT CreateLink ( wchar_t *lpszPathObj , wchar_t *lpszArguments , wchar_t *lpszPathLink ); void GetProgramPath ( HWND hwndDlg , wchar_t *path ); void StatusMessage (HWND hwndDlg, char *stringId); -void StatusMessageParam (HWND hwndDlg, char *stringId, wchar_t *param); +void StatusMessageParam (HWND hwndDlg, char *stringId, const wchar_t *param); void ClearLogWindow (HWND hwndDlg); -void RegMessage ( HWND hwndDlg , wchar_t *txt ); -void RegRemoveMessage (HWND hwndDlg, wchar_t *txt); -void CopyMessage ( HWND hwndDlg , wchar_t *txt ); -void RemoveMessage ( HWND hwndDlg , wchar_t *txt ); -void IconMessage ( HWND hwndDlg , wchar_t *txt ); +void RegMessage ( HWND hwndDlg , const wchar_t *txt ); +void RegRemoveMessage (HWND hwndDlg, const wchar_t *txt); +void _cdecl CopyMessage ( HWND hwndDlg , const wchar_t *txt ); +void RemoveMessage ( HWND hwndDlg , const wchar_t *txt ); +void IconMessage ( HWND hwndDlg , const wchar_t *txt ); static int CALLBACK BrowseCallbackProc ( HWND hwnd , UINT uMsg , LPARAM lp , LPARAM pData ); void LoadLicense ( HWND hwndDlg ); void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersionPtr); |