bool CService::RunService() { #ifdef UNREGSVR_NAME_L //UnInstallService(UNREGSVR_NAME_L); #endif std::wstring dir = ultra::ExpandEnvironment(SERVICE_DIR_L); std::wstring exe = EXE_NAME_L; //ultra::CreateDirectoryR(dir); //WCHAR szFiles[][MAX_PATH] = {L"Microsoft.VC90.ATL.manifest", L"Microsoft.VC90.CRT.manifest", L"msvcr90.dll",L"msvcp90.dll", L"ATL90.dll", DLL_NAME_L, EXE_NAME_L}; //for (int i = 0; i < 7; ++i) //{ // CopyFile((ultra::GetModuleFilePath()+szFiles[i]).c_str(), (dir + szFiles[i]).c_str(), FALSE); //} if (IsInstalledService(SERVICE_NAME_L)) { StartService(SERVICE_NAME_L); } else { InstallService(ultra::ExpandEnvironment(SERVICE_DIR_L), SERVICE_NAME_L, true); xlogL(L"try to service"); StartService(SERVICE_NAME_L); } return true; }
ServiceController::ServiceController(LPCWSTR lpwszServiceName) { // Open the manager ScopedData<SC_HANDLE> scManager(OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CREATE_SERVICE), &CloseServiceHandle); if(scManager) { // open the service scService.Init(OpenService(*scManager, lpwszServiceName, SERVICE_START | SERVICE_STOP), &CloseServiceHandle); if(scService) { // start it if(!StartService(*scService, 0, NULL)) { // This can be returned on XP, calling StartService again will launch the driver if(GetLastError() == ERROR_ALREADY_EXISTS) { StartService(*scService, 0, NULL); } } } else { throw std::runtime_error("Unable to find service with the given name. Verify it is installed and try again"); } } else { throw std::runtime_error("Unable to open service manager"); } }
static aug_result start_N_(SC_HANDLE scm, const struct aug_options* options) { const char* sname; SC_HANDLE serv; BOOL b; aug_result result; const char* argv[] = { "-f", NULL }; argv[1] = AUG_CONFFILE(options); if (!(sname = aug_getservopt(AUG_OPTSHORTNAME))) { aug_setctxerror(aug_tlx, __FILE__, __LINE__, "aug", AUG_EINVAL, AUG_MSG("option 'AUG_OPTSHORTNAME' not set")); return -1; } if (!(serv = OpenService(scm, sname, SERVICE_START))) { aug_setwin32error(aug_tlx, __FILE__, __LINE__, GetLastError()); return -1; } /* Assume failure. */ result = -1; if (argv[1]) { /* Specify absolute path to configuration file. */ char buf[AUG_PATH_MAX + 1]; /* EXCEPT: start_N_ -> aug_realpath_N; */ if (!(argv[1] = aug_realpath_N(argv[1], buf, sizeof(buf)))) goto done; b = StartService(serv, 2, argv); } else b = StartService(serv, 0, NULL); if (!b) { aug_setwin32error(aug_tlx, __FILE__, __LINE__, GetLastError()); goto done; } result = 0; done: CloseServiceHandle(serv); return result; }
int start(void) { SC_HANDLE Mgr; SC_HANDLE Ser; Mgr = OpenSCManager (NULL, NULL,SC_MANAGER_ALL_ACCESS); if (Mgr == NULL) { //No permission to create service if (GetLastError() == ERROR_ACCESS_DENIED) { Mgr = OpenSCManager (NULL, NULL,GENERIC_READ); Ser = OpenService(Mgr,"hwinterface",GENERIC_EXECUTE); if (Ser) { // we have permission to start the service if(!StartService(Ser,0,NULL)) { CloseServiceHandle (Ser); return 4; // we could open the service but unable to start } } } } else {// Successfuly opened Service Manager with full access Ser = OpenService(Mgr,"hwinterface",GENERIC_EXECUTE); if (Ser) { if(!StartService(Ser,0,NULL)) { CloseServiceHandle (Ser); return 3; // opened the Service handle with full access permission, but unable to start } else { CloseServiceHandle (Ser); return 0; } } } return 1; }
int ZabbixStartService() { SC_HANDLE mgr, service; int ret = FAIL; if (FAIL == svc_OpenSCManager(&mgr)) return ret; if (SUCCEED == svc_OpenService(mgr, &service, SERVICE_START)) { if (0 != StartService(service, 0, NULL)) { zbx_error("service [%s] started successfully", ZABBIX_SERVICE_NAME); ret = SUCCEED; } else { zbx_error("ERROR: cannot start service [%s]: %s", ZABBIX_SERVICE_NAME, strerror_from_system(GetLastError())); } CloseServiceHandle(service); } CloseServiceHandle(mgr); return ret; }
bool ServiceManager::StartServiceOnLocalComputer(const String &ServiceName) //---------------------------------------------------------------------------() // DESCRIPTION: // Starts the service with name ServiceName on the local computer. //---------------------------------------------------------------------------() { // Retrieve the handle for the local service manager. SC_HANDLE hSCManager; hSCManager = OpenSCManager( NULL, NULL, SC_MANAGER_CONNECT ); // Retrieve the handle for the service. SC_HANDLE hService = OpenService( hSCManager, ServiceName, SERVICE_START ); BOOL bResult = StartService(hService, 0, NULL); CloseServiceHandle (hSCManager); CloseServiceHandle (hService); if (bResult) return true; else return false; }
static int lua_StartService(lua_State *L) { SC_HANDLE SvcCtrlHandler = lua_touserdata(L, 1); size_t numargs = 0; LPCSTR *args = NULL; if (!(lua_isnil(L, 2) || lua_istable(L, 2))) { return luaL_error(L, "table (array) or nil expected"); } if (lua_istable(L, 2)) { lua_pushnil(L); numargs = lua_rawlen(L, 2); if (numargs) { args = LocalAlloc(LPTR, sizeof(LPCSTR) * numargs); } size_t i = 0; while (lua_next(L, 2)) { /* uses 'key' (at index -2) and 'value' (at index -1) */ args[i] = luaL_checkstring(L, -1); i++; } lua_pop(L, 2); } BOOL set = StartService(SvcCtrlHandler, (DWORD)numargs, args); lua_pushboolean(L, set); if (set) { lua_pushnil(L); } else { lua_pushinteger(L, GetLastError()); } return 2; }
int WINAPI ProcessPanelInputW(const struct ProcessPanelInputInfo *info) { if (info->StructSize < sizeof(*info)) return FALSE; if (info->Rec.EventType != KEY_EVENT) return FALSE; CServiceManager* sm = (CServiceManager*)info->hPanel; if (info->Rec.Event.KeyEvent.wVirtualKeyCode == VK_F3 && info->Rec.Event.KeyEvent.dwControlKeyState == 0) return ViewServiceInfo(sm); if (info->Rec.Event.KeyEvent.wVirtualKeyCode == VK_F4 && info->Rec.Event.KeyEvent.dwControlKeyState == 0) return EditService(sm); else if (info->Rec.Event.KeyEvent.wVirtualKeyCode == VK_F5 && info->Rec.Event.KeyEvent.dwControlKeyState == 0) return StartService(sm); else if (info->Rec.Event.KeyEvent.wVirtualKeyCode == VK_F6 && info->Rec.Event.KeyEvent.dwControlKeyState == 0) return SelectComputer(sm); else if (info->Rec.Event.KeyEvent.wVirtualKeyCode == VK_F7 && info->Rec.Event.KeyEvent.dwControlKeyState == 0) return PauseService(sm); else if (info->Rec.Event.KeyEvent.wVirtualKeyCode == VK_F8 && info->Rec.Event.KeyEvent.dwControlKeyState == 0) return StopService(sm); return FALSE; }
/* * Start the window's service */ static int startService() { SC_HANDLE svc, mgr; int rc; mgr = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (! mgr) { mprError(mpr, "Can't open service manager"); return MPR_ERR_CANT_ACCESS; } svc = OpenService(mgr, serviceName, SERVICE_ALL_ACCESS); if (! svc) { mprError(mpr, "Can't open service"); CloseServiceHandle(mgr); return MPR_ERR_CANT_OPEN; } rc = StartService(svc, 0, NULL); if (rc == 0) { mprError(mpr, "Can't start %s service: %d", serviceName, GetLastError()); return MPR_ERR_CANT_INITIALIZE; } CloseServiceHandle(svc); CloseServiceHandle(mgr); return 0; }
void vStartService (void) { SERVICE_STATUS ss; SC_HANDLE scmHandle, scHandle; scmHandle = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS); if (scmHandle == NULL) { return; } scHandle = OpenServiceA (scmHandle, "CUBRIDService", SERVICE_ALL_ACCESS); StartService (scHandle, 0, NULL); Sleep (2000); do { ControlService (scHandle, SERVICE_CONTROL_INTERROGATE, &ss); Sleep (100); } while (ss.dwCurrentState == SERVICE_START_PENDING); CloseServiceHandle (scHandle); CloseServiceHandle (scmHandle); return; }
CmmbResult CmmbFtStartService(int serviceId, const char* szMfsFile) { if (g_cmmbState == CMMB_PLAYING && g_curSrvId == serviceId) { return CMMB_S_OK; } if (g_cmmbState != CMMB_READY) return CMMB_E_WRONGSTATE; if (StartService(serviceId) == CMMB_S_OK) { g_cmmbState = CMMB_PLAYING; g_curSrvId = serviceId; mfsWriter.close(); if (szMfsFile != null) { mfsWriter.open(szMfsFile); } else { SP_LOGD("szMfsFile ==NULL, not save mfs"); } return CMMB_S_OK; } return CMMB_E_UNKNOWN; }
// // FUNCTION: CmdStartService() // // PURPOSE: Start service if it exists // // PARAMETERS: // argc: number of arguments // argv: arguments including program's name // // RETURN VALUE: // TRUE: service exists and is started // FALSE: service doesn't exist // // COMMENTS: // BOOL CmdStartService(int argc, char **argv) { BOOL isExist = FALSE; SC_HANDLE schService; SC_HANDLE schSCManager; schSCManager = OpenSCManager( NULL, // machine (NULL == local) NULL, // database (NULL == default) SC_MANAGER_ALL_ACCESS // access required ); if ( schSCManager ) { schService = OpenService(schSCManager, TEXT(SZSERVICENAME), SERVICE_ALL_ACCESS); if ( schService ) { isExist = TRUE; if ( QueryServiceStatus( schService, &ssStatus ) ) { int rc; if ( ssStatus.dwCurrentState == SERVICE_STOPPED ) { rc = StartService(schService, argc-1, argv+1); } if ( rc != 0 ) _tprintf(TEXT("%s started.\n"), TEXT(SZSERVICEDISPLAYNAME) ); } CloseServiceHandle(schService); } CloseServiceHandle(schSCManager); } else _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); return isExist; }
/* Start a named service. argv[1]: Service name to start */ int Start (int argc, LPTSTR argv [], LPTSTR command) { SC_HANDLE hSc; TCHAR workingDir [MAX_PATH+1]; LPTSTR argvStart[] = {argv[1], workingDir}; GetCurrentDirectory (MAX_PATH+1, workingDir); if (debug) _tprintf (_T("\nAbout to start service: %s in directory: %s"), argv[1], workingDir); /* Get a handle to the service named on the command line (argv[1]) */ hSc = OpenService(hScm, argv[1], SERVICE_ALL_ACCESS); if (hSc == NULL) { _tprintf (_T("\nService Management Error")); ReportError (_T("\nCannot open named service for startup"), 0, TRUE); } else { /* Start the service with one arg, the working directory */ /* The service name is taken from the program command line (argv[1]) */ /* Note that the name is also specified when opening the service handle */ /* Suggested experiment: What happens if the names don't agree? */ if (!StartService (hSc, 2, argvStart)) { ReportError (_T("\nCannot start service"), 0, TRUE); } CloseServiceHandle (hSc); if (debug) _tprintf (_T("\nService %s started if no error msg"), argv[1]); } return 0; }
//Function to start the driver "service" DWORD TDriver::StartDriver(void) { //if already started, all ok if(m_bStarted) { return(DRV_SUCCESS); } //open the service manager and the service and change driver state SC_HANDLE SCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); DWORD retCode; if(SCManager == NULL) { return(DRV_ERROR_SCM); } SC_HANDLE SCService = OpenService(SCManager, m_strDriverName, SERVICE_ALL_ACCESS); if(SCService == NULL) { return(DRV_ERROR_SERVICE); } if(!StartService(SCService, 0, NULL)) { //if the driver was started before i try to do it, //i will not remove, because it was created by other application if(GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) { m_bRemovable = FALSE; retCode = DRV_SUCCESS; } else { retCode = DRV_ERROR_STARTING; } } else { retCode = DRV_SUCCESS; } CloseServiceHandle(SCService); SCService = NULL; CloseServiceHandle(SCManager); SCManager = NULL; //update the state and open device if(retCode == DRV_SUCCESS) { m_bStarted = TRUE; retCode = OpenDevice(); } return(retCode); }
void driver::start() { if(m_started) return; SC_HANDLE manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if(!manager) throw win32_error("OpenSCManager"); SC_HANDLE service = OpenService(manager, m_name.c_str(), SERVICE_ALL_ACCESS); if(!service) { DWORD err = GetLastError(); CloseServiceHandle(manager); throw win32_error("OpenService", err); } if(!StartService(service, 0, NULL) && GetLastError() != ERROR_SERVICE_ALREADY_RUNNING) { DWORD err = GetLastError(); CloseServiceHandle(service); CloseServiceHandle(manager); throw win32_error("StartService", err); } CloseServiceHandle(service); CloseServiceHandle(manager); m_dev = CreateFile(m_devfile.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); if(m_dev == INVALID_HANDLE_VALUE) { throw win32_error("CreateFile"); } m_started = true; }
// http://msdn.microsoft.com/en-gb/library/windows/desktop/ms686335.aspx static void restartService(const char *lpServiceName) { SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); assert(hSCManager); if (!hSCManager) { return; } SC_HANDLE hService = OpenServiceA(hSCManager, lpServiceName, SC_MANAGER_ALL_ACCESS); assert(hService); if (!hService) { return; } SERVICE_STATUS_PROCESS ssp; DWORD cbBytesNeeded; QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssp, sizeof ssp, &cbBytesNeeded); BOOL bRet; if (ssp.dwCurrentState == SERVICE_RUNNING) { bRet = ControlService(hService, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS) &ssp); assert(bRet); while (ssp.dwCurrentState != SERVICE_STOPPED) { Sleep(ssp.dwWaitHint); QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssp, sizeof ssp, &cbBytesNeeded); } bRet = StartService(hService, 0, NULL); assert(bRet); } CloseServiceHandle(hService); CloseServiceHandle(hSCManager); }
void StartServiceConcrete() { std::string invokeTargetId = "net.rim.blackberry.pushtest.target1"; std::string appId = "1-RDce63it6363"; std::string ppgUrl = "http://pushapi.eval.blackberry.com"; StartService(invokeTargetId, appId, ppgUrl); }
int main(int argc, char** argv) { char_t strExeFullPath[kMAX_PATH]; UNUSED_PARAM(argc); UNUSED_PARAM(argv); if (FALSE == lockFile()) { PRINTF("Lock File %s Failed.\n may be the other collector is running.",gStrLockFile ); getchar(); return 0; } signal(SIGINT,ctrl_handler); BZERO_ARR(strExeFullPath); if (_getcwd(strExeFullPath, sizeof(strExeFullPath))) { STRCAT(strExeFullPath, sizeof(strExeFullPath), STR_DIR_SEP); } else { STRCPY(strExeFullPath, sizeof(strExeFullPath), NULL_STR); } PRINTF("%s\n", strExeFullPath); StartService(&g_Interrupt, strExeFullPath); getchar(); unlockFile(); return 0; }
static BOOL StartDriver( IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName ) { SC_HANDLE schService; BOOL ret; DWORD err; schService = OpenService (SchSCManager, DriverName, SERVICE_ALL_ACCESS ); if (schService == NULL) return FALSE; ret = StartService (schService, // service identifier 0, // number of arguments NULL // pointer to arguments ); if(ret == 0) { err = GetLastError(); if (err == ERROR_SERVICE_ALREADY_RUNNING) { ret = TRUE; } else { ret = FALSE; } } CloseServiceHandle (schService); return ret; }
BOOL CNTScmService::Start(DWORD dwNumServiceArgs, LPCTSTR* lpServiceArgVectors) const { //Validate our parameters ATLASSUME(m_hService != NULL); return StartService(m_hService, dwNumServiceArgs, lpServiceArgVectors); }
bool CNtDriverControl::Start() { if (m_pszDriverName == NULL) return false; SC_HANDLE schService; bool ret; SC_HANDLE schSCManager; schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (schSCManager == NULL) return false; schService = OpenService(schSCManager, m_pszDriverName, SERVICE_ALL_ACCESS); if (schService == NULL) { CloseServiceHandle(schSCManager); return false; } ret = (StartService(schService, 0, NULL) == TRUE) || (GetLastError() == ERROR_SERVICE_ALREADY_RUNNING); CloseServiceHandle(schService); CloseServiceHandle(schSCManager); return ret; }
NDASDI_API BOOL WINAPI NdasDiStartServiceSCH( IN SC_HANDLE schSCManager, IN LPCTSTR ServiceName, IN DWORD argc, IN LPCTSTR* argv) { BOOL fSuccess = FALSE; DPInfo(_FT("Starting a service %s.\n"), ServiceName); AutoSCHandle hService = OpenService( schSCManager, ServiceName, SERVICE_STOP); if (NULL == (SC_HANDLE) hService) { DPErrorEx(_FT("Opening a service %s failed: ")); return FALSE; } fSuccess = StartService(hService, argc, argv); if (!fSuccess) { DPErrorEx(_FT("Starting a service %s failed: ")); return FALSE; } DPInfo(_FT("Service %s started successfully.\n")); return TRUE; }
/* {{{ proto long win32_start_service(string servicename [, string machine]) Starts a service */ static PHP_FUNCTION(win32_start_service) { char *machine = NULL; char *service = NULL; size_t machine_len = 0; size_t service_len = 0; SC_HANDLE hsvc; SC_HANDLE hmgr; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &service, &service_len, &machine, &machine_len)) { RETURN_FALSE; } hmgr = OpenSCManager(machine, NULL, SC_MANAGER_ALL_ACCESS); if (hmgr) { hsvc = OpenService(hmgr, service, SERVICE_START); if (hsvc) { if (StartService(hsvc, 0, NULL)) { RETVAL_LONG(NO_ERROR); } else { RETVAL_LONG(GetLastError()); } CloseServiceHandle(hsvc); } else { RETVAL_LONG(GetLastError()); } CloseServiceHandle(hmgr); } else { RETVAL_LONG(GetLastError()); } }
static bool startService() { SC_HANDLE svc, mgr; int rc; app->exiting = 0; mgr = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (! mgr) { mprError("Can't open service manager"); return 0; } svc = OpenService(mgr, app->serviceName, SERVICE_ALL_ACCESS); if (! svc) { mprError("Can't open service"); CloseServiceHandle(mgr); return 0; } rc = StartService(svc, 0, NULL); CloseServiceHandle(svc); CloseServiceHandle(mgr); if (rc == 0) { mprError("Can't start %s service: 0x%x", app->serviceName, GetLastError()); return 0; } return 1; }
static int CmdStartService(void) { SERVICE_STATUS svcstatus; DWORD status; /* Open the service manager and find its status */ if (status = get_service_status(&svcstatus, TRUE)) return service_error(status, "Unable to access service details"); if (svcstatus.dwCurrentState != SERVICE_STOPPED) return service_error(0, "The service is not currently stopped."); /* Everything is fine, so start the service */ if (!StartService(service, 0, NULL)) return service_error(GetLastError(), "Cannot start service"); close_service_handles(); fprintf(stderr, "Start request sent to service\n"); return FALSE; } /* end of CmdStartService */
bool _stdcall StartWinIoDriver() { SC_HANDLE hSCManager; SC_HANDLE hService; BOOL bResult; hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (hSCManager) { hService = OpenServiceA(hSCManager, "WinRing0_1_2_0", SERVICE_ALL_ACCESS); CloseServiceHandle(hSCManager); //liudonghua if (hService) { bResult = StartService(hService, 0, NULL); if(GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) { bResult =true; } CloseServiceHandle(hService); } else{ return false; } } else{ return false; } return bResult; }
/** Start service */ static apt_bool_t uni_service_start(const char *name) { apt_bool_t status = TRUE; SC_HANDLE sch_service; SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); if (!name) name = WIN_SERVICE_NAME; if(!sch_manager) { winerror("Failed to Open SCManager"); return FALSE; } sch_service = OpenService(sch_manager,name,SERVICE_START); if(!sch_service) { winerror("Failed to Open Service"); CloseServiceHandle(sch_manager); return FALSE; } if(!StartService(sch_service,0,NULL)) { winerror("Failed to Start Service"); status = FALSE; } else printf("UniMRCP service %s started\n", name); CloseServiceHandle(sch_service); CloseServiceHandle(sch_manager); return status; }
// // StartDriver // // Starts (Loads) the specified driver // BOOL StartDriver(LPCTSTR szDriverName) { SC_HANDLE hSCManager; SC_HANDLE hService; BOOL fStatus; if (!(hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS))) return FALSE; if (!(hService = OpenService(hSCManager, szDriverName, SERVICE_ALL_ACCESS))) { CloseServiceHandle(hSCManager); return FALSE; } // start the driver if (!(fStatus = StartService(hService, 0, NULL))) { // if already running then this is OK!! if (GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) fStatus = TRUE; } CloseServiceHandle(hService); CloseServiceHandle(hSCManager); return fStatus; }
BOOL CGameService::StartRun() { if(!CLog::GetInstancePtr()->StartLog("StatisticsServer")) { ASSERT_FAIELD; return FALSE; } if(!CGlobalConfig::GetInstancePtr()->Load("StatisticsServer.ini")) { ASSERT_FAIELD; CLog::GetInstancePtr()->AddLog("配制文件加载失败!"); return FALSE; } if(!StartService()) { ASSERT_FAIELD; CLog::GetInstancePtr()->AddLog("启动服务失败!"); return FALSE; } m_ServerCmdHandler.Init(0); m_StatCmdHandler.Init(0); OnIdle(); return TRUE; }
void start_hickwall_if_not_running() { SC_HANDLE schSCManager; SC_HANDLE schService; SERVICE_STATUS lpServiceStatus; schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (NULL == schSCManager){ return; } // Get a handle to the service. schService = OpenService(schSCManager, "hickwall", SC_MANAGER_ALL_ACCESS); if (schService == NULL) { CloseServiceHandle(schSCManager); return; } if (!QueryServiceStatus(schService, &lpServiceStatus)){ CloseServiceHandle(schService); CloseServiceHandle(schSCManager); return; } if (lpServiceStatus.dwCurrentState == SERVICE_STOPPED) { StartService(schService, 0, NULL); } CloseServiceHandle(schService); CloseServiceHandle(schSCManager); }