https://git.reactos.org/?p=reactos.git;a=commitdiff;h=67e45c41ee8cef68d52b1…
commit 67e45c41ee8cef68d52b146531a1265b5669c133
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Tue May 29 01:32:52 2018 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Tue May 29 01:32:52 2018 +0200
[SYSSETUP] Open the security settings inf file only once in order to apply the
settings
---
dll/win32/syssetup/security.c | 64 ++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 35 deletions(-)
diff --git a/dll/win32/syssetup/security.c b/dll/win32/syssetup/security.c
index 385fde1b36..d5538a5b6b 100644
--- a/dll/win32/syssetup/security.c
+++ b/dll/win32/syssetup/security.c
@@ -271,9 +271,9 @@ InstallBuiltinAccounts(VOID)
static
VOID
-InstallPrivileges(VOID)
+InstallPrivileges(
+ HINF hSecurityInf)
{
- HINF hSecurityInf = INVALID_HANDLE_VALUE;
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR szPrivilegeString[256];
WCHAR szSidString[256];
@@ -287,16 +287,6 @@ InstallPrivileges(VOID)
DPRINT("InstallPrivileges()\n");
- hSecurityInf = SetupOpenInfFileW(L"defltws.inf", //szNameBuffer,
- NULL,
- INF_STYLE_WIN4,
- NULL);
- if (hSecurityInf == INVALID_HANDLE_VALUE)
- {
- DPRINT1("SetupOpenInfFileW failed\n");
- return;
- }
-
memset(&ObjectAttributes, 0, sizeof(LSA_OBJECT_ATTRIBUTES));
Status = LsaOpenPolicy(NULL,
@@ -394,17 +384,14 @@ InstallPrivileges(VOID)
done:
if (PolicyHandle != NULL)
LsaClose(PolicyHandle);
-
- if (hSecurityInf != INVALID_HANDLE_VALUE)
- SetupCloseInfFile(hSecurityInf);
}
static
VOID
-ApplyRegistryValues(VOID)
+ApplyRegistryValues(
+ HINF hSecurityInf)
{
- HINF hSecurityInf = INVALID_HANDLE_VALUE;
WCHAR szRegistryPath[MAX_PATH];
WCHAR szRootName[MAX_PATH];
WCHAR szKeyName[MAX_PATH];
@@ -418,23 +405,13 @@ ApplyRegistryValues(VOID)
DPRINT("ApplyRegistryValues()\n");
- hSecurityInf = SetupOpenInfFileW(L"defltws.inf", //szNameBuffer,
- NULL,
- INF_STYLE_WIN4,
- NULL);
- if (hSecurityInf == INVALID_HANDLE_VALUE)
- {
- DPRINT1("SetupOpenInfFileW failed\n");
- return;
- }
-
if (!SetupFindFirstLineW(hSecurityInf,
L"Registry Values",
NULL,
&InfContext))
{
DPRINT1("SetupFindFirstLineW failed\n");
- goto done;
+ return;
}
do
@@ -447,7 +424,7 @@ ApplyRegistryValues(VOID)
NULL))
{
DPRINT1("SetupGetStringFieldW() failed\n");
- goto done;
+ return;
}
DPRINT("RegistryPath: %S\n", szRegistryPath);
@@ -606,19 +583,36 @@ ApplyRegistryValues(VOID)
}
}
while (SetupFindNextLine(&InfContext, &InfContext));
-
-done:
- if (hSecurityInf != INVALID_HANDLE_VALUE)
- SetupCloseInfFile(hSecurityInf);
}
VOID
InstallSecurity(VOID)
{
+ HINF hSecurityInf = INVALID_HANDLE_VALUE;
+ PWSTR pszSecurityInf;
+
+// if (IsServer())
+// pszSecurityInf = L"defltsv.inf";
+// else
+ pszSecurityInf = L"defltws.inf";
+
InstallBuiltinAccounts();
- InstallPrivileges();
- ApplyRegistryValues();
+
+ hSecurityInf = SetupOpenInfFileW(pszSecurityInf,
+ NULL,
+ INF_STYLE_WIN4,
+ NULL);
+ if (hSecurityInf == INVALID_HANDLE_VALUE)
+ {
+ DPRINT1("SetupOpenInfFileW failed\n");
+ return;
+ }
+
+ InstallPrivileges(hSecurityInf);
+ ApplyRegistryValues(hSecurityInf);
+
+ SetupCloseInfFile(hSecurityInf);
/* Hack */
SetPrimaryDomain(L"WORKGROUP", NULL);