[WLNOTIFY]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 23 Sep 2017 22:29:36 +0000 (22:29 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 23 Sep 2017 22:29:36 +0000 (22:29 +0000)
- Add Notifications for the Scheduler Service.

svn path=/trunk/; revision=75936

reactos/dll/win32/wlnotify/CMakeLists.txt
reactos/dll/win32/wlnotify/schedsvc.c [new file with mode: 0644]
reactos/dll/win32/wlnotify/wlnotify.spec

index a37efe5..1db47ff 100644 (file)
@@ -2,6 +2,7 @@
 spec2def(wlnotify.dll wlnotify.spec ADD_IMPORTLIB)
 
 list(APPEND SOURCE
+    schedsvc.c
     test.c
     wlnotify.c
     precomp.h)
@@ -12,6 +13,6 @@ add_library(wlnotify SHARED
     ${CMAKE_CURRENT_BINARY_DIR}/wlnotify.def)
 
 set_module_type(wlnotify win32dll UNICODE ENTRYPOINT DllMain 12)
-add_importlibs(wlnotify kernel32 ntdll)
+add_importlibs(wlnotify advapi32 kernel32 ntdll)
 add_pch(wlnotify precomp.h SOURCE)
 add_cd_file(TARGET wlnotify DESTINATION reactos/system32 FOR all)
diff --git a/reactos/dll/win32/wlnotify/schedsvc.c b/reactos/dll/win32/wlnotify/schedsvc.c
new file mode 100644 (file)
index 0000000..ad8bcb5
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * PROJECT:     ReactOS system libraries
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        dll/win32/wlnotify/schedsvc.c
+ * PURPOSE:     Scheduler service logon notifications
+ * PROGRAMMER:  Eric Kohl <eric.kohl@reactos.org>
+ */
+
+#include "precomp.h"
+#include <winsvc.h>
+
+#define _NDEBUG
+#include <debug.h>
+
+
+VOID
+WINAPI
+SchedEventLogoff(
+    PWLX_NOTIFICATION_INFO pInfo)
+{
+    SC_HANDLE hManager = NULL;
+    SC_HANDLE hService = NULL;
+    SERVICE_STATUS ServiceStatus;
+
+    DPRINT("SchedStartShellEvent\n");
+    DPRINT("Size: %lu\n", pInfo->Size);
+    DPRINT("Flags: %lx\n", pInfo->Flags);
+    DPRINT("UserName: %S\n", pInfo->UserName);
+    DPRINT("Domain: %S\n", pInfo->Domain);
+    DPRINT("WindowStation: %S\n", pInfo->WindowStation);
+    DPRINT("hToken: %p\n", pInfo->hToken);
+    DPRINT("hDesktop: %p\n", pInfo->hDesktop);
+    DPRINT("pStatusCallback: %p\n", pInfo->pStatusCallback);
+
+    hManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
+    if (hManager == NULL)
+    {
+        DPRINT1("OpenSCManagerW() failed (Error %lu)\n", GetLastError());
+        goto done;
+    }
+
+    hService = OpenServiceW(hManager, L"Schedule", SERVICE_USER_DEFINED_CONTROL);
+    if (hManager == NULL)
+    {
+        DPRINT1("OpenServiceW() failed (Error %lu)\n", GetLastError());
+        goto done;
+    }
+
+    if (!ControlService(hService, 129, &ServiceStatus))
+    {
+        DPRINT1("ControlService() failed (Error %lu)\n", GetLastError());
+    }
+
+done:
+    if (hService != NULL)
+        CloseServiceHandle(hService);
+
+    if (hManager != NULL)
+        CloseServiceHandle(hManager);
+}
+
+
+VOID
+WINAPI
+SchedStartShell(
+    PWLX_NOTIFICATION_INFO pInfo)
+{
+    SC_HANDLE hManager = NULL;
+    SC_HANDLE hService = NULL;
+    SERVICE_STATUS ServiceStatus;
+
+    DPRINT("SchedStartShellEvent\n");
+    DPRINT("Size: %lu\n", pInfo->Size);
+    DPRINT("Flags: %lx\n", pInfo->Flags);
+    DPRINT("UserName: %S\n", pInfo->UserName);
+    DPRINT("Domain: %S\n", pInfo->Domain);
+    DPRINT("WindowStation: %S\n", pInfo->WindowStation);
+    DPRINT("hToken: %p\n", pInfo->hToken);
+    DPRINT("hDesktop: %p\n", pInfo->hDesktop);
+    DPRINT("pStatusCallback: %p\n", pInfo->pStatusCallback);
+
+    hManager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
+    if (hManager == NULL)
+    {
+        DPRINT1("OpenSCManagerW() failed (Error %lu)\n", GetLastError());
+        goto done;
+    }
+
+    hService = OpenServiceW(hManager, L"Schedule", SERVICE_USER_DEFINED_CONTROL);
+    if (hManager == NULL)
+    {
+        DPRINT1("OpenServiceW() failed (Error %lu)\n", GetLastError());
+        goto done;
+    }
+
+    if (!ControlService(hService, 128, &ServiceStatus))
+    {
+        DPRINT1("ControlService() failed (Error %lu)\n", GetLastError());
+    }
+
+done:
+    if (hService != NULL)
+        CloseServiceHandle(hService);
+
+    if (hManager != NULL)
+        CloseServiceHandle(hManager);
+}
+
+/* EOF */
index bd2d999..737448d 100644 (file)
@@ -1,3 +1,23 @@
+;@ stub RegisterTicketExpiredNotificationEvent
+;@ stub SCardResumeCertProp
+;@ stub SCardStartCertProp
+;@ stub SCardStopCertProp
+;@ stub SCardSuspendCertProp
+@ stdcall SchedEventLogoff(ptr)
+@ stdcall SchedStartShell(ptr)
+;@ stub SensDisconnectEvent
+;@ stub SensLockEvent
+;@ stub SensLogoffEvent
+;@ stub SensLogonEvent
+;@ stub SensPostShellEvent
+;@ stub SensReconnectEvent
+;@ stub SensShutdownEvent
+;@ stub SensStartScreenSaverEvent
+;@ stub SensStartShellEvent
+;@ stub SensStartupEvent
+;@ stub SensStopScreenSaverEvent
+;@ stub SensUnlockEvent
+;@ stub ShowNotificationBallonW
 @ stdcall TestDisconnectEvent(ptr)
 @ stdcall TestLockEvent(ptr)
 @ stdcall TestLogoffEvent(ptr)
 @ stdcall TestStartupEvent(ptr)
 @ stdcall TestStopScreenSaverEvent(ptr)
 @ stdcall TestUnlockEvent(ptr)
+;@ stub TSEventDisconnect
+;@ stub TSEventLogoff
+;@ stub TSEventLogon
+;@ stub TSEventPostShell
+;@ stub TSEventReconnect
+;@ stub TSEventShutdown
+;@ stub TSEventStartShell
+;@ stub TSEventStartup
+;@ stub TermsrvCreateTempDir
+;@ stub UnregisterTicketExpiredNotificationEvent