ReactOS  0.4.14-dev-115-g4576127
deviceinterface.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for deviceinterface.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS KspSetDeviceInterfacesState (IN PLIST_ENTRY ListHead, IN BOOL Enable)
 
NTSTATUS KspFreeDeviceInterfaces (IN PLIST_ENTRY ListHead)
 
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)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 3 of file deviceinterface.c.

Function Documentation

◆ KspFreeDeviceInterfaces()

NTSTATUS KspFreeDeviceInterfaces ( IN PLIST_ENTRY  ListHead)

Definition at line 37 of file deviceinterface.c.

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 }
struct _Entry Entry
Definition: kefuncs.h:640
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
_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: kstypes.h:121
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
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
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
Definition: typedefs.h:117
struct SYMBOLIC_LINK_ENTRY * PSYMBOLIC_LINK_ENTRY
return STATUS_SUCCESS
Definition: btrfs.c:2966
base of all file and directory entries
Definition: entries.h:82

Referenced by IKsFilterFactory_fnRelease().

◆ KspRegisterDeviceInterfaces()

NTSTATUS KspRegisterDeviceInterfaces ( IN PDEVICE_OBJECT  PhysicalDeviceObject,
IN ULONG  CategoriesCount,
IN GUID const Categories,
IN PUNICODE_STRING  ReferenceString,
OUT PLIST_ENTRY  SymbolicLinkList 
)

Definition at line 61 of file deviceinterface.c.

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 }
#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
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
LIST_ENTRY Entry
Definition: kstypes.h:123
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
#define InsertTailList(ListHead, Entry)
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
const GUID Categories[]
Definition: splitter.c:208
_In_ CONST GUID _In_opt_ PUNICODE_STRING ReferenceString
Definition: iofuncs.h:1134
Definition: kstypes.h:121
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const UCHAR Index[8]
Definition: usbohci.c:18
CLSID DeviceInterfaceClass
Definition: kstypes.h:125
Status
Definition: gdiplustypes.h:24
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
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by IKsFilterFactory_fnInitialize().

◆ KspSetDeviceInterfacesState()

NTSTATUS KspSetDeviceInterfacesState ( IN PLIST_ENTRY  ListHead,
IN BOOL  Enable 
)

Definition at line 7 of file deviceinterface.c.

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 }
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
UNICODE_STRING SymbolicLink
Definition: kstypes.h:124
Definition: kstypes.h:121
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
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
Definition: typedefs.h:117
struct SYMBOLIC_LINK_ENTRY * PSYMBOLIC_LINK_ENTRY
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2966
base of all file and directory entries
Definition: entries.h:82

Referenced by IKsFilterFactory_fnRelease(), and IKsFilterFactory_fnSetDeviceClassesState().

◆ KspSetFilterFactoriesState()

NTSTATUS KspSetFilterFactoriesState ( IN PKSIDEVICE_HEADER  DeviceHeader,
IN BOOLEAN  NewState 
)

Definition at line 109 of file deviceinterface.c.

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 }
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
Definition: kstypes.h:45
PKSOBJECT_CREATE_ITEM CreateItem
Definition: kstypes.h:48
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
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState(IN PKSFILTERFACTORY FilterFactory, IN BOOLEAN NewState)
return STATUS_SUCCESS
Definition: btrfs.c:2966
base of all file and directory entries
Definition: entries.h:82

Referenced by IKsDevice_PnpPostStart(), and IKsDevice_PnpStartDevice().