ReactOS  0.4.14-dev-606-g14ebc0b
filterfactory.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for filterfactory.c:

Go to the source code of this file.

Classes

struct  IKsFilterFactoryImpl
 

Macros

#define NDEBUG
 

Functions

VOID NTAPI IKsFilterFactory_ItemFreeCb (IN PKSOBJECT_CREATE_ITEM CreateItem)
 
NTSTATUS NTAPI IKsFilterFactory_Create (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IKsFilterFactory_fnQueryInterface (IKsFilterFactory *iface, IN REFIID refiid, OUT PVOID *Output)
 
ULONG NTAPI IKsFilterFactory_fnAddRef (IKsFilterFactory *iface)
 
ULONG NTAPI IKsFilterFactory_fnRelease (IKsFilterFactory *iface)
 
KSFILTERFACTORY *NTAPI IKsFilterFactory_fnGetStruct (IKsFilterFactory *iface)
 
NTSTATUS NTAPI IKsFilterFactory_fnSetDeviceClassesState (IKsFilterFactory *iface, IN BOOLEAN Enable)
 
VOID IKsFilterFactory_AttachFilterFactoryToDeviceHeader (IKsFilterFactoryImpl *This, PKSIDEVICE_HEADER DeviceHeader)
 
NTSTATUS NTAPI IKsFilterFactory_fnInitialize (IKsFilterFactory *iface, IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
 
NTSTATUS NTAPI KspCreateFilterFactory (IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
 
KSDDKAPI NTSTATUS NTAPI KsCreateFilterFactory (IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
 
KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState (IN PKSFILTERFACTORY FilterFactory, IN BOOLEAN NewState)
 
KSDDKAPI PUNICODE_STRING NTAPI KsFilterFactoryGetSymbolicLink (IN PKSFILTERFACTORY FilterFactory)
 
KSDDKAPI NTSTATUS NTAPI KsFilterFactoryAddCreateItem (IN PKSFILTERFACTORY FilterFactory, IN PWSTR RefString, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags)
 
ULONG KspCacheAddData (PKSPCACHE_DESCRIPTOR Descriptor, LPCVOID Data, ULONG Length)
 
KSDDKAPI NTSTATUS NTAPI KsFilterFactoryUpdateCacheData (IN PKSFILTERFACTORY FilterFactory, IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL)
 

Variables

static IKsFilterFactoryVtbl vt_IKsFilterFactoryVtbl
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file filterfactory.c.

Function Documentation

◆ IKsFilterFactory_AttachFilterFactoryToDeviceHeader()

VOID IKsFilterFactory_AttachFilterFactoryToDeviceHeader ( IKsFilterFactoryImpl This,
PKSIDEVICE_HEADER  DeviceHeader 
)

Definition at line 173 of file filterfactory.c.

176 {
177  PKSBASIC_HEADER BasicHeader;
178  PKSFILTERFACTORY FilterFactory;
179 
180  if (DeviceHeader->BasicHeader.FirstChild.FilterFactory == NULL)
181  {
182  /* first attached filter factory */
183  DeviceHeader->BasicHeader.FirstChild.FilterFactory = &This->FilterFactory;
184  return;
185  }
186 
187  /* set to first entry */
188  FilterFactory = DeviceHeader->BasicHeader.FirstChild.FilterFactory;
189 
190  do
191  {
192  /* get basic header */
193  BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)FilterFactory - sizeof(KSBASIC_HEADER));
194  /* sanity check */
195  ASSERT(BasicHeader->Type == KsObjectTypeFilterFactory);
196 
197  if (BasicHeader->Next.FilterFactory)
198  {
199  /* iterate to next filter factory */
200  FilterFactory = BasicHeader->Next.FilterFactory;
201  }
202  else
203  {
204  /* found last entry */
205  break;
206  }
207  }while(FilterFactory);
208 
209  /* attach filter factory */
210  BasicHeader->Next.FilterFactory = &This->FilterFactory;
211 }
struct KSBASIC_HEADER * PKSBASIC_HEADER
union KSBASIC_HEADER::@979 FirstChild
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
KSOBJECTTYPE Type
Definition: kstypes.h:56
union KSBASIC_HEADER::@978 Next
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
KSBASIC_HEADER BasicHeader
Definition: kstypes.h:87
PKSFILTERFACTORY FilterFactory
Definition: kstypes.h:72

Referenced by IKsFilterFactory_fnInitialize().

◆ IKsFilterFactory_Create()

NTSTATUS NTAPI IKsFilterFactory_Create ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 42 of file filterfactory.c.

45 {
46  PKSOBJECT_CREATE_ITEM CreateItem;
48  IKsFilterFactory * iface;
50 
51  /* access the create item */
52  CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
53  if (!CreateItem)
54  {
55  DPRINT1("IKsFilterFactory_Create no CreateItem\n");
56  return STATUS_UNSUCCESSFUL;
57  }
58 
59  /* get filter factory interface */
60  Factory = (IKsFilterFactoryImpl*)CONTAINING_RECORD(CreateItem->Context, IKsFilterFactoryImpl, FilterFactory);
61 
62  /* get interface */
63  iface = (IKsFilterFactory*)&Factory->Header.OuterUnknown;
64 
65  /* create a filter instance */
67 
68  DPRINT("KspCreateFilter Status %x\n", Status);
69 
70  if (Status != STATUS_PENDING)
71  {
72  Irp->IoStatus.Information = 0;
73  Irp->IoStatus.Status = Status;
75  }
76 
77  return Status;
78 }
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
void DPRINT(...)
Definition: polytest.cpp:61
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
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS NTAPI KspCreateFilter(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN IKsFilterFactory *iface)
Definition: filter.c:1636
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566

Referenced by IKsFilterFactory_fnInitialize(), KsFilterFactoryAddCreateItem(), and KspSetFilterFactoriesState().

◆ IKsFilterFactory_fnAddRef()

ULONG NTAPI IKsFilterFactory_fnAddRef ( IKsFilterFactory *  iface)

Definition at line 117 of file filterfactory.c.

119 {
121 
122  return InterlockedIncrement(&This->ref);
123 }
Definition: Header.h:8
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
#define InterlockedIncrement
Definition: armddk.h:53

◆ IKsFilterFactory_fnGetStruct()

KSFILTERFACTORY* NTAPI IKsFilterFactory_fnGetStruct ( IKsFilterFactory *  iface)

Definition at line 153 of file filterfactory.c.

155 {
157 
158  return &This->FilterFactory;
159 }
Definition: Header.h:8
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

◆ IKsFilterFactory_fnInitialize()

NTSTATUS NTAPI IKsFilterFactory_fnInitialize ( IKsFilterFactory *  iface,
IN PDEVICE_OBJECT  DeviceObject,
IN const KSFILTER_DESCRIPTOR *  Descriptor,
IN PWSTR RefString  OPTIONAL,
IN PSECURITY_DESCRIPTOR SecurityDescriptor  OPTIONAL,
IN ULONG  CreateItemFlags,
IN PFNKSFILTERFACTORYPOWER SleepCallback  OPTIONAL,
IN PFNKSFILTERFACTORYPOWER WakeCallback  OPTIONAL,
OUT PKSFILTERFACTORY *FilterFactory  OPTIONAL 
)

Definition at line 215 of file filterfactory.c.

225 {
228  PDEVICE_EXTENSION DeviceExtension;
229  KSOBJECT_CREATE_ITEM CreateItem;
230  BOOL FreeString = FALSE;
231  IKsDevice * KsDevice;
232 
234 
235  /* get device extension */
236  DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
237 
238  /* initialize filterfactory */
239  This->SleepCallback = SleepCallback;
240  This->WakeCallback = WakeCallback;
241  This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
242  This->Header.Type = KsObjectTypeFilterFactory;
243  This->Header.Parent.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
244  This->DeviceHeader = DeviceExtension->DeviceHeader;
245 
246  /* copy descriptor */
247  This->FilterFactory.FilterDescriptor = AllocateItem(NonPagedPool, sizeof(KSFILTER_DESCRIPTOR));
248  if (!This->FilterFactory.FilterDescriptor)
249  {
250  DPRINT("out of memory");
252  }
253  RtlMoveMemory((PVOID)This->FilterFactory.FilterDescriptor, (PVOID)Descriptor, sizeof(KSFILTER_DESCRIPTOR));
254 
255  /* initialize filter factory control mutex */
256  This->Header.ControlMutex = &This->ControlMutex;
257  KeInitializeMutex(This->Header.ControlMutex, 0);
258 
259  /* unused fields */
260  InitializeListHead(&This->Header.EventList);
261  KeInitializeSpinLock(&This->Header.EventListLock);
262 
263  InitializeListHead(&This->SymbolicLinkList);
264 
265  /* does the device use a reference string */
266  if (RefString || !Descriptor->ReferenceGuid)
267  {
268  /* use device reference string */
270  }
271  else
272  {
273  /* create reference string from descriptor guid */
275 
276  /* check for success */
277  if (!NT_SUCCESS(Status))
278  {
279  /* omg, we failed */
280  return Status;
281  }
282 
283  FreeString = TRUE;
284  }
285 
286  DPRINT("IKsFilterFactory_fnInitialize CategoriesCount %u ReferenceString '%S'\n", Descriptor->CategoriesCount,ReferenceString.Buffer);
287 
288  /* now register the device interface */
289  Status = KspRegisterDeviceInterfaces(DeviceExtension->DeviceHeader->KsDevice.PhysicalDeviceObject,
290  Descriptor->CategoriesCount,
291  Descriptor->Categories,
293  &This->SymbolicLinkList);
294  /* check for success */
295  if (!NT_SUCCESS(Status))
296  {
297  DPRINT1("KspRegisterDeviceInterfaces failed with %x\n", Status);
298 
299  if (FreeString)
300  {
301  /* free unicode string */
303  }
304 
305  return Status;
306  }
307 
308  /* now setup the create item */
309  CreateItem.SecurityDescriptor = SecurityDescriptor;
310  CreateItem.Flags = CreateItemFlags;
311  CreateItem.Create = IKsFilterFactory_Create;
312  CreateItem.Context = (PVOID)&This->FilterFactory;
313  RtlInitUnicodeString(&CreateItem.ObjectClass, ReferenceString.Buffer);
314 
315  /* insert create item to device header */
316  Status = KsAllocateObjectCreateItem((KSDEVICE_HEADER)DeviceExtension->DeviceHeader, &CreateItem, TRUE, IKsFilterFactory_ItemFreeCb);
317 
318  if (FreeString)
319  {
320  /* free unicode string */
322  }
323 
324  /* create a object bag for the filter factory */
325  This->FilterFactory.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
326  if (This->FilterFactory.Bag)
327  {
328  /* initialize object bag */
329  KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->BasicHeader.OuterUnknown;
330  KsDevice->lpVtbl->InitializeObjectBag(KsDevice, (PKSIOBJECT_BAG)This->FilterFactory.Bag, NULL);
331  }
332 
333  if (FilterFactory)
334  {
335  /* return filterfactory */
336  *FilterFactory = &This->FilterFactory;
337  }
338 
339  /* attach filterfactory to device header */
340  IKsFilterFactory_AttachFilterFactoryToDeviceHeader(This, DeviceExtension->DeviceHeader);
341 
342  /* return result */
343  return Status;
344 }
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
VOID IKsFilterFactory_AttachFilterFactoryToDeviceHeader(IKsFilterFactoryImpl *This, PKSIDEVICE_HEADER DeviceHeader)
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
Definition: Header.h:8
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ CONST GUID _In_opt_ PUNICODE_STRING ReferenceString
Definition: iofuncs.h:1134
VOID NTAPI IKsFilterFactory_ItemFreeCb(IN PKSOBJECT_CREATE_ITEM CreateItem)
Definition: filterfactory.c:31
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
void * PVOID
Definition: retypes.h:9
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
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI IKsFilterFactory_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filterfactory.c:42
NTSTATUS KspRegisterDeviceInterfaces(IN PDEVICE_OBJECT PhysicalDeviceObject, IN ULONG CategoriesCount, IN GUID const *Categories, IN PUNICODE_STRING ReferenceString, OUT PLIST_ENTRY SymbolicLinkList)
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
KSDDKAPI NTSTATUS NTAPI KsAllocateObjectCreateItem(IN KSDEVICE_HEADER DevHeader, IN PKSOBJECT_CREATE_ITEM CreateItem, IN BOOLEAN AllocateEntry, IN PFNKSITEMFREECALLBACK ItemFreeCallback OPTIONAL)
Definition: api.c:886
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DPRINT1
Definition: precomp.h:8
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ IKsFilterFactory_fnQueryInterface()

NTSTATUS NTAPI IKsFilterFactory_fnQueryInterface ( IKsFilterFactory *  iface,
IN REFIID  refiid,
OUT PVOID Output 
)

Definition at line 83 of file filterfactory.c.

87 {
89 
91 
92  if (IsEqualGUIDAligned(refiid, &IID_IUnknown))
93  {
94  *Output = &This->Header.OuterUnknown;
96  return STATUS_SUCCESS;
97  }
98 
99  if (This->Header.ClientAggregate)
100  {
101  /* using client aggregate */
102  Status = This->Header.ClientAggregate->lpVtbl->QueryInterface(This->Header.ClientAggregate, refiid, Output);
103 
104  if (NT_SUCCESS(Status))
105  {
106  /* client aggregate supports interface */
107  return Status;
108  }
109  }
110 
111  DPRINT("IKsFilterFactory_fnQueryInterface no interface\n");
112  return STATUS_NOT_SUPPORTED;
113 }
LONG NTSTATUS
Definition: precomp.h:26
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
Definition: Header.h:8
void DPRINT(...)
Definition: polytest.cpp:61
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
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
const GUID IID_IUnknown
Definition: arc.h:85
Status
Definition: gdiplustypes.h:24
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ IKsFilterFactory_fnRelease()

ULONG NTAPI IKsFilterFactory_fnRelease ( IKsFilterFactory *  iface)

Definition at line 127 of file filterfactory.c.

129 {
131 
132  InterlockedDecrement(&This->ref);
133 
134  if (This->ref == 0)
135  {
136  if (!IsListEmpty(&This->SymbolicLinkList))
137  {
138  /* disable device interfaces */
139  KspSetDeviceInterfacesState(&This->SymbolicLinkList, FALSE);
140  /* free device interface strings */
141  KspFreeDeviceInterfaces(&This->SymbolicLinkList);
142  }
143 
144  FreeItem(This);
145  return 0;
146  }
147  /* Return new reference count */
148  return This->ref;
149 }
NTSTATUS KspFreeDeviceInterfaces(IN PLIST_ENTRY ListHead)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
Definition: Header.h:8
NTSTATUS KspSetDeviceInterfacesState(IN PLIST_ENTRY ListHead, IN BOOL Enable)
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
#define InterlockedDecrement
Definition: armddk.h:52

◆ IKsFilterFactory_fnSetDeviceClassesState()

NTSTATUS NTAPI IKsFilterFactory_fnSetDeviceClassesState ( IKsFilterFactory *  iface,
IN BOOLEAN  Enable 
)

Definition at line 163 of file filterfactory.c.

166 {
168 
169  return KspSetDeviceInterfacesState(&This->SymbolicLinkList, Enable);
170 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
Definition: Header.h:8
NTSTATUS KspSetDeviceInterfacesState(IN PLIST_ENTRY ListHead, IN BOOL Enable)
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

◆ IKsFilterFactory_ItemFreeCb()

VOID NTAPI IKsFilterFactory_ItemFreeCb ( IN PKSOBJECT_CREATE_ITEM  CreateItem)

Definition at line 31 of file filterfactory.c.

33 {
34  /* callback when create item is freed in the device header */
35  IKsFilterFactory * iface = (IKsFilterFactory*)CONTAINING_RECORD(CreateItem->Context, IKsFilterFactoryImpl, FilterFactory);
36 
37  iface->lpVtbl->Release(iface);
38 }
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

Referenced by IKsFilterFactory_fnInitialize(), and KsFilterFactoryAddCreateItem().

◆ KsCreateFilterFactory()

KSDDKAPI NTSTATUS NTAPI KsCreateFilterFactory ( IN PDEVICE_OBJECT  DeviceObject,
IN const KSFILTER_DESCRIPTOR *  Descriptor,
IN PWSTR RefString  OPTIONAL,
IN PSECURITY_DESCRIPTOR SecurityDescriptor  OPTIONAL,
IN ULONG  CreateItemFlags,
IN PFNKSFILTERFACTORYPOWER SleepCallback  OPTIONAL,
IN PFNKSFILTERFACTORYPOWER WakeCallback  OPTIONAL,
OUT PKSFILTERFACTORY *FilterFactory  OPTIONAL 
)

Definition at line 413 of file filterfactory.c.

422 {
423  return KspCreateFilterFactory(DeviceObject, Descriptor, RefString, SecurityDescriptor, CreateItemFlags, SleepCallback, WakeCallback, FilterFactory);
424 
425 }
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
NTSTATUS NTAPI KspCreateFilterFactory(IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

Referenced by BdaCreateFilterFactoryEx(), and USBAudioCreateFilterContext().

◆ KsFilterFactoryAddCreateItem()

KSDDKAPI NTSTATUS NTAPI KsFilterFactoryAddCreateItem ( IN PKSFILTERFACTORY  FilterFactory,
IN PWSTR  RefString,
IN PSECURITY_DESCRIPTOR SecurityDescriptor  OPTIONAL,
IN ULONG  CreateItemFlags 
)

Definition at line 476 of file filterfactory.c.

481 {
482  KSOBJECT_CREATE_ITEM CreateItem;
483 
485 
486  /* initialize create item */
487  CreateItem.Context = (PVOID)&Factory->FilterFactory;
488  CreateItem.Create = IKsFilterFactory_Create;
489  CreateItem.Flags = CreateItemFlags;
490  CreateItem.SecurityDescriptor = SecurityDescriptor;
491  RtlInitUnicodeString(&CreateItem.ObjectClass, RefString);
492 
493  /* insert create item to device header */
495 }
#define TRUE
Definition: types.h:120
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
VOID NTAPI IKsFilterFactory_ItemFreeCb(IN PKSOBJECT_CREATE_ITEM CreateItem)
Definition: filterfactory.c:31
void * PVOID
Definition: retypes.h:9
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
NTSTATUS NTAPI IKsFilterFactory_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filterfactory.c:42
KSDDKAPI NTSTATUS NTAPI KsAllocateObjectCreateItem(IN KSDEVICE_HEADER DevHeader, IN PKSOBJECT_CREATE_ITEM CreateItem, IN BOOLEAN AllocateEntry, IN PFNKSITEMFREECALLBACK ItemFreeCallback OPTIONAL)
Definition: api.c:886
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

◆ KsFilterFactoryGetSymbolicLink()

KSDDKAPI PUNICODE_STRING NTAPI KsFilterFactoryGetSymbolicLink ( IN PKSFILTERFACTORY  FilterFactory)

Definition at line 451 of file filterfactory.c.

453 {
454  PSYMBOLIC_LINK_ENTRY LinkEntry;
456 
457  if (IsListEmpty(&Factory->SymbolicLinkList))
458  {
459  /* device has not registered any interfaces */
460  return NULL;
461  }
462 
463  /* get first entry */
464  LinkEntry = (PSYMBOLIC_LINK_ENTRY)CONTAINING_RECORD(Factory->SymbolicLinkList.Flink, SYMBOLIC_LINK_ENTRY, Entry);
465 
466  /* return first link */
467  return &LinkEntry->SymbolicLink;
468 }
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
Definition: kstypes.h:121
smooth NULL
Definition: ftsmooth.c:416
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
struct SYMBOLIC_LINK_ENTRY * PSYMBOLIC_LINK_ENTRY
base of all file and directory entries
Definition: entries.h:82

◆ KsFilterFactorySetDeviceClassesState()

KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState ( IN PKSFILTERFACTORY  FilterFactory,
IN BOOLEAN  NewState 
)

Definition at line 433 of file filterfactory.c.

436 {
437  IKsFilterFactory * Factory;
439 
440  Factory = (IKsFilterFactory*)&This->Header.OuterUnknown;
441  return Factory->lpVtbl->SetDeviceClassesState(Factory, NewState);
442 }
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

Referenced by KspSetFilterFactoriesState().

◆ KsFilterFactoryUpdateCacheData()

KSDDKAPI NTSTATUS NTAPI KsFilterFactoryUpdateCacheData ( IN PKSFILTERFACTORY  FilterFactory,
IN const KSFILTER_DESCRIPTOR *FilterDescriptor  OPTIONAL 
)

Definition at line 541 of file filterfactory.c.

544 {
546  PKSPCACHE_FILTER_HEADER FilterHeader;
548  PKSPCACHE_PIN_HEADER PinHeader;
549  ULONG Index, SubIndex;
551  PSYMBOLIC_LINK_ENTRY SymEntry;
552  BOOLEAN Found;
553  HANDLE hKey;
555 
557 
558  DPRINT("KsFilterFactoryUpdateCacheData %p\n", FilterDescriptor);
559 
560  if (!FilterDescriptor)
561  FilterDescriptor = Factory->FilterFactory.FilterDescriptor;
562 
564 
565  /* initialize cache descriptor */
567 
568  /* calculate filter data size */
569  Descriptor.FilterLength = sizeof(KSPCACHE_FILTER_HEADER);
570 
571  /* FIXME support variable size pin descriptors */
572  ASSERT(FilterDescriptor->PinDescriptorSize == sizeof(KSPIN_DESCRIPTOR_EX));
573 
574  for(Index = 0; Index < FilterDescriptor->PinDescriptorsCount; Index++)
575  {
576  /* add filter descriptor */
577  Descriptor.FilterLength += sizeof(KSPCACHE_PIN_HEADER);
578 
579  if (FilterDescriptor->PinDescriptors[Index].PinDescriptor.Category)
580  {
581  /* add extra ULONG for offset to category */
582  Descriptor.FilterLength += sizeof(ULONG);
583 
584  /* add size for clsid */
585  Descriptor.DataLength += sizeof(CLSID);
586  }
587 
588  /* add space for formats */
589  Descriptor.FilterLength += FilterDescriptor->PinDescriptors[Index].PinDescriptor.DataRangesCount * sizeof(KSPCACHE_DATARANGE);
590 
591  /* add space for MajorFormat / MinorFormat */
592  Descriptor.DataLength += FilterDescriptor->PinDescriptors[Index].PinDescriptor.DataRangesCount * sizeof(CLSID) * 2;
593 
594  /* add space for mediums */
595  Descriptor.FilterLength += FilterDescriptor->PinDescriptors[Index].PinDescriptor.MediumsCount * sizeof(ULONG);
596 
597  /* add space for the data */
598  Descriptor.DataLength += FilterDescriptor->PinDescriptors[Index].PinDescriptor.MediumsCount * sizeof(KSPCACHE_MEDIUM);
599  }
600 
601  /* now allocate the space */
602  Descriptor.FilterData = (PUCHAR)AllocateItem(NonPagedPool, Descriptor.DataLength + Descriptor.FilterLength);
603  if (!Descriptor.FilterData)
604  {
605  /* no memory */
607  }
608 
609  /* initialize data cache */
610  Descriptor.DataCache = (PUCHAR)((ULONG_PTR)Descriptor.FilterData + Descriptor.FilterLength);
611 
612  /* setup filter header */
613  FilterHeader = (PKSPCACHE_FILTER_HEADER)Descriptor.FilterData;
614 
615  FilterHeader->dwVersion = 2;
616  FilterHeader->dwMerit = MERIT_DO_NOT_USE;
617  FilterHeader->dwUnused = 0;
618  FilterHeader->dwPins = FilterDescriptor->PinDescriptorsCount;
619 
620  Descriptor.FilterOffset = sizeof(KSPCACHE_FILTER_HEADER);
621 
622  /* write pin headers */
623  for(Index = 0; Index < FilterDescriptor->PinDescriptorsCount; Index++)
624  {
625  /* get offset to pin */
626  PinHeader = (PKSPCACHE_PIN_HEADER)((ULONG_PTR)Descriptor.FilterData + Descriptor.FilterOffset);
627 
628  /* write pin header */
629  PinHeader->Signature = 0x33697030 + Index;
630  PinHeader->Flags = 0;
631  PinHeader->Instances = FilterDescriptor->PinDescriptors[Index].InstancesPossible;
632  if (PinHeader->Instances > 1)
633  PinHeader->Flags |= REG_PINFLAG_B_MANY;
634 
635 
636  PinHeader->MediaTypes = FilterDescriptor->PinDescriptors[Index].PinDescriptor.DataRangesCount;
637  PinHeader->Mediums = FilterDescriptor->PinDescriptors[Index].PinDescriptor.MediumsCount;
638  PinHeader->Category = (FilterDescriptor->PinDescriptors[Index].PinDescriptor.Category ? TRUE : FALSE);
639 
640  Descriptor.FilterOffset += sizeof(KSPCACHE_PIN_HEADER);
641 
642  if (PinHeader->Category)
643  {
644  /* get category offset */
645  PULONG Category = (PULONG)(PinHeader + 1);
646 
647  /* write category offset */
648  *Category = KspCacheAddData(&Descriptor, FilterDescriptor->PinDescriptors[Index].PinDescriptor.Category, sizeof(CLSID));
649 
650  /* adjust offset */
651  Descriptor.FilterOffset += sizeof(ULONG);
652  }
653 
654  /* add dataranges */
655  for(SubIndex = 0; SubIndex < FilterDescriptor->PinDescriptors[Index].PinDescriptor.DataRangesCount; SubIndex++)
656  {
657  /* get datarange offset */
658  PKSPCACHE_DATARANGE DataRange = (PKSPCACHE_DATARANGE)((ULONG_PTR)Descriptor.FilterData + Descriptor.FilterOffset);
659 
660  /* initialize data range */
661  DataRange->Signature = 0x33797430 + SubIndex;
662  DataRange->dwUnused = 0;
663  DataRange->OffsetMajor = KspCacheAddData(&Descriptor, &FilterDescriptor->PinDescriptors[Index].PinDescriptor.DataRanges[SubIndex]->MajorFormat, sizeof(CLSID));
664  DataRange->OffsetMinor = KspCacheAddData(&Descriptor, &FilterDescriptor->PinDescriptors[Index].PinDescriptor.DataRanges[SubIndex]->SubFormat, sizeof(CLSID));
665 
666  /* adjust offset */
667  Descriptor.FilterOffset += sizeof(KSPCACHE_DATARANGE);
668  }
669 
670  /* add mediums */
671  for(SubIndex = 0; SubIndex < FilterDescriptor->PinDescriptors[Index].PinDescriptor.MediumsCount; SubIndex++)
672  {
673  KSPCACHE_MEDIUM Medium;
674  PULONG MediumOffset;
675 
676  /* get pin medium offset */
677  MediumOffset = (PULONG)((ULONG_PTR)Descriptor.FilterData + Descriptor.FilterOffset);
678 
679  /* copy medium guid */
680  RtlMoveMemory(&Medium.Medium, &FilterDescriptor->PinDescriptors[Index].PinDescriptor.Mediums[SubIndex].Set, sizeof(GUID));
681  Medium.dw1 = FilterDescriptor->PinDescriptors[Index].PinDescriptor.Mediums[SubIndex].Id; /* FIXME verify */
682  Medium.dw2 = 0;
683 
684  *MediumOffset = KspCacheAddData(&Descriptor, &Medium, sizeof(KSPCACHE_MEDIUM));
685 
686  /* adjust offset */
687  Descriptor.FilterOffset += sizeof(ULONG);
688  }
689  }
690 
691  /* sanity checks */
692  ASSERT(Descriptor.FilterOffset == Descriptor.FilterLength);
693  ASSERT(Descriptor.DataOffset <= Descriptor.DataLength);
694 
695 
696  /* now go through all entries and update 'FilterData' key */
697  for(Index = 0; Index < FilterDescriptor->CategoriesCount; Index++)
698  {
699  /* get first entry */
700  Entry = Factory->SymbolicLinkList.Flink;
701 
702  /* set status to not found */
703  Found = FALSE;
704  /* loop list until the the current category is found */
705  while(Entry != &Factory->SymbolicLinkList)
706  {
707  /* fetch symbolic link entry */
709 
710  if (IsEqualGUIDAligned(&SymEntry->DeviceInterfaceClass, &FilterDescriptor->Categories[Index]))
711  {
712  /* found category */
713  Found = TRUE;
714  break;
715  }
716 
717  /* move to next entry */
718  Entry = Entry->Flink;
719  }
720 
721  if (!Found)
722  {
723  /* filter category is not present */
725  break;
726  }
727 
728  /* now open device interface */
730  if (!NT_SUCCESS(Status))
731  {
732  /* failed to open interface key */
733  break;
734  }
735 
736  /* update filterdata key */
737  Status = ZwSetValueKey(hKey, &FilterData, 0, REG_BINARY, Descriptor.FilterData, Descriptor.FilterLength + Descriptor.DataOffset);
738 
739  /* close filterdata key */
740  ZwClose(hKey);
741 
742  if (!NT_SUCCESS(Status))
743  {
744  /* failed to set key value */
745  break;
746  }
747  }
748  /* free filter data */
749  FreeItem(Descriptor.FilterData);
750 
751  /* done */
752  return Status;
753 }
const KSFILTER_DESCRIPTOR FilterDescriptor
Definition: splitter.c:229
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS NTAPI IoOpenDeviceInterfaceRegistryKey(IN PUNICODE_STRING SymbolicLinkName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DeviceInterfaceKey)
Definition: deviface.c:241
struct _Entry Entry
Definition: kefuncs.h:640
#define REG_BINARY
Definition: nt_native.h:1496
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
struct KSPCACHE_DATARANGE * PKSPCACHE_DATARANGE
unsigned char * PUCHAR
Definition: retypes.h:3
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
struct KSPCACHE_PIN_HEADER * PKSPCACHE_PIN_HEADER
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define MERIT_DO_NOT_USE
Definition: precomp.h:18
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
Definition: kstypes.h:121
unsigned char BOOLEAN
void DPRINT(...)
Definition: polytest.cpp:61
return Found
Definition: dirsup.c:1270
struct KSPCACHE_FILTER_HEADER * PKSPCACHE_FILTER_HEADER
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
#define KEY_WRITE
Definition: nt_native.h:1031
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const UCHAR Index[8]
Definition: usbohci.c:18
CLSID DeviceInterfaceClass
Definition: kstypes.h:125
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:117
struct SYMBOLIC_LINK_ENTRY * PSYMBOLIC_LINK_ENTRY
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData
Definition: wmitypes.h:55
Status
Definition: gdiplustypes.h:24
ULONG KspCacheAddData(PKSPCACHE_DESCRIPTOR Descriptor, LPCVOID Data, ULONG Length)
CLSID Medium
Definition: kstypes.h:277
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2938
base of all file and directory entries
Definition: entries.h:82
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

Referenced by BdaFilterFactoryUpdateCacheData().

◆ KspCacheAddData()

ULONG KspCacheAddData ( PKSPCACHE_DESCRIPTOR  Descriptor,
LPCVOID  Data,
ULONG  Length 
)

Definition at line 498 of file filterfactory.c.

502 {
503  ULONG Index;
504 
505  for(Index = 0; Index < Descriptor->DataOffset; Index++)
506  {
507  if (RtlCompareMemory(Descriptor->DataCache, Data, Length) == Length)
508  {
509  if (Index + Length > Descriptor->DataOffset)
510  {
511  /* adjust used space */
512  Descriptor->DataOffset = Index + Length;
513  /* return absolute offset */
514  return Descriptor->DataLength + Index;
515  }
516  }
517  }
518 
519  /* sanity check */
521 
522  /* copy to data blob */
523  RtlMoveMemory((Descriptor->DataCache + Descriptor->DataOffset), Data, Length);
524 
525  /* backup offset */
526  Index = Descriptor->DataOffset;
527 
528  /* adjust used space */
529  Descriptor->DataOffset += Length;
530 
531  /* return absolute offset */
532  return Descriptor->DataLength + Index;
533 }
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
static const UCHAR Index[8]
Definition: usbohci.c:18
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

Referenced by KsFilterFactoryUpdateCacheData().

◆ KspCreateFilterFactory()

NTSTATUS NTAPI KspCreateFilterFactory ( IN PDEVICE_OBJECT  DeviceObject,
IN const KSFILTER_DESCRIPTOR *  Descriptor,
IN PWSTR RefString  OPTIONAL,
IN PSECURITY_DESCRIPTOR SecurityDescriptor  OPTIONAL,
IN ULONG  CreateItemFlags,
IN PFNKSFILTERFACTORYPOWER SleepCallback  OPTIONAL,
IN PFNKSFILTERFACTORYPOWER WakeCallback  OPTIONAL,
OUT PKSFILTERFACTORY *FilterFactory  OPTIONAL 
)

Definition at line 359 of file filterfactory.c.

368 {
370  IKsFilterFactory * Filter;
372 
373  DPRINT("KsCreateFilterFactory\n");
374 
375  /* Lets allocate a filterfactory */
377  if (!This)
378  {
379  /* not enough memory */
381  }
382 
383  /* initialize struct */
384  This->ref = 1;
385  This->Header.OuterUnknown = (PUNKNOWN)&vt_IKsFilterFactoryVtbl;
386 
387  /* map to com object */
388  Filter = (IKsFilterFactory*)&This->Header.OuterUnknown;
389 
390  /* initialize filter */
391  Status = Filter->lpVtbl->Initialize(Filter, DeviceObject, Descriptor, RefString, SecurityDescriptor, CreateItemFlags, SleepCallback, WakeCallback, FilterFactory);
392  /* did we succeed */
393  if (!NT_SUCCESS(Status))
394  {
395  /* destroy filterfactory */
396  Filter->lpVtbl->Release(Filter);
397  }
398 
399  /* return result */
400  DPRINT("KsCreateFilterFactory %x\n", Status);
401  /* sanity check */
403 
404  return Status;
405 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
static IKsFilterFactoryVtbl vt_IKsFilterFactoryVtbl
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
return STATUS_SUCCESS
Definition: btrfs.c:2938
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

Referenced by KsCreateFilterFactory(), and KsInitializeDevice().

Variable Documentation

◆ vt_IKsFilterFactoryVtbl

IKsFilterFactoryVtbl vt_IKsFilterFactoryVtbl
static
Initial value:
=
{
}
ULONG NTAPI IKsFilterFactory_fnAddRef(IKsFilterFactory *iface)
KSFILTERFACTORY *NTAPI IKsFilterFactory_fnGetStruct(IKsFilterFactory *iface)
NTSTATUS NTAPI IKsFilterFactory_fnQueryInterface(IKsFilterFactory *iface, IN REFIID refiid, OUT PVOID *Output)
Definition: filterfactory.c:83
NTSTATUS NTAPI IKsFilterFactory_fnSetDeviceClassesState(IKsFilterFactory *iface, IN BOOLEAN Enable)
NTSTATUS NTAPI IKsFilterFactory_fnInitialize(IKsFilterFactory *iface, IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
ULONG NTAPI IKsFilterFactory_fnRelease(IKsFilterFactory *iface)

Definition at line 346 of file filterfactory.c.

Referenced by KspCreateFilterFactory().