diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-07-28 23:30:10 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-07-29 15:54:27 +0200 |
commit | 8288fecc0ad74624f489bbdf3fb71cb1a1fbf286 (patch) | |
tree | 8c3a52c28f417fcc2b3b12f33b60fe72c1ed6d27 /src/Setup/Setup.c | |
parent | 7a94a05974376fede2f8496a13e28b3cde851016 (diff) | |
download | VeraCrypt-8288fecc0ad74624f489bbdf3fb71cb1a1fbf286.tar.gz VeraCrypt-8288fecc0ad74624f489bbdf3fb71cb1a1fbf286.zip |
Windows: Add portable installer that only extra binaries without the need of administrative privileges for extraction.
Diffstat (limited to 'src/Setup/Setup.c')
-rw-r--r-- | src/Setup/Setup.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index 3da3609d..a1f27f41 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -1058,6 +1058,7 @@ err: return bOK; } +#ifndef PORTABLE BOOL DoRegInstall (HWND hwndDlg, wchar_t *szDestDir, BOOL bInstallType) { wchar_t szDir[TC_MAX_PATH], *key; @@ -2493,6 +2494,7 @@ BOOL CALLBACK UninstallDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return 0; } +#endif int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpszCommandLine, int nCmdShow) @@ -2501,18 +2503,22 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz SelfExtractStartupInit(); +#ifdef PORTABLE + lpszTitle = L"VeraCrypt Portable"; +#else lpszTitle = L"VeraCrypt Setup"; - +#endif /* Call InitApp to initialize the common code */ InitApp (hInstance, NULL); +#ifndef PORTABLE if (IsAdmin () != TRUE) if (MessageBoxW (NULL, GetString ("SETUP_ADMIN"), lpszTitle, MB_YESNO | MB_ICONQUESTION) != IDYES) { FinalizeApp (); exit (1); } - +#endif /* Setup directory */ { wchar_t *s; @@ -2526,6 +2532,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz if (lpszCommandLine[0] == L'/') { +#ifndef PORTABLE if (lpszCommandLine[1] == L'u') { // Uninstall: /u @@ -2538,7 +2545,9 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz bChangeMode = TRUE; } - else if (lpszCommandLine[1] == L'p') + else +#endif + if (lpszCommandLine[1] == L'p') { // Create self-extracting package: /p @@ -2559,8 +2568,9 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz } else { +#ifndef PORTABLE SetInstallationPath (NULL); - +#endif if (!bUninstall) { if (IsSelfExtractingPackage()) @@ -2574,11 +2584,16 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz } else if (!bDevm) { +#ifndef PORTABLE MessageBox (NULL, L"Error: This installer file does not contain any compressed files.\n\nTo create a self-extracting installation package (with embedded compressed files), run:\n\"VeraCrypt Setup.exe\" /p", L"VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST); +#else + MessageBox (NULL, L"Error: This portable installer file does not contain any compressed files.\n\nTo create a self-extracting portable installation package (with embedded compressed files), run:\n\"VeraCrypt Portable.exe\" /p", L"VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST); +#endif FinalizeApp (); exit (1); } +#ifndef PORTABLE if (bChangeMode) { /* VeraCrypt is already installed on this system and we were launched from the Program Files folder */ @@ -2599,8 +2614,10 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz exit (1); } } +#endif } +#ifndef PORTABLE // System Restore if (IsSystemRestoreEnabled ()) { @@ -2615,6 +2632,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz } else SystemRestoreDll = 0; +#endif if (!bUninstall) { @@ -2623,6 +2641,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_INSTL_DLG), NULL, (DLGPROC) MainDialogProc, (LPARAM)lpszCommandLine); } +#ifndef PORTABLE else { /* Create the main dialog for uninstall */ @@ -2648,6 +2667,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz } } } +#endif } FinalizeApp (); return 0; |