| 542 | return result; |
| 543 | } |
| 544 | BOOL CreateWindowsService(LPCWSTR name, LPCWSTR binPath) |
| 545 | { |
| 546 | BOOL result = FALSE; |
| 547 | |
| 548 | SC_HANDLE serviceManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS); |
| 549 | if (serviceManager) |
| 550 | { |
| 551 | SC_HANDLE service = CreateServiceW(serviceManager, name, NULL, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, binPath, NULL, NULL, NULL, NULL, NULL); |
| 552 | if (service) |
| 553 | { |
| 554 | if (StartServiceW(service, 0, NULL)) |
| 555 | { |
| 556 | result = TRUE; |
| 557 | } |
| 558 | |
| 559 | CloseServiceHandle(service); |
| 560 | } |
| 561 | |
| 562 | CloseServiceHandle(serviceManager); |
| 563 | } |
| 564 | |
| 565 | return result; |
| 566 | } |
| 567 | BOOL DeleteWindowsService(LPCWSTR name) |
| 568 | { |
| 569 | BOOL result = FALSE; |