edf89e29ec8ac9467db9459707173b881ff150c4
[reactos.git] / dll / win32 / wlnotify / schedsvc.c
1 /*
2 * PROJECT: ReactOS system libraries
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/win32/wlnotify/schedsvc.c
5 * PURPOSE: Scheduler service logon notifications
6 * PROGRAMMER: Eric Kohl <eric.kohl@reactos.org>
7 */
8
9 #include "precomp.h"
10 #include <winsvc.h>
11
12 WINE_DEFAULT_DEBUG_CHANNEL(wlnotify);
13
14
15 VOID
16 WINAPI
17 SchedEventLogoff(
18 PWLX_NOTIFICATION_INFO pInfo)
19 {
20 SC_HANDLE hManager = NULL;
21 SC_HANDLE hService = NULL;
22 SERVICE_STATUS ServiceStatus;
23
24 TRACE("SchedEventLogoff\n");
25 TRACE("Size: %lu\n", pInfo->Size);
26 TRACE("Flags: %lx\n", pInfo->Flags);
27 TRACE("UserName: %S\n", pInfo->UserName);
28 TRACE("Domain: %S\n", pInfo->Domain);
29 TRACE("WindowStation: %S\n", pInfo->WindowStation);
30 TRACE("hToken: %p\n", pInfo->hToken);
31 TRACE("hDesktop: %p\n", pInfo->hDesktop);
32 TRACE("pStatusCallback: %p\n", pInfo->pStatusCallback);
33
34 hManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
35 if (hManager == NULL)
36 {
37 WARN("OpenSCManagerW() failed (Error %lu)\n", GetLastError());
38 goto done;
39 }
40
41 hService = OpenServiceW(hManager, L"Schedule", SERVICE_USER_DEFINED_CONTROL);
42 if (hManager == NULL)
43 {
44 WARN("OpenServiceW() failed (Error %lu)\n", GetLastError());
45 goto done;
46 }
47
48 if (!ControlService(hService, 129, &ServiceStatus))
49 {
50 WARN("ControlService() failed (Error %lu)\n", GetLastError());
51 }
52
53 done:
54 if (hService != NULL)
55 CloseServiceHandle(hService);
56
57 if (hManager != NULL)
58 CloseServiceHandle(hManager);
59 }
60
61
62 VOID
63 WINAPI
64 SchedStartShell(
65 PWLX_NOTIFICATION_INFO pInfo)
66 {
67 SC_HANDLE hManager = NULL;
68 SC_HANDLE hService = NULL;
69 SERVICE_STATUS ServiceStatus;
70
71 TRACE("SchedStartShell\n");
72 TRACE("Size: %lu\n", pInfo->Size);
73 TRACE("Flags: %lx\n", pInfo->Flags);
74 TRACE("UserName: %S\n", pInfo->UserName);
75 TRACE("Domain: %S\n", pInfo->Domain);
76 TRACE("WindowStation: %S\n", pInfo->WindowStation);
77 TRACE("hToken: %p\n", pInfo->hToken);
78 TRACE("hDesktop: %p\n", pInfo->hDesktop);
79 TRACE("pStatusCallback: %p\n", pInfo->pStatusCallback);
80
81 hManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
82 if (hManager == NULL)
83 {
84 WARN("OpenSCManagerW() failed (Error %lu)\n", GetLastError());
85 goto done;
86 }
87
88 hService = OpenServiceW(hManager, L"Schedule", SERVICE_USER_DEFINED_CONTROL);
89 if (hManager == NULL)
90 {
91 WARN("OpenServiceW() failed (Error %lu)\n", GetLastError());
92 goto done;
93 }
94
95 if (!ControlService(hService, 128, &ServiceStatus))
96 {
97 WARN("ControlService() failed (Error %lu)\n", GetLastError());
98 }
99
100 done:
101 if (hService != NULL)
102 CloseServiceHandle(hService);
103
104 if (hManager != NULL)
105 CloseServiceHandle(hManager);
106 }
107
108 /* EOF */