ReactOS  0.4.14-dev-98-gb0d4763
schedsvc.c
Go to the documentation of this file.
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 
13 
14 
15 VOID
16 WINAPI
19 {
20 #if 0
21  SC_HANDLE hManager = NULL;
22  SC_HANDLE hService = NULL;
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
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
70 {
71  SC_HANDLE hManager = NULL;
72  SC_HANDLE hService = NULL;
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 
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 */
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
VOID WINAPI SchedStartShell(PWLX_NOTIFICATION_INFO pInfo)
Definition: schedsvc.c:68
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static SERVICE_STATUS ServiceStatus
Definition: schedsvc.c:38
PFNMSGECALLBACK pStatusCallback
Definition: winwlx.h:629
VOID WINAPI SchedEventLogoff(PWLX_NOTIFICATION_INFO pInfo)
Definition: schedsvc.c:17
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define SERVICE_USER_DEFINED_CONTROL
Definition: winsvc.h:61
#define WINAPI
Definition: msvc.h:8
static const WCHAR L[]
Definition: oid.c:1250
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
WINE_DEFAULT_DEBUG_CHANNEL(schedsvc)
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619