-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (29 loc) · 878 Bytes
/
Copy pathmain.cpp
File metadata and controls
37 lines (29 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "user_tracker_service.h"
#include "service_installer.h"
int _tmain(int argc, TCHAR* argv[]) {
UserTrackerService service;
if (argc > 1) {
if (_tcscmp(argv[1], _T("install")) == 0) {
_tprintf(_T("Installing service\n"));
if (!ServiceInstaller::Install(service)) {
_tprintf(_T("Couldn't install service: %d\n"), ::GetLastError());
return -1;
}
_tprintf(_T("Service installed\n"));
return 0;
}
if (_tcscmp(argv[1], _T("uninstall")) == 0) {
_tprintf(_T("Uninstalling service\n"));
if (!ServiceInstaller::Uninstall(service)) {
_tprintf(_T("Couldn't uninstall service: %d\n"), ::GetLastError());
return -1;
}
_tprintf(_T("Service uninstalled\n"));
return 0;
}
_tprintf(_T("Invalid argument\n"));
return -1;
}
service.Run();
return 0;
}