ReactOS 0.4.15-dev-8241-g63935f8
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,
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 */
55 }
56
57 return STATUS_SUCCESS;
58}
59
63 IN ULONG CategoriesCount,
64 IN GUID const*Categories,
67{
70 PSYMBOLIC_LINK_ENTRY SymEntry;
71
72 for(Index = 0; Index < CategoriesCount; Index++)
73 {
74 /* allocate a symbolic link entry */
76 /* check for success */
77 if (!SymEntry)
79
80 /* now register device interface */
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
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}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
NTSTATUS KspRegisterDeviceInterfaces(IN PDEVICE_OBJECT PhysicalDeviceObject, IN ULONG CategoriesCount, IN GUID const *Categories, IN PUNICODE_STRING ReferenceString, OUT PLIST_ENTRY SymbolicLinkList)
NTSTATUS KspSetFilterFactoriesState(IN PKSIDEVICE_HEADER DeviceHeader, IN BOOLEAN NewState)
NTSTATUS KspSetDeviceInterfacesState(IN PLIST_ENTRY ListHead, IN BOOL Enable)
NTSTATUS KspFreeDeviceInterfaces(IN PLIST_ENTRY ListHead)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define NonPagedPool
Definition: env_spec_w32.h:307
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSTATUS NTAPI IKsFilterFactory_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filterfactory.c:42
KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState(IN PKSFILTERFACTORY FilterFactory, IN BOOLEAN NewState)
Status
Definition: gdiplustypes.h:25
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
struct SYMBOLIC_LINK_ENTRY * PSYMBOLIC_LINK_ENTRY
#define ASSERT(a)
Definition: mode.c:44
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
const GUID Categories[]
Definition: splitter.c:208
Definition: kstypes.h:46
PKSOBJECT_CREATE_ITEM CreateItem
Definition: kstypes.h:48
base of all file and directory entries
Definition: entries.h:83
Definition: kstypes.h:122
LIST_ENTRY Entry
Definition: kstypes.h:123
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
CLSID DeviceInterfaceClass
Definition: kstypes.h:125
Definition: typedefs.h:120
#define IN
Definition: typedefs.h:39
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID _In_opt_ PCUNICODE_STRING ReferenceString
Definition: wdfdevice.h:3630
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList