ReactOS  0.4.14-dev-342-gdc047f9
notify.c
Go to the documentation of this file.
1 /*
2  * PROJECT: Local Security Authority Server DLL
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: LSA policy change notifications
5  * COPYRIGHT: Eric Kohl 2018
6  */
7 
8 #include "lsasrv.h"
9 
11 {
16 
17 /* GLOBALS *****************************************************************/
18 
21 
22 
23 /* FUNCTIONS ***************************************************************/
24 
25 VOID
27 {
30 }
31 
32 
33 static
38 {
40  PLSA_NOTIFICATION_ENTRY CurrentNotification;
41 
44  {
46 
47  if ((CurrentNotification->EventHandle == EventHandle) &&
48  (CurrentNotification->InformationClass == InformationClass))
49  return CurrentNotification;
50 
52  }
53 
54  return NULL;
55 }
56 
57 
60  PLSA_API_MSG pRequestMsg)
61 {
64 
65  FIXME("LsapRegisterNotification(%p)\n", pRequestMsg);
66 
67  /* Acquire the notification list lock exclusively */
69 
70  if (pRequestMsg->PolicyChangeNotify.Request.Register)
71  {
72  /* Register the notification event */
73  pEntry = RtlAllocateHeap(RtlGetProcessHeap(),
75  sizeof(LSA_NOTIFICATION_ENTRY));
76  if (pEntry == NULL)
77  {
79  goto done;
80  }
81 
82  pEntry->InformationClass = pRequestMsg->PolicyChangeNotify.Request.InformationClass;
83  pEntry->EventHandle = pRequestMsg->PolicyChangeNotify.Request.NotificationEventHandle;
84 
86  &pEntry->Entry);
87  }
88  else
89  {
90  /* Unregister the notification event */
91  pEntry = LsapGetNotificationEntry(pRequestMsg->PolicyChangeNotify.Request.NotificationEventHandle,
92  pRequestMsg->PolicyChangeNotify.Request.InformationClass);
93  if (pEntry == NULL)
94  {
96  goto done;
97  }
98 
99  RemoveEntryList(&pEntry->Entry);
100  RtlFreeHeap(RtlGetProcessHeap(), 0, pEntry);
101  }
102 
103 done:
104  /* Release the notification list lock */
106 
107  return Status;
108 }
109 
110 
111 VOID
114 {
116  PLSA_NOTIFICATION_ENTRY CurrentNotification;
117 
118  FIXME("LsapNotifyPolicyChange(%lu)\n", InformationClass);
119 
120  /* Acquire the notification list lock shared */
122 
125  {
127 
128  if (CurrentNotification->InformationClass == InformationClass)
129  {
130  FIXME("Notify event %p\n", CurrentNotification->EventHandle);
131 
132  }
133 
135  }
136 
137  /* Release the notification list lock */
139 }
140 
141 /* EOF */
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
VOID LsapInitNotificationList(VOID)
Definition: notify.c:26
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
LSA_POLICY_CHANGE_NOTIFY_MSG PolicyChangeNotify
Definition: lsass.h:193
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass
Definition: notify.c:13
struct _LSA_NOTIFICATION_ENTRY LSA_NOTIFICATION_ENTRY
static RTL_RESOURCE NotificationListLock
Definition: notify.c:20
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
_In_ ULONG _In_opt_ PVOID _In_ PDRIVER_OBJECT _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE _Inout_opt_ __drv_aliasesMem PVOID _Outptr_result_nullonfailure_ _At_ * NotificationEntry(return==0, __drv_allocatesMem(Mem))) PVOID *NotificationEntry
Definition: notify.c:10
static PLSA_NOTIFICATION_ENTRY LsapGetNotificationEntry(HANDLE EventHandle, POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass)
Definition: notify.c:35
#define FIXME(fmt,...)
Definition: debug.h:110
enum _POLICY_NOTIFICATION_INFORMATION_CLASS POLICY_NOTIFICATION_INFORMATION_CLASS
HANDLE EventHandle
Definition: notify.c:14
smooth NULL
Definition: ftsmooth.c:416
static LIST_ENTRY NotificationListHead
Definition: notify.c:19
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
struct _LSA_POLICY_CHANGE_NOTIFY_MSG::@3377::@3379 Request
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID LsapNotifyPolicyChange(POLICY_NOTIFICATION_INFORMATION_CLASS InformationClass)
Definition: notify.c:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
NTSTATUS LsapRegisterNotification(PLSA_API_MSG pRequestMsg)
Definition: notify.c:59
LIST_ENTRY Entry
Definition: notify.c:12
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct _LSA_NOTIFICATION_ENTRY * PLSA_NOTIFICATION_ENTRY
base of all file and directory entries
Definition: entries.h:82
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)