27 Result = SynchronizedRoutine(Ctx);
33 Result = SynchronizedRoutine(Ctx);
40 Result = SynchronizedRoutine(Ctx);
47 Result = SynchronizedRoutine(Ctx);
55 Result = SynchronizedRoutine(Ctx);
69 Result = SynchronizedRoutine(Ctx);
90 IN const KSEVENT_SET* EventSet,
100 PKSEVENT_ITEM EventItem, FoundEventItem;
102 const KSEVENT_SET *FoundEventSet;
147 FoundEventItem =
NULL;
148 FoundEventSet =
NULL;
154 Irp->IoStatus.Information =
sizeof(
GUID) * EventSetsCount;
177 EventItem = (PKSEVENT_ITEM)EventSet[
Index].EventItem;
184 for(SubIndex = 0; SubIndex < EventSet[
Index].EventsCount; SubIndex++)
186 if (EventItem[SubIndex].EventId ==
Event.Id)
189 FoundEventItem = &EventItem[SubIndex];
190 FoundEventSet = &EventSet[
Index];
220 if (!FoundEventItem->AddHandler && !EventsList)
227 EventData =
Irp->UserBuffer;
292 EventEntry = KSEVENT_ENTRY_IRP_STORAGE(
Irp);
311 EventEntry->EventData = EventData;
313 EventEntry->EventItem = FoundEventItem;
314 EventEntry->EventSet = FoundEventSet;
317 switch(EventEntry->NotificationType)
320 EventEntry->Object =
Object;
321 EventEntry->Reserved = 0;
324 EventEntry->Object =
Object;
325 EventEntry->SemaphoreAdjustment = EventData->
SemaphoreHandle.Adjustment;
326 EventEntry->Reserved = 0;
328 case KSEVENTF_EVENT_OBJECT:
329 EventEntry->Object = EventData->EventObject.
Event;
330 EventEntry->Reserved = EventData->EventObject.Increment;
332 case KSEVENTF_SEMAPHORE_OBJECT:
333 EventEntry->Object = EventData->SemaphoreObject.
Semaphore;
334 EventEntry->SemaphoreAdjustment = EventData->SemaphoreObject.
Adjustment;
335 EventEntry->Reserved = EventData->SemaphoreObject.Increment;
338 EventEntry->Object = EventData->Dpc.Dpc;
339 EventData->Dpc.ReferenceCount = 0;
341 case KSEVENTF_WORKITEM:
342 EventEntry->Object = EventData->WorkItem.WorkQueueItem;
343 EventEntry->BufferItem = (PKSBUFFER_ITEM)
UlongToPtr(EventData->WorkItem.WorkQueueType);
345 case KSEVENTF_KSWORKITEM:
346 EventEntry->Object = EventData->KsWorkItem.KsWorkerObject;
347 EventEntry->DpcItem = (PKSDPC_ITEM)EventData->KsWorkItem.WorkQueueItem;
354 if (FoundEventItem->AddHandler)
357 Status = FoundEventItem->AddHandler(
Irp, EventData, EventEntry);
368 Ctx.
List = EventsList;
390 IN KSEVENT_SET* EventSet,
405KsEnableEventWithAllocator(
408 _In_reads_(EventSetsCount)
const KSEVENT_SET* EventSet,
415 return KspEnableEvent(
Irp, EventSetsCount, EventSet, EventsList, EventsFlags, EventsLock, Allocator, EventItemSize);
428 if (!Ctx || !Ctx->List || !Ctx->FileObject || !Ctx->Irp)
441 Entry = Ctx->List->Flink;
443 while(
Entry != Ctx->List)
448 if (EventEntry->EventData == EventData && EventEntry->FileObject == Ctx->FileObject)
452 Ctx->EventEntry = EventEntry;
495 Ctx.
List = EventsList;
527 ASSERT(EventEntry->Object);
549 if (!Ctx || !Ctx->List)
567 Ctx->EventEntry = EventEntry;
588 Ctx.
List = EventsList;
611 if (EntryEvent->NotificationType ==
KSEVENTF_EVENT_HANDLE || EntryEvent->NotificationType == KSEVENTF_EVENT_OBJECT)
616 else if (EntryEvent->NotificationType ==
KSEVENTF_SEMAPHORE_HANDLE || EntryEvent->NotificationType == KSEVENTF_SEMAPHORE_OBJECT)
621 else if (EntryEvent->NotificationType == KSEVENTF_DPC)
628 else if (EntryEvent->NotificationType == KSEVENTF_WORKITEM)
633 else if (EntryEvent->NotificationType == KSEVENTF_KSWORKITEM)
740 IN PFNKSGENERATEEVENTCALLBACK CallBack
OPTIONAL,
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedIncrement
#define STATUS_NOT_SUPPORTED
#define NT_SUCCESS(StatCode)
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
KSDDKAPI void NTAPI KsGenerateEvents(IN PVOID Object, IN const GUID *EventSet OPTIONAL, IN ULONG EventId, IN ULONG DataSize, IN PVOID Data OPTIONAL, IN PFNKSGENERATEEVENTCALLBACK CallBack OPTIONAL, IN PVOID CallBackContext OPTIONAL)
BOOLEAN NTAPI KspFreeEventList(IN PKSEVENT_CTX Ctx)
BOOLEAN KspSynchronizedEventRoutine(IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock, IN PKSEVENT_SYNCHRONIZED_ROUTINE SynchronizedRoutine, IN PKSEVENT_CTX Ctx)
KSDDKAPI NTSTATUS NTAPI KsEnableEvent(IN PIRP Irp, IN ULONG EventSetsCount, IN KSEVENT_SET *EventSet, IN OUT PLIST_ENTRY EventsList OPTIONAL, IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL, IN PVOID EventsLock OPTIONAL)
BOOLEAN NTAPI SyncAddEvent(PKSEVENT_CTX Context)
KSDDKAPI NTSTATUS NTAPI KsGenerateEvent(IN PKSEVENT_ENTRY EntryEvent)
BOOLEAN NTAPI KspDisableEvent(IN PKSEVENT_CTX Ctx)
KSDDKAPI NTSTATUS NTAPI KsDisableEvent(IN PIRP Irp, IN OUT PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
KSDDKAPI VOID NTAPI KsFreeEventList(IN PFILE_OBJECT FileObject, IN OUT PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
KSDDKAPI VOID NTAPI KsAddEvent(IN PVOID Object, IN PKSEVENT_ENTRY EventEntry)
KSDDKAPI VOID NTAPI KsGenerateEventList(IN GUID *Set OPTIONAL, IN ULONG EventId, IN PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
NTSTATUS NTAPI KsDefaultAddEventHandler(IN PIRP Irp, IN PKSEVENTDATA EventData, IN OUT PKSEVENT_ENTRY EventEntry)
NTSTATUS KspEnableEvent(IN PIRP Irp, IN ULONG EventSetsCount, IN const KSEVENT_SET *EventSet, IN OUT PLIST_ENTRY EventsList OPTIONAL, IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL, IN PVOID EventsLock OPTIONAL, IN PFNKSALLOCATOR Allocator OPTIONAL, IN ULONG EventItemSize OPTIONAL)
KSDDKAPI NTSTATUS NTAPI KsGenerateDataEvent(IN PKSEVENT_ENTRY EventEntry, IN ULONG DataSize, IN PVOID Data)
KSDDKAPI VOID NTAPI KsDiscardEvent(IN PKSEVENT_ENTRY EventEntry)
#define _IRQL_requires_max_(irql)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeReleaseSpinLock(sl, irql)
#define KeSetEvent(pEvt, foo, foo2)
#define KeAcquireSpinLock(sl, irql)
#define ExAcquireResourceExclusiveLite(res, wait)
#define RemoveHeadList(ListHead)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define EXCEPTION_EXECUTE_HANDLER
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
#define KeLeaveCriticalRegion()
#define KeEnterCriticalRegion()
struct _KSEVENT_ENTRY * PKSEVENT_ENTRY
#define KSEVENT_TYPE_SETSUPPORT
struct KSEVENTDATA * PKSEVENTDATA
#define KSEVENTF_EVENT_HANDLE
struct _KSEVENT_ENTRY KSEVENT_ENTRY
#define KSEVENTF_SEMAPHORE_HANDLE
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
VOID FreeItem(IN PVOID Item)
struct KSBASIC_HEADER * PKSBASIC_HEADER
struct KSIOBJECT_HEADER * PKSIOBJECT_HEADER
BOOLEAN(NTAPI * PKSEVENT_SYNCHRONIZED_ROUTINE)(PKSEVENT_CTX Context)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
POBJECT_TYPE ExEventObjectType
VOID FASTCALL ExReleaseFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
VOID FASTCALL ExAcquireFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
#define STATUS_INVALID_BUFFER_SIZE
#define STATUS_PROPSET_NOT_FOUND
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
POBJECT_TYPE ExSemaphoreObjectType
LONG NTAPI KeReleaseSemaphore(IN PKSEMAPHORE Semaphore, IN KPRIORITY Increment, IN LONG Adjustment, IN BOOLEAN Wait)
PULONG MinorVersion OPTIONAL
base of all file and directory entries
struct KSEVENTDATA::@3016::@3019 SemaphoreHandle
struct KSEVENTDATA::@3016::@3018 EventHandle
PKSEVENT_ENTRY EventEntry
struct _IO_STACK_LOCATION::@1580::@1581 DeviceIoControl
union _IO_STACK_LOCATION::@1580 Parameters
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_MORE_ENTRIES
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
#define IsEqualGUIDAligned(guid1, guid2)
#define SEMAPHORE_MODIFY_STATE
#define EVENT_MODIFY_STATE
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
KSDDKAPI NTSTATUS NTAPI KsQueueWorkItem(IN PKSWORKER Worker, IN PWORK_QUEUE_ITEM WorkItem)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
KSYNCHRONIZE_ROUTINE * PKSYNCHRONIZE_ROUTINE
#define ObDereferenceObject