ReactOS  0.4.14-dev-554-g2f8d847
deviceinterface.c
Go to the documentation of this file.
1 #include "precomp.h"
2 
3 #define NDEBUG
4 #include <debug.h>
5 
8  IN PLIST_ENTRY ListHead,
9  IN BOOL Enable)
10 {
13  PSYMBOLIC_LINK_ENTRY SymEntry;
14 
15 
16  Entry = ListHead->Flink;
17  while(Entry != ListHead)
18  {
19  /* fetch symbolic link entry */
21  /* set device interface state */
23 
24  DPRINT("KspSetDeviceInterfacesState SymbolicLink '%S' Status %lx\n", SymEntry->SymbolicLink.Buffer, Status, Enable);
25 
26  /* check for success */
27  if (!NT_SUCCESS(Status))
28  return Status;
29  /* get next entry */
30  Entry = Entry->Flink;
31  }
32  /* return result */
33  return Status;
34 }
35 
38  IN PLIST_ENTRY ListHead)
39 {
41  PSYMBOLIC_LINK_ENTRY SymEntry;
42 
43  while(!IsListEmpty(ListHead))
44  {
45  /* remove first entry */
46  Entry = RemoveHeadList(ListHead);
47 
48  /* fetch symbolic link entry */
50 
51  /* free device interface string */
53  /* free entry item */
54  FreeItem(Entry);
55  }
56 
57  return STATUS_SUCCESS;
58 }
59 
63  IN ULONG CategoriesCount,
64  IN GUID const*Categories,
67 {
68  ULONG Index;
70  PSYMBOLIC_LINK_ENTRY SymEntry;
71 
72  for(Index = 0; Index < CategoriesCount; Index++)
73  {
74  /* allocate a symbolic link entry */
75  SymEntry = AllocateItem(NonPagedPool, sizeof(SYMBOLIC_LINK_ENTRY));
76  /* check for success */
77  if (!SymEntry)
79 
80  /* now register device interface */
82  &Categories[Index],
84  &SymEntry->SymbolicLink);
85 
86  if (!NT_SUCCESS(Status))
87  {
88  DPRINT1("Failed to register device interface %x\n", Status);
89 
90  /* free entry */
91  FreeItem(SymEntry);
92 
93  /* return result */
94  return Status;
95  }
96 
97  /* copy device class */
99 
100  /* insert symbolic link entry */
102  }
103 
104  /* return result */
105  return Status;
106 }
107 
108 NTSTATUS
110  IN PKSIDEVICE_HEADER DeviceHeader,
111  IN BOOLEAN NewState)
112 {
113  PCREATE_ITEM_ENTRY CreateEntry;
116 
117  /* grab first device interface */
118  Entry = DeviceHeader->ItemList.Flink;
119  while(Entry != &DeviceHeader->ItemList && Status == STATUS_SUCCESS)
120  {
121  /* grab create entry */
123 
124  /* sanity check */
125  ASSERT(CreateEntry->CreateItem);
126 
127  if (CreateEntry->CreateItem->Create == IKsFilterFactory_Create)
128  {
129  /* found our own filterfactory */
130  Status = KsFilterFactorySetDeviceClassesState((PKSFILTERFACTORY)CreateEntry->CreateItem->Context, NewState);
131  }
132 
133  Entry = Entry->Flink;
134  }
135 
136  /* store result */
137  return Status;
138 }
#define IN
Definition: typedefs.h:38
NTSTATUS KspFreeDeviceInterfaces(IN PLIST_ENTRY ListHead)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList
struct _Entry Entry
Definition: kefuncs.h:640
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
LIST_ENTRY Entry
Definition: kstypes.h:123
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1122
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
Definition: kstypes.h:45
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
unsigned int BOOL
Definition: ntddk_ex.h:94
const GUID Categories[]
Definition: splitter.c:208
_In_ CONST GUID _In_opt_ PUNICODE_STRING ReferenceString
Definition: iofuncs.h:1134
PKSOBJECT_CREATE_ITEM CreateItem
Definition: kstypes.h:48
NTSTATUS KspSetDeviceInterfacesState(IN PLIST_ENTRY ListHead, IN BOOL Enable)
Definition: kstypes.h:121
unsigned char BOOLEAN
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
NTSTATUS KspSetFilterFactoriesState(IN PKSIDEVICE_HEADER DeviceHeader, IN BOOLEAN NewState)
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
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
CLSID DeviceInterfaceClass
Definition: kstypes.h:125
NTSTATUS NTAPI IKsFilterFactory_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filterfactory.c:42
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSTATUS KspRegisterDeviceInterfaces(IN PDEVICE_OBJECT PhysicalDeviceObject, IN ULONG CategoriesCount, IN GUID const *Categories, IN PUNICODE_STRING ReferenceString, OUT PLIST_ENTRY SymbolicLinkList)
Definition: typedefs.h:117
struct SYMBOLIC_LINK_ENTRY * PSYMBOLIC_LINK_ENTRY
Status
Definition: gdiplustypes.h:24
KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState(IN PKSFILTERFACTORY FilterFactory, IN BOOLEAN NewState)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
#define DPRINT1
Definition: precomp.h:8
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
base of all file and directory entries
Definition: entries.h:82