ReactOS 0.4.15-dev-5672-gf73ac17
Messaging.c
Go to the documentation of this file.
1/*
2* PROJECT: Filesystem Filter Manager
3* LICENSE: GPL - See COPYING in the top level directory
4* FILE: drivers/filters/fltmgr/Messaging.c
5* PURPOSE: Contains the routines to handle the comms layer
6* PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org)
7*/
8
9/* INCLUDES ******************************************************************/
10
11#include "fltmgr.h"
12#include "fltmgrint.h"
13#include <fltmgr_shared.h>
14
15#define NDEBUG
16#include <debug.h>
17
18
19/* DATA *********************************************************************/
20
21UNICODE_STRING CommsDeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\FltMgrMsg");
23
26
27static
30 _In_ PFLT_PORT_OBJECT PortObject
31);
32
33static
38);
39
40static
45);
46
47static
51);
52
53static
56 _In_ PFLT_PORT_OBJECT PortObject
57);
58
59
60
61/* EXPORTED FUNCTIONS ******************************************************/
62
66FLTAPI
67FltCreateCommunicationPort(_In_ PFLT_FILTER Filter,
75{
76 PFLT_SERVER_PORT_OBJECT PortObject;
78
79 /* The caller must allow at least one connection */
80 if (MaxConnections == 0)
81 {
83 }
84
85 /* The request must be for a kernel handle */
86 if (!(ObjectAttributes->Attributes & OBJ_KERNEL_HANDLE))
87 {
89 }
90
91 /*
92 * Get rundown protection on the target to stop the owner
93 * from unloading whilst this port object is open. It gets
94 * removed in the FltpServerPortClose callback
95 */
97 if (!NT_SUCCESS(Status))
98 {
99 return Status;
100 }
101
102 /* Create the server port object for this filter */
107 NULL,
109 0,
110 0,
111 (PVOID *)&PortObject);
112 if (NT_SUCCESS(Status))
113 {
114 /* Zero out the struct */
115 RtlZeroMemory(PortObject, sizeof(FLT_SERVER_PORT_OBJECT));
116
117 /* Increment the ref count on the target filter */
119
120 /* Setup the filter port object */
121 PortObject->Filter = Filter;
125 PortObject->Cookie = ServerPortCookie;
126 PortObject->MaxConnections = MaxConnections;
127
128 /* Insert the object */
129 Status = ObInsertObject(PortObject,
130 NULL,
132 0,
133 NULL,
135 if (NT_SUCCESS(Status))
136 {
137 /* Lock the connection list */
139
140 /* Add the new port object to the connection list and increment the count */
143
144 /* Unlock the connection list*/
146 }
147 }
148
149 if (!NT_SUCCESS(Status))
150 {
151 /* Allow the filter to be cleaned up */
153 }
154
155 return Status;
156}
157
159VOID
160FLTAPI
161FltCloseCommunicationPort(_In_ PFLT_PORT ServerPort)
162{
163 /* Just close the handle to initiate the cleanup callbacks */
165}
166
168VOID
169FLTAPI
170FltCloseClientPort(_In_ PFLT_FILTER Filter,
172{
174
175 /* Protect against the handle being used whilst we're closing it */
176 FltAcquirePushLockShared(&Filter->PortLock);
177
178 /* Store the port handle while we have the lock held */
179 Port = *ClientPort;
180
181 if (*ClientPort)
182 {
183 /* Set the hadle to null */
184 *ClientPort = NULL;
185 }
186
187 /* Unlock the port */
188 FltReleasePushLock(&Filter->PortLock);
189
190 if (Port)
191 {
192 /* Close the safe handle */
193 ZwClose(Port);
194 }
195}
196
200FLTAPI
201FltSendMessage(_In_ PFLT_FILTER Filter,
208{
211 UNREFERENCED_PARAMETER(SenderBuffer);
217}
218
219/* INTERNAL FUNCTIONS ******************************************************/
220
221
225{
226 PIO_STACK_LOCATION StackPtr;
228
229 /* Get the stack location */
231
233
234 /* Check if this is a caller wanting to connect */
235 if (StackPtr->MajorFunction == IRP_MJ_CREATE)
236 {
237 /* Create the client port for this connection and exit */
239 }
240 else
241 {
243 }
244
245 if (Status != STATUS_PENDING)
246 {
247 Irp->IoStatus.Status = Status;
248 Irp->IoStatus.Information = 0;
250 }
251
252 return Status;
253}
254
258{
259 PIO_STACK_LOCATION StackPtr;
261
262 /* Get the stack location */
264
265 /* Check if this is a caller wanting to connect */
266 if (StackPtr->MajorFunction == IRP_MJ_CLOSE)
267 {
268 /* Create the client port for this connection and exit */
269 Status = CloseClientPort(StackPtr->FileObject, Irp);
270 }
271 else
272 {
273 // We don't support anything else yet
275 }
276
277 if (Status != STATUS_PENDING)
278 {
279 Irp->IoStatus.Status = Status;
280 Irp->IoStatus.Information = 0;
282 }
283
284 return Status;
285}
286
287VOID
288NTAPI
293 _In_ ULONG SystemHandleCount)
294{
295 PFLT_SERVER_PORT_OBJECT PortObject;
297
298 /* Cast the object to a server port object */
299 PortObject = (PFLT_SERVER_PORT_OBJECT)Object;
300
301 /* Lock the connection list */
302 Lock = &PortObject->Filter->ConnectionList.mLock;
304
305 /* Remove the server port object from the list */
306 RemoveEntryList(&PortObject->FilterLink);
307
308 /* Unlock the connection list */
310
311 /* Remove the rundown protection we added to stop the owner from tearing us down */
312 FltObjectDereference(PortObject->Filter);
313}
314
315VOID
316NTAPI
318{
319 /* Decrement the filter count we added in the create routine */
322
323}
324
325VOID
326NTAPI
331 _In_ ULONG SystemHandleCount)
332{
334
335 if (FltpDisconnectPort(PortObject))
336 {
338 }
339}
340
343{
344 BOOLEAN Disconnected = FALSE;
345
346 /* Lock the port object while we disconnect it */
347 ExAcquireFastMutex(&PortObject->Lock);
348
349 /* Make sure we have a valid connection */
350 if (PortObject->Disconnected == FALSE)
351 {
352 /* Let any waiters know we're dusconnecing */
353 KeSetEvent(&PortObject->DisconnectEvent, 0, 0);
354
355 // cleanup everything in the message queue (PortObject->MsgQ.Csq)
356
357 /* Set the disconnected state to true */
358 PortObject->Disconnected = TRUE;
359 Disconnected = TRUE;
360 }
361
362 /* Unlock and exit*/
363 ExReleaseFastMutex(&PortObject->Lock);
364 return Disconnected;
365}
366
367VOID
368NTAPI
370{
372 ObDereferenceObject(PortObject->ServerPort);
373}
374
375
378{
379 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
380 UNICODE_STRING SymLinkName;
383
385 {
390 };
391
392 /* Create the server comms object type */
393 RtlZeroMemory(&ObjectTypeInitializer, sizeof(OBJECT_TYPE_INITIALIZER));
394 RtlInitUnicodeString(&Name, L"FilterConnectionPort");
395 ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER);
396 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
397 ObjectTypeInitializer.GenericMapping = Mapping;
398 ObjectTypeInitializer.PoolType = NonPagedPool;
399 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FLT_SERVER_PORT_OBJECT);
400 ObjectTypeInitializer.ValidAccessMask = GENERIC_ALL;
401 ObjectTypeInitializer.CloseProcedure = FltpServerPortClose;
402 ObjectTypeInitializer.DeleteProcedure = FltpServerPortDelete;
403 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ServerPortObjectType);
404 if (!NT_SUCCESS(Status)) return Status;
405
406 /* Create the client comms object type */
407 RtlZeroMemory(&ObjectTypeInitializer, sizeof(OBJECT_TYPE_INITIALIZER));
408 RtlInitUnicodeString(&Name, L"FilterCommunicationPort");
409 ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER);
410 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
411 ObjectTypeInitializer.GenericMapping = Mapping;
412 ObjectTypeInitializer.PoolType = NonPagedPool;
413 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FLT_PORT_OBJECT);
414 ObjectTypeInitializer.ValidAccessMask = GENERIC_ALL;
415 ObjectTypeInitializer.CloseProcedure = FltpClientPortClose;
416 ObjectTypeInitializer.DeleteProcedure = FltpClientPortDelete;
417 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ClientPortObjectType);
418 if (!NT_SUCCESS(Status))
419 {
420 goto Quit;
421 }
422
423 /* Create the device object */
425 0,
428 0,
429 0,
431 if (NT_SUCCESS(Status))
432 {
433 /* Setup a symbolic link for the device */
434 RtlInitUnicodeString(&SymLinkName, L"\\DosDevices\\FltMgrMsg");
436 }
437
438Quit:
439 if (!NT_SUCCESS(Status))
440 {
441 /* Something went wrong, undo */
443 {
446 }
448 {
452 }
453
455 {
459 }
460 }
461
462 return Status;
463}
464
465/* CSQ IRP CALLBACKS *******************************************************/
466
467
469NTAPI
471 _In_ PIRP Irp,
473{
474 PFLT_MESSAGE_WAITER_QUEUE MessageWaiterQueue;
475
476 /* Get the start of the waiter queue struct */
477 MessageWaiterQueue = CONTAINING_RECORD(Csq,
479 Csq);
480
481 /* Insert the IRP at the end of the queue */
482 InsertTailList(&MessageWaiterQueue->WaiterQ.mList,
483 &Irp->Tail.Overlay.ListEntry);
484
485 /* return success */
486 return STATUS_SUCCESS;
487}
488
489VOID
490NTAPI
492 _In_ PIRP Irp)
493{
494 /* Remove the IRP from the queue */
495 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
496}
497
498PIRP
499NTAPI
501 _In_ PIRP Irp,
503{
504 PFLT_MESSAGE_WAITER_QUEUE MessageWaiterQueue;
505 PIRP NextIrp = NULL;
506 PLIST_ENTRY NextEntry;
507 PIO_STACK_LOCATION IrpStack;
508
509 /* Get the start of the waiter queue struct */
510 MessageWaiterQueue = CONTAINING_RECORD(Csq,
512 Csq);
513
514 /* Is the IRP valid? */
515 if (Irp == NULL)
516 {
517 /* Start peeking from the listhead */
518 NextEntry = MessageWaiterQueue->WaiterQ.mList.Flink;
519 }
520 else
521 {
522 /* Start peeking from that IRP onwards */
523 NextEntry = Irp->Tail.Overlay.ListEntry.Flink;
524 }
525
526 /* Loop through the queue */
527 while (NextEntry != &MessageWaiterQueue->WaiterQ.mList)
528 {
529 /* Store the next IRP in the list */
530 NextIrp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
531
532 /* Did we supply a PeekContext on insert? */
533 if (!PeekContext)
534 {
535 /* We already have the next IRP */
536 break;
537 }
538 else
539 {
540 /* Get the stack of the next IRP */
541 IrpStack = IoGetCurrentIrpStackLocation(NextIrp);
542
543 /* Does the PeekContext match the object? */
544 if (IrpStack->FileObject == (PFILE_OBJECT)PeekContext)
545 {
546 /* We have a match */
547 break;
548 }
549
550 /* Move to the next IRP */
551 NextIrp = NULL;
552 NextEntry = NextEntry->Flink;
553 }
554 }
555
556 return NextIrp;
557}
558
562VOID
563NTAPI
564FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq,
566{
567 PFLT_MESSAGE_WAITER_QUEUE MessageWaiterQueue;
568
570
571 /* Get the start of the waiter queue struct */
572 MessageWaiterQueue = CONTAINING_RECORD(Csq,
574 Csq);
575
576 /* Acquire the IRP queue lock */
577 ExAcquireFastMutex(&MessageWaiterQueue->WaiterQ.mLock);
578}
579
583VOID
584NTAPI
585FltpReleaseMessageWaiterLock(_In_ PIO_CSQ Csq,
587{
588 PFLT_MESSAGE_WAITER_QUEUE MessageWaiterQueue;
589
591
592 /* Get the start of the waiter queue struct */
593 MessageWaiterQueue = CONTAINING_RECORD(Csq,
595 Csq);
596
597 /* Release the IRP queue lock */
598 ExReleaseFastMutex(&MessageWaiterQueue->WaiterQ.mLock);
599}
600
601VOID
602NTAPI
604 _In_ PIRP Irp)
605{
606 /* Cancel the IRP */
607 Irp->IoStatus.Status = STATUS_CANCELLED;
608 Irp->IoStatus.Information = 0;
610}
611
612
613/* PRIVATE FUNCTIONS ******************************************************/
614
615static
619{
620 PFLT_SERVER_PORT_OBJECT ServerPortObject = NULL;
622 PFILTER_PORT_DATA FilterPortData;
623 PFLT_PORT_OBJECT ClientPortObject = NULL;
624 PFLT_PORT PortHandle = NULL;
625 PPORT_CCB PortCCB = NULL;
626 //ULONG BufferLength;
627 LONG NumConns;
629
630 /* We received the buffer via FilterConnectCommunicationPort, cast it back to its original form */
631 FilterPortData = Irp->AssociatedIrp.SystemBuffer;
632
633 /* Get a reference to the server port the filter created */
634 Status = ObReferenceObjectByName(&FilterPortData->PortName,
635 0,
636 0,
640 0,
641 (PVOID *)&ServerPortObject);
642 if (!NT_SUCCESS(Status))
643 {
644 return Status;
645 }
646
647 /* Increment the number of connections on the server port */
648 NumConns = InterlockedIncrement(&ServerPortObject->NumberOfConnections);
649 if (NumConns > ServerPortObject->MaxConnections)
650 {
652 goto Quit;
653 }
654
655 /* Initialize a basic kernel handle request */
657 NULL,
659 NULL,
660 NULL);
661
662 /* Now create the new client port object */
667 NULL,
668 sizeof(FLT_PORT_OBJECT),
669 0,
670 0,
671 (PVOID *)&ClientPortObject);
672 if (!NT_SUCCESS(Status))
673 {
674 goto Quit;
675 }
676
677 /* Clear out the buffer */
678 RtlZeroMemory(ClientPortObject, sizeof(FLT_PORT_OBJECT));
679
680 /* Initialize the locks */
682 ExInitializeFastMutex(&ClientPortObject->Lock);
683
684 /* Set the server port object this belongs to */
685 ClientPortObject->ServerPort = ServerPortObject;
686
687 /* Setup the message queue */
688 Status = InitializeMessageWaiterQueue(&ClientPortObject->MsgQ);
689 if (!NT_SUCCESS(Status))
690 {
691 goto Quit;
692 }
693
694 /* Create the CCB which we'll attach to the file object */
695 PortCCB = CreatePortCCB(ClientPortObject);
696 if (PortCCB == NULL)
697 {
699 goto Quit;
700 }
701
702 /* Now insert the new client port into the object manager */
703 Status = ObInsertObject(ClientPortObject, NULL, FLT_PORT_ALL_ACCESS, 1, NULL, (PHANDLE)&PortHandle);
704 if (!NT_SUCCESS(Status))
705 {
706 /* ObInsertObject() failed and already dereferenced ClientPortObject */
707 ClientPortObject = NULL;
708 goto Quit;
709 }
710
711 /* Add a reference to the filter to keep it alive while we do some work with it */
712 Status = FltObjectReference(ServerPortObject->Filter);
713 if (NT_SUCCESS(Status))
714 {
715 /* Invoke the callback to let the filter know we have a connection */
716 Status = ServerPortObject->ConnectNotify(PortHandle,
717 ServerPortObject->Cookie,
718 NULL, //ConnectionContext
719 0, //SizeOfContext
720 &ClientPortObject->Cookie);
721 if (NT_SUCCESS(Status))
722 {
723 /* Add the client port CCB to the file object */
724 FileObject->FsContext2 = PortCCB;
725
726 /* Lock the port list on the filter and add this new port object to the list */
727 ExAcquireFastMutex(&ServerPortObject->Filter->PortList.mLock);
728 InsertTailList(&ServerPortObject->Filter->PortList.mList, &ClientPortObject->FilterLink);
729 ExReleaseFastMutex(&ServerPortObject->Filter->PortList.mLock);
730 }
731
732 /* We're done with the filter object, decremement the count */
733 FltObjectDereference(ServerPortObject->Filter);
734 }
735
736
737Quit:
738 if (!NT_SUCCESS(Status))
739 {
740 if (ClientPortObject)
741 {
742 ObDereferenceObject(ClientPortObject);
743 }
744
745 if (PortHandle)
746 {
747 ZwClose(PortHandle);
748 }
749 else if (ServerPortObject)
750 {
751 InterlockedDecrement(&ServerPortObject->NumberOfConnections);
752 ObDereferenceObject(ServerPortObject);
753 }
754
755 if (PortCCB)
756 {
758 }
759 }
760
761 return Status;
762}
763
764static
768{
770
771 Ccb = (PFLT_CCB)FileObject->FsContext2;
772
773 /* Remove the reference on the filter we added when we opened the port */
774 ObDereferenceObject(Ccb->Data.Port.Port);
775
776 // FIXME: Free the CCB
777
778 return STATUS_SUCCESS;
779}
780
781static
784{
786
787 /* Setup the IRP queue */
788 Status = IoCsqInitializeEx(&MsgWaiterQueue->Csq,
792 FltpAcquireMessageWaiterLock,
793 FltpReleaseMessageWaiterLock,
795 if (!NT_SUCCESS(Status))
796 {
797 return Status;
798 }
799
800 /* Initialize the waiter queue */
801 ExInitializeFastMutex(&MsgWaiterQueue->WaiterQ.mLock);
802 InitializeListHead(&MsgWaiterQueue->WaiterQ.mList);
803 MsgWaiterQueue->WaiterQ.mCount = 0;
804
805 /* We don't have a minimum waiter length */
806 MsgWaiterQueue->MinimumWaiterLength = (ULONG)-1;
807
808 /* Init the semaphore and event used for counting and signaling available IRPs */
809 KeInitializeSemaphore(&MsgWaiterQueue->Semaphore, 0, MAXLONG);
810 KeInitializeEvent(&MsgWaiterQueue->Event, NotificationEvent, FALSE);
811
812 return STATUS_SUCCESS;
813}
814
815static
818{
819 PPORT_CCB PortCCB;
820
821 /* Allocate a CCB struct to hold the client port object info */
823 if (PortCCB)
824 {
825 /* Initialize the structure */
826 PortCCB->Port = PortObject;
827 PortCCB->ReplyWaiterList.mCount = 0;
830 }
831
832 return PortCCB;
833}
static const INTERNET_PORT ServerPort
Definition: CWebService.cpp:11
VOID NTAPI FltpServerPortDelete(PVOID Object)
Definition: Messaging.c:317
static NTSTATUS CreateClientPort(_In_ PFILE_OBJECT FileObject, _Inout_ PIRP Irp)
Definition: Messaging.c:617
NTSTATUS FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject)
Definition: Messaging.c:377
UNICODE_STRING CommsDeviceName
Definition: Messaging.c:21
NTSTATUS NTAPI FltpAddMessageWaiter(_In_ PIO_CSQ Csq, _In_ PIRP Irp, _In_ PVOID InsertContext)
Definition: Messaging.c:470
PDEVICE_OBJECT CommsDeviceObject
Definition: Messaging.c:22
VOID NTAPI FltpClientPortDelete(PVOID Object)
Definition: Messaging.c:369
POBJECT_TYPE ClientPortObjectType
Definition: Messaging.c:25
NTSTATUS FltpMsgCreate(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Messaging.c:223
POBJECT_TYPE ServerPortObjectType
Definition: Messaging.c:24
static NTSTATUS CloseClientPort(_In_ PFILE_OBJECT FileObject, _Inout_ PIRP Irp)
Definition: Messaging.c:766
static BOOLEAN FltpDisconnectPort(_In_ PFLT_PORT_OBJECT PortObject)
Definition: Messaging.c:342
NTSTATUS FltpMsgDispatch(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: Messaging.c:256
PIRP NTAPI FltpGetNextMessageWaiter(_In_ PIO_CSQ Csq, _In_ PIRP Irp, _In_ PVOID PeekContext)
Definition: Messaging.c:500
VOID NTAPI FltpServerPortClose(_In_opt_ PEPROCESS Process, _In_ PVOID Object, _In_ ACCESS_MASK GrantedAccess, _In_ ULONG ProcessHandleCount, _In_ ULONG SystemHandleCount)
Definition: Messaging.c:289
VOID NTAPI FltpClientPortClose(_In_opt_ PEPROCESS Process, _In_ PVOID Object, _In_ ACCESS_MASK GrantedAccess, _In_ ULONG ProcessHandleCount, _In_ ULONG SystemHandleCount)
Definition: Messaging.c:327
VOID NTAPI FltpRemoveMessageWaiter(_In_ PIO_CSQ Csq, _In_ PIRP Irp)
Definition: Messaging.c:491
static PPORT_CCB CreatePortCCB(_In_ PFLT_PORT_OBJECT PortObject)
Definition: Messaging.c:817
VOID NTAPI FltpCancelMessageWaiter(_In_ PIO_CSQ Csq, _In_ PIRP Irp)
Definition: Messaging.c:603
static NTSTATUS InitializeMessageWaiterQueue(_Inout_ PFLT_MESSAGE_WAITER_QUEUE MsgWaiterQueue)
Definition: Messaging.c:783
VOID FLTAPI FltObjectDereference(_Inout_ PVOID Object)
Definition: Object.c:53
NTSTATUS FLTAPI FltObjectReference(_Inout_ PVOID Object)
Definition: Object.c:41
unsigned char BOOLEAN
struct NameRec_ * Name
Definition: cdprocs.h:460
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
#define _Acquires_lock_(lock)
#define _Releases_lock_(lock)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
_In_ PIRP Irp
Definition: csq.h:116
_In_ PIRP _In_ PVOID InsertContext
Definition: csq.h:258
_In_opt_ PIRP _In_opt_ PVOID PeekContext
Definition: csq.h:160
_Out_ PKIRQL Irql
Definition: csq.h:179
NTKERNELAPI NTSTATUS NTAPI IoCsqInitializeEx(_Out_ PIO_CSQ Csq, _In_ PIO_CSQ_INSERT_IRP_EX CsqInsertIrpEx, _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp, _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp, _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock, _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock, _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp)
Set up a CSQ struct to initialize the queue (extended version)
Definition: csq.c:143
LIST_ENTRY IrpQueue
Definition: csqrtns.c:49
IO_CSQ Csq
Definition: csqrtns.c:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
#define _IRQL_raises_(irql)
Definition: driverspecs.h:228
#define _IRQL_saves_global_(kind, param)
Definition: driverspecs.h:236
#define _IRQL_restores_global_(kind, param)
Definition: driverspecs.h:234
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define ExGetPreviousMode
Definition: ex.h:139
#define ExInitializeRundownProtection
Definition: ex.h:136
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG SenderBufferLength
Definition: fltkernel.h:1901
_Outptr_ PFLT_PORT * ClientPort
Definition: fltkernel.h:1891
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG _Out_writes_bytes_opt_ ReplyLength PVOID ReplyBuffer
Definition: fltkernel.h:1902
VOID(FLTAPI * PFLT_DISCONNECT_NOTIFY)(_In_opt_ PVOID ConnectionCookie)
Definition: fltkernel.h:856
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
NTSTATUS(FLTAPI * PFLT_MESSAGE_NOTIFY)(_In_opt_ PVOID PortCookie, _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_writes_bytes_to_opt_(OutputBufferLength, *ReturnOutputBufferLength) PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _Out_ PULONG ReturnOutputBufferLength)
Definition: fltkernel.h:839
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY _In_opt_ PFLT_MESSAGE_NOTIFY MessageNotifyCallback
Definition: fltkernel.h:1877
#define FLT_PORT_ALL_ACCESS
Definition: fltkernel.h:836
struct _FLT_PORT * PFLT_PORT
Definition: fltkernel.h:87
NTSTATUS(FLTAPI * PFLT_CONNECT_NOTIFY)(_In_ PFLT_PORT ClientPort, _In_opt_ PVOID ServerPortCookie, _In_reads_bytes_opt_(SizeOfContext) PVOID ConnectionContext, _In_ ULONG SizeOfContext, _Outptr_result_maybenull_ PVOID *ConnectionPortCookie)
Definition: fltkernel.h:848
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY ConnectNotifyCallback
Definition: fltkernel.h:1875
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG _Out_writes_bytes_opt_ ReplyLength PVOID _Inout_opt_ PULONG ReplyLength
Definition: fltkernel.h:1903
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID ServerPortCookie
Definition: fltkernel.h:1874
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback
Definition: fltkernel.h:1876
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define FM_TAG_CCB
Definition: fltmgr.h:23
VOID FltpObjectPointerDereference(_In_ PFLT_OBJECT Object)
Definition: Object.c:335
struct _FLT_SERVER_PORT_OBJECT * PFLT_SERVER_PORT_OBJECT
ULONG FltpObjectPointerReference(_In_ PFLT_OBJECT Object)
Definition: Object.c:322
struct _FLT_SERVER_PORT_OBJECT FLT_SERVER_PORT_OBJECT
struct _FLT_PORT_OBJECT * PFLT_PORT_OBJECT
struct _FLT_PORT_OBJECT FLT_PORT_OBJECT
struct _FLT_CCB * PFLT_CCB
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:25
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
CPPORT Port[4]
Definition: headless.c:35
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_OPENLINK
Definition: winternl.h:230
@ ProcessHandleCount
Definition: winternl.h:876
static LONG MaxConnections
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define _In_reads_bytes_(size)
Definition: ms_sal.h:321
#define _Inout_
Definition: ms_sal.h:378
#define _Outptr_
Definition: ms_sal.h:427
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define _Out_writes_bytes_opt_(size)
Definition: ms_sal.h:351
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
struct _OBJECT_TYPE_INITIALIZER OBJECT_TYPE_INITIALIZER
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_READ_DATA
Definition: nt_native.h:628
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define GENERIC_ALL
Definition: nt_native.h:92
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
@ NotificationEvent
@ SynchronizationEvent
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define IoCompleteRequest
Definition: irp.c:1240
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_CONNECTION_COUNT_LIMIT
Definition: ntstatus.h:714
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2935
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:951
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1048
VOID NTAPI ObMakeTemporaryObject(IN PVOID ObjectBody)
Definition: oblife.c:1361
NTSTATUS NTAPI ObReferenceObjectByName(IN PUNICODE_STRING ObjectPath, IN ULONG Attributes, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext, OUT PVOID *ObjectPtr)
Definition: obref.c:409
long LONG
Definition: pedump.c:60
static ULONG Timeout
Definition: ping.c:61
#define FILE_DEVICE_WPD
Definition: winioctl.h:168
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
Definition: semphobj.c:22
#define STATUS_SUCCESS
Definition: shellext.h:65
UNICODE_STRING PortName
Definition: fltmgr_shared.h:28
FLT_MUTEX_LIST_HEAD PortList
Definition: fltmgrint.h:122
EX_PUSH_LOCK PortLock
Definition: fltmgrint.h:123
FLT_MUTEX_LIST_HEAD ConnectionList
Definition: fltmgrint.h:121
FLT_MUTEX_LIST_HEAD WaiterQ
Definition: fltmgrint.h:206
LIST_ENTRY mList
Definition: fltmgrint.h:56
FAST_MUTEX mLock
Definition: fltmgrint.h:55
EX_RUNDOWN_REF MsgNotifRundownRef
Definition: fltmgrint.h:219
PFLT_SERVER_PORT_OBJECT ServerPort
Definition: fltmgrint.h:217
FLT_MESSAGE_WAITER_QUEUE MsgQ
Definition: fltmgrint.h:221
LIST_ENTRY FilterLink
Definition: fltmgrint.h:216
FAST_MUTEX Lock
Definition: fltmgrint.h:220
PFLT_DISCONNECT_NOTIFY DisconnectNotify
Definition: fltmgrint.h:192
PFLT_MESSAGE_NOTIFY MessageNotify
Definition: fltmgrint.h:193
PFLT_CONNECT_NOTIFY ConnectNotify
Definition: fltmgrint.h:191
Definition: csq.h:222
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
OB_CLOSE_METHOD CloseProcedure
Definition: obtypes.h:368
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365
PFLT_PORT_OBJECT Port
Definition: fltmgrint.h:356
FLT_MUTEX_LIST_HEAD ReplyWaiterList
Definition: fltmgrint.h:357
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define MAXLONG
Definition: umtypes.h:116
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
* PFAST_MUTEX
Definition: extypes.h:17
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:20