xref: /reactos/dll/win32/wlnotify/schedsvc.c (revision 8a978a17)
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 #if 0
21     SC_HANDLE hManager = NULL;
22     SC_HANDLE hService = NULL;
23     SERVICE_STATUS ServiceStatus;
24 #endif
25 
26     TRACE("SchedEventLogoff\n");
27     TRACE("Size: %lu\n", pInfo->Size);
28     TRACE("Flags: %lx\n", pInfo->Flags);
29     TRACE("UserName: %S\n", pInfo->UserName);
30     TRACE("Domain: %S\n", pInfo->Domain);
31     TRACE("WindowStation: %S\n", pInfo->WindowStation);
32     TRACE("hToken: %p\n", pInfo->hToken);
33     TRACE("hDesktop: %p\n", pInfo->hDesktop);
34     TRACE("pStatusCallback: %p\n", pInfo->pStatusCallback);
35 
36 #if 0
37     hManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
38     if (hManager == NULL)
39     {
40         WARN("OpenSCManagerW() failed (Error %lu)\n", GetLastError());
41         goto done;
42     }
43 
44     hService = OpenServiceW(hManager, L"Schedule", SERVICE_USER_DEFINED_CONTROL);
45     if (hManager == NULL)
46     {
47         WARN("OpenServiceW() failed (Error %lu)\n", GetLastError());
48         goto done;
49     }
50 
51     if (!ControlService(hService, 129, &ServiceStatus))
52     {
53         WARN("ControlService() failed (Error %lu)\n", GetLastError());
54     }
55 
56 done:
57     if (hService != NULL)
58         CloseServiceHandle(hService);
59 
60     if (hManager != NULL)
61         CloseServiceHandle(hManager);
62 #endif
63 }
64 
65 
66 VOID
67 WINAPI
68 SchedStartShell(
69     PWLX_NOTIFICATION_INFO pInfo)
70 {
71     SC_HANDLE hManager = NULL;
72     SC_HANDLE hService = NULL;
73     SERVICE_STATUS ServiceStatus;
74 
75     TRACE("SchedStartShell\n");
76     TRACE("Size: %lu\n", pInfo->Size);
77     TRACE("Flags: %lx\n", pInfo->Flags);
78     TRACE("UserName: %S\n", pInfo->UserName);
79     TRACE("Domain: %S\n", pInfo->Domain);
80     TRACE("WindowStation: %S\n", pInfo->WindowStation);
81     TRACE("hToken: %p\n", pInfo->hToken);
82     TRACE("hDesktop: %p\n", pInfo->hDesktop);
83     TRACE("pStatusCallback: %p\n", pInfo->pStatusCallback);
84 
85     hManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
86     if (hManager == NULL)
87     {
88         WARN("OpenSCManagerW() failed (Error %lu)\n", GetLastError());
89         goto done;
90     }
91 
92     hService = OpenServiceW(hManager, L"Schedule", SERVICE_USER_DEFINED_CONTROL);
93     if (hManager == NULL)
94     {
95         WARN("OpenServiceW() failed (Error %lu)\n", GetLastError());
96         goto done;
97     }
98 
99     if (!ControlService(hService, 128, &ServiceStatus))
100     {
101         WARN("ControlService() failed (Error %lu)\n", GetLastError());
102     }
103 
104 done:
105     if (hService != NULL)
106         CloseServiceHandle(hService);
107 
108     if (hManager != NULL)
109         CloseServiceHandle(hManager);
110 }
111 
112 /* EOF */
113