[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.
This commit is contained in:
George Bișoc 2022-02-21 11:12:48 +01:00
parent cd1070dfc4
commit f340524ea4
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6
3 changed files with 26 additions and 1 deletions

View file

@ -28,6 +28,7 @@ int WINAPI RegisterServicesProcess(DWORD ServicesProcessId);
BOOL ScmInitialize = FALSE;
BOOL ScmShutdown = FALSE;
BOOL ScmLiveSetup = FALSE;
BOOL ScmSetupInProgress = FALSE;
static HANDLE hScmShutdownEvent = NULL;
static HANDLE hScmSecurityServicesEvent = NULL;
@ -55,6 +56,7 @@ CheckForLiveCD(VOID)
WCHAR CommandLine[MAX_PATH];
HKEY hSetupKey;
DWORD dwSetupType;
DWORD dwSetupInProgress;
DWORD dwType;
DWORD dwSize;
DWORD dwError;
@ -107,6 +109,28 @@ CheckForLiveCD(VOID)
ScmLiveSetup = TRUE;
}
/* Read the SystemSetupInProgress value */
dwSize = sizeof(DWORD);
dwError = RegQueryValueExW(hSetupKey,
L"SystemSetupInProgress",
NULL,
&dwType,
(LPBYTE)&dwSetupInProgress,
&dwSize);
if (dwError != ERROR_SUCCESS ||
dwType != REG_DWORD ||
dwSize != sizeof(DWORD) ||
dwSetupType == 0)
{
goto done;
}
if (dwSetupInProgress == 1)
{
DPRINT1("ReactOS Setup currently in progress!\n");
ScmSetupInProgress = TRUE;
}
done:
RegCloseKey(hSetupKey);