- 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");