--- main.cc | 2 +- root.cc | 5 +++++ win32.cc | 7 +------ win32.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/main.cc b/main.cc index 3a8c5ea..1cc8a0c 100644 --- a/main.cc +++ b/main.cc @@ -359,7 +359,7 @@ WinMain (HINSTANCE h, } /* Set default DACL and Group. */ - nt_sec.setDefaultSecurity ((root_scope == IDC_ROOT_SYSTEM)); + nt_sec.setDefaultSecurity (); /* If --symlink-type option isn't given, look for winsymlinks in CYGWIN diff --git a/root.cc b/root.cc index 1723a53..9f072d7 100644 --- a/root.cc +++ b/root.cc @@ -297,6 +297,11 @@ RootPage::OnNext () Log (LOG_PLAIN) << "root: " << get_root_dir () << (root_scope == IDC_ROOT_USER ? " user" : " system") << endLog; + if (root_scope == IDC_ROOT_SYSTEM) + nt_sec.setAdminGroup (); + else + nt_sec.resetPrimaryGroup (); + return 0; } diff --git a/win32.cc b/win32.cc index 62ae4eb..ea3d53a 100644 --- a/win32.cc +++ b/win32.cc @@ -308,7 +308,7 @@ NTSecurity::setAdminGroup () } void -NTSecurity::setDefaultSecurity (bool isAdmin) +NTSecurity::setDefaultSecurity () { /* Get the processes access token. */ if (!OpenProcessToken (GetCurrentProcess (), @@ -358,11 +358,6 @@ NTSecurity::setDefaultSecurity (bool isAdmin) primaryGroupSID.pgrp.PrimaryGroup = (PSID) NULL; } groupSID = primaryGroupSID.pgrp.PrimaryGroup; - /* Try to set the primary group to the Administrators group, but only if - "Install for all users" has been chosen. If it doesn't work, we're - no admin and that's all there's to say about it. */ - if (isAdmin) - setAdminGroup (); } bool diff --git a/win32.h b/win32.h index 02c1d06..bf3ff10 100644 --- a/win32.h +++ b/win32.h @@ -130,7 +130,7 @@ public: void resetPrimaryGroup(); void setAdminGroup (); void initialiseWellKnownSIDs (); - void setDefaultSecurity(bool isAdmin); + void setDefaultSecurity (); bool isRunAsAdmin (); bool hasSymlinkCreationRights (); private: -- 2.36.1