Author: ekohl
Date: Mon Feb 22 20:26:54 2010
New Revision: 45658
URL:
http://svn.reactos.org/svn/reactos?rev=45658&view=rev
Log:
Revert remaining parts of patches 45626 and 45633.
Modified:
trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
trunk/reactos/base/system/services/services.c
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
==============================================================================
--- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Mon Feb 22 20:26:54 2010
@@ -51,11 +51,12 @@
/* GLOBALS ******************************************************************/
-static VOID CALLBACK ServiceMain(DWORD, LPWSTR *);
-static WCHAR ServiceName[] = L"PlugPlay";
-static SERVICE_TABLE_ENTRYW ServiceTable[] =
-{
- {ServiceName, ServiceMain},
+static VOID CALLBACK
+ServiceMain(DWORD argc, LPTSTR *argv);
+
+static SERVICE_TABLE_ENTRY ServiceTable[2] =
+{
+ {TEXT("PlugPlay"), ServiceMain},
{NULL, NULL}
};
@@ -2445,36 +2446,63 @@
}
-static DWORD WINAPI
-ServiceControlHandler(DWORD dwControl,
- DWORD dwEventType,
- LPVOID lpEventData,
- LPVOID lpContext)
-{
- /* FIXME */
- DPRINT1("ServiceControlHandler() called (control code %lu)\n", dwControl);
- return ERROR_SUCCESS;
-}
-
-
-static DWORD
-ServiceInit(VOID)
+static VOID CALLBACK
+ServiceMain(DWORD argc, LPTSTR *argv)
{
HANDLE hThread;
DWORD dwThreadId;
+
+ UNREFERENCED_PARAMETER(argc);
+ UNREFERENCED_PARAMETER(argv);
+
+ DPRINT("ServiceMain() called\n");
+
+ hThread = CreateThread(NULL,
+ 0,
+ PnpEventThread,
+ NULL,
+ 0,
+ &dwThreadId);
+ if (hThread != NULL)
+ CloseHandle(hThread);
+
+ hThread = CreateThread(NULL,
+ 0,
+ RpcServerThread,
+ NULL,
+ 0,
+ &dwThreadId);
+ if (hThread != NULL)
+ CloseHandle(hThread);
+
+ hThread = CreateThread(NULL,
+ 0,
+ DeviceInstallThread,
+ NULL,
+ 0,
+ &dwThreadId);
+ if (hThread != NULL)
+ CloseHandle(hThread);
+
+ DPRINT("ServiceMain() done\n");
+}
+
+
+int
+wmain(int argc, WCHAR *argv[])
+{
+ BOOLEAN OldValue;
DWORD dwError;
- BOOLEAN OldValue;
+
+ UNREFERENCED_PARAMETER(argc);
+ UNREFERENCED_PARAMETER(argv);
+
+ DPRINT("Umpnpmgr: main() started\n");
/* We need this privilege for using CreateProcessAsUserW */
- RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE,
- TRUE,
- FALSE,
- &OldValue);
-
- hInstallEvent = CreateEvent(NULL,
- TRUE,
- SetupIsActive()/*FALSE*/,
- NULL);
+ RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, TRUE, FALSE, &OldValue);
+
+ hInstallEvent = CreateEvent(NULL, TRUE, SetupIsActive()/*FALSE*/, NULL);
if (hInstallEvent == NULL)
{
dwError = GetLastError();
@@ -2482,10 +2510,7 @@
return dwError;
}
- hDeviceInstallListNotEmpty = CreateEvent(NULL,
- FALSE,
- FALSE,
- NULL);
+ hDeviceInstallListNotEmpty = CreateEvent(NULL, FALSE, FALSE, NULL);
if (hDeviceInstallListNotEmpty == NULL)
{
dwError = GetLastError();
@@ -2532,110 +2557,11 @@
return dwError;
}
- hThread = CreateThread(NULL,
- 0,
- PnpEventThread,
- NULL,
- 0,
- &dwThreadId);
- if (hThread == NULL)
- {
- return GetLastError();
- }
- CloseHandle(hThread);
-
- hThread = CreateThread(NULL,
- 0,
- RpcServerThread,
- NULL,
- 0,
- &dwThreadId);
- if (hThread == NULL)
- {
- return GetLastError();
- }
- CloseHandle(hThread);
-
- hThread = CreateThread(NULL,
- 0,
- DeviceInstallThread,
- NULL,
- 0,
- &dwThreadId);
- if (hThread == NULL)
- {
- return GetLastError();
- }
- CloseHandle(hThread);
-
- return ERROR_SUCCESS;
-}
-
-
-static VOID CALLBACK
-ServiceMain(DWORD argc,
- LPWSTR *argv)
-{
- SERVICE_STATUS ServiceStatus;
- SERVICE_STATUS_HANDLE ServiceStatusHandle;
- DWORD dwError;
-
- UNREFERENCED_PARAMETER(argc);
- UNREFERENCED_PARAMETER(argv);
-
- DPRINT("ServiceMain() called\n");
-
- ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName,
- ServiceControlHandler,
- NULL);
- if (!ServiceStatusHandle)
- {
- dwError = GetLastError();
- DPRINT1("RegisterServiceCtrlHandlerW() failed! (Error %lu)\n",
dwError);
- return;
- }
-
- ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
- ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
- ServiceStatus.dwControlsAccepted = 0;
- ServiceStatus.dwWin32ExitCode = NO_ERROR;
- ServiceStatus.dwServiceSpecificExitCode = 0;
- ServiceStatus.dwCheckPoint = 0;
- ServiceStatus.dwWaitHint = 2000;
-
- SetServiceStatus(ServiceStatusHandle,
- &ServiceStatus);
-
- dwError = ServiceInit();
- if (dwError != ERROR_SUCCESS)
- {
- DPRINT1("Service stopped\n");
- ServiceStatus.dwCurrentState = SERVICE_STOPPED;
- }
- else
- {
- ServiceStatus.dwCurrentState = SERVICE_RUNNING;
- }
-
- SetServiceStatus(ServiceStatusHandle,
- &ServiceStatus);
-
- DPRINT("ServiceMain() done\n");
-}
-
-
-int
-wmain(int argc,
- WCHAR *argv[])
-{
- UNREFERENCED_PARAMETER(argc);
- UNREFERENCED_PARAMETER(argv);
-
- DPRINT1("Umpnpmgr: main() started\n");
-
- StartServiceCtrlDispatcherW(ServiceTable);
-
- DPRINT1("Umpnpmgr: main() done\n");
+ StartServiceCtrlDispatcher(ServiceTable);
+
+ DPRINT("Umpnpmgr: main() done\n");
+
+ ExitThread(0);
return 0;
}
Modified: trunk/reactos/base/system/services/services.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.c [iso-8859-1] Mon Feb 22 20:26:54 2010
@@ -48,34 +48,35 @@
BOOL
-ScmCreateEvent(PHANDLE Event,
- LPCWSTR Name)
+ScmCreateStartEvent(PHANDLE StartEvent)
{
HANDLE hEvent;
- hEvent = CreateEventW(NULL,
- TRUE,
- FALSE,
- Name);
+ hEvent = CreateEvent(NULL,
+ TRUE,
+ FALSE,
+ TEXT("SvcctrlStartEvent_A3752DX"));
if (hEvent == NULL)
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
- hEvent = OpenEventW(EVENT_ALL_ACCESS,
- FALSE,
- Name);
- }
- }
-
- if (hEvent)
- {
- DPRINT("SERVICES: created event %S with handle %x\n", Name, hEvent);
- *Event = hEvent;
- return TRUE;
- }
-
- DPRINT1("SERVICES: Failed to create event %S\n", Name);
- return FALSE;
+ hEvent = OpenEvent(EVENT_ALL_ACCESS,
+ FALSE,
+ TEXT("SvcctrlStartEvent_A3752DX"));
+ if (hEvent == NULL)
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ *StartEvent = hEvent;
+
+ return TRUE;
}
@@ -298,7 +299,6 @@
int nShowCmd)
{
HANDLE hScmStartEvent;
- HANDLE hScmAutoStartCompleteEvent;
HANDLE hEvent;
DWORD dwError;
@@ -307,16 +307,14 @@
/* Acquire privileges to load drivers */
AcquireLoadDriverPrivilege();
- /* Create events */
- if (!ScmCreateEvent(&hScmAutoStartCompleteEvent,
L"SC_AutoStartComplete"))
- {
+ /* Create start event */
+ if (!ScmCreateStartEvent(&hScmStartEvent))
+ {
+ DPRINT1("SERVICES: Failed to create start event\n");
ExitThread(0);
}
- if (!ScmCreateEvent(&hScmStartEvent, L"SvcctrlStartEvent_A3752DX"))
- {
- ExitThread(0);
- }
+ DPRINT("SERVICES: created start event with handle %x.\n", hScmStartEvent);
// ScmInitThreadManager();
@@ -355,9 +353,6 @@
DPRINT("SERVICES: Running.\n");
-
- /* Signal complete event */
- SetEvent(hScmAutoStartCompleteEvent);
#if 1
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);