VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-06 11:39:47 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-06 20:31:01 +0200
commit42a7a17cb963eff8a94e60f218db943398d0dee0 (patch)
tree30a3d6da25bbb6d66266b93ac9a708bb24b8f8fb /src/Common
parentadc32743954de1976f1e9c907b40673ed8756e10 (diff)
downloadVeraCrypt-42a7a17cb963eff8a94e60f218db943398d0dee0.tar.gz
VeraCrypt-42a7a17cb963eff8a94e60f218db943398d0dee0.zip
Windows Installer: better handling for updating system favorite service from 1.0f-2 (solve Windows 10 issue) . Remove extra VeraCrypt files that may remain after uninstalling it.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/BootEncryption.cpp34
-rw-r--r--src/Common/BootEncryption.h1
2 files changed, 35 insertions, 0 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 064d1f8d..02affc89 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -2017,6 +2017,7 @@ namespace VeraCrypt
{
SC_HANDLE scm = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
throw_sys_if (!scm);
+ finally_do_arg (SC_HANDLE, scm, { CloseServiceHandle (finally_arg); });
string servicePath = GetServiceConfigPath (TC_APP_NAME ".exe", false);
string serviceLegacyPath = GetServiceConfigPath (TC_APP_NAME ".exe", true);
@@ -2099,6 +2100,39 @@ namespace VeraCrypt
}
}
+ void BootEncryption::UpdateSystemFavoritesService ()
+ {
+ SC_HANDLE scm = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ throw_sys_if (!scm);
+
+ finally_do_arg (SC_HANDLE, scm, { CloseServiceHandle (finally_arg); });
+
+ string servicePath = GetServiceConfigPath (TC_APP_NAME ".exe", false);
+
+ // check if service exists
+ SC_HANDLE service = OpenService (scm, TC_SYSTEM_FAVORITES_SERVICE_NAME, SERVICE_ALL_ACCESS);
+ if (service)
+ {
+ // ensure that its parameters are correct
+ throw_sys_if (!ChangeServiceConfig (service,
+ SERVICE_WIN32_OWN_PROCESS,
+ SERVICE_AUTO_START,
+ SERVICE_ERROR_NORMAL,
+ (string ("\"") + servicePath + "\" " TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION).c_str(),
+ TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ TC_APP_NAME " System Favorites"));
+
+ }
+ else
+ {
+ RegisterSystemFavoritesService (TRUE, TRUE);
+ }
+ }
+
void BootEncryption::SetDriverConfigurationFlag (uint32 flag, bool state)
{
DWORD configMap = ReadDriverConfigurationFlags();
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index b1c5e7c1..561e1723 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -186,6 +186,7 @@ namespace VeraCrypt
void RegisterFilterDriver (bool registerDriver, FilterType filterType);
void RegisterSystemFavoritesService (BOOL registerService);
void RegisterSystemFavoritesService (BOOL registerService, BOOL noFileHandling);
+ void UpdateSystemFavoritesService ();
void RenameDeprecatedSystemLoaderBackup ();
bool RestartComputer (void);
void InitialSecurityChecksForHiddenOS ();