- 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
Modified: trunk/reactos/bootdata/hivesys.inf
Modified: trunk/reactos/lib/advapi32/service/scm.c
Modified: trunk/reactos/lib/syssetup/install.c
Modified: trunk/reactos/subsys/system/services/rpcserver.c
_____
Modified: trunk/reactos/bootdata/hivesys.inf
--- trunk/reactos/bootdata/hivesys.inf 2005-11-17 08:29:59 UTC (rev
19288)
+++ trunk/reactos/bootdata/hivesys.inf 2005-11-17 12:49:37 UTC (rev
19289)
@@ -241,8 +241,8 @@
;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",0x000000
00,"0409"
-HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",
0x00000000,"0409"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x000000
00,"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\PlugPlay","ErrorControl",0x00010
001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Group",0x00000000,"Pl
ugPlay"
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000
,"%SystemRoot%\system32\umpnpmgr.exe"
-HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x
00000002
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x
00000004
HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00
000010
; RPC service
_____
Modified: trunk/reactos/lib/advapi32/service/scm.c
--- trunk/reactos/lib/advapi32/service/scm.c 2005-11-17 08:29:59 UTC
(rev 19288)
+++ trunk/reactos/lib/advapi32/service/scm.c 2005-11-17 12:49:37 UTC
(rev 19289)
@@ -126,7 +126,7 @@
DWORD dwLength;
LPWSTR lpStr;
- DPRINT1("ChangeServiceConfigW() called\n");
+ DPRINT("ChangeServiceConfigW() called\n");
/* Calculate the Dependencies length*/
if (lpDependencies != NULL)
@@ -1061,9 +1061,10 @@
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;
}
_____
Modified: trunk/reactos/lib/syssetup/install.c
--- trunk/reactos/lib/syssetup/install.c 2005-11-17 08:29:59 UTC
(rev 19288)
+++ trunk/reactos/lib/syssetup/install.c 2005-11-17 12:49:37 UTC
(rev 19289)
@@ -331,6 +331,43 @@
}
+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 @@
return 0;
}
+ if (!EnableUserModePnpManager())
+ {
+ DebugPrint("EnableUserModePnpManager() failed!\n");
+ return 0;
+ }
+
InstallWizard();
SetupCloseInfFile(hSysSetupInf);
_____
Modified: trunk/reactos/subsys/system/services/rpcserver.c
--- trunk/reactos/subsys/system/services/rpcserver.c 2005-11-17
08:29:59 UTC (rev 19288)
+++ trunk/reactos/subsys/system/services/rpcserver.c 2005-11-17
12:49:37 UTC (rev 19289)
@@ -539,6 +539,7 @@
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 @@
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 @@
wcscpy(lpService->lpDisplayName, lpDisplayName);
}
-
-
- /* FIXME: set lpLoadOrderGroup, lpDependencies etc. */
-
-
/* Write service data to the registry */
/* Create the service key */
dwError = ScmCreateServiceKey(lpServiceName,