mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
- 2nd stage setup: start umpnpmgr service only after the installation of device classes
- Implement ScmrChangeServiceConfigW - Change StartServiceW stub to return success This fixes a race condition in device installation, which sometimes lead to a bad installation for network cards, and no network connectivity at next reboot svn path=/trunk/; revision=19289
This commit is contained in:
@@ -241,8 +241,8 @@ HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0441",0x00000000,"l_intl.n
|
||||
;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0443",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0843",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0456",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"040c"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"040c"
|
||||
|
||||
; Supported and installed locales
|
||||
; If you add/uncomment an entry here, please also add the appropriate Language
|
||||
@@ -668,7 +668,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Group",0x00000000,"PlugPlay"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\umpnpmgr.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000002
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000010
|
||||
|
||||
; RPC service
|
||||
|
||||
@@ -126,7 +126,7 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||
DWORD dwLength;
|
||||
LPWSTR lpStr;
|
||||
|
||||
DPRINT1("ChangeServiceConfigW() called\n");
|
||||
DPRINT("ChangeServiceConfigW() called\n");
|
||||
|
||||
/* Calculate the Dependencies length*/
|
||||
if (lpDependencies != NULL)
|
||||
@@ -1061,9 +1061,10 @@ StartServiceW(
|
||||
DWORD dwNumServiceArgs,
|
||||
LPCWSTR *lpServiceArgVectors)
|
||||
{
|
||||
DPRINT1("StartServiceW is unimplemented\n");
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
DPRINT1("StartServiceW is unimplemented, but returns success...\n");
|
||||
//SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
//return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -331,6 +331,43 @@ ProcessSysSetupInf(VOID)
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
EnableUserModePnpManager(VOID)
|
||||
{
|
||||
SC_HANDLE hSCManager = NULL;
|
||||
SC_HANDLE hService = NULL;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
hSCManager = OpenSCManager(NULL, NULL, 0);
|
||||
if (hSCManager == NULL)
|
||||
goto cleanup;
|
||||
|
||||
hService = OpenService(hSCManager, _T("PlugPlay"), SERVICE_CHANGE_CONFIG | SERVICE_START);
|
||||
if (hService == NULL)
|
||||
goto cleanup;
|
||||
|
||||
ret = ChangeServiceConfig(
|
||||
hService,
|
||||
SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
if (!ret)
|
||||
goto cleanup;
|
||||
|
||||
ret = StartService(hService, 0, NULL);
|
||||
if (!ret)
|
||||
goto cleanup;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
cleanup:
|
||||
if (hSCManager != NULL)
|
||||
CloseServiceHandle(hSCManager);
|
||||
if (hService != NULL)
|
||||
CloseServiceHandle(hService);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
DWORD STDCALL
|
||||
InstallReactOS (HINSTANCE hInstance)
|
||||
{
|
||||
@@ -493,6 +530,12 @@ InstallReactOS (HINSTANCE hInstance)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EnableUserModePnpManager())
|
||||
{
|
||||
DebugPrint("EnableUserModePnpManager() failed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
InstallWizard();
|
||||
|
||||
SetupCloseInfFile(hSysSetupInf);
|
||||
|
||||
@@ -539,6 +539,7 @@ ScmrChangeServiceConfigW(handle_t BiningHandle,
|
||||
DWORD dwError = ERROR_SUCCESS;
|
||||
PSERVICE_HANDLE hSvc;
|
||||
PSERVICE lpService = NULL;
|
||||
HKEY hServiceKey = NULL;
|
||||
|
||||
DPRINT("ScmrChangeServiceConfigW() called\n");
|
||||
DPRINT("dwServiceType = %lu\n", dwServiceType);
|
||||
@@ -581,10 +582,137 @@ ScmrChangeServiceConfigW(handle_t BiningHandle,
|
||||
return ERROR_SERVICE_MARKED_FOR_DELETE;
|
||||
}
|
||||
|
||||
/* FIXME: ... */
|
||||
/* Open the service key */
|
||||
dwError = ScmOpenServiceKey(lpService->szServiceName,
|
||||
KEY_WRITE,
|
||||
&hServiceKey);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
|
||||
/* Write service data to the registry */
|
||||
/* Set the display name */
|
||||
if (lpDisplayName != NULL && *lpDisplayName != 0)
|
||||
{
|
||||
RegSetValueExW(hServiceKey,
|
||||
L"DisplayName",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)lpDisplayName,
|
||||
(wcslen(lpDisplayName) + 1) * sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (dwServiceType != SERVICE_NO_CHANGE)
|
||||
{
|
||||
/* Set the service type */
|
||||
dwError = RegSetValueExW(hServiceKey,
|
||||
L"Type",
|
||||
0,
|
||||
REG_DWORD,
|
||||
(LPBYTE)&dwServiceType,
|
||||
sizeof(DWORD));
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (dwStartType != SERVICE_NO_CHANGE)
|
||||
{
|
||||
/* Set the start value */
|
||||
dwError = RegSetValueExW(hServiceKey,
|
||||
L"Start",
|
||||
0,
|
||||
REG_DWORD,
|
||||
(LPBYTE)&dwStartType,
|
||||
sizeof(DWORD));
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (dwErrorControl != SERVICE_NO_CHANGE)
|
||||
{
|
||||
/* Set the error control value */
|
||||
dwError = RegSetValueExW(hServiceKey,
|
||||
L"ErrorControl",
|
||||
0,
|
||||
REG_DWORD,
|
||||
(LPBYTE)&dwErrorControl,
|
||||
sizeof(DWORD));
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* FIXME: set the new ImagePath value */
|
||||
|
||||
/* Set the image path */
|
||||
if (dwServiceType & SERVICE_WIN32)
|
||||
{
|
||||
if (lpBinaryPathName != NULL && *lpBinaryPathName != 0)
|
||||
{
|
||||
dwError = RegSetValueExW(hServiceKey,
|
||||
L"ImagePath",
|
||||
0,
|
||||
REG_EXPAND_SZ,
|
||||
(LPBYTE)lpBinaryPathName,
|
||||
(wcslen(lpBinaryPathName) + 1) * sizeof(WCHAR));
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else if (dwServiceType & SERVICE_DRIVER)
|
||||
{
|
||||
if (lpImagePath != NULL && *lpImagePath != 0)
|
||||
{
|
||||
dwError = RegSetValueExW(hServiceKey,
|
||||
L"ImagePath",
|
||||
0,
|
||||
REG_EXPAND_SZ,
|
||||
(LPBYTE)lpImagePath,
|
||||
(wcslen(lpImagePath) + 1) *sizeof(WCHAR));
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the group name */
|
||||
if (lpLoadOrderGroup != NULL && *lpLoadOrderGroup != 0)
|
||||
{
|
||||
dwError = RegSetValueExW(hServiceKey,
|
||||
L"Group",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)lpLoadOrderGroup,
|
||||
(wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (lpdwTagId != NULL)
|
||||
{
|
||||
/* FIXME: Write tag */
|
||||
}
|
||||
|
||||
/* Write dependencies */
|
||||
if (lpDependencies != NULL && *lpDependencies != 0)
|
||||
{
|
||||
dwError = ScmWriteDependencies(hServiceKey,
|
||||
lpDependencies,
|
||||
dwDependenciesLength);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (lpPassword != NULL)
|
||||
{
|
||||
/* FIXME: Write password */
|
||||
}
|
||||
|
||||
/* FIXME: Unlock database */
|
||||
|
||||
done:
|
||||
if (hServiceKey != NULL)
|
||||
RegCloseKey(hServiceKey);
|
||||
|
||||
DPRINT("ScmrChangeServiceConfigW() done (Error %lu)\n", dwError);
|
||||
|
||||
return dwError;
|
||||
@@ -695,11 +823,6 @@ ScmrCreateServiceW(handle_t BindingHandle,
|
||||
wcscpy(lpService->lpDisplayName, lpDisplayName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* FIXME: set lpLoadOrderGroup, lpDependencies etc. */
|
||||
|
||||
|
||||
/* Write service data to the registry */
|
||||
/* Create the service key */
|
||||
dwError = ScmCreateServiceKey(lpServiceName,
|
||||
|
||||
Reference in New Issue
Block a user