xref: /reactos/drivers/ksfilter/ks/kstypes.h (revision 34593d93)
1 #pragma once
2 
3 typedef struct
4 {
5     KoCreateObjectHandler CreateObjectHandler;
6 }KO_DRIVER_EXTENSION, *PKO_DRIVER_EXTENSION;
7 
8 typedef struct
9 {
10     const KSDEVICE_DESCRIPTOR  *Descriptor;
11 }KS_DRIVER_EXTENSION, *PKS_DRIVER_EXTENSION;
12 
13 typedef struct
14 {
15     KSOBJECT_HEADER ObjectHeader;
16     KSOBJECT_CREATE_ITEM CreateItem;
17 }KO_OBJECT_HEADER, *PKO_OBJECT_HEADER;
18 
19 
20 typedef struct
21 {
22     KSDISPATCH_TABLE DispatchTable;
23     KSOBJECTTYPE Type;
24 
25     LONG ItemListCount;
26     LIST_ENTRY ItemList;
27 
28     UNICODE_STRING ObjectClass;
29     PUNKNOWN Unknown;
30     PVOID ObjectType;
31 
32     PDEVICE_OBJECT TargetDevice;
33     LIST_ENTRY TargetDeviceListEntry;
34 
35     PDEVICE_OBJECT ParentDeviceObject;
36 
37     PFNKSCONTEXT_DISPATCH PowerDispatch;
38     PVOID PowerContext;
39     LIST_ENTRY PowerDispatchEntry;
40     PKSOBJECT_CREATE_ITEM OriginalCreateItem;
41     ACCESS_MASK AccessMask;
42 
43 }KSIOBJECT_HEADER, *PKSIOBJECT_HEADER;
44 
45 typedef struct
46 {
47     LIST_ENTRY Entry;
48     PKSOBJECT_CREATE_ITEM CreateItem;
49     PFNKSITEMFREECALLBACK ItemFreeCallback;
50     LONG ReferenceCount;
51     LIST_ENTRY ObjectItemList;
52 }CREATE_ITEM_ENTRY, *PCREATE_ITEM_ENTRY;
53 
54 typedef struct
55 {
56     KSOBJECTTYPE Type;
57     PKSDEVICE KsDevice;
58     PRKMUTEX ControlMutex;
59     LIST_ENTRY EventList;
60     KSPIN_LOCK EventListLock;
61     PUNKNOWN ClientAggregate;
62     PUNKNOWN OuterUnknown;
63     union
64     {
65         PKSDEVICE KsDevice;
66         PKSFILTERFACTORY KsFilterFactory;
67         PKSFILTER KsFilter;
68     }Parent;
69 
70     union
71     {
72         PKSFILTERFACTORY FilterFactory;
73         PKSFILTER Filter;
74         PKSPIN Pin;
75     }Next;
76 
77     union
78     {
79         PKSFILTERFACTORY FilterFactory;
80         PKSFILTER Filter;
81     }FirstChild;
82 
83 }KSBASIC_HEADER, *PKSBASIC_HEADER;
84 
85 typedef struct
86 {
87     KSBASIC_HEADER BasicHeader;
88     KSDEVICE KsDevice;
89 
90     LONG ref;
91     ERESOURCE SecurityLock;
92 
93     LONG ItemListCount;
94     LIST_ENTRY ItemList;
95 
96     ULONG DeviceIndex;
97     PDEVICE_OBJECT PnpDeviceObject;
98     PDEVICE_OBJECT BaseDevice;
99 
100     KSTARGET_STATE TargetState;
101     LIST_ENTRY TargetDeviceList;
102 
103     KMUTEX DeviceMutex;
104     KMUTEX BagMutex;
105 
106     LIST_ENTRY PowerDispatchList;
107     LIST_ENTRY ObjectBags;
108 
109     PADAPTER_OBJECT AdapterObject;
110     ULONG MaxMappingsByteCount;
111     ULONG MappingTableStride;
112 
113 }KSIDEVICE_HEADER, *PKSIDEVICE_HEADER;
114 
115 typedef struct
116 {
117     PKSIDEVICE_HEADER DeviceHeader;
118 
119 }DEVICE_EXTENSION, *PDEVICE_EXTENSION;
120 
121 typedef struct
122 {
123     LIST_ENTRY Entry;
124     UNICODE_STRING SymbolicLink;
125     CLSID DeviceInterfaceClass;
126 }SYMBOLIC_LINK_ENTRY, *PSYMBOLIC_LINK_ENTRY;
127 
128 typedef struct
129 {
130     PKSIDEVICE_HEADER DeviceHeader;
131     PIO_WORKITEM WorkItem;
132 }PNP_POSTSTART_CONTEXT, *PPNP_POSTSTART_CONTEXT;
133 
134 typedef struct
135 {
136     PLIST_ENTRY List;
137     PFILE_OBJECT FileObject;
138     PKSEVENT_ENTRY EventEntry;
139     PIRP Irp;
140 }KSEVENT_CTX, *PKSEVENT_CTX;
141 
142 typedef BOOLEAN (NTAPI *PKSEVENT_SYNCHRONIZED_ROUTINE)(PKSEVENT_CTX Context);
143 
144 struct __BUS_ENUM_DEVICE_EXTENSION__;
145 struct __BUS_DEVICE_ENTRY__;
146 
147 typedef struct
148 {
149     LIST_ENTRY Entry;
150     ULONG IsBus;
151     union
152     {
153         PDEVICE_OBJECT DeviceObject;
154         ULONG DeviceReferenceCount;
155     };
156     union
157     {
158         struct __BUS_DEVICE_ENTRY__* DeviceEntry;
159         ULONG Dummy1;
160     };
161     struct __BUS_ENUM_DEVICE_EXTENSION__ *BusDeviceExtension;
162     ULONG DeviceObjectReferenceCount;
163 }COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
164 
165 typedef struct
166 {
167     PCOMMON_DEVICE_EXTENSION Ext;
168 }DEV_EXTENSION, *PDEV_EXTENSION;
169 
170 typedef struct
171 {
172     LIST_ENTRY Entry;
173     GUID InterfaceGuid;
174     UNICODE_STRING SymbolicLink;
175 }BUS_INSTANCE_ENTRY, *PBUS_INSTANCE_ENTRY;
176 
177 
178 
179 typedef enum
180 {
181     NotStarted = 0,         // Not started yet
182     Started,                // Device has received the START_DEVICE IRP
183     StopPending,            // Device has received the QUERY_STOP IRP
184     Stopped,                // Device has received the STOP_DEVICE IRP
185     RemovePending,          // Device has received the QUERY_REMOVE IRP
186     SurpriseRemovePending,  // Device has received the SURPRISE_REMOVE IRP
187     Deleted
188 }DEVICE_STATE;
189 
190 
191 typedef struct __BUS_DEVICE_ENTRY__
192 {
193     LIST_ENTRY Entry;
194     LIST_ENTRY DeviceInterfaceList;
195     LIST_ENTRY IrpPendingList;
196     PDEVICE_OBJECT PDO;
197     DEVICE_STATE DeviceState;
198     GUID DeviceGuid;
199     LPWSTR PDODeviceName;
200     LPWSTR DeviceName;
201     LPWSTR BusId;
202     LARGE_INTEGER TimeCreated;
203     LARGE_INTEGER TimeExpired;
204     LPWSTR Instance;
205 }BUS_DEVICE_ENTRY, *PBUS_DEVICE_ENTRY;
206 
207 typedef struct __BUS_ENUM_DEVICE_EXTENSION__
208 {
209     COMMON_DEVICE_EXTENSION Common;
210     KSPIN_LOCK Lock;
211     KEVENT Event;
212     UNICODE_STRING DeviceInterfaceLink;
213     PDEVICE_OBJECT PhysicalDeviceObject;
214     PDEVICE_OBJECT PnpDeviceObject;
215     PDEVICE_OBJECT BusDeviceObject;
216     ULONG PdoCreated;
217     KTIMER Timer;
218     KDPC Dpc;
219     WORK_QUEUE_ITEM WorkItem;
220     ULONG DeviceAttached;
221     UNICODE_STRING ServicePath;
222 
223     WCHAR BusIdentifier[1];
224 }BUS_ENUM_DEVICE_EXTENSION, *PBUS_ENUM_DEVICE_EXTENSION;
225 
226 typedef struct
227 {
228     PIRP Irp;
229     PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
230     KEVENT Event;
231     NTSTATUS Status;
232     WORK_QUEUE_ITEM WorkItem;
233 }BUS_INSTALL_ENUM_CONTEXT, *PBUS_INSTALL_ENUM_CONTEXT;
234 
235 typedef struct
236 {
237     PUCHAR FilterData;
238     ULONG FilterLength;
239     ULONG FilterOffset;
240 
241     PUCHAR DataCache;
242     ULONG DataLength;
243     ULONG DataOffset;
244 
245 }KSPCACHE_DESCRIPTOR, *PKSPCACHE_DESCRIPTOR;
246 
247 typedef struct
248 {
249     DWORD dwVersion;
250     DWORD dwMerit;
251     DWORD dwPins;
252     DWORD dwUnused;
253 }KSPCACHE_FILTER_HEADER, *PKSPCACHE_FILTER_HEADER;
254 
255 typedef struct
256 {
257     ULONG Signature;
258     ULONG Flags;
259     ULONG Instances;
260     ULONG MediaTypes;
261     ULONG Mediums;
262     DWORD Category;
263 }KSPCACHE_PIN_HEADER, *PKSPCACHE_PIN_HEADER;
264 
265 
266 typedef struct
267 {
268     ULONG Signature;
269     ULONG dwUnused;
270     ULONG OffsetMajor;
271     ULONG OffsetMinor;
272 }KSPCACHE_DATARANGE, *PKSPCACHE_DATARANGE;
273 
274 
275 typedef struct
276 {
277     CLSID Medium;
278     ULONG dw1;
279     ULONG dw2;
280 }KSPCACHE_MEDIUM;
281 
282