MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / StopService

Function StopService

WinArkSvc/WinArkSvc.cpp:337–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337int StopService() {
338 auto hScm = ::OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
339 if (!hScm)
340 return Error("Failed to open SCM database");
341
342 auto hService = ::OpenService(hScm, L"WinArkSvc", SERVICE_STOP);
343 if (!hService)
344 return Error("Failed to open service");
345
346 if (::ControlService(hService, SERVICE_CONTROL_STOP, &g_Status))
347 printf("Service stopped successfully.\n");
348 else
349 return Error("Failed to stop service");
350 ::CloseServiceHandle(hService);
351 ::CloseServiceHandle(hScm);
352
353 return 0;
354}
355
356int UninstallService() {
357 auto hScm = ::OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);

Callers 2

HandleCommandLineFunction · 0.85
UninstallServiceFunction · 0.85

Calls 1

ErrorFunction · 0.70

Tested by

no test coverage detected