Skip to content

Commit f340524

Browse files
committed
[SERVICES] Grant ReactOS Setup component SYSTEM access
ReactOS Setup is an integral component that is part of the operating system responsible for the installation of ROS during 2nd installation stage. The situation with current master branch is like this -- the Services component always tries to create the process on behalf of the logged in user with its own security context. That user doesn't have the privileges and access rights like SYSTEM thus the Services component tries to create the process but it fails to do so because of lacking of required access right, TOKEN_DUPLICATE, in order for the calling thread to impersonate as self.
1 parent cd1070d commit f340524

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

base/system/services/database.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ ScmLogonService(
370370
DPRINT("ScmLogonService(%p %p)\n", pService, pImage);
371371
DPRINT("Service %S\n", pService->lpServiceName);
372372

373-
if (ScmIsLocalSystemAccount(pImage->pszAccountName) || ScmLiveSetup)
373+
if (ScmIsLocalSystemAccount(pImage->pszAccountName) || ScmLiveSetup || ScmSetupInProgress)
374374
return ERROR_SUCCESS;
375375

376376
/* Get the user and domain names */

base/system/services/services.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ int WINAPI RegisterServicesProcess(DWORD ServicesProcessId);
2828
BOOL ScmInitialize = FALSE;
2929
BOOL ScmShutdown = FALSE;
3030
BOOL ScmLiveSetup = FALSE;
31+
BOOL ScmSetupInProgress = FALSE;
3132
static HANDLE hScmShutdownEvent = NULL;
3233
static HANDLE hScmSecurityServicesEvent = NULL;
3334

@@ -55,6 +56,7 @@ CheckForLiveCD(VOID)
5556
WCHAR CommandLine[MAX_PATH];
5657
HKEY hSetupKey;
5758
DWORD dwSetupType;
59+
DWORD dwSetupInProgress;
5860
DWORD dwType;
5961
DWORD dwSize;
6062
DWORD dwError;
@@ -107,6 +109,28 @@ CheckForLiveCD(VOID)
107109
ScmLiveSetup = TRUE;
108110
}
109111

112+
/* Read the SystemSetupInProgress value */
113+
dwSize = sizeof(DWORD);
114+
dwError = RegQueryValueExW(hSetupKey,
115+
L"SystemSetupInProgress",
116+
NULL,
117+
&dwType,
118+
(LPBYTE)&dwSetupInProgress,
119+
&dwSize);
120+
if (dwError != ERROR_SUCCESS ||
121+
dwType != REG_DWORD ||
122+
dwSize != sizeof(DWORD) ||
123+
dwSetupType == 0)
124+
{
125+
goto done;
126+
}
127+
128+
if (dwSetupInProgress == 1)
129+
{
130+
DPRINT1("ReactOS Setup currently in progress!\n");
131+
ScmSetupInProgress = TRUE;
132+
}
133+
110134
done:
111135
RegCloseKey(hSetupKey);
112136

base/system/services/services.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ extern LIST_ENTRY ImageListHead;
102102
extern BOOL ScmInitialize;
103103
extern BOOL ScmShutdown;
104104
extern BOOL ScmLiveSetup;
105+
extern BOOL ScmSetupInProgress;
105106
extern PSECURITY_DESCRIPTOR pPipeSD;
106107

107108

0 commit comments

Comments
 (0)