[SDK]
[reactos.git] / reactos / sdk / include / psdk / ks.h
1 /*
2 ReactOS
3 Kernel Streaming API
4
5 by Andrew Greenwood
6
7 NOTES:
8 This is a basic stubbing of the Kernel Streaming API header. It is
9 very incomplete - a lot of the #defines are not set to any value at all.
10
11 Some of the structs/funcs may be incorrectly grouped.
12
13 GUIDs need to be defined properly.
14
15 AVStream functionality (XP and above, DirectX 8.0 and above) will NOT
16 implemented for a while.
17
18 Some example code for interaction from usermode:
19 DeviceIoControl(
20 FilterHandle,
21 IOCTL_KS_PROPERTY,
22 &Property,
23 sizeof(KSPROPERTY),
24 &SeekingCapabilities,
25 sizeof(KS_SEEKING_CAPABILITIES),
26 &BytesReturned,
27 &Overlapped);
28 */
29
30 #ifndef _KS_
31 #define _KS_
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #ifdef BUILDING_KS
38 #define KSDDKAPI
39 #else
40 #define KSDDKAPI //DECLSPEC_IMPORT /* TODO */
41 #endif
42
43
44 #define KSFILTER_NODE ((ULONG)-1)
45 #define KSALL_NODES ((ULONG)-1)
46
47 #define KSSTRING_Filter L"{9B365890-165F-11D0-A195-0020AFD156E4}"
48 #define KSSTRING_Pin L"{146F1A80-4791-11D0-A5D6-28DB04C10000}"
49 #define KSSTRING_Clock L"{53172480-4791-11D0-A5D6-28DB04C10000}"
50 #define KSSTRING_Allocator L"{642F5D00-4791-11D0-A5D6-28DB04C10000}"
51 #define KSSTRING_AllocatorEx L"{091BB63B-603F-11D1-B067-00A0C9062802}"
52 #define KSSTRING_TopologyNode L"{0621061A-EE75-11D0-B915-00A0C9223196}"
53
54 #define KSDATAFORMAT_BIT_ATTRIBUTES 1
55 #define KSDATAFORMAT_ATTRIBUTES (1 << KSDATAFORMAT_BIT_ATTRIBUTES)
56
57 #if defined(_NTDDK_)
58 typedef PVOID PKSWORKER;
59 #endif
60
61 #ifndef SIZEOF_ARRAY
62 #define SIZEOF_ARRAY(a) (sizeof(a)/sizeof((a)[0]))
63 #endif
64
65 /* ===============================================================
66 GUID definition helpers
67 */
68
69 #ifndef _NTRTL_
70
71 #ifndef DEFINE_GUIDEX
72 #ifdef _MSC_VER
73 #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
74 #else
75 #define DEFINE_GUIDEX(name) EXTERN_C const GUID name
76 #endif
77 #endif /* !DEFINE_GUIDEX */
78
79 #ifndef STATICGUIDOF
80 #define STATICGUIDOF(guid) STATIC_##guid
81 #endif
82
83 #endif /* !_NTRTL_ */
84
85 #if defined(__cplusplus)
86
87 #if _MSC_VER >= 1100
88 #define DEFINE_GUIDSTRUCT(guid, name) struct __declspec(uuid(guid)) name
89 #define DEFINE_GUIDNAMED(name) __uuidof(struct name)
90 #else
91 #define DEFINE_GUIDSTRUCT(guid, name) \
92 extern const DECLSPEC_SELECTANY GUID __uuid__##name={STATIC_##name};
93 #define DEFINE_GUIDNAMED(name) __uuid__##name
94 #endif
95
96 #else /* __cplusplus */
97
98 #define DEFINE_GUIDSTRUCT(guid, name) DEFINE_GUIDEX(name)
99 #define DEFINE_GUIDNAMED(name) name
100
101 #endif /* __cplusplus */
102
103 #define STATIC_GUID_NULL \
104 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
105 DEFINE_GUIDSTRUCT("00000000-0000-0000-0000-000000000000", GUID_NULL);
106 #define GUID_NULL DEFINE_GUIDNAMED(GUID_NULL)
107
108 #define STATIC_KSNAME_Filter\
109 0x9b365890L, 0x165f, 0x11d0, {0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}
110 DEFINE_GUIDSTRUCT("9b365890-165f-11d0-a195-0020afd156e4", KSNAME_Filter);
111 #define KSNAME_Filter DEFINE_GUIDNAMED(KSNAME_Filter)
112
113 #define STATIC_KSMEMORY_TYPE_KERNEL_PAGED \
114 0xd833f8f8L, 0x7894, 0x11d1, {0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02}
115 DEFINE_GUIDSTRUCT("d833f8f8-7894-11d1-b069-00a0c9062802", KSMEMORY_TYPE_KERNEL_PAGED);
116 #define KSMEMORY_TYPE_KERNEL_PAGED DEFINE_GUIDNAMED(KSMEMORY_TYPE_KERNEL_PAGED)
117
118 #define STATIC_KSDATAFORMAT_SUBTYPE_NONE \
119 0xe436eb8eL, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
120 DEFINE_GUIDSTRUCT("e436eb8e-524f-11ce-9f53-0020af0ba770", KSDATAFORMAT_SUBTYPE_NONE);
121 #define KSDATAFORMAT_SUBTYPE_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_NONE)
122
123 /* ===============================================================
124 I/O Control Codes
125 */
126
127 #define IOCTL_KS_DISABLE_EVENT \
128 CTL_CODE( \
129 FILE_DEVICE_KS, \
130 0x000, \
131 METHOD_NEITHER, \
132 FILE_ANY_ACCESS)
133
134 #define IOCTL_KS_ENABLE_EVENT \
135 CTL_CODE( \
136 FILE_DEVICE_KS, \
137 0x001, \
138 METHOD_NEITHER, \
139 FILE_ANY_ACCESS)
140
141 // WAS 2
142 #define IOCTL_KS_METHOD \
143 CTL_CODE( \
144 FILE_DEVICE_KS, \
145 0x003, \
146 METHOD_NEITHER, \
147 FILE_ANY_ACCESS)
148
149 // WAS 3
150 #define IOCTL_KS_PROPERTY \
151 CTL_CODE( \
152 FILE_DEVICE_KS, \
153 0x000, \
154 METHOD_NEITHER, \
155 FILE_ANY_ACCESS)
156
157 #define IOCTL_KS_WRITE_STREAM \
158 CTL_CODE( \
159 FILE_DEVICE_KS, \
160 0x004, \
161 METHOD_NEITHER, \
162 FILE_WRITE_ACCESS)
163
164 #define IOCTL_KS_READ_STREAM \
165 CTL_CODE( \
166 FILE_DEVICE_KS, \
167 0x005, \
168 METHOD_NEITHER, \
169 FILE_READ_ACCESS)
170
171 #define IOCTL_KS_RESET_STATE \
172 CTL_CODE( \
173 FILE_DEVICE_KS, \
174 0x006, \
175 METHOD_NEITHER, \
176 FILE_ANY_ACCESS)
177
178 /* ===============================================================
179 Categories
180 */
181
182 #define STATIC_KSCATEGORY_BRIDGE \
183 0x085AFF00L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
184 DEFINE_GUIDSTRUCT("085AFF00-62CE-11CF-A5D6-28DB04C10000", KSCATEGORY_BRIDGE);
185 #define KSCATEGORY_BRIDGE DEFINE_GUIDNAMED(KSCATEGORY_BRIDGE)
186
187 #define STATIC_KSCATEGORY_CAPTURE \
188 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
189 DEFINE_GUIDSTRUCT("65E8773D-8F56-11D0-A3B9-00A0C9223196", KSCATEGORY_CAPTURE);
190 #define KSCATEGORY_CAPTURE DEFINE_GUIDNAMED(KSCATEGORY_CAPTURE)
191
192 #define STATIC_KSCATEGORY_RENDER \
193 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
194 DEFINE_GUIDSTRUCT("65E8773E-8F56-11D0-A3B9-00A0C9223196", KSCATEGORY_RENDER);
195 #define KSCATEGORY_RENDER DEFINE_GUIDNAMED(KSCATEGORY_RENDER)
196
197 #define STATIC_KSCATEGORY_MIXER \
198 0xAD809C00L, 0x7B88, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
199 DEFINE_GUIDSTRUCT("AD809C00-7B88-11D0-A5D6-28DB04C10000", KSCATEGORY_MIXER);
200 #define KSCATEGORY_MIXER DEFINE_GUIDNAMED(KSCATEGORY_MIXER)
201
202 #define STATIC_KSCATEGORY_SPLITTER \
203 0x0A4252A0L, 0x7E70, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
204 DEFINE_GUIDSTRUCT("0A4252A0-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_SPLITTER);
205 #define KSCATEGORY_SPLITTER DEFINE_GUIDNAMED(KSCATEGORY_SPLITTER)
206
207 #define STATIC_KSCATEGORY_DATACOMPRESSOR \
208 0x1E84C900L, 0x7E70, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
209 DEFINE_GUIDSTRUCT("1E84C900-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATACOMPRESSOR);
210 #define KSCATEGORY_DATACOMPRESSOR DEFINE_GUIDNAMED(KSCATEGORY_DATACOMPRESSOR)
211
212 #define STATIC_KSCATEGORY_DATADECOMPRESSOR \
213 0x2721AE20L, 0x7E70, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
214 DEFINE_GUIDSTRUCT("2721AE20-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATADECOMPRESSOR);
215 #define KSCATEGORY_DATADECOMPRESSOR DEFINE_GUIDNAMED(KSCATEGORY_DATADECOMPRESSOR)
216
217 #define STATIC_KSCATEGORY_DATATRANSFORM \
218 0x2EB07EA0L, 0x7E70, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
219 DEFINE_GUIDSTRUCT("2EB07EA0-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATATRANSFORM);
220 #define KSCATEGORY_DATATRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_DATATRANSFORM)
221
222 #define STATIC_KSCATEGORY_COMMUNICATIONSTRANSFORM \
223 0xCF1DDA2CL, 0x9743, 0x11D0, {0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
224 DEFINE_GUIDSTRUCT("CF1DDA2C-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_COMMUNICATIONSTRANSFORM);
225 #define KSCATEGORY_COMMUNICATIONSTRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_COMMUNICATIONSTRANSFORM)
226
227 #define STATIC_KSCATEGORY_INTERFACETRANSFORM \
228 0xCF1DDA2DL, 0x9743, 0x11D0, {0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
229 DEFINE_GUIDSTRUCT("CF1DDA2D-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_INTERFACETRANSFORM);
230 #define KSCATEGORY_INTERFACETRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_INTERFACETRANSFORM)
231
232 #define STATIC_KSCATEGORY_MEDIUMTRANSFORM \
233 0xCF1DDA2EL, 0x9743, 0x11D0, {0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
234 DEFINE_GUIDSTRUCT("CF1DDA2E-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_MEDIUMTRANSFORM);
235 #define KSCATEGORY_MEDIUMTRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_MEDIUMTRANSFORM)
236
237 #define STATIC_KSCATEGORY_FILESYSTEM \
238 0x760FED5EL, 0x9357, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
239 DEFINE_GUIDSTRUCT("760FED5E-9357-11D0-A3CC-00A0C9223196", KSCATEGORY_FILESYSTEM);
240 #define KSCATEGORY_FILESYSTEM DEFINE_GUIDNAMED(KSCATEGORY_FILESYSTEM)
241
242 #define STATIC_KSCATEGORY_CLOCK \
243 0x53172480L, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
244 DEFINE_GUIDSTRUCT("53172480-4791-11D0-A5D6-28DB04C10000", KSCATEGORY_CLOCK);
245 #define KSCATEGORY_CLOCK DEFINE_GUIDNAMED(KSCATEGORY_CLOCK)
246
247 #define STATIC_KSCATEGORY_PROXY \
248 0x97EBAACAL, 0x95BD, 0x11D0, {0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
249 DEFINE_GUIDSTRUCT("97EBAACA-95BD-11D0-A3EA-00A0C9223196", KSCATEGORY_PROXY);
250 #define KSCATEGORY_PROXY DEFINE_GUIDNAMED(KSCATEGORY_PROXY)
251
252 #define STATIC_KSCATEGORY_QUALITY \
253 0x97EBAACBL, 0x95BD, 0x11D0, {0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
254 DEFINE_GUIDSTRUCT("97EBAACB-95BD-11D0-A3EA-00A0C9223196", KSCATEGORY_QUALITY);
255 #define KSCATEGORY_QUALITY DEFINE_GUIDNAMED(KSCATEGORY_QUALITY)
256
257 /* ===============================================================
258 Common
259 */
260
261 typedef struct {
262 GUID Set;
263 ULONG Id;
264 ULONG Flags;
265 } KSIDENTIFIER, *PKSIDENTIFIER;
266
267 typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY;
268 typedef KSIDENTIFIER KSMETHOD, *PKSMETHOD;
269 typedef KSIDENTIFIER KSEVENT, *PKSEVENT;
270
271 typedef KSIDENTIFIER KSDEGRADE, *PKSDEGRADE;
272
273 typedef KSIDENTIFIER KSPIN_INTERFACE, *PKSPIN_INTERFACE;
274 typedef KSIDENTIFIER KSPIN_MEDIUM, *PKSPIN_MEDIUM;
275
276 typedef union {
277 struct {
278 ULONG FormatSize;
279 ULONG Flags;
280 ULONG SampleSize;
281 ULONG Reserved;
282 GUID MajorFormat;
283 GUID SubFormat;
284 GUID Specifier;
285 };
286 LONGLONG Alignment;
287 } KSDATAFORMAT, *PKSDATAFORMAT, KSDATARANGE, *PKSDATARANGE;
288
289 typedef struct {
290 ULONG Size;
291 ULONG Flags;
292 GUID Attribute;
293 } KSATTRIBUTE, *PKSATTRIBUTE;
294
295
296 /* ===============================================================
297 Interface Sets - TODO
298 */
299
300 #if 0
301 #define KSINTERFACESETID_Media
302 #define KSINTERFACE_STANDARD_STREAMING
303 #define KSINTERFACE_STANDARD_LOOPED_STREAMING
304 #define KSINTERFACE_STANDARD_CONTROL
305 #endif
306
307 #define STATIC_KSINTERFACESETID_Standard \
308 0x1A8766A0L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
309 DEFINE_GUIDSTRUCT("1A8766A0-62CE-11CF-A5D6-28DB04C10000", KSINTERFACESETID_Standard);
310 #define KSINTERFACESETID_Standard DEFINE_GUIDNAMED(KSINTERFACESETID_Standard)
311
312 typedef enum {
313 KSINTERFACE_STANDARD_STREAMING,
314 KSINTERFACE_STANDARD_LOOPED_STREAMING,
315 KSINTERFACE_STANDARD_CONTROL
316 } KSINTERFACE_STANDARD;
317
318 #define STATIC_KSINTERFACESETID_FileIo \
319 0x8C6F932CL, 0xE771, 0x11D0, {0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
320 DEFINE_GUIDSTRUCT("8C6F932C-E771-11D0-B8FF-00A0C9223196", KSINTERFACESETID_FileIo);
321 #define KSINTERFACESETID_FileIo DEFINE_GUIDNAMED(KSINTERFACESETID_FileIo)
322
323 /* ===============================================================
324 Mediums
325 */
326
327 typedef enum {
328 KSINTERFACE_FILEIO_STREAMING
329 } KSINTERFACE_FILEIO;
330
331 #define KSMEDIUM_TYPE_ANYINSTANCE 0
332
333 #define STATIC_KSMEDIUMSETID_Standard \
334 0x4747B320L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
335 DEFINE_GUIDSTRUCT("4747B320-62CE-11CF-A5D6-28DB04C10000", KSMEDIUMSETID_Standard);
336 #define KSMEDIUMSETID_Standard DEFINE_GUIDNAMED(KSMEDIUMSETID_Standard)
337
338 /* ===============================================================
339 Clock Properties/Methods/Events
340 */
341
342 #define STATIC_KSPROPSETID_Clock \
343 0xDF12A4C0L, 0xAC17, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
344 DEFINE_GUIDSTRUCT("DF12A4C0-AC17-11CF-A5D6-28DB04C10000", KSPROPSETID_Clock);
345 #define KSPROPSETID_Clock DEFINE_GUIDNAMED(KSPROPSETID_Clock)
346
347 typedef enum {
348 KSPROPERTY_CLOCK_TIME,
349 KSPROPERTY_CLOCK_PHYSICALTIME,
350 KSPROPERTY_CLOCK_CORRELATEDTIME,
351 KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME,
352 KSPROPERTY_CLOCK_RESOLUTION,
353 KSPROPERTY_CLOCK_STATE,
354 #if defined(_NTDDK_)
355 KSPROPERTY_CLOCK_FUNCTIONTABLE
356 #endif // defined(_NTDDK_)
357 } KSPROPERTY_CLOCK;
358
359 #define STATIC_KSEVENTSETID_Clock \
360 0x364D8E20L, 0x62C7, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
361 DEFINE_GUIDSTRUCT("364D8E20-62C7-11CF-A5D6-28DB04C10000", KSEVENTSETID_Clock);
362 #define KSEVENTSETID_Clock DEFINE_GUIDNAMED(KSEVENTSETID_Clock)
363
364 typedef enum {
365 KSEVENT_CLOCK_INTERVAL_MARK,
366 KSEVENT_CLOCK_POSITION_MARK
367 } KSEVENT_CLOCK_POSITION;
368
369 /* ===============================================================
370 Connection Properties/Methods/Events
371 */
372
373 #define STATIC_KSPROPSETID_Connection \
374 0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
375 DEFINE_GUIDSTRUCT("1D58C920-AC9B-11CF-A5D6-28DB04C10000", KSPROPSETID_Connection);
376 #define KSPROPSETID_Connection DEFINE_GUIDNAMED(KSPROPSETID_Connection)
377
378 typedef enum {
379 KSPROPERTY_CONNECTION_STATE,
380 KSPROPERTY_CONNECTION_PRIORITY,
381 KSPROPERTY_CONNECTION_DATAFORMAT,
382 KSPROPERTY_CONNECTION_ALLOCATORFRAMING,
383 KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT,
384 KSPROPERTY_CONNECTION_ACQUIREORDERING,
385 KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX,
386 KSPROPERTY_CONNECTION_STARTAT
387 } KSPROPERTY_CONNECTION;
388
389 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(GetHandler, SetHandler)\
390 DEFINE_KSPROPERTY_ITEM(\
391 KSPROPERTY_CONNECTION_STATE,\
392 (GetHandler),\
393 sizeof(KSPROPERTY),\
394 sizeof(KSSTATE),\
395 (SetHandler),\
396 NULL, 0, NULL, NULL, 0)
397
398 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_PRIORITY(GetHandler, SetHandler)\
399 DEFINE_KSPROPERTY_ITEM(\
400 KSPROPERTY_CONNECTION_PRIORITY,\
401 (GetHandler),\
402 sizeof(KSPROPERTY),\
403 sizeof(KSPRIORITY),\
404 (SetHandler),\
405 NULL, 0, NULL, NULL, 0)
406
407 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_DATAFORMAT(GetHandler, SetHandler)\
408 DEFINE_KSPROPERTY_ITEM(\
409 KSPROPERTY_CONNECTION_DATAFORMAT,\
410 (GetHandler),\
411 sizeof(KSPROPERTY),\
412 0,\
413 (SetHandler),\
414 NULL, 0, NULL, NULL, 0)
415
416 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING(Handler)\
417 DEFINE_KSPROPERTY_ITEM(\
418 KSPROPERTY_CONNECTION_ALLOCATORFRAMING,\
419 (Handler),\
420 sizeof(KSPROPERTY),\
421 sizeof(KSALLOCATOR_FRAMING),\
422 NULL, NULL, 0, NULL, NULL, 0)
423
424 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING_EX(Handler)\
425 DEFINE_KSPROPERTY_ITEM(\
426 KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX,\
427 (Handler),\
428 sizeof(KSPROPERTY),\
429 0,\
430 NULL, NULL, 0, NULL, NULL, 0)
431
432 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_PROPOSEDATAFORMAT(Handler)\
433 DEFINE_KSPROPERTY_ITEM(\
434 KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT,\
435 NULL,\
436 sizeof(KSPROPERTY),\
437 sizeof(KSDATAFORMAT),\
438 (Handler),\
439 NULL, 0, NULL, NULL, 0)
440
441 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ACQUIREORDERING(Handler)\
442 DEFINE_KSPROPERTY_ITEM(\
443 KSPROPERTY_CONNECTION_ACQUIREORDERING,\
444 (Handler),\
445 sizeof(KSPROPERTY),\
446 sizeof(int),\
447 NULL, NULL, 0, NULL, NULL, 0)
448
449 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STARTAT(Handler)\
450 DEFINE_KSPROPERTY_ITEM(\
451 KSPROPERTY_CONNECTION_STARTAT,\
452 NULL,\
453 sizeof(KSPROPERTY),\
454 sizeof(KSRELATIVEEVENT),\
455 (Handler),\
456 NULL, 0, NULL, NULL, 0)
457
458 typedef enum {
459 KSEVENT_CONNECTION_POSITIONUPDATE,
460 KSEVENT_CONNECTION_DATADISCONTINUITY,
461 KSEVENT_CONNECTION_TIMEDISCONTINUITY,
462 KSEVENT_CONNECTION_PRIORITY,
463 KSEVENT_CONNECTION_ENDOFSTREAM
464 } KSEVENT_CONNECTION;
465
466 /* ===============================================================
467 General
468 Properties/Methods/Events
469 */
470
471 #define STATIC_KSPROPSETID_General\
472 0x1464EDA5L, 0x6A8F, 0x11D1, {0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
473 DEFINE_GUIDSTRUCT("1464EDA5-6A8F-11D1-9AA7-00A0C9223196", KSPROPSETID_General);
474 #define KSPROPSETID_General DEFINE_GUIDNAMED(KSPROPSETID_General)
475
476 typedef enum {
477 KSPROPERTY_GENERAL_COMPONENTID
478 } KSPROPERTY_GENERAL;
479
480 /* ===============================================================
481 Graph Manager
482 Properties/Methods/Events
483 */
484
485 #define KSPROPSETID_GM \
486 0xAF627536L, 0xE719, 0x11D2, {0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D}
487
488 typedef enum {
489 KSPROPERTY_GM_GRAPHMANAGER,
490 KSPROPERTY_GM_TIMESTAMP_CLOCK,
491 KSPROPERTY_GM_RATEMATCH,
492 KSPROPERTY_GM_RENDERCLOCK
493 } KSPROPERTY_GM;
494
495 /* ===============================================================
496 Media Seeking
497 Properties/Methods/Events
498 */
499
500 #define STATIC_KSPROPSETID_MediaSeeking\
501 0xEE904F0CL, 0xD09B, 0x11D0, {0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
502 DEFINE_GUIDSTRUCT("EE904F0C-D09B-11D0-ABE9-00A0C9223196", KSPROPSETID_MediaSeeking);
503 #define KSPROPSETID_MediaSeeking DEFINE_GUIDNAMED(KSPROPSETID_MediaSeeking)
504
505 typedef enum {
506 KSPROPERTY_MEDIASEEKING_CAPABILITIES,
507 KSPROPERTY_MEDIASEEKING_FORMATS,
508 KSPROPERTY_MEDIASEEKING_TIMEFORMAT,
509 KSPROPERTY_MEDIASEEKING_POSITION,
510 KSPROPERTY_MEDIASEEKING_STOPPOSITION,
511 KSPROPERTY_MEDIASEEKING_POSITIONS,
512 KSPROPERTY_MEDIASEEKING_DURATION,
513 KSPROPERTY_MEDIASEEKING_AVAILABLE,
514 KSPROPERTY_MEDIASEEKING_PREROLL,
515 KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT
516 } KSPROPERTY_MEDIASEEKING;
517
518 typedef enum {
519 KS_SEEKING_NoPositioning,
520 KS_SEEKING_AbsolutePositioning,
521 KS_SEEKING_RelativePositioning,
522 KS_SEEKING_IncrementalPositioning,
523 KS_SEEKING_PositioningBitsMask = 0x3,
524 KS_SEEKING_SeekToKeyFrame,
525 KS_SEEKING_ReturnTime = 0x8
526 } KS_SEEKING_FLAGS;
527
528 typedef enum {
529 KS_SEEKING_CanSeekAbsolute = 0x1,
530 KS_SEEKING_CanSeekForwards = 0x2,
531 KS_SEEKING_CanSeekBackwards = 0x4,
532 KS_SEEKING_CanGetCurrentPos = 0x8,
533 KS_SEEKING_CanGetStopPos = 0x10,
534 KS_SEEKING_CanGetDuration = 0x20,
535 KS_SEEKING_CanPlayBackwards = 0x40
536 } KS_SEEKING_CAPABILITIES;
537
538 typedef struct {
539 LONGLONG Current;
540 LONGLONG Stop;
541 KS_SEEKING_FLAGS CurrentFlags;
542 KS_SEEKING_FLAGS StopFlags;
543 } KSPROPERTY_POSITIONS, *PKSPROPERTY_POSITIONS;
544
545 typedef struct {
546 LONGLONG Earliest;
547 LONGLONG Latest;
548 } KSPROPERTY_MEDIAAVAILABLE, *PKSPROPERTY_MEDIAAVAILABLE;
549
550 typedef struct {
551 KSPROPERTY Property;
552 GUID SourceFormat;
553 GUID TargetFormat;
554 LONGLONG Time;
555 } KSP_TIMEFORMAT, *PKSP_TIMEFORMAT;
556
557 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CAPABILITIES(Handler)\
558 DEFINE_KSPROPERTY_ITEM(\
559 KSPROPERTY_MEDIASEEKING_CAPABILITIES,\
560 (Handler),\
561 sizeof(KSPROPERTY),\
562 sizeof(KS_SEEKING_CAPABILITIES),\
563 NULL, NULL, 0, NULL, NULL, 0)
564
565 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_FORMATS(Handler)\
566 DEFINE_KSPROPERTY_ITEM(\
567 KSPROPERTY_MEDIASEEKING_FORMATS,\
568 (Handler),\
569 sizeof(KSPROPERTY),\
570 0,\
571 NULL, NULL, 0, NULL, NULL, 0)
572
573 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_TIMEFORMAT(GetHandler, SetHandler)\
574 DEFINE_KSPROPERTY_ITEM(\
575 KSPROPERTY_MEDIASEEKING_TIMEFORMAT,\
576 (GetHandler),\
577 sizeof(KSPROPERTY),\
578 sizeof(GUID),\
579 (SetHandler),\
580 NULL, 0, NULL, NULL, 0)
581
582 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_POSITION(Handler)\
583 DEFINE_KSPROPERTY_ITEM(\
584 KSPROPERTY_MEDIASEEKING_POSITION,\
585 (Handler),\
586 sizeof(KSPROPERTY),\
587 sizeof(LONGLONG),\
588 NULL, NULL, 0, NULL, NULL, 0)
589
590 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_STOPPOSITION(Handler)\
591 DEFINE_KSPROPERTY_ITEM(\
592 KSPROPERTY_MEDIASEEKING_STOPPOSITION,\
593 (Handler),\
594 sizeof(KSPROPERTY),\
595 sizeof(LONGLONG),\
596 NULL, NULL, 0, NULL, NULL, 0)
597
598 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_POSITIONS(Handler)\
599 DEFINE_KSPROPERTY_ITEM(\
600 KSPROPERTY_MEDIASEEKING_POSITIONS,\
601 NULL,\
602 sizeof(KSPROPERTY),\
603 sizeof(KSPROPERTY_POSITIONS),\
604 (Handler),\
605 NULL, 0, NULL, NULL, 0)
606
607 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_DURATION(Handler)\
608 DEFINE_KSPROPERTY_ITEM(\
609 KSPROPERTY_MEDIASEEKING_DURATION,\
610 (Handler),\
611 sizeof(KSPROPERTY),\
612 sizeof(LONGLONG),\
613 NULL, NULL, 0, NULL, NULL, 0)
614
615 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_AVAILABLE(Handler)\
616 DEFINE_KSPROPERTY_ITEM(\
617 KSPROPERTY_MEDIASEEKING_AVAILABLE,\
618 (Handler),\
619 sizeof(KSPROPERTY),\
620 sizeof(KSPROPERTY_MEDIAAVAILABLE),\
621 NULL, NULL, 0, NULL, NULL, 0)
622
623 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_PREROLL(Handler)\
624 DEFINE_KSPROPERTY_ITEM(\
625 KSPROPERTY_MEDIASEEKING_PREROLL,\
626 (Handler),\
627 sizeof(KSPROPERTY),\
628 sizeof(LONGLONG),\
629 NULL, NULL, 0, NULL, NULL, 0)
630
631 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CONVERTTIMEFORMAT(Handler)\
632 DEFINE_KSPROPERTY_ITEM(\
633 KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT,\
634 (Handler),\
635 sizeof(KSP_TIMEFORMAT),\
636 sizeof(LONGLONG),\
637 NULL, NULL, 0, NULL, NULL, 0)
638
639 /* ===============================================================
640 Pin
641 Properties/Methods/Events
642 */
643
644 #define STATIC_KSPROPSETID_Pin\
645 0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}
646 DEFINE_GUIDSTRUCT("8C134960-51AD-11CF-878A-94F801C10000", KSPROPSETID_Pin);
647 #define KSPROPSETID_Pin DEFINE_GUIDNAMED(KSPROPSETID_Pin)
648
649 #define STATIC_KSNAME_Pin\
650 0x146F1A80L, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
651 DEFINE_GUIDSTRUCT("146F1A80-4791-11D0-A5D6-28DB04C10000", KSNAME_Pin);
652 #define KSNAME_Pin DEFINE_GUIDNAMED(KSNAME_Pin)
653
654 typedef enum {
655 KSPROPERTY_PIN_CINSTANCES,
656 KSPROPERTY_PIN_CTYPES,
657 KSPROPERTY_PIN_DATAFLOW,
658 KSPROPERTY_PIN_DATARANGES,
659 KSPROPERTY_PIN_DATAINTERSECTION,
660 KSPROPERTY_PIN_INTERFACES,
661 KSPROPERTY_PIN_MEDIUMS,
662 KSPROPERTY_PIN_COMMUNICATION,
663 KSPROPERTY_PIN_GLOBALCINSTANCES,
664 KSPROPERTY_PIN_NECESSARYINSTANCES,
665 KSPROPERTY_PIN_PHYSICALCONNECTION,
666 KSPROPERTY_PIN_CATEGORY,
667 KSPROPERTY_PIN_NAME,
668 KSPROPERTY_PIN_CONSTRAINEDDATARANGES,
669 KSPROPERTY_PIN_PROPOSEDATAFORMAT
670 } KSPROPERTY_PIN;
671
672 typedef struct {
673 KSPROPERTY Property;
674 ULONG PinId;
675 ULONG Reserved;
676 } KSP_PIN, *PKSP_PIN;
677
678 #define KSINSTANCE_INDETERMINATE ((ULONG)-1)
679
680 typedef struct {
681 ULONG PossibleCount;
682 ULONG CurrentCount;
683 } KSPIN_CINSTANCES, *PKSPIN_CINSTANCES;
684
685 typedef struct {
686 ULONG Size;
687 ULONG Pin;
688 WCHAR SymbolicLinkName[1];
689 } KSPIN_PHYSICALCONNECTION, *PKSPIN_PHYSICALCONNECTION;
690
691 /* ===============================================================
692 Quality
693 Properties/Methods/Events
694 */
695
696 #define KSPROPSETID_Quality \
697 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
698
699 typedef enum {
700 KSPROPERTY_QUALITY_REPORT,
701 KSPROPERTY_QUALITY_ERROR
702 } KSPROPERTY_QUALITY;
703
704 /* ===============================================================
705 Stream
706 Properties/Methods/Events
707 */
708
709 #define STATIC_KSPROPSETID_Stream\
710 0x65aaba60L, 0x98ae, 0x11cf, {0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}
711 DEFINE_GUIDSTRUCT("65aaba60-98ae-11cf-a10d-0020afd156e4", KSPROPSETID_Stream);
712 #define KSPROPSETID_Stream DEFINE_GUIDNAMED(KSPROPSETID_Stream)
713
714 typedef enum {
715 KSPROPERTY_STREAM_ALLOCATOR,
716 KSPROPERTY_STREAM_QUALITY,
717 KSPROPERTY_STREAM_DEGRADATION,
718 KSPROPERTY_STREAM_MASTERCLOCK,
719 KSPROPERTY_STREAM_TIMEFORMAT,
720 KSPROPERTY_STREAM_PRESENTATIONTIME,
721 KSPROPERTY_STREAM_PRESENTATIONEXTENT,
722 KSPROPERTY_STREAM_FRAMETIME,
723 KSPROPERTY_STREAM_RATECAPABILITY,
724 KSPROPERTY_STREAM_RATE,
725 KSPROPERTY_STREAM_PIPE_ID
726 } KSPROPERTY_STREAM;
727
728 #define DEFINE_KSPROPERTY_ITEM_STREAM_ALLOCATOR(GetHandler, SetHandler)\
729 DEFINE_KSPROPERTY_ITEM(\
730 KSPROPERTY_STREAM_ALLOCATOR,\
731 (GetHandler),\
732 sizeof(KSPROPERTY),\
733 sizeof(HANDLE),\
734 (SetHandler),\
735 NULL, 0, NULL, NULL, 0)
736
737 #define DEFINE_KSPROPERTY_ITEM_STREAM_QUALITY(Handler)\
738 DEFINE_KSPROPERTY_ITEM(\
739 KSPROPERTY_STREAM_QUALITY,\
740 (Handler),\
741 sizeof(KSPROPERTY),\
742 sizeof(KSQUALITY_MANAGER),\
743 NULL, NULL, 0, NULL, NULL, 0)
744
745 #define DEFINE_KSPROPERTY_ITEM_STREAM_DEGRADATION(GetHandler, SetHandler)\
746 DEFINE_KSPROPERTY_ITEM(\
747 KSPROPERTY_STREAM_DEGRADATION,\
748 (GetHandler),\
749 sizeof(KSPROPERTY),\
750 0,\
751 (SetHandler),\
752 NULL, 0, NULL, NULL, 0)
753
754 #define DEFINE_KSPROPERTY_ITEM_STREAM_MASTERCLOCK(GetHandler, SetHandler)\
755 DEFINE_KSPROPERTY_ITEM(\
756 KSPROPERTY_STREAM_MASTERCLOCK,\
757 (GetHandler),\
758 sizeof(KSPROPERTY),\
759 sizeof(HANDLE),\
760 (SetHandler),\
761 NULL, 0, NULL, NULL, 0)
762
763 #define DEFINE_KSPROPERTY_ITEM_STREAM_TIMEFORMAT(Handler)\
764 DEFINE_KSPROPERTY_ITEM(\
765 KSPROPERTY_STREAM_TIMEFORMAT,\
766 (Handler),\
767 sizeof(KSPROPERTY),\
768 sizeof(GUID),\
769 NULL, NULL, 0, NULL, NULL, 0)
770
771 #define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONTIME(GetHandler, SetHandler)\
772 DEFINE_KSPROPERTY_ITEM(\
773 KSPROPERTY_STREAM_PRESENTATIONTIME,\
774 (GetHandler),\
775 sizeof(KSPROPERTY),\
776 sizeof(KSTIME),\
777 (SetHandler),\
778 NULL, 0, NULL, NULL, 0)
779
780 #define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONEXTENT(Handler)\
781 DEFINE_KSPROPERTY_ITEM(\
782 KSPROPERTY_STREAM_PRESENTATIONEXTENT,\
783 (Handler),\
784 sizeof(KSPROPERTY),\
785 sizeof(LONGLONG),\
786 NULL, NULL, 0, NULL, NULL, 0)
787
788 #define DEFINE_KSPROPERTY_ITEM_STREAM_FRAMETIME(Handler)\
789 DEFINE_KSPROPERTY_ITEM(\
790 KSPROPERTY_STREAM_FRAMETIME,\
791 (Handler),\
792 sizeof(KSPROPERTY),\
793 sizeof(KSFRAMETIME),\
794 NULL, NULL, 0, NULL, NULL, 0)
795
796 #define DEFINE_KSPROPERTY_ITEM_STREAM_RATECAPABILITY(Handler)\
797 DEFINE_KSPROPERTY_ITEM(\
798 KSPROPERTY_STREAM_RATECAPABILITY,\
799 (Handler),\
800 sizeof(KSRATE_CAPABILITY),\
801 sizeof(KSRATE),\
802 NULL, NULL, 0, NULL, NULL, 0)
803
804 #define DEFINE_KSPROPERTY_ITEM_STREAM_RATE(GetHandler, SetHandler)\
805 DEFINE_KSPROPERTY_ITEM(\
806 KSPROPERTY_STREAM_RATE,\
807 (GetHandler),\
808 sizeof(KSPROPERTY),\
809 sizeof(KSRATE),\
810 (SetHandler),\
811 NULL, 0, NULL, NULL, 0)
812
813 #define DEFINE_KSPROPERTY_ITEM_STREAM_PIPE_ID(GetHandler, SetHandler)\
814 DEFINE_KSPROPERTY_ITEM(\
815 KSPROPERTY_STREAM_PIPE_ID,\
816 (GetHandler),\
817 sizeof(KSPROPERTY),\
818 sizeof(HANDLE),\
819 (SetHandler),\
820 NULL, 0, NULL, NULL, 0)
821
822 /* ===============================================================
823 StreamAllocator
824 Properties/Methods/Events
825 */
826
827 #define STATIC_KSPROPSETID_StreamAllocator\
828 0xcf6e4342L, 0xec87, 0x11cf, {0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}
829 DEFINE_GUIDSTRUCT("cf6e4342-ec87-11cf-a130-0020afd156e4", KSPROPSETID_StreamAllocator);
830 #define KSPROPSETID_StreamAllocator DEFINE_GUIDNAMED(KSPROPSETID_StreamAllocator)
831
832 typedef enum {
833 KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE,
834 KSPROPERTY_STREAMALLOCATOR_STATUS
835 } KSPROPERTY_STREAMALLOCATOR;
836
837 #define KSMETHODSETID_StreamAllocator \
838 0xcf6e4341L, 0xec87, 0x11cf, {0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}
839
840 typedef enum {
841 KSMETHOD_STREAMALLOCATOR_ALLOC,
842 KSMETHOD_STREAMALLOCATOR_FREE
843 } KSMETHOD_STREAMALLOCATOR;
844
845 #define KSEVENTSETID_StreamAllocator
846
847 typedef enum {
848 KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME,
849 KSEVENT_STREAMALLOCATOR_FREEFRAME
850 } KSEVENT_STREAMALLOCATOR;
851
852 /* ===============================================================
853 StreamInterface
854 Properties/Methods/Events
855 */
856
857 #define KSPROPSETID_StreamInterface \
858 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a
859
860 typedef enum {
861 KSPROPERTY_STREAMINTERFACE_HEADERSIZE
862 } KSPROPERTY_STREAMINTERFACE;
863
864 /* ===============================================================
865 Topology
866 Properties/Methods/Events
867 */
868
869 #define STATIC_KSPROPSETID_Topology\
870 0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
871 DEFINE_GUIDSTRUCT("720D4AC0-7533-11D0-A5D6-28DB04C10000", KSPROPSETID_Topology);
872 #define KSPROPSETID_Topology DEFINE_GUIDNAMED(KSPROPSETID_Topology)
873
874 typedef enum {
875 KSPROPERTY_TOPOLOGY_CATEGORIES,
876 KSPROPERTY_TOPOLOGY_NODES,
877 KSPROPERTY_TOPOLOGY_CONNECTIONS,
878 KSPROPERTY_TOPOLOGY_NAME
879 } KSPROPERTY_TOPOLOGY;
880
881 /* ===============================================================
882 Property Sets for audio drivers - TODO
883 */
884
885 #define STATIC_KSPROPTYPESETID_General \
886 0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
887 DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_General);
888 #define KSPROPTYPESETID_General DEFINE_GUIDNAMED(KSPROPTYPESETID_General)
889
890 /*
891 KSPROPERTY_AC3_ALTERNATE_AUDIO
892 KSPROPERTY_AC3_BIT_STREAM_MODE
893 KSPROPERTY_AC3_DIALOGUE_LEVEL
894 KSPROPERTY_AC3_DOWNMIX
895 KSPROPERTY_AC3_ERROR_CONCEALMENT
896 KSPROPERTY_AC3_LANGUAGE_CODE
897 KSPROPERTY_AC3_ROOM_TYPE
898 */
899
900 #define KSPROPSETID_Acoustic_Echo_Cancel
901 /*
902 KSPROPERTY_AEC_MODE
903 KSPROPERTY_AEC_NOISE_FILL_ENABLE
904 KSPROPERTY_AEC_STATUS
905 */
906
907 /*
908 KSPROPERTY_AUDIO_3D_INTERFACE
909 KSPROPERTY_AUDIO_AGC
910 KSPROPERTY_AUDIO_ALGORITHM_INSTANCE
911 KSPROPERTY_AUDIO_BASS
912 KSPROPERTY_AUDIO_BASS_BOOST
913 KSPROPERTY_AUDIO_CHANNEL_CONFIG
914 KSPROPERTY_AUDIO_CHORUS_LEVEL
915 KSPROPERTY_AUDIO_COPY_PROTECTION
916 KSPROPERTY_AUDIO_CPU_RESOURCES
917 KSPROPERTY_AUDIO_DELAY
918 KSPROPERTY_AUDIO_DEMUX_DEST
919 KSPROPERTY_AUDIO_DEV_SPECIFIC
920 KSPROPERTY_AUDIO_DYNAMIC_RANGE
921 KSPROPERTY_AUDIO_DYNAMIC_SAMPLING_RATE
922 KSPROPERTY_AUDIO_EQ_BANDS
923 KSPROPERTY_AUDIO_EQ_LEVEL
924 KSPROPERTY_AUDIO_FILTER_STATE
925 KSPROPERTY_AUDIO_LATENCY
926 KSPROPERTY_AUDIO_LOUDNESS
927 KSPROPERTY_AUDIO_MANUFACTURE_GUID
928 KSPROPERTY_AUDIO_MID
929 KSPROPERTY_AUDIO_MIX_LEVEL_CAPS
930 KSPROPERTY_AUDIO_MIX_LEVEL_TABLE
931 KSPROPERTY_AUDIO_MUTE
932 KSPROPERTY_AUDIO_MUX_SOURCE
933 KSPROPERTY_AUDIO_NUM_EQ_BANDS
934 KSPROPERTY_AUDIO_PEAKMETER
935 KSPROPERTY_AUDIO_POSITION
936 KSPROPERTY_AUDIO_PREFERRED_STATUS
937 KSPROPERTY_AUDIO_PRODUCT_GUID
938 KSPROPERTY_AUDIO_QUALITY
939 KSPROPERTY_AUDIO_REVERB_LEVEL
940 KSPROPERTY_AUDIO_SAMPLING_RATE
941 KSPROPERTY_AUDIO_STEREO_ENHANCE
942 KSPROPERTY_AUDIO_STEREO_SPEAKER_GEOMETRY
943 KSPROPERTY_AUDIO_SURROUND_ENCODE
944 KSPROPERTY_AUDIO_TREBLE
945 KSPROPERTY_AUDIO_VOLUMELEVEL
946 KSPROPERTY_AUDIO_WIDE_MODE
947 KSPROPERTY_AUDIO_WIDENESS
948 */
949
950 #define KSPROPSETID_AudioGfx
951 /*
952 KSPROPERTY_AUDIOGFX_CAPTURETARGETDEVICEID
953 KSPROPERTY_AUDIOGFX_RENDERTARGETDEVICEID
954 */
955
956 #define KSPROPSETID_DirectSound3DBuffer
957 /*
958 KSPROPERTY_DIRECTSOUND3DBUFFER_ALL
959 KSPROPERTY_DIRECTSOUND3DBUFFER_CONEANGLES
960 KSPROPERTY_DIRECTSOUND3DBUFFER_CONEORIENTATION
961 KSPROPERTY_DIRECTSOUND3DBUFFER_CONEOUTSIDEVOLUME
962 KSPROPERTY_DIRECTSOUND3DBUFFER_MAXDISTANCE
963 KSPROPERTY_DIRECTSOUND3DBUFFER_MINDISTANCE
964 KSPROPERTY_DIRECTSOUND3DBUFFER_MODE
965 KSPROPERTY_DIRECTSOUND3DBUFFER_POSITION
966 KSPROPERTY_DIRECTSOUND3DBUFFER_VELOCITY
967 */
968
969 #define KSPROPSETID_DirectSound3DListener
970 /*
971 KSPROPERTY_DIRECTSOUND3DLISTENER_ALL
972 KSPROPERTY_DIRECTSOUND3DLISTENER_ALLOCATION
973 KSPROPERTY_DIRECTSOUND3DLISTENER_BATCH
974 KSPROPERTY_DIRECTSOUND3DLISTENER_DISTANCEFACTOR
975 KSPROPERTY_DIRECTSOUND3DLISTENER_DOPPLERFACTOR
976 KSPROPERTY_DIRECTSOUND3DLISTENER_ORIENTATION
977 KSPROPERTY_DIRECTSOUND3DLISTENER_POSITION
978 KSPROPERTY_DIRECTSOUND3DLISTENER_ROLLOFFFACTOR
979 KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
980 */
981
982 #define KSPROPSETID_Hrtf3d
983 /*
984 KSPROPERTY_HRTF3D_FILTER_FORMAT
985 KSPROPERTY_HRTF3D_INITIALIZE
986 KSPROPERTY_HRTF3D_PARAMS
987 */
988
989 #define KSPROPSETID_Itd3d
990 /*
991 KSPROPERTY_ITD3D_PARAMS
992 */
993
994 #define KSPROPSETID_TopologyNode
995 /*
996 KSPROPERTY_TOPOLOGYNODE_ENABLE
997 KSPROPERTY_TOPOLOGYNODE_RESET
998 */
999
1000
1001 /* ===============================================================
1002 Node Types
1003 */
1004 /*
1005 KSNODETYPE_3D_EFFECTS
1006 KSNODETYPE_ACOUSTIC_ECHO_CANCEL
1007 KSNODETYPE_ADC
1008 KSNODETYPE_AGC
1009 KSNODETYPE_CHORUS
1010 KSNODETYPE_DAC
1011 KSNODETYPE_DELAY
1012 KSNODETYPE_DEMUX
1013 KSNODETYPE_DEV_SPECIFIC
1014 KSNODETYPE_DMSYNTH
1015 KSNODETYPE_DMSYNTH_CAPS
1016 KSNODETYPE_DRM_DESCRAMBLE
1017 KSNODETYPE_EQUALIZER
1018 KSNODETYPE_LOUDNESS
1019 KSNODETYPE_MUTE
1020 KSNODETYPE_MUX
1021 KSNODETYPE_PEAKMETER
1022 KSNODETYPE_PROLOGIC_DECODER
1023 KSNODETYPE_PROLOGIC_ENCODER
1024 KSNODETYPE_REVERB
1025 KSNODETYPE_SRC
1026 KSNODETYPE_STEREO_ENHANCE
1027 KSNODETYPE_STEREO_WIDE
1028 KSNODETYPE_SUM
1029 KSNODETYPE_SUPERMIX
1030 KSNODETYPE_SWMIDI
1031 KSNODETYPE_SWSYNTH
1032 KSNODETYPE_SYNTHESIZER
1033 KSNODETYPE_TONE
1034 KSNODETYPE_VOLUME
1035 */
1036
1037 typedef PVOID KSDEVICE_HEADER, KSOBJECT_HEADER, KSOBJECT_BAG;
1038
1039 /* ===============================================================
1040 Method Types
1041 */
1042
1043 #define KSMETHOD_TYPE_NONE 0x00000000
1044 #define KSMETHOD_TYPE_READ 0x00000001
1045 #define KSMETHOD_TYPE_WRITE 0x00000002
1046 #define KSMETHOD_TYPE_MODIFY 0x00000003
1047 #define KSMETHOD_TYPE_SOURCE 0x00000004
1048 #define KSMETHOD_TYPE_SEND 0x00000001
1049 #define KSMETHOD_TYPE_SETSUPPORT 0x00000100
1050 #define KSMETHOD_TYPE_BASICSUPPORT 0x00000200
1051
1052 /* ===============================================================
1053 Property Types
1054 */
1055
1056 #define KSPROPERTY_TYPE_GET 0x00000001
1057 #define KSPROPERTY_TYPE_SET 0x00000002
1058 #define KSPROPERTY_TYPE_SETSUPPORT 0x00000100
1059 #define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200
1060 #define KSPROPERTY_TYPE_RELATIONS 0x00000400
1061 #define KSPROPERTY_TYPE_SERIALIZESET 0x00000800
1062 #define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000
1063 #define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000
1064 #define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000
1065 #define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000
1066 #define KSPROPERTY_TYPE_DEFAULT_VALUES 0x00010000
1067
1068 /* ===============================================================
1069 Topology Methods/Properties
1070 */
1071
1072 #define KSMETHOD_TYPE_TOPOLOGY 0x10000000
1073 #define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
1074
1075 /*
1076 #define DEFINE_KS_GUID(GA,GB,GC,GD,GE,GF,GG,GH,GI,GJ,GK) \
1077 DEFINE_GUID(??, 0x#GA#L, 0xGB, 0xGC, 0xGD, 0xGE, 0xGF, 0xGG, 0xGH, 0xGI, 0xGJ, 0xGK) \
1078 "GA-GB-GC-GDGE-GFGGGHGIGJGK"
1079 */
1080
1081 /* ===============================================================
1082 KS Category GUIDs
1083
1084 BRIDGE - 0x085AFF00L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1085 CAPTURE - 0x65E8773DL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1086 RENDER - 0x65E8773EL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1087 MIXER - 0xAD809C00L, 0x7B88, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1088 SPLITTER - 0x0A4252A0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1089 DATACOMPRESSOR - 0x1E84C900L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1090 DATADECOMPRESSOR - 0x2721AE20L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1091 DATATRANSFORM - 0x2EB07EA0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1092 COMMUNICATIONSTRANSFORM - 0xCF1DDA2CL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1093 INTERFACETRANSFORM - 0xCF1DDA2DL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1094 MEDIUMTRANSFORM - 0xCF1DDA2EL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1095 FILESYSTEM - 0x760FED5EL, 0x9357, 0x11D0, 0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1096 CLOCK - 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1097 PROXY - 0x97EBAACAL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1098 QUALITY - 0x97EBAACBL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1099 */
1100
1101 /* ===============================================================
1102 KSNAME GUIDs (defined also as KSSTRING_Xxx L"{...}"
1103
1104 Filter - 0x9b365890L, 0x165f, 0x11d0, 0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1105 Pin - 0x146F1A80L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1106 Clock - 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1107 Allocator - 0x642F5D00L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1108 TopologyNode - 0x0621061AL, 0xEE75, 0x11D0, 0xB9, 0x15, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1109 */
1110
1111 /* ===============================================================
1112 Interface GUIDs
1113
1114 Standard - 0x1A8766A0L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1115 FileIo - 0x8C6F932CL, 0xE771, 0x11D0, 0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1116 */
1117
1118 /* ===============================================================
1119 Medium Type GUIDs
1120
1121 Standard - 0x4747B320L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1122 */
1123
1124 /* ===============================================================
1125 Property Set GUIDs
1126
1127 General - 0x1464EDA5L, 0x6A8F, 0x11D1, 0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1128 StreamIo - 0x65D003CAL, 0x1523, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1129 MediaSeeking - 0xEE904F0CL, 0xD09B, 0x11D0, 0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1130 Topology - 0x720D4AC0L, 0x7533, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1131 GM - 0xAF627536L, 0xE719, 0x11D2, 0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D
1132 Quality - 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1133 Connection - 0x1D58C920L, 0xAC9B, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1134 */
1135
1136 /* ===============================================================
1137 StreamAllocator Sets
1138
1139 Event set - 0x75d95571L, 0x073c, 0x11d0, 0xa1, 0x61, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1140 Method set - 0xcf6e4341L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1141 Property set - 0xcf6e4342L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1142 */
1143
1144 /* ===============================================================
1145 StreamInterface Sets
1146
1147 Property set - 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a
1148 */
1149
1150 /* ===============================================================
1151 Clock Sets
1152
1153 Property set - 0xDF12A4C0L, 0xAC17, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1154 Event sets - 0x364D8E20L, 0x62C7, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1155 */
1156
1157 /* ===============================================================
1158 Connection Sets
1159
1160 Event set - 0x7f4bcbe0L, 0x9ea5, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00
1161 */
1162
1163 /* ===============================================================
1164 Time Format GUIDs
1165
1166 KSTIME_FORMAT_NONE (null guid)
1167 FRAME - 0x7b785570L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1168 BYTE - 0x7b785571L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1169 SAMPLE - 0x7b785572L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1170 FIELD - 0x7b785573L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1171 MEDIA_TIME - 0x7b785574L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1172 */
1173
1174 /* ===============================================================
1175 Media Type GUIDs
1176
1177 NULL
1178 Stream -
1179 None -
1180
1181 TODO ...
1182 */
1183
1184 #define STATIC_KSDATAFORMAT_SPECIFIER_NONE\
1185 0x0F6417D6L, 0xC318, 0x11D0, {0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
1186 DEFINE_GUIDSTRUCT("0F6417D6-C318-11D0-A43F-00A0C9223196", KSDATAFORMAT_SPECIFIER_NONE);
1187 #define KSDATAFORMAT_SPECIFIER_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_NONE)
1188
1189 /* ===============================================================
1190 KSMEMORY_TYPE_xxx
1191
1192 WILDCARD, DONT_CARE = NULL
1193 SYSTEM - 0x091bb638L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1194 USER - 0x8cb0fc28L, 0x7893, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1195 KERNEL_PAGED - 0xd833f8f8L, 0x7894, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1196 KERNEL_NONPAGED - 0x4a6d5fc4L, 0x7895, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1197 DEVICE_UNKNOWN - 0x091bb639L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1198 */
1199
1200 /* ===============================================================
1201 Enums
1202 (values have been checked)
1203 */
1204
1205 #ifndef _MSC_VER
1206
1207 #define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler,\
1208 MinProperty,\
1209 MinData,\
1210 SetHandler,\
1211 Values, RelationsCount, Relations, SupportHandler,\
1212 SerializedSize)\
1213 {\
1214 PropertyId, {(PFNKSHANDLER)GetHandler}, MinProperty, MinData,\
1215 {(PFNKSHANDLER)SetHandler},\
1216 (PKSPROPERTY_VALUES)Values, RelationsCount, (PKSPROPERTY)Relations,\
1217 (PFNKSHANDLER)SupportHandler, (ULONG)SerializedSize\
1218 }
1219
1220 #else
1221
1222 #define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler,\
1223 MinProperty,\
1224 MinData,\
1225 SetHandler,\
1226 Values, RelationsCount, Relations, SupportHandler,\
1227 SerializedSize)\
1228 {\
1229 PropertyId, (PFNKSHANDLER)GetHandler, MinProperty, MinData,\
1230 (PFNKSHANDLER)SetHandler,\
1231 (PKSPROPERTY_VALUES)Values, RelationsCount, (PKSPROPERTY)Relations,\
1232 (PFNKSHANDLER)SupportHandler, (ULONG)SerializedSize\
1233 }
1234
1235 #endif
1236
1237 typedef enum {
1238 KsObjectTypeDevice,
1239 KsObjectTypeFilterFactory,
1240 KsObjectTypeFilter,
1241 KsObjectTypePin
1242 } KSOBJECTTYPE;
1243
1244 typedef enum {
1245 KSSTATE_STOP,
1246 KSSTATE_ACQUIRE,
1247 KSSTATE_PAUSE,
1248 KSSTATE_RUN
1249 } KSSTATE, *PKSSTATE;
1250
1251 typedef enum {
1252 KSTARGET_STATE_DISABLED,
1253 KSTARGET_STATE_ENABLED
1254 } KSTARGET_STATE;
1255
1256 typedef enum {
1257 KSRESET_BEGIN,
1258 KSRESET_END
1259 } KSRESET;
1260
1261 typedef enum {
1262 KSEVENTS_NONE,
1263 KSEVENTS_SPINLOCK,
1264 KSEVENTS_MUTEX,
1265 KSEVENTS_FMUTEX,
1266 KSEVENTS_FMUTEXUNSAFE,
1267 KSEVENTS_INTERRUPT,
1268 KSEVENTS_ERESOURCE
1269 } KSEVENTS_LOCKTYPE;
1270
1271 typedef enum {
1272 KSDEGRADE_STANDARD_SIMPLE,
1273 KSDEGRADE_STANDARD_QUALITY,
1274 KSDEGRADE_STANDARD_COMPUTATION,
1275 KSDEGRADE_STANDARD_SKIP
1276 } KSDEGRADE_STANDARD;
1277
1278 typedef enum {
1279 KSPIN_DATAFLOW_IN = 1,
1280 KSPIN_DATAFLOW_OUT
1281 } KSPIN_DATAFLOW, *PKSPIN_DATAFLOW;
1282
1283 typedef enum {
1284 KSPIN_COMMUNICATION_NONE,
1285 KSPIN_COMMUNICATION_SINK,
1286 KSPIN_COMMUNICATION_SOURCE,
1287 KSPIN_COMMUNICATION_BOTH,
1288 KSPIN_COMMUNICATION_BRIDGE
1289 } KSPIN_COMMUNICATION, *PKSPIN_COMMUNICATION;
1290
1291 typedef enum {
1292 KsListEntryTail,
1293 KsListEntryHead
1294 } KSLIST_ENTRY_LOCATION;
1295
1296 typedef enum {
1297 KsStackCopyToNewLocation,
1298 KsStackReuseCurrentLocation,
1299 KsStackUseNewLocation
1300 } KSSTACK_USE;
1301
1302 typedef enum {
1303 KsAcquireOnly,
1304 KsAcquireAndRemove,
1305 KsAcquireOnlySingleItem,
1306 KsAcquireAndRemoveOnlySingleItem
1307 } KSIRP_REMOVAL_OPERATION;
1308
1309 typedef enum {
1310 KsInvokeOnSuccess = 1,
1311 KsInvokeOnError = 2,
1312 KsInvokeOnCancel = 4
1313 } KSCOMPLETION_INVOCATION;
1314
1315 #if defined(_NTDDK_) && !defined(__wtypes_h__)
1316 enum VARENUM {
1317 VT_EMPTY = 0,
1318 VT_NULL = 1,
1319 VT_I2 = 2,
1320 VT_I4 = 3,
1321 VT_R4 = 4,
1322 VT_R8 = 5,
1323 VT_CY = 6,
1324 VT_DATE = 7,
1325 VT_BSTR = 8,
1326 VT_DISPATCH = 9,
1327 VT_ERROR = 10,
1328 VT_BOOL = 11,
1329 VT_VARIANT = 12,
1330 VT_UNKNOWN = 13,
1331 VT_DECIMAL = 14,
1332 VT_I1 = 16,
1333 VT_UI1 = 17,
1334 VT_UI2 = 18,
1335 VT_UI4 = 19,
1336 VT_I8 = 20,
1337 VT_UI8 = 21,
1338 VT_INT = 22,
1339 VT_UINT = 23,
1340 VT_VOID = 24,
1341 VT_HRESULT = 25,
1342 VT_PTR = 26,
1343 VT_SAFEARRAY = 27,
1344 VT_CARRAY = 28,
1345 VT_USERDEFINED = 29,
1346 VT_LPSTR = 30,
1347 VT_LPWSTR = 31,
1348 VT_FILETIME = 64,
1349 VT_BLOB = 65,
1350 VT_STREAM = 66,
1351 VT_STORAGE = 67,
1352 VT_STREAMED_OBJECT = 68,
1353 VT_STORED_OBJECT = 69,
1354 VT_BLOB_OBJECT = 70,
1355 VT_CF = 71,
1356 VT_CLSID = 72,
1357 VT_VECTOR = 0x1000,
1358 VT_ARRAY = 0x2000,
1359 VT_BYREF = 0x4000,
1360 VT_RESERVED = 0x8000,
1361 VT_ILLEGAL = 0xffff,
1362 VT_ILLEGALMASKED = 0xfff,
1363 VT_TYPEMASK = 0xfff
1364 };
1365 #endif
1366
1367 #define STATIC_KSDATAFORMAT_TYPE_WILDCARD STATIC_GUID_NULL
1368 #define KSDATAFORMAT_TYPE_WILDCARD GUID_NULL
1369
1370 #define STATIC_KSDATAFORMAT_SUBTYPE_WILDCARD STATIC_GUID_NULL
1371 #define KSDATAFORMAT_SUBTYPE_WILDCARD GUID_NULL
1372
1373 #define STATIC_KSDATAFORMAT_SPECIFIER_WILDCARD STATIC_GUID_NULL
1374 #define KSDATAFORMAT_SPECIFIER_WILDCARD GUID_NULL
1375
1376 /* ===============================================================
1377 Framing
1378 */
1379
1380 typedef struct {
1381 ULONG MinFrameSize;
1382 ULONG MaxFrameSize;
1383 ULONG Stepping;
1384 } KS_FRAMING_RANGE, *PKS_FRAMING_RANGE;
1385
1386 typedef struct {
1387 KS_FRAMING_RANGE Range;
1388 ULONG InPlaceWeight;
1389 ULONG NotInPlaceWeight;
1390 } KS_FRAMING_RANGE_WEIGHTED, *PKS_FRAMING_RANGE_WEIGHTED;
1391
1392 typedef struct {
1393 GUID MemoryType;
1394 GUID BusType;
1395 ULONG MemoryFlags;
1396 ULONG BusFlags;
1397 ULONG Flags;
1398 ULONG Frames;
1399 ULONG FileAlignment;
1400 ULONG MemoryTypeWeight;
1401 KS_FRAMING_RANGE PhysicalRange;
1402 KS_FRAMING_RANGE_WEIGHTED FramingRange;
1403 } KS_FRAMING_ITEM, *PKS_FRAMING_ITEM;
1404
1405 typedef struct {
1406 ULONG RatioNumerator;
1407 ULONG RatioDenominator;
1408 ULONG RatioConstantMargin;
1409 } KS_COMPRESSION, *PKS_COMPRESSION;
1410
1411 /* ===============================================================
1412 Priorities
1413 */
1414
1415 #define KSPRIORITY_LOW 0x00000001
1416 #define KSPRIORITY_NORMAL 0x40000000
1417 #define KSPRIORITY_HIGH 0x80000000
1418 #define KSPRIORITY_EXCLUSIVE 0xFFFFFFFF
1419
1420 typedef struct {
1421 ULONG PriorityClass;
1422 ULONG PrioritySubClass;
1423 } KSPRIORITY, *PKSPRIORITY;
1424
1425 /* ===============================================================
1426 Dispatch Table
1427 http://www.osronline.com/DDKx/stream/ks-struct_494j.htm
1428 */
1429
1430 #if defined(_NTDDK_)
1431
1432 typedef struct {
1433 PDRIVER_DISPATCH DeviceIoControl;
1434 PDRIVER_DISPATCH Read;
1435 PDRIVER_DISPATCH Write;
1436 PDRIVER_DISPATCH Flush;
1437 PDRIVER_DISPATCH Close;
1438 PDRIVER_DISPATCH QuerySecurity;
1439 PDRIVER_DISPATCH SetSecurity;
1440 PFAST_IO_DEVICE_CONTROL FastDeviceIoControl;
1441 PFAST_IO_READ FastRead;
1442 PFAST_IO_WRITE FastWrite;
1443 } KSDISPATCH_TABLE, *PKSDISPATCH_TABLE;
1444
1445 #define KSCREATE_ITEM_IRP_STORAGE(Irp) (*(PKSOBJECT_CREATE_ITEM*)&(Irp)->Tail.Overlay.DriverContext[0])
1446 #define KSEVENT_SET_IRP_STORAGE(Irp) (*(const KSEVENT_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
1447 #define KSEVENT_ITEM_IRP_STORAGE(Irp) (*(const KSEVENT_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
1448 #define KSEVENT_ENTRY_IRP_STORAGE(Irp) (*(PKSEVENT_ENTRY*)&(Irp)->Tail.Overlay.DriverContext[0])
1449 #define KSMETHOD_SET_IRP_STORAGE(Irp) (*(const KSMETHOD_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
1450 #define KSMETHOD_ITEM_IRP_STORAGE(Irp) (*(const KSMETHOD_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
1451 #define KSMETHOD_TYPE_IRP_STORAGE(Irp) (*(ULONG_PTR*)(&(Irp)->Tail.Overlay.DriverContext[2]))
1452 #define KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) (*(PKSPIN_LOCK*)&(Irp)->Tail.Overlay.DriverContext[1])
1453 #define KSPROPERTY_SET_IRP_STORAGE(Irp) (*(const KSPROPERTY_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
1454 #define KSPROPERTY_ITEM_IRP_STORAGE(Irp) (*(const KSPROPERTY_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
1455 #define KSPROPERTY_ATTRIBUTES_IRP_STORAGE(Irp) (*(PKSATTRIBUTE_LIST*)&(Irp)->Tail.Overlay.DriverContext[2])
1456
1457 _IRQL_requires_max_(PASSIVE_LEVEL)
1458 typedef VOID
1459 (NTAPI *PFNREFERENCEDEVICEOBJECT)(
1460 _In_ PVOID Context);
1461
1462 _IRQL_requires_max_(PASSIVE_LEVEL)
1463 typedef VOID
1464 (NTAPI *PFNDEREFERENCEDEVICEOBJECT)(
1465 _In_ PVOID Context);
1466
1467 _IRQL_requires_max_(PASSIVE_LEVEL)
1468 typedef NTSTATUS
1469 (NTAPI *PFNQUERYREFERENCESTRING)(
1470 _In_ PVOID Context,
1471 _Inout_ PWCHAR *String);
1472
1473 typedef struct {
1474 INTERFACE Interface;
1475 PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject;
1476 PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject;
1477 PFNQUERYREFERENCESTRING QueryReferenceString;
1478 } BUS_INTERFACE_REFERENCE, *PBUS_INTERFACE_REFERENCE;
1479
1480 typedef struct {
1481 KDPC Dpc;
1482 ULONG ReferenceCount;
1483 KSPIN_LOCK AccessLock;
1484 } KSDPC_ITEM, *PKSDPC_ITEM;
1485
1486 typedef struct {
1487 KSDPC_ITEM DpcItem;
1488 LIST_ENTRY BufferList;
1489 } KSBUFFER_ITEM, *PKSBUFFER_ITEM;
1490
1491 #endif /* _NTDDK_ */
1492
1493 typedef struct {
1494 GUID Manufacturer;
1495 GUID Product;
1496 GUID Component;
1497 GUID Name;
1498 ULONG Version;
1499 ULONG Revision;
1500 } KSCOMPONENTID, *PKSCOMPONENTID;
1501
1502 #define DEFINE_KSPROPERTY_ITEM_GENERAL_COMPONENTID(Handler)\
1503 DEFINE_KSPROPERTY_ITEM(\
1504 KSPROPERTY_GENERAL_COMPONENTID,\
1505 (Handler),\
1506 sizeof(KSPROPERTY),\
1507 sizeof(KSCOMPONENTID),\
1508 NULL, NULL, 0, NULL, NULL, 0)
1509
1510 /* ===============================================================
1511 Properties
1512 */
1513
1514 typedef struct {
1515 GUID PropertySet;
1516 ULONG Count;
1517 } KSPROPERTY_SERIALHDR, *PKSPROPERTY_SERIALHDR;
1518
1519 typedef struct {
1520 KSIDENTIFIER PropTypeSet;
1521 ULONG Id;
1522 ULONG PropertyLength;
1523 } KSPROPERTY_SERIAL, *PKSPROPERTY_SERIAL;
1524
1525 typedef union {
1526 struct {
1527 LONG SignedMinimum;
1528 LONG SignedMaximum;
1529 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1530 } _SIGNED;
1531 #else
1532 };
1533 #endif
1534 struct {
1535 ULONG UnsignedMinimum;
1536 ULONG UnsignedMaximum;
1537 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1538 } _UNSIGNED;
1539 #else
1540 };
1541 #endif
1542 } KSPROPERTY_BOUNDS_LONG, *PKSPROPERTY_BOUNDS_LONG;
1543
1544 typedef union {
1545 struct {
1546 LONGLONG SignedMinimum;
1547 LONGLONG SignedMaximum;
1548 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1549 } _SIGNED64;
1550 #else
1551 };
1552 #endif
1553 struct {
1554 #if defined(_NTDDK_)
1555 ULONGLONG UnsignedMinimum;
1556 ULONGLONG UnsignedMaximum;
1557 #else
1558 DWORDLONG UnsignedMinimum;
1559 DWORDLONG UnsignedMaximum;
1560 #endif
1561 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1562 } _UNSIGNED64;
1563 #else
1564 };
1565 #endif
1566 } KSPROPERTY_BOUNDS_LONGLONG, *PKSPROPERTY_BOUNDS_LONGLONG;
1567
1568 typedef struct {
1569 ULONG AccessFlags;
1570 ULONG DescriptionSize;
1571 KSIDENTIFIER PropTypeSet;
1572 ULONG MembersListCount;
1573 ULONG Reserved;
1574 } KSPROPERTY_DESCRIPTION, *PKSPROPERTY_DESCRIPTION;
1575
1576 typedef struct {
1577 ULONG MembersFlags;
1578 ULONG MembersSize;
1579 ULONG MembersCount;
1580 ULONG Flags;
1581 } KSPROPERTY_MEMBERSHEADER, *PKSPROPERTY_MEMBERSHEADER;
1582
1583 typedef struct {
1584 KSPROPERTY_MEMBERSHEADER MembersHeader;
1585 const VOID *Members;
1586 } KSPROPERTY_MEMBERSLIST, *PKSPROPERTY_MEMBERSLIST;
1587
1588 #define KSPROPERTY_MEMBER_RANGES 0x00000001
1589 #define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002
1590 #define KSPROPERTY_MEMBER_VALUES 0x00000003
1591
1592 #define KSPROPERTY_MEMBER_FLAG_DEFAULT 0x00000001
1593 #if (NTDDI_VERSION >= NTDDI_WINXP)
1594 #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_MULTICHANNEL 0x00000002
1595 #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM 0x00000004
1596 #endif
1597
1598 typedef struct {
1599 KSIDENTIFIER PropTypeSet;
1600 ULONG MembersListCount;
1601 _Field_size_(MembersListCount) const KSPROPERTY_MEMBERSLIST *MembersList;
1602 } KSPROPERTY_VALUES, *PKSPROPERTY_VALUES;
1603
1604 #if defined(_NTDDK_)
1605
1606 _IRQL_requires_max_(PASSIVE_LEVEL)
1607 typedef NTSTATUS
1608 (NTAPI *PFNKSCONTEXT_DISPATCH)(
1609 _In_ PVOID Context,
1610 _In_ PIRP Irp);
1611
1612 _IRQL_requires_max_(PASSIVE_LEVEL)
1613 typedef NTSTATUS
1614 (NTAPI *PFNKSHANDLER)(
1615 _In_ PIRP Irp,
1616 _In_ PKSIDENTIFIER Request,
1617 _Inout_ PVOID Data);
1618
1619 typedef struct {
1620 ULONG PropertyId;
1621 union {
1622 PFNKSHANDLER GetPropertyHandler;
1623 BOOLEAN GetSupported;
1624 };
1625 ULONG MinProperty;
1626 ULONG MinData;
1627 union {
1628 PFNKSHANDLER SetPropertyHandler;
1629 BOOLEAN SetSupported;
1630 };
1631 const KSPROPERTY_VALUES *Values;
1632 ULONG RelationsCount;
1633 _Field_size_(RelationsCount) const KSPROPERTY *Relations;
1634 PFNKSHANDLER SupportHandler;
1635 ULONG SerializedSize;
1636 } KSPROPERTY_ITEM, *PKSPROPERTY_ITEM;
1637
1638 _IRQL_requires_max_(PASSIVE_LEVEL)
1639 typedef BOOLEAN
1640 (NTAPI *PFNKSFASTHANDLER)(
1641 _In_ PFILE_OBJECT FileObject,
1642 _In_reads_bytes_(RequestLength) PKSIDENTIFIER Request,
1643 _In_ ULONG RequestLength,
1644 _Inout_updates_bytes_(DataLength) PVOID Data,
1645 _In_ ULONG DataLength,
1646 _Out_ PIO_STATUS_BLOCK IoStatus);
1647
1648 typedef struct {
1649 ULONG PropertyId;
1650 union {
1651 PFNKSFASTHANDLER GetPropertyHandler;
1652 BOOLEAN GetSupported;
1653 };
1654 union {
1655 PFNKSFASTHANDLER SetPropertyHandler;
1656 BOOLEAN SetSupported;
1657 };
1658 ULONG Reserved;
1659 } KSFASTPROPERTY_ITEM, *PKSFASTPROPERTY_ITEM;
1660
1661 typedef struct {
1662 const GUID *Set;
1663 ULONG PropertiesCount;
1664 _Field_size_(PropertiesCount) const KSPROPERTY_ITEM *PropertyItem;
1665 ULONG FastIoCount;
1666 const KSFASTPROPERTY_ITEM *FastIoTable;
1667 } KSPROPERTY_SET, *PKSPROPERTY_SET;
1668
1669 #endif /* _NTDDK_ */
1670
1671 typedef struct {
1672 ULONG SteppingDelta;
1673 ULONG Reserved;
1674 KSPROPERTY_BOUNDS_LONG Bounds;
1675 } KSPROPERTY_STEPPING_LONG, *PKSPROPERTY_STEPPING_LONG;
1676
1677 typedef struct {
1678 #if defined(_NTDDK_)
1679 ULONGLONG SteppingDelta;
1680 #else
1681 DWORDLONG SteppingDelta;
1682 #endif
1683 KSPROPERTY_BOUNDS_LONGLONG Bounds;
1684 } KSPROPERTY_STEPPING_LONGLONG, *PKSPROPERTY_STEPPING_LONGLONG;
1685
1686 /* ===============================================================
1687 Allocator Framing
1688 */
1689
1690 typedef struct {
1691 union {
1692 ULONG OptionsFlags;
1693 ULONG RequirementsFlags;
1694 };
1695 #if defined(_NTDDK_)
1696 POOL_TYPE PoolType;
1697 #else
1698 ULONG PoolType;
1699 #endif
1700 ULONG Frames;
1701 ULONG FrameSize;
1702 ULONG FileAlignment;
1703 ULONG Reserved;
1704 } KSALLOCATOR_FRAMING, *PKSALLOCATOR_FRAMING;
1705
1706 typedef struct {
1707 ULONG CountItems;
1708 ULONG PinFlags;
1709 KS_COMPRESSION OutputCompression;
1710 ULONG PinWeight;
1711 KS_FRAMING_ITEM FramingItem[1];
1712 } KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX;
1713
1714 #define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001
1715 #define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002
1716 #define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004
1717 #define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008
1718 #define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000
1719
1720 #define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001
1721 #define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002
1722 #define KSALLOCATOR_OPTIONF_VALID 0x00000003
1723
1724 #define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010
1725 #define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020
1726 #define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040
1727 #define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080
1728
1729 /* ===============================================================
1730 Quality
1731 */
1732
1733 typedef struct {
1734 PVOID Context;
1735 ULONG Proportion;
1736 LONGLONG DeltaTime;
1737 } KSQUALITY, *PKSQUALITY;
1738
1739 typedef struct {
1740 HANDLE QualityManager;
1741 PVOID Context;
1742 } KSQUALITY_MANAGER, *PKSQUALITY_MANAGER;
1743
1744 typedef struct {
1745 LONGLONG PresentationStart;
1746 LONGLONG Duration;
1747 KSPIN_INTERFACE Interface;
1748 LONG Rate;
1749 ULONG Flags;
1750 } KSRATE, *PKSRATE;
1751
1752 typedef struct {
1753 KSPROPERTY Property;
1754 KSRATE Rate;
1755 } KSRATE_CAPABILITY, *PKSRATE_CAPABILITY;
1756
1757 typedef struct {
1758 LONGLONG Granularity;
1759 LONGLONG Error;
1760 } KSRESOLUTION, *PKSRESOLUTION;
1761
1762 typedef struct {
1763 ULONG NotificationType;
1764 union {
1765 struct {
1766 HANDLE Event;
1767 ULONG_PTR Reserved[2];
1768 } EventHandle;
1769 struct {
1770 HANDLE Semaphore;
1771 ULONG Reserved;
1772 LONG Adjustment;
1773 } SemaphoreHandle;
1774 #if defined(_NTDDK_)
1775 struct {
1776 PVOID Event;
1777 KPRIORITY Increment;
1778 ULONG_PTR Reserved;
1779 } EventObject;
1780 struct {
1781 PVOID Semaphore;
1782 KPRIORITY Increment;
1783 LONG Adjustment;
1784 } SemaphoreObject;
1785 struct {
1786 PKDPC Dpc;
1787 ULONG ReferenceCount;
1788 ULONG_PTR Reserved;
1789 } Dpc;
1790 struct {
1791 PWORK_QUEUE_ITEM WorkQueueItem;
1792 WORK_QUEUE_TYPE WorkQueueType;
1793 ULONG_PTR Reserved;
1794 } WorkItem;
1795 struct {
1796 PWORK_QUEUE_ITEM WorkQueueItem;
1797 PKSWORKER KsWorkerObject;
1798 ULONG_PTR Reserved;
1799 } KsWorkItem;
1800 #endif
1801 struct {
1802 PVOID Unused;
1803 LONG_PTR Alignment[2];
1804 } Alignment;
1805 };
1806 } KSEVENTDATA, *PKSEVENTDATA;
1807
1808 #define KSEVENTF_EVENT_HANDLE 0x00000001
1809 #define KSEVENTF_SEMAPHORE_HANDLE 0x00000002
1810 #if defined(_NTDDK_)
1811 #define KSEVENTF_EVENT_OBJECT 0x00000004
1812 #define KSEVENTF_SEMAPHORE_OBJECT 0x00000008
1813 #define KSEVENTF_DPC 0x00000010
1814 #define KSEVENTF_WORKITEM 0x00000020
1815 #define KSEVENTF_KSWORKITEM 0x00000080
1816 #endif
1817
1818
1819 #define KSEVENT_TYPE_ENABLE 0x00000001
1820 #define KSEVENT_TYPE_ONESHOT 0x00000002
1821 #define KSEVENT_TYPE_ENABLEBUFFERED 0x00000004
1822 #define KSEVENT_TYPE_SETSUPPORT 0x00000100
1823 #define KSEVENT_TYPE_BASICSUPPORT 0x00000200
1824 #define KSEVENT_TYPE_QUERYBUFFER 0x00000400
1825
1826 #define KSEVENT_TYPE_TOPOLOGY 0x10000000
1827
1828 typedef struct {
1829 ULONG Size;
1830 ULONG Flags;
1831 union {
1832 HANDLE ObjectHandle;
1833 PVOID ObjectPointer;
1834 };
1835 PVOID Reserved;
1836 KSEVENT Event;
1837 KSEVENTDATA EventData;
1838 } KSRELATIVEEVENT, *PKSRELATIVEEVENT;
1839
1840 #define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001
1841 #define KSRELATIVEEVENT_FLAG_POINTER 0x00000002
1842
1843 /* ===============================================================
1844 Timing
1845 */
1846
1847 typedef struct {
1848 KSEVENTDATA EventData;
1849 LONGLONG MarkTime;
1850 } KSEVENT_TIME_MARK, *PKSEVENT_TIME_MARK;
1851
1852 typedef struct {
1853 KSEVENTDATA EventData;
1854 LONGLONG TimeBase;
1855 LONGLONG Interval;
1856 } KSEVENT_TIME_INTERVAL, *PKSEVENT_TIME_INTERVAL;
1857
1858 typedef struct {
1859 LONGLONG TimeBase;
1860 LONGLONG Interval;
1861 } KSINTERVAL, *PKSINTERVAL;
1862
1863 typedef struct {
1864 LONGLONG Time;
1865 ULONG Numerator;
1866 ULONG Denominator;
1867 } KSTIME, *PKSTIME;
1868
1869 typedef struct {
1870 LONGLONG Time;
1871 LONGLONG SystemTime;
1872 } KSCORRELATED_TIME, *PKSCORRELATED_TIME;
1873
1874 typedef struct {
1875 LONGLONG Duration;
1876 ULONG FrameFlags;
1877 ULONG Reserved;
1878 } KSFRAMETIME, *PKSFRAMETIME;
1879
1880 /* ===============================================================
1881 Clocks
1882 */
1883
1884 typedef PVOID PKSDEFAULTCLOCK;
1885
1886 typedef struct {
1887 ULONG CreateFlags;
1888 } KSCLOCK_CREATE, *PKSCLOCK_CREATE;
1889
1890 #if defined(_NTDDK_)
1891
1892 _IRQL_requires_max_(PASSIVE_LEVEL)
1893 typedef LONGLONG
1894 (FASTCALL *PFNKSCLOCK_GETTIME)(
1895 _In_ PFILE_OBJECT FileObject);
1896
1897 _IRQL_requires_max_(PASSIVE_LEVEL)
1898 typedef LONGLONG
1899 (FASTCALL *PFNKSCLOCK_CORRELATEDTIME)(
1900 _In_ PFILE_OBJECT FileObject,
1901 _Out_ PLONGLONG SystemTime);
1902
1903 typedef struct {
1904 PFNKSCLOCK_GETTIME GetTime;
1905 PFNKSCLOCK_GETTIME GetPhysicalTime;
1906 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime;
1907 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime;
1908 } KSCLOCK_FUNCTIONTABLE, *PKSCLOCK_FUNCTIONTABLE;
1909
1910 #define DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(Handler)\
1911 DEFINE_KSPROPERTY_ITEM(\
1912 KSPROPERTY_CLOCK_TIME,\
1913 (Handler),\
1914 sizeof(KSPROPERTY),\
1915 sizeof(LONGLONG),\
1916 NULL, NULL, 0, NULL, NULL, 0)
1917
1918 #define DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(Handler)\
1919 DEFINE_KSPROPERTY_ITEM(\
1920 KSPROPERTY_CLOCK_PHYSICALTIME,\
1921 (Handler),\
1922 sizeof(KSPROPERTY),\
1923 sizeof(LONGLONG),\
1924 NULL, NULL, 0, NULL, NULL, 0)
1925
1926 #define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(Handler)\
1927 DEFINE_KSPROPERTY_ITEM(\
1928 KSPROPERTY_CLOCK_CORRELATEDTIME,\
1929 (Handler),\
1930 sizeof(KSPROPERTY),\
1931 sizeof(KSCORRELATED_TIME),\
1932 NULL, NULL, 0, NULL, NULL, 0)
1933
1934 #define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(Handler)\
1935 DEFINE_KSPROPERTY_ITEM(\
1936 KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME,\
1937 (Handler),\
1938 sizeof(KSPROPERTY),\
1939 sizeof(KSCORRELATED_TIME),\
1940 NULL, NULL, 0, NULL, NULL, 0)
1941
1942 #define DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(Handler)\
1943 DEFINE_KSPROPERTY_ITEM(\
1944 KSPROPERTY_CLOCK_RESOLUTION,\
1945 (Handler),\
1946 sizeof(KSPROPERTY),\
1947 sizeof(KSRESOLUTION),\
1948 NULL, NULL, 0, NULL, NULL, 0)
1949
1950 #define DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(Handler)\
1951 DEFINE_KSPROPERTY_ITEM(\
1952 KSPROPERTY_CLOCK_STATE,\
1953 (Handler),\
1954 sizeof(KSPROPERTY),\
1955 sizeof(KSSTATE),\
1956 NULL, NULL, 0, NULL, NULL, 0)
1957
1958 #define DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(Handler)\
1959 DEFINE_KSPROPERTY_ITEM(\
1960 KSPROPERTY_CLOCK_FUNCTIONTABLE,\
1961 (Handler),\
1962 sizeof(KSPROPERTY),\
1963 sizeof(KSCLOCK_FUNCTIONTABLE),\
1964 NULL, NULL, 0, NULL, NULL, 0)
1965
1966 #define DEFINE_KSPROPERTY_CLOCKSET(ClockSet,\
1967 PropTime, PropPhysicalTime,\
1968 PropCorrelatedTime, PropCorrelatedPhysicalTime,\
1969 PropResolution, PropState, PropFunctionTable)\
1970 DEFINE_KSPROPERTY_TABLE(ClockSet) {\
1971 DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(PropTime),\
1972 DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(PropPhysicalTime),\
1973 DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(PropCorrelatedTime),\
1974 DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(PropCorrelatedPhysicalTime),\
1975 DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(PropResolution),\
1976 DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(PropState),\
1977 DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(PropFunctionTable)\
1978 }
1979
1980 /* ===============================================================
1981 Objects ??? SORT ME!
1982 */
1983
1984 #define KSCREATE_ITEM_SECURITYCHANGED 0x1
1985 #define KSCREATE_ITEM_WILDCARD 0x2
1986 #define KSCREATE_ITEM_NOPARAMETERS 0x4
1987 #define KSCREATE_ITEM_FREEONSTOP 0x8
1988
1989 typedef struct {
1990 PDRIVER_DISPATCH Create;
1991 PVOID Context;
1992 UNICODE_STRING ObjectClass;
1993 PSECURITY_DESCRIPTOR SecurityDescriptor;
1994 ULONG Flags;
1995 } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM;
1996
1997 typedef struct {
1998 ULONG CreateItemsCount;
1999 _Field_size_(CreateItemsCount) PKSOBJECT_CREATE_ITEM CreateItemsList;
2000 } KSOBJECT_CREATE, *PKSOBJECT_CREATE;
2001
2002 typedef VOID
2003 (NTAPI *PFNKSITEMFREECALLBACK)(
2004 _In_ PKSOBJECT_CREATE_ITEM CreateItem);
2005
2006 #endif /* _NTDDK_ */
2007
2008 typedef struct {
2009 ULONG Size;
2010 ULONG Count;
2011 } KSMULTIPLE_ITEM, *PKSMULTIPLE_ITEM;
2012
2013 typedef struct {
2014 KSEVENT Event;
2015 PKSEVENTDATA EventData;
2016 PVOID Reserved;
2017 } KSQUERYBUFFER, *PKSQUERYBUFFER;
2018
2019 typedef struct {
2020 PVOID Context;
2021 ULONG Status;
2022 } KSERROR, *PKSERROR;
2023
2024 /* ===============================================================
2025 Methods
2026 */
2027
2028 #if defined(_NTDDK_)
2029
2030 typedef struct {
2031 ULONG MethodId;
2032 union {
2033 PFNKSHANDLER MethodHandler;
2034 BOOLEAN MethodSupported;
2035 };
2036 ULONG MinMethod;
2037 ULONG MinData;
2038 PFNKSHANDLER SupportHandler;
2039 ULONG Flags;
2040 } KSMETHOD_ITEM, *PKSMETHOD_ITEM;
2041
2042 #ifndef _MSC_VER
2043
2044 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
2045 MethodHandler,\
2046 MinMethod, MinData, SupportHandler)\
2047 {\
2048 MethodId, {(PFNKSHANDLER)MethodHandler}, MinMethod, MinData,\
2049 SupportHandler, Flags\
2050 }
2051
2052 #else
2053
2054 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
2055 MethodHandler,\
2056 MinMethod, MinData, SupportHandler)\
2057 {\
2058 MethodId, (PFNKSHANDLER)MethodHandler, MinMethod, MinData,\
2059 SupportHandler, Flags\
2060 }
2061
2062 #endif
2063
2064 typedef struct {
2065 ULONG MethodId;
2066 union {
2067 PFNKSFASTHANDLER MethodHandler;
2068 BOOLEAN MethodSupported;
2069 };
2070 } KSFASTMETHOD_ITEM, *PKSFASTMETHOD_ITEM;
2071
2072 #define DEFINE_KSFASTMETHOD_ITEM(MethodId, MethodHandler)\
2073 {\
2074 MethodId, (PFNKSFASTHANDLER)MethodHandler\
2075 }
2076
2077 typedef struct {
2078 const GUID *Set;
2079 ULONG MethodsCount;
2080 _Field_size_(MethodsCount) const KSMETHOD_ITEM *MethodItem;
2081 ULONG FastIoCount;
2082 _Field_size_(FastIoCount) const KSFASTMETHOD_ITEM *FastIoTable;
2083 } KSMETHOD_SET, *PKSMETHOD_SET;
2084
2085 #define DEFINE_KSMETHOD_SET(Set,\
2086 MethodsCount,\
2087 MethodItem,\
2088 FastIoCount,\
2089 FastIoTable)\
2090 {\
2091 Set,\
2092 MethodsCount,\
2093 MethodItem,\
2094 FastIoCount,\
2095 FastIoTable\
2096 }
2097
2098 #endif /* _NTDDK_ */
2099
2100 /* ===============================================================
2101 Nodes
2102 */
2103
2104 typedef struct {
2105 KSPROPERTY Property;
2106 ULONG NodeId;
2107 ULONG Reserved;
2108 } KSP_NODE, *PKSP_NODE;
2109
2110 typedef struct {
2111 KSMETHOD Method;
2112 ULONG NodeID;
2113 ULONG Reserved;
2114 } KSM_NODE, *PKSM_NODE;
2115
2116 typedef struct {
2117 KSEVENT Event;
2118 ULONG NodeId;
2119 ULONG Reserved;
2120 } KSE_NODE, *PKSE_NODE;
2121
2122 typedef struct {
2123 ULONG CreateFlags;
2124 ULONG Node;
2125 } KSNODE_CREATE, *PKSNODE_CREATE;
2126
2127 /* ===============================================================
2128 Events
2129 */
2130
2131 typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, *PKSEVENT_ENTRY;
2132
2133 #if defined(_NTDDK_)
2134
2135 typedef NTSTATUS
2136 (NTAPI *PFNKSADDEVENT)(
2137 _In_ PIRP Irp,
2138 _In_ PKSEVENTDATA EventData,
2139 _In_ struct _KSEVENT_ENTRY *EventEntry);
2140
2141 typedef VOID
2142 (NTAPI *PFNKSREMOVEEVENT)(
2143 _In_ PFILE_OBJECT FileObject,
2144 _In_ struct _KSEVENT_ENTRY *EventEntry);
2145
2146 typedef struct {
2147 ULONG EventId;
2148 ULONG DataInput;
2149 ULONG ExtraEntryData;
2150 PFNKSADDEVENT AddHandler;
2151 PFNKSREMOVEEVENT RemoveHandler;
2152 PFNKSHANDLER SupportHandler;
2153 } KSEVENT_ITEM, *PKSEVENT_ITEM;
2154
2155 typedef struct {
2156 const GUID *Set;
2157 ULONG EventsCount;
2158 _Field_size_(EventsCount) const KSEVENT_ITEM *EventItem;
2159 } KSEVENT_SET, *PKSEVENT_SET;
2160
2161 struct _KSEVENT_ENTRY {
2162 LIST_ENTRY ListEntry;
2163 PVOID Object;
2164 union {
2165 PKSDPC_ITEM DpcItem;
2166 PKSBUFFER_ITEM BufferItem;
2167 };
2168 PKSEVENTDATA EventData;
2169 ULONG NotificationType;
2170 const KSEVENT_SET *EventSet;
2171 const KSEVENT_ITEM *EventItem;
2172 PFILE_OBJECT FileObject;
2173 ULONG SemaphoreAdjustment;
2174 ULONG Reserved;
2175 ULONG Flags;
2176 };
2177
2178 #endif /* _NTDDK_ */
2179
2180 /* ===============================================================
2181 Pins
2182 */
2183
2184 #if defined(_NTDDK_)
2185
2186 typedef struct _KSPIN KSPIN, *PKSPIN;
2187 typedef struct _KSSTREAM_POINTER KSSTREAM_POINTER, *PKSSTREAM_POINTER;
2188 typedef struct _KSSTREAM_POINTER_OFFSET KSSTREAM_POINTER_OFFSET, *PKSSTREAM_POINTER_OFFSET;
2189 typedef struct _KSMAPPING KSMAPPING, *PKSMAPPING;
2190 typedef struct _KSPROCESSPIN KSPROCESSPIN, *PKSPROCESSPIN;
2191
2192 #define IOCTL_KS_HANDSHAKE CTL_CODE(FILE_DEVICE_KS, 0x007, METHOD_NEITHER, FILE_ANY_ACCESS)
2193
2194 typedef struct {
2195 GUID ProtocolId;
2196 PVOID Argument1;
2197 PVOID Argument2;
2198 } KSHANDSHAKE, *PKSHANDSHAKE;
2199
2200 _IRQL_requires_max_(PASSIVE_LEVEL)
2201 typedef NTSTATUS
2202 (NTAPI *PFNKSPINHANDSHAKE)(
2203 _In_ PKSPIN Pin,
2204 _In_ PKSHANDSHAKE In,
2205 _In_ PKSHANDSHAKE Out);
2206
2207 _IRQL_requires_max_(PASSIVE_LEVEL)
2208 typedef void
2209 (NTAPI *PFNKSPINPOWER)(
2210 _In_ PKSPIN Pin,
2211 _In_ DEVICE_POWER_STATE State);
2212
2213 typedef void
2214 (NTAPI *PFNKSPINFRAMERETURN)(
2215 _In_ PKSPIN Pin,
2216 _In_reads_bytes_opt_(Size) PVOID Data,
2217 _In_opt_ ULONG Size,
2218 _In_opt_ PMDL Mdl,
2219 _In_opt_ PVOID Context,
2220 _In_ NTSTATUS Status);
2221
2222 _IRQL_requires_max_(DISPATCH_LEVEL)
2223 typedef void
2224 (NTAPI *PFNKSPINIRPCOMPLETION)(
2225 _In_ PKSPIN Pin,
2226 _In_ PIRP Irp);
2227
2228 _IRQL_requires_max_(PASSIVE_LEVEL)
2229 typedef NTSTATUS
2230 (NTAPI *PFNKSPINIRP)(
2231 _In_ PKSPIN Pin,
2232 _In_ PIRP Irp);
2233
2234 typedef NTSTATUS
2235 (NTAPI *PFNKSPIN)(
2236 _In_ PKSPIN Pin);
2237
2238 _IRQL_requires_max_(PASSIVE_LEVEL)
2239 typedef void
2240 (NTAPI *PFNKSPINVOID)(
2241 _In_ PKSPIN Pin);
2242
2243 _IRQL_requires_max_(DISPATCH_LEVEL)
2244 typedef void
2245 (NTAPI *PFNKSSTREAMPOINTER)(
2246 _In_ PKSSTREAM_POINTER StreamPointer);
2247
2248 typedef struct {
2249 ULONG Count;
2250 _Field_size_(Count) PKSATTRIBUTE *Attributes;
2251 } KSATTRIBUTE_LIST, *PKSATTRIBUTE_LIST;
2252
2253 _IRQL_requires_max_(PASSIVE_LEVEL)
2254 typedef NTSTATUS
2255 (NTAPI *PFNKSPINSETDATAFORMAT)(
2256 _In_ PKSPIN Pin,
2257 _In_opt_ PKSDATAFORMAT OldFormat,
2258 _In_opt_ PKSMULTIPLE_ITEM OldAttributeList,
2259 _In_ const KSDATARANGE* DataRange,
2260 _In_opt_ const KSATTRIBUTE_LIST* AttributeRange);
2261
2262 _IRQL_requires_max_(PASSIVE_LEVEL)
2263 typedef NTSTATUS
2264 (NTAPI *PFNKSPINSETDEVICESTATE)(
2265 _In_ PKSPIN Pin,
2266 _In_ KSSTATE ToState,
2267 _In_ KSSTATE FromState);
2268
2269 typedef struct _KSCLOCK_DISPATCH KSCLOCK_DISPATCH, *PKSCLOCK_DISPATCH;
2270 typedef struct _KSALLOCATOR_DISPATCH KSALLOCATOR_DISPATCH, *PKSALLOCATOR_DISPATCH;
2271
2272 typedef struct {
2273 PFNKSPINIRP Create;
2274 PFNKSPINIRP Close;
2275 PFNKSPIN Process;
2276 PFNKSPINVOID Reset;
2277 PFNKSPINSETDATAFORMAT SetDataFormat;
2278 PFNKSPINSETDEVICESTATE SetDeviceState;
2279 PFNKSPIN Connect;
2280 PFNKSPINVOID Disconnect;
2281 const KSCLOCK_DISPATCH* Clock;
2282 const KSALLOCATOR_DISPATCH* Allocator;
2283 } KSPIN_DISPATCH, *PKSPIN_DISPATCH;
2284
2285 _IRQL_requires_max_(DISPATCH_LEVEL)
2286 typedef BOOLEAN
2287 (NTAPI *PFNKSPINSETTIMER)(
2288 _In_ PKSPIN Pin,
2289 _In_ PKTIMER Timer,
2290 _In_ LARGE_INTEGER DueTime,
2291 _In_ PKDPC Dpc);
2292
2293 _IRQL_requires_max_(DISPATCH_LEVEL)
2294 typedef BOOLEAN
2295 (NTAPI *PFNKSPINCANCELTIMER)(
2296 _In_ PKSPIN Pin,
2297 _In_ PKTIMER Timer);
2298
2299 _IRQL_requires_max_(DISPATCH_LEVEL)
2300 typedef LONGLONG
2301 (FASTCALL *PFNKSPINCORRELATEDTIME)(
2302 _In_ PKSPIN Pin,
2303 _Out_ PLONGLONG SystemTime);
2304
2305 _IRQL_requires_max_(DISPATCH_LEVEL)
2306 typedef void
2307 (NTAPI *PFNKSPINRESOLUTION)(
2308 _In_ PKSPIN Pin,
2309 _Out_ PKSRESOLUTION Resolution);
2310
2311 struct _KSCLOCK_DISPATCH {
2312 PFNKSPINSETTIMER SetTimer;
2313 PFNKSPINCANCELTIMER CancelTimer;
2314 PFNKSPINCORRELATEDTIME CorrelatedTime;
2315 PFNKSPINRESOLUTION Resolution;
2316 };
2317
2318 _IRQL_requires_max_(PASSIVE_LEVEL)
2319 typedef NTSTATUS
2320 (NTAPI *PFNKSPININITIALIZEALLOCATOR)(
2321 _In_ PKSPIN Pin,
2322 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
2323 _Out_ PVOID *Context);
2324
2325 typedef PVOID
2326 (NTAPI *PFNKSDELETEALLOCATOR)(
2327 _In_ PVOID Context);
2328
2329 typedef PVOID
2330 (NTAPI *PFNKSDEFAULTALLOCATE)(
2331 _In_ PVOID Context);
2332
2333 typedef PVOID
2334 (NTAPI *PFNKSDEFAULTFREE)(
2335 _In_ PVOID Context,
2336 _In_ PVOID Buffer);
2337
2338 struct _KSALLOCATOR_DISPATCH {
2339 PFNKSPININITIALIZEALLOCATOR InitializeAllocator;
2340 PFNKSDELETEALLOCATOR DeleteAllocator;
2341 PFNKSDEFAULTALLOCATE Allocate;
2342 PFNKSDEFAULTFREE Free;
2343 };
2344
2345 typedef struct KSAUTOMATION_TABLE_ {
2346 ULONG PropertySetsCount;
2347 ULONG PropertyItemSize;
2348 _Field_size_bytes_(PropertySetsCount * PropertyItemSize) const KSPROPERTY_SET *PropertySets;
2349 ULONG MethodSetsCount;
2350 ULONG MethodItemSize;
2351 _Field_size_bytes_(MethodSetsCount * MethodItemSize) const KSMETHOD_SET *MethodSets;
2352 ULONG EventSetsCount;
2353 ULONG EventItemSize;
2354 _Field_size_bytes_(EventSetsCount * EventItemSize) const KSEVENT_SET *EventSets;
2355 #if !defined(_WIN64)
2356 PVOID Alignment;
2357 #endif
2358 } KSAUTOMATION_TABLE, *PKSAUTOMATION_TABLE;
2359
2360 typedef struct {
2361 ULONG InterfacesCount;
2362 _Field_size_(InterfacesCount) const KSPIN_INTERFACE *Interfaces;
2363 ULONG MediumsCount;
2364 _Field_size_(MediumsCount) const KSPIN_MEDIUM *Mediums;
2365 ULONG DataRangesCount;
2366 _Field_size_(DataRangesCount) const PKSDATARANGE *DataRanges;
2367 KSPIN_DATAFLOW DataFlow;
2368 KSPIN_COMMUNICATION Communication;
2369 const GUID *Category;
2370 const GUID *Name;
2371 union {
2372 LONGLONG Reserved;
2373 struct {
2374 ULONG ConstrainedDataRangesCount;
2375 _Field_size_(ConstrainedDataRangesCount) PKSDATARANGE *ConstrainedDataRanges;
2376 };
2377 };
2378 } KSPIN_DESCRIPTOR, *PKSPIN_DESCRIPTOR;
2379
2380 _Must_inspect_result_
2381 _IRQL_requires_max_(PASSIVE_LEVEL)
2382 typedef NTSTATUS
2383 (NTAPI *PFNKSINTERSECTHANDLER)(
2384 _In_ PIRP Irp,
2385 _In_ PKSP_PIN Pin,
2386 _In_ PKSDATARANGE DataRange,
2387 _Out_opt_ PVOID Data);
2388
2389 _Must_inspect_result_
2390 _IRQL_requires_max_(PASSIVE_LEVEL)
2391 typedef NTSTATUS
2392 (NTAPI *PFNKSINTERSECTHANDLEREX)(
2393 _In_ PVOID Context,
2394 _In_ PIRP Irp,
2395 _In_ PKSP_PIN Pin,
2396 _In_ PKSDATARANGE DataRange,
2397 _In_ PKSDATARANGE MatchingDataRange,
2398 _In_ ULONG DataBufferSize,
2399 _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data,
2400 _Out_ PULONG DataSize);
2401
2402 typedef struct {
2403 const KSPIN_DISPATCH* Dispatch;
2404 const KSAUTOMATION_TABLE* AutomationTable;
2405 KSPIN_DESCRIPTOR PinDescriptor;
2406 ULONG Flags;
2407 ULONG InstancesPossible;
2408 ULONG InstancesNecessary;
2409 const KSALLOCATOR_FRAMING_EX* AllocatorFraming;
2410 PFNKSINTERSECTHANDLEREX IntersectHandler;
2411 } KSPIN_DESCRIPTOR_EX, *PKSPIN_DESCRIPTOR_EX;
2412
2413 #define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001
2414 #define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002
2415 #define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004
2416 #define KSFILTER_FLAG_RECEIVE_ZERO_LENGTH_SAMPLES 0x00000008
2417 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
2418 #define KSFILTER_FLAG_DENY_USERMODE_ACCESS 0x80000000
2419 #endif
2420
2421 #define KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING
2422 #define KSPIN_FLAG_CRITICAL_PROCESSING KSFILTER_FLAG_CRITICAL_PROCESSING
2423 #define KSPIN_FLAG_HYPERCRITICAL_PROCESSING KSFILTER_FLAG_HYPERCRITICAL_PROCESSING
2424
2425 #define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008
2426 #define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010
2427 #define KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL 0x00000020
2428 #define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040
2429 #define KSPIN_FLAG_ENFORCE_FIFO 0x00000080
2430
2431 #define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100
2432 #define KSPIN_FLAG_DISTINCT_TRAILING_EDGE 0x00000200
2433
2434 #define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000
2435 #define KSPIN_FLAG_SPLITTER 0x00020000
2436 #define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000
2437 #define KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT 0x00080000
2438 #define KSPIN_FLAG_FIXED_FORMAT 0x00100000
2439 #define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000
2440
2441 #define KSPIN_FLAG_RENDERER (KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY|KSPIN_FLAG_GENERATE_EOS_EVENTS)
2442
2443 #define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000
2444 #define KSPIN_FLAG_SOME_FRAMES_REQUIRED_FOR_PROCESSING 0x00800000
2445 #define KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE 0x01000000
2446 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
2447 #define KSPIN_FLAG_DENY_USERMODE_ACCESS 0x80000000
2448 #endif
2449
2450 struct _KSPIN {
2451 const KSPIN_DESCRIPTOR_EX *Descriptor;
2452 KSOBJECT_BAG Bag;
2453 PVOID Context;
2454 ULONG Id;
2455 KSPIN_COMMUNICATION Communication;
2456 BOOLEAN ConnectionIsExternal;
2457 KSPIN_INTERFACE ConnectionInterface;
2458 KSPIN_MEDIUM ConnectionMedium;
2459 KSPRIORITY ConnectionPriority;
2460 PKSDATAFORMAT ConnectionFormat;
2461 PKSMULTIPLE_ITEM AttributeList;
2462 ULONG StreamHeaderSize;
2463 KSPIN_DATAFLOW DataFlow;
2464 KSSTATE DeviceState;
2465 KSRESET ResetState;
2466 KSSTATE ClientState;
2467 };
2468
2469 #define DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(Handler)\
2470 DEFINE_KSPROPERTY_ITEM(\
2471 KSPROPERTY_PIN_CINSTANCES,\
2472 (Handler),\
2473 sizeof(KSP_PIN),\
2474 sizeof(KSPIN_CINSTANCES),\
2475 NULL, NULL, 0, NULL, NULL, 0)
2476
2477 #define DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(Handler)\
2478 DEFINE_KSPROPERTY_ITEM(\
2479 KSPROPERTY_PIN_CTYPES,\
2480 (Handler),\
2481 sizeof(KSPROPERTY),\
2482 sizeof(ULONG),\
2483 NULL, NULL, 0, NULL, NULL, 0)
2484
2485 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(Handler)\
2486 DEFINE_KSPROPERTY_ITEM(\
2487 KSPROPERTY_PIN_DATAFLOW,\
2488 (Handler),\
2489 sizeof(KSP_PIN),\
2490 sizeof(KSPIN_DATAFLOW),\
2491 NULL, NULL, 0, NULL, NULL, 0)
2492
2493 #define DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(Handler)\
2494 DEFINE_KSPROPERTY_ITEM(\
2495 KSPROPERTY_PIN_DATARANGES,\
2496 (Handler),\
2497 sizeof(KSP_PIN),\
2498 0,\
2499 NULL, NULL, 0, NULL, NULL, 0)
2500
2501 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(Handler)\
2502 DEFINE_KSPROPERTY_ITEM(\
2503 KSPROPERTY_PIN_DATAINTERSECTION,\
2504 (Handler),\
2505 sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM),\
2506 0,\
2507 NULL, NULL, 0, NULL, NULL, 0)
2508
2509 #define DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(Handler)\
2510 DEFINE_KSPROPERTY_ITEM(\
2511 KSPROPERTY_PIN_INTERFACES,\
2512 (Handler),\
2513 sizeof(KSP_PIN),\
2514 0,\
2515 NULL, NULL, 0, NULL, NULL, 0)
2516
2517 #define DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(Handler)\
2518 DEFINE_KSPROPERTY_ITEM(\
2519 KSPROPERTY_PIN_MEDIUMS,\
2520 (Handler),\
2521 sizeof(KSP_PIN),\
2522 0,\
2523 NULL, NULL, 0, NULL, NULL, 0)
2524
2525 #define DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(Handler)\
2526 DEFINE_KSPROPERTY_ITEM(\
2527 KSPROPERTY_PIN_COMMUNICATION,\
2528 (Handler),\
2529 sizeof(KSP_PIN),\
2530 sizeof(KSPIN_COMMUNICATION),\
2531 NULL, NULL, 0, NULL, NULL, 0)
2532
2533 #define DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(Handler)\
2534 DEFINE_KSPROPERTY_ITEM(\
2535 KSPROPERTY_PIN_GLOBALCINSTANCES,\
2536 (Handler),\
2537 sizeof(KSP_PIN),\
2538 sizeof(KSPIN_CINSTANCES),\
2539 NULL, NULL, 0, NULL, NULL, 0)
2540
2541 #define DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(Handler)\
2542 DEFINE_KSPROPERTY_ITEM(\
2543 KSPROPERTY_PIN_NECESSARYINSTANCES,\
2544 (Handler),\
2545 sizeof(KSP_PIN),\
2546 sizeof(ULONG),\
2547 NULL, NULL, 0, NULL, NULL, 0)
2548
2549 #define DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(Handler)\
2550 DEFINE_KSPROPERTY_ITEM(\
2551 KSPROPERTY_PIN_PHYSICALCONNECTION,\
2552 (Handler),\
2553 sizeof(KSP_PIN),\
2554 0,\
2555 NULL, NULL, 0, NULL, NULL, 0)
2556
2557 #define DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(Handler)\
2558 DEFINE_KSPROPERTY_ITEM(\
2559 KSPROPERTY_PIN_CATEGORY,\
2560 (Handler),\
2561 sizeof(KSP_PIN),\
2562 sizeof(GUID),\
2563 NULL, NULL, 0, NULL, NULL, 0)
2564
2565 #define DEFINE_KSPROPERTY_ITEM_PIN_NAME(Handler)\
2566 DEFINE_KSPROPERTY_ITEM(\
2567 KSPROPERTY_PIN_NAME,\
2568 (Handler),\
2569 sizeof(KSP_PIN),\
2570 0,\
2571 NULL, NULL, 0, NULL, NULL, 0)
2572
2573 #define DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(Handler)\
2574 DEFINE_KSPROPERTY_ITEM(\
2575 KSPROPERTY_PIN_CONSTRAINEDDATARANGES,\
2576 (Handler),\
2577 sizeof(KSP_PIN),\
2578 0,\
2579 NULL, NULL, 0, NULL, NULL, 0)
2580
2581 #define DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(Handler)\
2582 DEFINE_KSPROPERTY_ITEM(\
2583 KSPROPERTY_PIN_PROPOSEDATAFORMAT,\
2584 NULL,\
2585 sizeof(KSP_PIN),\
2586 sizeof(KSDATAFORMAT),\
2587 (Handler), NULL, 0, NULL, NULL, 0)
2588
2589 #define DEFINE_KSPROPERTY_PINSET(PinSet,\
2590 PropGeneral, PropInstances, PropIntersection)\
2591 DEFINE_KSPROPERTY_TABLE(PinSet) {\
2592 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
2593 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
2594 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
2595 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
2596 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
2597 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
2598 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
2599 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
2600 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
2601 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral)\
2602 }
2603
2604 #define DEFINE_KSPROPERTY_PINSETCONSTRAINED(PinSet,\
2605 PropGeneral, PropInstances, PropIntersection)\
2606 DEFINE_KSPROPERTY_TABLE(PinSet) {\
2607 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
2608 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
2609 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
2610 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
2611 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
2612 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
2613 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
2614 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
2615 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
2616 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
2617 DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral)\
2618 }
2619
2620 typedef void
2621 (NTAPI *PFNKSFREE)(
2622 _In_ PVOID Data);
2623
2624 #define DEFINE_KSPROPERTY_TABLE(tablename) \
2625 const KSPROPERTY_ITEM tablename[] =
2626
2627 #endif /* _NTDDK_ */
2628
2629 typedef struct {
2630 KSPIN_INTERFACE Interface;
2631 KSPIN_MEDIUM Medium;
2632 ULONG PinId;
2633 HANDLE PinToHandle;
2634 KSPRIORITY Priority;
2635 } KSPIN_CONNECT, *PKSPIN_CONNECT;
2636
2637 /* ===============================================================
2638 Topology
2639 */
2640
2641 typedef struct {
2642 ULONG FromNode;
2643 ULONG FromNodePin;
2644 ULONG ToNode;
2645 ULONG ToNodePin;
2646 } KSTOPOLOGY_CONNECTION, *PKSTOPOLOGY_CONNECTION;
2647
2648 typedef struct {
2649 ULONG CategoriesCount;
2650 _Field_size_(CategoriesCount) const GUID *Categories;
2651 ULONG TopologyNodesCount;
2652 _Field_size_(TopologyNodesCount) const GUID *TopologyNodes;
2653 ULONG TopologyConnectionsCount;
2654 _Field_size_(TopologyConnectionsCount) const KSTOPOLOGY_CONNECTION *TopologyConnections;
2655 _Field_size_(TopologyNodesCount) const GUID *TopologyNodesNames;
2656 ULONG Reserved;
2657 } KSTOPOLOGY, *PKSTOPOLOGY;
2658
2659
2660 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler)\
2661 DEFINE_KSPROPERTY_ITEM(\
2662 KSPROPERTY_TOPOLOGY_CATEGORIES,\
2663 (Handler),\
2664 sizeof(KSPROPERTY),\
2665 0,\
2666 NULL, NULL, 0, NULL, NULL, 0)
2667
2668 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler)\
2669 DEFINE_KSPROPERTY_ITEM(\
2670 KSPROPERTY_TOPOLOGY_NODES,\
2671 (Handler),\
2672 sizeof(KSPROPERTY),\
2673 0,\
2674 NULL, NULL, 0, NULL, NULL, 0)
2675
2676 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler)\
2677 DEFINE_KSPROPERTY_ITEM(\
2678 KSPROPERTY_TOPOLOGY_CONNECTIONS,\
2679 (Handler),\
2680 sizeof(KSPROPERTY),\
2681 0,\
2682 NULL, NULL, 0, NULL, NULL, 0)
2683
2684 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
2685 DEFINE_KSPROPERTY_ITEM(\
2686 KSPROPERTY_TOPOLOGY_NAME,\
2687 (Handler),\
2688 sizeof(KSP_NODE),\
2689 0,\
2690 NULL, NULL, 0, NULL, NULL, 0)
2691
2692 #define DEFINE_KSPROPERTY_TOPOLOGYSET(TopologySet, Handler)\
2693 DEFINE_KSPROPERTY_TABLE(TopologySet) {\
2694 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler),\
2695 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler),\
2696 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler),\
2697 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
2698 }
2699
2700 /* ===============================================================
2701 ??? SORT ME
2702 */
2703
2704 /* TODO */
2705 typedef void* UNKNOWN;
2706
2707 typedef PVOID
2708 (NTAPI *PFNKSINITIALIZEALLOCATOR)(
2709 _In_ PVOID InitialContext,
2710 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
2711 _Outptr_ PVOID *Context);
2712
2713 #if defined(_NTDDK_)
2714
2715 _IRQL_requires_max_(PASSIVE_LEVEL)
2716 typedef NTSTATUS
2717 (NTAPI *PFNKSALLOCATOR)(
2718 _In_ PIRP Irp,
2719 _In_ ULONG BufferSize,
2720 _In_ BOOLEAN InputOperation);
2721
2722 _Must_inspect_result_
2723 _IRQL_requires_max_(PASSIVE_LEVEL)
2724 typedef NTSTATUS
2725 (NTAPI *PFNKINTERSECTHANDLEREX)(
2726 _In_ PVOID Context,
2727 _In_ PIRP Irp,
2728 _In_ PKSP_PIN Pin,
2729 _In_ PKSDATARANGE DataRange,
2730 _In_ PKSDATARANGE MatchingDataRange,
2731 _In_ ULONG DataBufferSize,
2732 _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data,
2733 _Out_ PULONG DataSize);
2734
2735 typedef NTSTATUS
2736 (NTAPI *PFNALLOCATOR_ALLOCATEFRAME)(
2737 _In_ PFILE_OBJECT FileObject,
2738 _Outptr_ PVOID *Frame);
2739
2740 typedef VOID
2741 (NTAPI *PFNALLOCATOR_FREEFRAME)(
2742 _In_ PFILE_OBJECT FileObject,
2743 _In_ PVOID Frame);
2744
2745 typedef struct {
2746 PFNALLOCATOR_ALLOCATEFRAME AllocateFrame;
2747 PFNALLOCATOR_FREEFRAME FreeFrame;
2748 } KSSTREAMALLOCATOR_FUNCTIONTABLE, *PKSSTREAMALLOCATOR_FUNCTIONTABLE;
2749
2750 #endif /* _NTDDK_ */
2751
2752 typedef struct {
2753 KSALLOCATOR_FRAMING Framing;
2754 ULONG AllocatedFrames;
2755 ULONG Reserved;
2756 } KSSTREAMALLOCATOR_STATUS, *PKSSTREAMALLOCATOR_STATUS;
2757
2758 typedef struct {
2759 KSALLOCATOR_FRAMING_EX Framing;
2760 ULONG AllocatedFrames;
2761 ULONG Reserved;
2762 } KSSTREAMALLOCATOR_STATUS_EX, *PKSSTREAMALLOCATOR_STATUS_EX;
2763
2764 typedef struct {
2765 ULONG Size;
2766 ULONG TypeSpecificFlags;
2767 KSTIME PresentationTime;
2768 LONGLONG Duration;
2769 ULONG FrameExtent;
2770 ULONG DataUsed;
2771 PVOID Data;
2772 ULONG OptionsFlags;
2773 #ifdef _WIN64
2774 ULONG Reserved;
2775 #endif
2776 } KSSTREAM_HEADER, *PKSSTREAM_HEADER;
2777
2778 #define KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT 0x00000001
2779 #define KSSTREAM_HEADER_OPTIONSF_PREROLL 0x00000002
2780 #define KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY 0x00000004
2781 #define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED 0x00000008
2782 #define KSSTREAM_HEADER_OPTIONSF_TIMEVALID 0x00000010
2783 #define KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY 0x00000040
2784 #define KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE 0x00000080
2785 #define KSSTREAM_HEADER_OPTIONSF_DURATIONVALID 0x00000100
2786 #define KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM 0x00000200
2787 #define KSSTREAM_HEADER_OPTIONSF_BUFFEREDTRANSFER 0x00000400
2788 #define KSSTREAM_HEADER_OPTIONSF_VRAM_DATA_TRANSFER 0x00000800
2789 #define KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA 0x80000000
2790
2791 /* ===============================================================
2792 XP / DX8
2793 */
2794
2795 #if defined(_NTDDK_)
2796
2797 typedef struct _KSGATE KSGATE, *PKSGATE;
2798
2799 struct _KSGATE {
2800 LONG Count;
2801 PKSGATE NextGate;
2802 };
2803
2804 #ifndef _NTOS_
2805
2806 _IRQL_requires_max_(DISPATCH_LEVEL)
2807 KSDDKAPI
2808 PKSGATE
2809 NTAPI
2810 KsPinGetAndGate(
2811 _In_ PKSPIN Pin);
2812
2813 _IRQL_requires_max_(HIGH_LEVEL)
2814 static
2815 __inline
2816 void
2817 KsGateTurnInputOn(
2818 _In_opt_ PKSGATE Gate)
2819 {
2820 while (Gate && (InterlockedIncrement(&Gate->Count) == 1))
2821 {
2822 Gate = Gate->NextGate;
2823 }
2824 }
2825
2826 _IRQL_requires_max_(HIGH_LEVEL)
2827 static
2828 __inline
2829 void
2830 KsGateTurnInputOff(
2831 _In_opt_ PKSGATE Gate)
2832 {
2833 while (Gate && (InterlockedDecrement(&Gate->Count) == 0))
2834 {
2835 Gate = Gate->NextGate;
2836 }
2837 }
2838
2839 _IRQL_requires_max_(HIGH_LEVEL)
2840 static
2841 __inline
2842 BOOLEAN
2843 KsGateGetStateUnsafe(
2844 _In_ PKSGATE Gate)
2845 {
2846 ASSERT(Gate);
2847 return((BOOLEAN)(Gate->Count > 0));
2848 }
2849
2850 _IRQL_requires_max_(HIGH_LEVEL)
2851 static
2852 __inline
2853 BOOLEAN
2854 KsGateCaptureThreshold(
2855 _In_ PKSGATE Gate)
2856 {
2857 BOOLEAN captured;
2858
2859 ASSERT(Gate);
2860
2861 captured = (BOOLEAN)(InterlockedCompareExchange(&Gate->Count,0,1) == 1);
2862
2863 if (captured)
2864 {
2865 KsGateTurnInputOff(Gate->NextGate);
2866 }
2867
2868 return captured;
2869 }
2870
2871 _IRQL_requires_max_(HIGH_LEVEL)
2872 static
2873 __inline
2874 void
2875 KsGateInitialize(
2876 _In_ PKSGATE Gate,
2877 _In_ LONG InitialCount,
2878 _In_opt_ PKSGATE NextGate,
2879 _In_ BOOLEAN StateToPropagate)
2880 {
2881 ASSERT(Gate);
2882 Gate->Count = InitialCount;
2883 Gate->NextGate = NextGate;
2884
2885 if (NextGate)
2886 {
2887 if (InitialCount > 0)
2888 {
2889 if (StateToPropagate)
2890 {
2891 KsGateTurnInputOn(NextGate);
2892 }
2893 }
2894 else
2895 {
2896 if (!StateToPropagate)
2897 {
2898 KsGateTurnInputOff(NextGate);
2899 }
2900 }
2901 }
2902 }
2903
2904 _IRQL_requires_max_(HIGH_LEVEL)
2905 static
2906 __inline
2907 void
2908 KsGateInitializeAnd(
2909 _In_ PKSGATE AndGate,
2910 _In_opt_ PKSGATE NextOrGate)
2911 {
2912 KsGateInitialize(AndGate,1,NextOrGate,TRUE);
2913 }
2914
2915 _IRQL_requires_max_(HIGH_LEVEL)
2916 static
2917 __inline
2918 void
2919 KsGateInitializeOr(
2920 _In_ PKSGATE OrGate,
2921 _In_opt_ PKSGATE NextAndGate)
2922 {
2923 KsGateInitialize(OrGate,0,NextAndGate,FALSE);
2924 }
2925
2926 _IRQL_requires_max_(HIGH_LEVEL)
2927 static
2928 __inline
2929 void
2930 KsGateAddOnInputToAnd(
2931 _In_ PKSGATE AndGate)
2932 {
2933 UNREFERENCED_PARAMETER (AndGate);
2934 }
2935
2936 _IRQL_requires_max_(HIGH_LEVEL)
2937 static
2938 __inline
2939 void
2940 KsGateAddOffInputToAnd(
2941 _In_ PKSGATE AndGate)
2942 {
2943 KsGateTurnInputOff(AndGate);
2944 }
2945
2946 _IRQL_requires_max_(HIGH_LEVEL)
2947 static
2948 __inline
2949 void
2950 KsGateRemoveOnInputFromAnd(
2951 _In_ PKSGATE AndGate)
2952 {
2953 UNREFERENCED_PARAMETER (AndGate);
2954 }
2955
2956 _IRQL_requires_max_(HIGH_LEVEL)
2957 static
2958 __inline
2959 void
2960 KsGateRemoveOffInputFromAnd(
2961 _In_ PKSGATE AndGate)
2962 {
2963 KsGateTurnInputOn(AndGate);
2964 }
2965
2966 _IRQL_requires_max_(HIGH_LEVEL)
2967 static
2968 __inline
2969 void
2970 KsGateAddOnInputToOr(
2971 _In_ PKSGATE OrGate)
2972 {
2973 KsGateTurnInputOn(OrGate);
2974 }
2975
2976 _IRQL_requires_max_(HIGH_LEVEL)
2977 static
2978 __inline
2979 void
2980 KsGateAddOffInputToOr(
2981 _In_ PKSGATE OrGate)
2982 {
2983 UNREFERENCED_PARAMETER (OrGate);
2984 }
2985
2986 _IRQL_requires_max_(HIGH_LEVEL)
2987 static
2988 __inline
2989 void
2990 KsGateRemoveOnInputFromOr(
2991 _In_ PKSGATE OrGate)
2992 {
2993 KsGateTurnInputOff(OrGate);
2994 }
2995
2996 _IRQL_requires_max_(HIGH_LEVEL)
2997 static
2998 __inline
2999 void
3000 KsGateRemoveOffInputFromOr(
3001 _In_ PKSGATE OrGate)
3002 {
3003 UNREFERENCED_PARAMETER (OrGate);
3004 }
3005
3006 _IRQL_requires_max_(HIGH_LEVEL)
3007 static
3008 __inline
3009 void
3010 KsGateTerminateAnd(
3011 _In_ PKSGATE AndGate)
3012 {
3013 ASSERT(AndGate);
3014 if (KsGateGetStateUnsafe(AndGate))
3015 {
3016 KsGateRemoveOnInputFromOr(AndGate->NextGate);
3017 }
3018 else
3019 {
3020 KsGateRemoveOffInputFromOr(AndGate->NextGate);
3021 }
3022 }
3023
3024 _IRQL_requires_max_(HIGH_LEVEL)
3025 static
3026 __inline
3027 void
3028 KsGateTerminateOr(
3029 _In_ PKSGATE OrGate)
3030 {
3031 ASSERT(OrGate);
3032 if (KsGateGetStateUnsafe(OrGate))
3033 {
3034 KsGateRemoveOnInputFromAnd(OrGate->NextGate);
3035 }
3036 else
3037 {
3038 KsGateRemoveOffInputFromAnd(OrGate->NextGate);
3039 }
3040 }
3041
3042 #endif /* !_NTOS_ */
3043
3044 struct _KSMAPPING {
3045 PHYSICAL_ADDRESS PhysicalAddress;
3046 ULONG ByteCount;
3047 ULONG Alignment;
3048 };
3049
3050 #endif /* _NTDDK_ */
3051
3052 typedef enum {
3053 KSSTREAM_POINTER_STATE_UNLOCKED = 0,
3054 KSSTREAM_POINTER_STATE_LOCKED
3055 } KSSTREAM_POINTER_STATE;
3056
3057 typedef struct _KSPROCESSPIN_INDEXENTRY KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY;
3058
3059 struct _KSSTREAM_POINTER_OFFSET {
3060 #if defined(_NTDDK_)
3061 union {
3062 PUCHAR Data;
3063 PKSMAPPING Mappings;
3064 };
3065 #else
3066 PUCHAR Data;
3067 #endif
3068 #if !defined(_WIN64)
3069 PVOID Alignment;
3070 #endif
3071 ULONG Count;
3072 ULONG Remaining;
3073 };
3074
3075 #if defined(_NTDDK_)
3076
3077 struct _KSSTREAM_POINTER {
3078 PVOID Context;
3079 PKSPIN Pin;
3080 PKSSTREAM_HEADER StreamHeader;
3081 PKSSTREAM_POINTER_OFFSET Offset;
3082 KSSTREAM_POINTER_OFFSET OffsetIn;
3083 KSSTREAM_POINTER_OFFSET OffsetOut;
3084 };
3085
3086 struct _KSPROCESSPIN {
3087 PKSPIN Pin;
3088 PKSSTREAM_POINTER StreamPointer;
3089 PKSPROCESSPIN InPlaceCounterpart;
3090 PKSPROCESSPIN DelegateBranch;
3091 PKSPROCESSPIN CopySource;
3092 _Field_size_bytes_(BytesAvailable) PVOID Data;
3093 ULONG BytesAvailable;
3094 ULONG BytesUsed;
3095 ULONG Flags;
3096 BOOLEAN Terminate;
3097 };
3098
3099 struct _KSPROCESSPIN_INDEXENTRY {
3100 _Field_size_(Count) PKSPROCESSPIN *Pins;
3101 ULONG Count;
3102 };
3103
3104 #endif /* _NTDDK_ */
3105
3106 /* ===============================================================
3107 Device Dispatch
3108 */
3109
3110 #if defined(_NTDDK_)
3111
3112 typedef struct _KSFILTER_DISPATCH KSFILTER_DISPATCH, *PKSFILTER_DISPATCH;
3113 typedef struct _KSDEVICE KSDEVICE, *PKSDEVICE;
3114 typedef struct _KSFILTER KSFILTER, *PKSFILTER;
3115 typedef struct _KSNODE_DESCRIPTOR KSNODE_DESCRIPTOR, *PKSNODE_DESCRIPTOR;
3116 typedef struct _KSFILTER_DESCRIPTOR KSFILTER_DESCRIPTOR, *PKSFILTER_DESCRIPTOR;
3117 typedef struct _KSDEVICE_DESCRIPTOR KSDEVICE_DESCRIPTOR, *PKSDEVICE_DESCRIPTOR;
3118
3119 _IRQL_requires_max_(PASSIVE_LEVEL)
3120 typedef NTSTATUS
3121 (NTAPI *PFNKSDEVICECREATE)(
3122 _In_ PKSDEVICE Device);
3123
3124 _IRQL_requires_max_(PASSIVE_LEVEL)
3125 typedef NTSTATUS
3126 (NTAPI *PFNKSDEVICEPNPSTART)(
3127 _In_ PKSDEVICE Device,
3128 _In_ PIRP Irp,
3129 _In_opt_ PCM_RESOURCE_LIST TranslatedResourceList,
3130 _In_opt_ PCM_RESOURCE_LIST UntranslatedResourceList);
3131
3132 _IRQL_requires_max_(PASSIVE_LEVEL)
3133 typedef NTSTATUS
3134 (NTAPI *PFNKSDEVICE)(
3135 _In_ PKSDEVICE Device);
3136
3137 _IRQL_requires_max_(PASSIVE_LEVEL)
3138 typedef NTSTATUS
3139 (NTAPI *PFNKSDEVICEIRP)(
3140 _In_ PKSDEVICE Device,
3141 _In_ PIRP Irp);
3142
3143 _IRQL_requires_max_(PASSIVE_LEVEL)
3144 typedef VOID
3145 (NTAPI *PFNKSDEVICEIRPVOID)(
3146 _In_ PKSDEVICE Device,
3147 _In_ PIRP Irp);
3148
3149 _IRQL_requires_max_(PASSIVE_LEVEL)
3150 typedef NTSTATUS
3151 (NTAPI *PFNKSDEVICEQUERYCAPABILITIES)(
3152 _In_ PKSDEVICE Device,
3153 _In_ PIRP Irp,
3154 _Inout_ PDEVICE_CAPABILITIES Capabilities);
3155
3156 _IRQL_requires_max_(PASSIVE_LEVEL)
3157 typedef NTSTATUS
3158 (NTAPI *PFNKSDEVICEQUERYPOWER)(
3159 _In_ PKSDEVICE Device,
3160 _In_ PIRP Irp,
3161 _In_ DEVICE_POWER_STATE DeviceTo,
3162 _In_ DEVICE_POWER_STATE DeviceFrom,
3163 _In_ SYSTEM_POWER_STATE SystemTo,
3164 _In_ SYSTEM_POWER_STATE SystemFrom,
3165 _In_ POWER_ACTION Action);
3166
3167 _IRQL_requires_max_(PASSIVE_LEVEL)
3168 typedef VOID
3169 (NTAPI *PFNKSDEVICESETPOWER)(
3170 _In_ PKSDEVICE Device,
3171 _In_ PIRP Irp,
3172 _In_ DEVICE_POWER_STATE To,
3173 _In_ DEVICE_POWER_STATE From);
3174
3175 typedef struct _KSDEVICE_DISPATCH {
3176 PFNKSDEVICECREATE Add;
3177 PFNKSDEVICEPNPSTART Start;
3178 PFNKSDEVICE PostStart;
3179 PFNKSDEVICEIRP QueryStop;
3180 PFNKSDEVICEIRPVOID CancelStop;
3181 PFNKSDEVICEIRPVOID Stop;
3182 PFNKSDEVICEIRP QueryRemove;
3183 PFNKSDEVICEIRPVOID CancelRemove;
3184 PFNKSDEVICEIRPVOID Remove;
3185 PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities;
3186 PFNKSDEVICEIRPVOID SurpriseRemoval;
3187 PFNKSDEVICEQUERYPOWER QueryPower;
3188 PFNKSDEVICESETPOWER SetPower;
3189 PFNKSDEVICEIRP QueryInterface;
3190 } KSDEVICE_DISPATCH, *PKSDEVICE_DISPATCH;
3191
3192 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
3193 #define KSDEVICE_DESCRIPTOR_VERSION_2 (0x110)
3194 #define MIN_DEV_VER_FOR_FLAGS (0x110)
3195 #endif
3196
3197 struct _KSDEVICE {
3198 const KSDEVICE_DESCRIPTOR* Descriptor;
3199 KSOBJECT_BAG Bag;
3200 PVOID Context;
3201 PDEVICE_OBJECT FunctionalDeviceObject;
3202 PDEVICE_OBJECT PhysicalDeviceObject;
3203 PDEVICE_OBJECT NextDeviceObject;
3204 BOOLEAN Started;
3205 SYSTEM_POWER_STATE SystemPowerState;
3206 DEVICE_POWER_STATE DevicePowerState;
3207 };
3208
3209 #endif /* _NTDDK_ */
3210
3211 /* ===============================================================
3212 Filter Dispatch
3213 */
3214
3215 #if defined(_NTDDK_)
3216
3217 struct _KSFILTER {
3218 const KSFILTER_DESCRIPTOR* Descriptor;
3219 KSOBJECT_BAG Bag;
3220 PVOID Context;
3221 };
3222
3223 _IRQL_requires_max_(PASSIVE_LEVEL)
3224 typedef void
3225 (NTAPI *PFNKSFILTERPOWER)(
3226 _In_ PKSFILTER Filter,
3227 _In_ DEVICE_POWER_STATE State);
3228
3229 _IRQL_requires_max_(PASSIVE_LEVEL)
3230 typedef NTSTATUS
3231 (NTAPI *PFNKSFILTERIRP)(
3232 _In_ PKSFILTER Filter,
3233 _In_ PIRP Irp);
3234
3235 typedef NTSTATUS
3236 (NTAPI *PFNKSFILTERPROCESS)(
3237 _In_ PKSFILTER Filter,
3238 _In_ PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex);
3239
3240 _IRQL_requires_max_(PASSIVE_LEVEL)
3241 typedef NTSTATUS
3242 (NTAPI *PFNKSFILTERVOID)(
3243 _In_ PKSFILTER Filter);
3244
3245 struct _KSFILTER_DISPATCH {
3246 PFNKSFILTERIRP Create;
3247 PFNKSFILTERIRP Close;
3248 PFNKSFILTERPROCESS Process;
3249 PFNKSFILTERVOID Reset;
3250 };
3251
3252 struct _KSNODE_DESCRIPTOR {
3253 const KSAUTOMATION_TABLE *AutomationTable;
3254 const GUID *Type;
3255 const GUID *Name;
3256 #if !defined(_WIN64)
3257 PVOID Alignment;
3258 #endif
3259 };
3260
3261 struct _KSFILTER_DESCRIPTOR {
3262 const KSFILTER_DISPATCH *Dispatch;
3263 const KSAUTOMATION_TABLE *AutomationTable;
3264 ULONG Version;
3265 ULONG Flags;
3266 const GUID *ReferenceGuid;
3267 ULONG PinDescriptorsCount;
3268 ULONG PinDescriptorSize;
3269 _Field_size_bytes_(PinDescriptorsCount * PinDescriptorSize) const KSPIN_DESCRIPTOR_EX *PinDescriptors;
3270 ULONG CategoriesCount;
3271 _Field_size_(CategoriesCount) const GUID *Categories;
3272 ULONG NodeDescriptorsCount;
3273 ULONG NodeDescriptorSize;
3274 _Field_size_bytes_(NodeDescriptorsCount * NodeDescriptorSize) const KSNODE_DESCRIPTOR *NodeDescriptors;
3275 ULONG ConnectionsCount;
3276 _Field_size_(ConnectionsCount) const KSTOPOLOGY_CONNECTION *Connections;
3277 const KSCOMPONENTID *ComponentId;
3278 };
3279
3280 #define KSFILTER_DESCRIPTOR_VERSION ((ULONG)-1)
3281
3282 struct _KSDEVICE_DESCRIPTOR {
3283 const KSDEVICE_DISPATCH *Dispatch;
3284 ULONG FilterDescriptorsCount;
3285 _Field_size_(FilterDescriptorsCount) const KSFILTER_DESCRIPTOR * const *FilterDescriptors;
3286 ULONG Version;
3287 ULONG Flags;
3288 };
3289
3290 struct _KSFILTERFACTORY {
3291 const KSFILTER_DESCRIPTOR* FilterDescriptor;
3292 KSOBJECT_BAG Bag;
3293 PVOID Context;
3294 };
3295
3296 #define DEFINE_KSFILTER_DESCRIPTOR(descriptor)\
3297 const KSFILTER_DESCRIPTOR descriptor =
3298
3299 #define DEFINE_KSFILTER_PIN_DESCRIPTORS(table)\
3300 SIZEOF_ARRAY(table),\
3301 sizeof(table[0]),\
3302 table
3303
3304 #define DEFINE_KSFILTER_CATEGORIES(table)\
3305 SIZEOF_ARRAY(table),\
3306 table
3307
3308 #define DEFINE_KSFILTER_CATEGORY(category)\
3309 1,\
3310 &(category)
3311
3312 #define DEFINE_KSFILTER_CATEGORIES_NULL\
3313 0,\
3314 NULL
3315
3316 #define DEFINE_KSFILTER_NODE_DESCRIPTORS(table)\
3317 SIZEOF_ARRAY(table),\
3318 sizeof(table[0]),\
3319 table
3320
3321 #define DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL\
3322 0,\
3323 sizeof(KSNODE_DESCRIPTOR),\
3324 NULL
3325
3326 #define DEFINE_KSFILTER_CONNECTIONS(table)\
3327 SIZEOF_ARRAY(table),\
3328 table
3329
3330 #define DEFINE_KSFILTER_DEFAULT_CONNECTIONS\
3331 0,\
3332 NULL
3333
3334 #endif /* _NTDDK_ */
3335
3336 /* ===============================================================
3337 Minidriver Callbacks
3338 */
3339
3340 #if defined(_NTDDK_)
3341
3342 typedef NTSTATUS
3343 (NTAPI *KStrMethodHandler)(
3344 IN PIRP Irp,
3345 IN PKSIDENTIFIER Request,
3346 IN OUT PVOID Data);
3347
3348 typedef NTSTATUS
3349 (NTAPI *KStrSupportHandler)(
3350 IN PIRP Irp,
3351 IN PKSIDENTIFIER Request,
3352 IN OUT PVOID Data);
3353
3354 #endif
3355
3356 /* ===============================================================
3357 Allocator Functions
3358 */
3359
3360 #if defined(_NTDDK_)
3361
3362 _IRQL_requires_max_(PASSIVE_LEVEL)
3363 KSDDKAPI
3364 NTSTATUS
3365 NTAPI
3366 KsCreateAllocator(
3367 _In_ HANDLE ConnectionHandle,
3368 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
3369 _Out_ PHANDLE AllocatorHandle);
3370
3371 _IRQL_requires_max_(PASSIVE_LEVEL)
3372 KSDDKAPI
3373 NTSTATUS
3374 NTAPI
3375 KsCreateDefaultAllocator(
3376 _In_ PIRP Irp);
3377
3378 _IRQL_requires_max_(PASSIVE_LEVEL)
3379 KSDDKAPI
3380 NTSTATUS
3381 NTAPI
3382 KsValidateAllocatorCreateRequest(
3383 _In_ PIRP Irp,
3384 _Out_ PKSALLOCATOR_FRAMING *AllocatorFraming);
3385
3386 _IRQL_requires_max_(PASSIVE_LEVEL)
3387 KSDDKAPI
3388 NTSTATUS
3389 NTAPI
3390 KsCreateDefaultAllocatorEx(
3391 _In_ PIRP Irp,
3392 _In_opt_ PVOID InitializeContext,
3393 _In_opt_ PFNKSDEFAULTALLOCATE DefaultAllocate,
3394 _In_opt_ PFNKSDEFAULTFREE DefaultFree,
3395 _In_opt_ PFNKSINITIALIZEALLOCATOR InitializeAllocator,
3396 _In_opt_ PFNKSDELETEALLOCATOR DeleteAllocator);
3397
3398 _IRQL_requires_max_(PASSIVE_LEVEL)
3399 KSDDKAPI
3400 NTSTATUS
3401 NTAPI
3402 KsValidateAllocatorFramingEx(
3403 _In_ PKSALLOCATOR_FRAMING_EX Framing,
3404 _In_ ULONG BufferSize,
3405 _In_ const KSALLOCATOR_FRAMING_EX *PinFraming);
3406
3407 #endif /* _NTDDK_ */
3408
3409 /* ===============================================================
3410 Clock Functions
3411 */
3412
3413 #if defined(_NTDDK_)
3414
3415 _IRQL_requires_max_(DISPATCH_LEVEL)
3416 typedef BOOLEAN
3417 (NTAPI *PFNKSSETTIMER)(
3418 _In_ PVOID Context,
3419 _In_ PKTIMER Timer,
3420 _In_ LARGE_INTEGER DueTime,
3421 _In_ PKDPC Dpc);
3422
3423 _IRQL_requires_max_(DISPATCH_LEVEL)
3424 typedef BOOLEAN
3425 (NTAPI *PFNKSCANCELTIMER)(
3426 _In_ PVOID Context,
3427 _In_ PKTIMER Timer);
3428
3429 typedef LONGLONG
3430 (FASTCALL *PFNKSCORRELATEDTIME)(
3431 _In_ PVOID Context,
3432 _Out_ PLONGLONG SystemTime);
3433
3434 _IRQL_requires_max_(PASSIVE_LEVEL)
3435 KSDDKAPI
3436 NTSTATUS
3437 NTAPI
3438 KsCreateClock(
3439 _In_ HANDLE ConnectionHandle,
3440 _In_ PKSCLOCK_CREATE ClockCreate,
3441 _Out_ PHANDLE ClockHandle);
3442
3443 _IRQL_requires_max_(PASSIVE_LEVEL)
3444 KSDDKAPI
3445 NTSTATUS
3446 NTAPI
3447 KsCreateDefaultClock(
3448 _In_ PIRP Irp,
3449 _In_ PKSDEFAULTCLOCK DefaultClock);
3450
3451 _IRQL_requires_max_(PASSIVE_LEVEL)
3452 KSDDKAPI
3453 NTSTATUS
3454 NTAPI
3455 KsAllocateDefaultClock(
3456 _Out_ PKSDEFAULTCLOCK *DefaultClock);
3457
3458 _IRQL_requires_max_(PASSIVE_LEVEL)
3459 KSDDKAPI
3460 NTSTATUS
3461 NTAPI
3462 KsAllocateDefaultClockEx(
3463 _Out_ PKSDEFAULTCLOCK *DefaultClock,
3464 _In_opt_ PVOID Context,
3465 _In_opt_ PFNKSSETTIMER SetTimer,
3466 _In_opt_ PFNKSCANCELTIMER CancelTimer,
3467 _In_opt_ PFNKSCORRELATEDTIME CorrelatedTime,
3468 _In_opt_ const KSRESOLUTION *Resolution,
3469 _In_ ULONG Flags);
3470
3471 _IRQL_requires_max_(PASSIVE_LEVEL)
3472 KSDDKAPI
3473 VOID
3474 NTAPI
3475 KsFreeDefaultClock(
3476 _In_ PKSDEFAULTCLOCK DefaultClock);
3477
3478 _IRQL_requires_max_(PASSIVE_LEVEL)
3479 KSDDKAPI
3480 NTSTATUS
3481 NTAPI
3482 KsValidateClockCreateRequest(
3483 _In_ PIRP Irp,
3484 _Outptr_ PKSCLOCK_CREATE *ClockCreate);
3485
3486 _IRQL_requires_max_(DISPATCH_LEVEL)
3487 KSDDKAPI
3488 KSSTATE
3489 NTAPI
3490 KsGetDefaultClockState(
3491 _In_ PKSDEFAULTCLOCK DefaultClock);
3492
3493 _IRQL_requires_max_(DISPATCH_LEVEL)
3494 KSDDKAPI
3495 VOID
3496 NTAPI
3497 KsSetDefaultClockState(
3498 _In_ PKSDEFAULTCLOCK DefaultClock,
3499 _In_ KSSTATE State);
3500
3501 _IRQL_requires_max_(DISPATCH_LEVEL)
3502 KSDDKAPI
3503 LONGLONG
3504 NTAPI
3505 KsGetDefaultClockTime(
3506 _In_ PKSDEFAULTCLOCK DefaultClock);
3507
3508 _IRQL_requires_max_(DISPATCH_LEVEL)
3509 KSDDKAPI
3510 VOID
3511 NTAPI
3512 KsSetDefaultClockTime(
3513 _In_ PKSDEFAULTCLOCK DefaultClock,
3514 _In_ LONGLONG Time);
3515
3516 #endif /* _NTDDK_ */
3517
3518 /* ===============================================================
3519 Method Functions
3520 */
3521
3522 /* Method sets - TODO: Make into macros! */
3523 #if defined(_NTDDK_)
3524
3525 #if 0
3526
3527 VOID
3528 KSMETHOD_SET_IRP_STORAGE(
3529 IN IRP Irp);
3530
3531 VOID
3532 KSMETHOD_ITEM_IRP_STORAGE(
3533 IN IRP Irp);
3534
3535 VOID
3536 KSMETHOD_TYPE_IRP_STORAGE(
3537 IN IRP Irp);
3538
3539 #endif
3540
3541 _IRQL_requires_max_(PASSIVE_LEVEL)
3542 KSDDKAPI
3543 NTSTATUS
3544 NTAPI
3545 KsMethodHandler(
3546 _In_ PIRP Irp,
3547 _In_ ULONG MethodSetsCount,
3548 _In_reads_(MethodSetsCount) const KSMETHOD_SET* MethodSet);
3549
3550 _IRQL_requires_max_(PASSIVE_LEVEL)
3551 KSDDKAPI
3552 NTSTATUS
3553 NTAPI
3554 KsMethodHandlerWithAllocator(
3555 _In_ PIRP Irp,
3556 _In_ ULONG MethodSetsCount,
3557 _In_reads_(MethodSetsCount) const KSMETHOD_SET* MethodSet,
3558 _In_opt_ PFNKSALLOCATOR Allocator,
3559 _In_opt_ ULONG MethodItemSize);
3560
3561 _IRQL_requires_max_(PASSIVE_LEVEL)
3562 KSDDKAPI
3563 BOOLEAN
3564 NTAPI
3565 KsFastMethodHandler(
3566 _In_ PFILE_OBJECT FileObject,
3567 _In_reads_bytes_(MethodLength) PKSMETHOD UNALIGNED Method,
3568 _In_ ULONG MethodLength,
3569 _Inout_updates_bytes_(DataLength) PVOID UNALIGNED Data,
3570 _In_ ULONG DataLength,
3571 _Out_ PIO_STATUS_BLOCK IoStatus,
3572 _In_ ULONG MethodSetsCount,
3573 _In_reads_(MethodSetsCount) const KSMETHOD_SET *MethodSet);
3574
3575 #endif /* _NTDDK_ */
3576
3577 /* ===============================================================
3578 Property Functions
3579 */
3580
3581 #if defined(_NTDDK_)
3582
3583 _IRQL_requires_max_(PASSIVE_LEVEL)
3584 KSDDKAPI
3585 NTSTATUS
3586 NTAPI
3587 KsPropertyHandler(
3588 _In_ PIRP Irp,
3589 _In_ ULONG PropertySetsCount,
3590 _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet);
3591
3592 _IRQL_requires_max_(PASSIVE_LEVEL)
3593 KSDDKAPI
3594 NTSTATUS
3595 NTAPI
3596 KsPropertyHandlerWithAllocator(
3597 _In_ PIRP Irp,
3598 _In_ ULONG PropertySetsCount,
3599 _In_reads_(PropertySetsCount) const KSPROPERTY_SET* PropertySet,
3600 _In_opt_ PFNKSALLOCATOR Allocator,
3601 _In_opt_ ULONG PropertyItemSize);
3602
3603 _IRQL_requires_max_(PASSIVE_LEVEL)
3604 KSDDKAPI
3605 NTSTATUS
3606 NTAPI
3607 KsUnserializeObjectPropertiesFromRegistry(
3608 _In_ PFILE_OBJECT FileObject,
3609 _In_opt_ HANDLE ParentKey,
3610 _In_opt_ PUNICODE_STRING RegistryPath);
3611
3612 _IRQL_requires_max_(PASSIVE_LEVEL)
3613 KSDDKAPI
3614 BOOLEAN
3615 NTAPI
3616 KsFastPropertyHandler(
3617 _In_ PFILE_OBJECT FileObject,
3618 _In_reads_bytes_(PropertyLength) PKSPROPERTY UNALIGNED Property,
3619 _In_ ULONG PropertyLength,
3620 _In_reads_bytes_(DataLength) PVOID UNALIGNED Data,
3621 _In_ ULONG DataLength,
3622 _Out_ PIO_STATUS_BLOCK IoStatus,
3623 _In_ ULONG PropertySetsCount,
3624 _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet);
3625
3626 #endif /* _NTDDK_ */
3627
3628 /* ===============================================================
3629 Event Functions
3630 */
3631
3632 #if defined(_NTDDK_)
3633
3634 #define KSPROBE_STREAMREAD 0x00000000
3635 #define KSPROBE_STREAMWRITE 0x00000001
3636 #define KSPROBE_ALLOCATEMDL 0x00000010
3637 #define KSPROBE_PROBEANDLOCK 0x00000020
3638 #define KSPROBE_SYSTEMADDRESS 0x00000040
3639 #define KSPROBE_MODIFY 0x00000200
3640 #define KSPROBE_STREAMWRITEMODIFY (KSPROBE_MODIFY | KSPROBE_STREAMWRITE)
3641 #define KSPROBE_ALLOWFORMATCHANGE 0x00000080
3642
3643 #define KSSTREAM_READ KSPROBE_STREAMREAD
3644 #define KSSTREAM_WRITE KSPROBE_STREAMWRITE
3645 #define KSSTREAM_PAGED_DATA 0x00000000
3646 #define KSSTREAM_NONPAGED_DATA 0x00000100
3647 #define KSSTREAM_SYNCHRONOUS 0x00001000
3648 #define KSSTREAM_FAILUREEXCEPTION 0x00002000
3649
3650 _IRQL_requires_max_(DISPATCH_LEVEL)
3651 typedef BOOLEAN
3652 (NTAPI *PFNKSGENERATEEVENTCALLBACK)(
3653 _In_ PVOID Context,
3654 _In_ PKSEVENT_ENTRY EventEntry);
3655
3656 KSDDKAPI
3657 NTSTATUS
3658 NTAPI
3659 KsGenerateEvent(
3660 _In_ PKSEVENT_ENTRY EntryEvent);
3661
3662 _IRQL_requires_max_(DISPATCH_LEVEL)
3663 KSDDKAPI
3664 void
3665 NTAPI
3666 KsGenerateEvents(
3667 _In_ PVOID Object,
3668 _In_opt_ const GUID *EventSet,
3669 _In_ ULONG EventId,
3670 _In_ ULONG DataSize,
3671 _In_reads_bytes_opt_(DataSize) PVOID Data,
3672 _In_opt_ PFNKSGENERATEEVENTCALLBACK CallBack,
3673 _In_opt_ PVOID CallBackContext);
3674
3675 _IRQL_requires_max_(PASSIVE_LEVEL)
3676 KSDDKAPI
3677 NTSTATUS
3678 NTAPI
3679 KsEnableEventWithAllocator(
3680 _In_ PIRP Irp,
3681 _In_ ULONG EventSetsCount,
3682 _In_reads_(EventSetsCount) const KSEVENT_SET* EventSet,
3683 _Inout_opt_ PLIST_ENTRY EventsList,
3684 _In_opt_ KSEVENTS_LOCKTYPE EventsFlags,
3685 _In_opt_ PVOID EventsLock,
3686 _In_opt_ PFNKSALLOCATOR Allocator,
3687 _In_opt_ ULONG EventItemSize);
3688
3689 KSDDKAPI
3690 NTSTATUS
3691 NTAPI
3692 KsGenerateDataEvent(
3693 _In_ PKSEVENT_ENTRY EventEntry,
3694 _In_ ULONG DataSize,
3695 _In_reads_bytes_(DataSize) PVOID Data);
3696
3697 _IRQL_requires_max_(PASSIVE_LEVEL)
3698 KSDDKAPI
3699 NTSTATUS
3700 NTAPI
3701 KsEnableEvent(
3702 _In_ PIRP Irp,
3703 _In_ ULONG EventSetsCount,
3704 _In_reads_(EventSetsCount) KSEVENT_SET *EventSet,
3705 _Inout_opt_ PLIST_ENTRY EventsList,
3706 _In_opt_ KSEVENTS_LOCKTYPE EventsFlags,
3707 _In_opt_ PVOID EventsLock);
3708
3709 _IRQL_requires_max_(PASSIVE_LEVEL)
3710 KSDDKAPI
3711 VOID
3712 NTAPI
3713 KsDiscardEvent(
3714 _In_ PKSEVENT_ENTRY EventEntry);
3715
3716 _IRQL_requires_max_(PASSIVE_LEVEL)
3717 KSDDKAPI
3718 NTSTATUS
3719 NTAPI
3720 KsDisableEvent(
3721 _In_ PIRP Irp,
3722 _Inout_ PLIST_ENTRY EventsList,
3723 _In_ KSEVENTS_LOCKTYPE EventsFlags,
3724 _In_ PVOID EventsLock);
3725
3726 _IRQL_requires_max_(PASSIVE_LEVEL)
3727 KSDDKAPI
3728 VOID
3729 NTAPI
3730 KsFreeEventList(
3731 _In_ PFILE_OBJECT FileObject,
3732 _Inout_ PLIST_ENTRY EventsList,
3733 _In_ KSEVENTS_LOCKTYPE EventsFlags,
3734 _In_ PVOID EventsLock);
3735
3736 /* ===============================================================
3737 Topology Functions
3738 */
3739
3740 _IRQL_requires_max_(PASSIVE_LEVEL)
3741 KSDDKAPI
3742 NTSTATUS
3743 NTAPI
3744 KsValidateTopologyNodeCreateRequest(
3745 _In_ PIRP Irp,
3746 _In_ PKSTOPOLOGY Topology,
3747 _Out_ PKSNODE_CREATE *NodeCreate);
3748
3749 _IRQL_requires_max_(PASSIVE_LEVEL)
3750 KSDDKAPI
3751 NTSTATUS
3752 NTAPI
3753 KsCreateTopologyNode(
3754 _In_ HANDLE ParentHandle,
3755 _In_ PKSNODE_CREATE NodeCreate,
3756 _In_ ACCESS_MASK DesiredAccess,
3757 _Out_ PHANDLE NodeHandle);
3758
3759 _IRQL_requires_max_(PASSIVE_LEVEL)
3760 KSDDKAPI
3761 NTSTATUS
3762 NTAPI
3763 KsTopologyPropertyHandler(
3764 _In_ PIRP Irp,
3765 _In_ PKSPROPERTY Property,
3766 _Inout_ PVOID Data,
3767 _In_ const KSTOPOLOGY *Topology);
3768
3769 /* ===============================================================
3770 Connectivity Functions
3771 */
3772
3773 _IRQL_requires_max_(PASSIVE_LEVEL)
3774 KSDDKAPI
3775 NTSTATUS
3776 NTAPI
3777 KsCreatePin(
3778 _In_ HANDLE FilterHandle,
3779 _In_ PKSPIN_CONNECT Connect,
3780 _In_ ACCESS_MASK DesiredAccess,
3781 _Out_ PHANDLE ConnectionHandle);
3782
3783 _IRQL_requires_max_(PASSIVE_LEVEL)
3784 KSDDKAPI
3785 NTSTATUS
3786 NTAPI
3787 KsValidateConnectRequest(
3788 _In_ PIRP Irp,
3789 _In_ ULONG DescriptorsCount,
3790 _In_reads_(DescriptorsCount) KSPIN_DESCRIPTOR *Descriptor,
3791 _Out_ PKSPIN_CONNECT *Connect);
3792
3793 _IRQL_requires_max_(PASSIVE_LEVEL)
3794 KSDDKAPI
3795 NTSTATUS
3796 NTAPI
3797 KsPinPropertyHandler(
3798 _In_ PIRP Irp,
3799 _In_ PKSPROPERTY Property,
3800 _Inout_ PVOID Data,
3801 _In_ ULONG DescriptorsCount,
3802 _In_reads_(DescriptorsCount) const KSPIN_DESCRIPTOR *Descriptor);
3803
3804 _Must_inspect_result_
3805 _IRQL_requires_max_(PASSIVE_LEVEL)
3806 KSDDKAPI
3807 NTSTATUS
3808 NTAPI
3809 KsPinDataIntersection(
3810 _In_ PIRP Irp,
3811 _In_ PKSP_PIN Pin,
3812 _Out_opt_ PVOID Data,
3813 _In_ ULONG DescriptorsCount,
3814 _In_reads_(DescriptorsCount) const KSPIN_DESCRIPTOR *Descriptor,
3815 _In_ PFNKSINTERSECTHANDLER IntersectHandler);
3816
3817 _Must_inspect_result_
3818 _IRQL_requires_max_(PASSIVE_LEVEL)
3819 KSDDKAPI
3820 NTSTATUS
3821 NTAPI
3822 KsPinDataIntersectionEx(
3823 _In_ PIRP Irp,
3824 _In_ PKSP_PIN Pin,
3825 _Out_ PVOID Data,
3826 _In_ ULONG DescriptorsCount,
3827 _In_reads_bytes_(DescriptorsCount * DescriptorSize) const KSPIN_DESCRIPTOR *Descriptor,
3828 _In_ ULONG DescriptorSize,
3829 _In_opt_ PFNKSINTERSECTHANDLEREX IntersectHandler,
3830 _In_opt_ PVOID HandlerContext);
3831
3832 _IRQL_requires_max_(PASSIVE_LEVEL)
3833 KSDDKAPI
3834 PKSFILTER
3835 NTAPI
3836 KsPinGetParentFilter(
3837 _In_ PKSPIN Pin);
3838
3839 _IRQL_requires_max_(PASSIVE_LEVEL)
3840 KSDDKAPI
3841 PKSPIN
3842 NTAPI
3843 KsPinGetNextSiblingPin(
3844 _In_ PKSPIN Pin);
3845
3846 _IRQL_requires_max_(DISPATCH_LEVEL)
3847 KSDDKAPI
3848 PKSSTREAM_POINTER
3849 NTAPI
3850 KsPinGetLeadingEdgeStreamPointer(
3851 _In_ PKSPIN Pin,
3852 _In_ KSSTREAM_POINTER_STATE State);
3853
3854 _IRQL_requires_max_(DISPATCH_LEVEL)
3855 KSDDKAPI
3856 NTSTATUS
3857 NTAPI
3858 KsStreamPointerSetStatusCode(
3859 _In_ PKSSTREAM_POINTER StreamPointer,
3860 _In_ NTSTATUS Status
3861 );
3862
3863 _IRQL_requires_max_(DISPATCH_LEVEL)
3864 KSDDKAPI
3865 void
3866 NTAPI
3867 KsStreamPointerDelete(
3868 _In_ PKSSTREAM_POINTER StreamPointer
3869 );
3870
3871 _IRQL_requires_max_(DISPATCH_LEVEL)
3872 KSDDKAPI
3873 NTSTATUS
3874 NTAPI
3875 KsStreamPointerClone(
3876 _In_ PKSSTREAM_POINTER StreamPointer,
3877 _In_opt_ PFNKSSTREAMPOINTER CancelCallback,
3878 _In_ ULONG ContextSize,
3879 _Out_ PKSSTREAM_POINTER* CloneStreamPointer
3880 );
3881
3882
3883 /* Does this belong here? */
3884
3885 _IRQL_requires_max_(PASSIVE_LEVEL)
3886 KSDDKAPI
3887 NTSTATUS
3888 NTAPI
3889 KsHandleSizedListQuery(
3890 _In_ PIRP Irp,
3891 _In_ ULONG DataItemsCount,
3892 _In_ ULONG DataItemSize,
3893 _In_reads_bytes_(DataItemsCount * DataItemSize) const VOID *DataItems);
3894
3895 /* ===============================================================
3896 IRP Helper Functions
3897 */
3898
3899 _IRQL_requires_max_(DISPATCH_LEVEL)
3900 typedef NTSTATUS
3901 (NTAPI *PFNKSIRPLISTCALLBACK)(
3902 _In_ PIRP Irp,
3903 _In_ PVOID Context);
3904
3905 _IRQL_requires_max_(PASSIVE_LEVEL)
3906 KSDDKAPI
3907 NTSTATUS
3908 NTAPI
3909 KsAcquireResetValue(
3910 _In_ PIRP Irp,
3911 _Out_ KSRESET *ResetValue);
3912
3913 _IRQL_requires_max_(DISPATCH_LEVEL)
3914 KSDDKAPI
3915 VOID
3916 NTAPI
3917 KsAddIrpToCancelableQueue(
3918 _Inout_ PLIST_ENTRY QueueHead,
3919 _In_ PKSPIN_LOCK SpinLock,
3920 _In_ PIRP Irp,
3921 _In_ KSLIST_ENTRY_LOCATION ListLocation,
3922 _In_opt_ PDRIVER_CANCEL DriverCancel);
3923
3924 _IRQL_requires_max_(PASSIVE_LEVEL)
3925 KSDDKAPI
3926 NTSTATUS
3927 NTAPI
3928 KsAddObjectCreateItemToDeviceHeader(
3929 _In_ KSDEVICE_HEADER Header,
3930 _In_ PDRIVER_DISPATCH Create,
3931 _In_ PVOID Context,
3932 _In_ PWSTR ObjectClass,
3933 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor);
3934
3935 _IRQL_requires_max_(PASSIVE_LEVEL)
3936 KSDDKAPI
3937 NTSTATUS
3938 NTAPI
3939 KsAddObjectCreateItemToObjectHeader(
3940 _In_ KSOBJECT_HEADER Header,
3941 _In_ PDRIVER_DISPATCH Create,
3942 _In_ PVOID Context,
3943 _In_ PWSTR ObjectClass,
3944 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor);
3945
3946 _IRQL_requires_max_(APC_LEVEL)
3947 KSDDKAPI
3948 NTSTATUS
3949 NTAPI
3950 KsAllocateDeviceHeader(
3951 _Out_ KSDEVICE_HEADER *Header,
3952 _In_ ULONG ItemsCount,
3953 _In_reads_opt_(ItemsCount) PKSOBJECT_CREATE_ITEM ItemsList);
3954
3955 _IRQL_requires_max_(PASSIVE_LEVEL)
3956 KSDDKAPI
3957 NTSTATUS
3958 NTAPI
3959 KsAllocateExtraData(
3960 _Inout_ PIRP Irp,
3961 _In_ ULONG ExtraSize,
3962 _Out_ PVOID *ExtraBuffer);
3963
3964 _IRQL_requires_max_(PASSIVE_LEVEL)
3965 KSDDKAPI
3966 NTSTATUS
3967 NTAPI
3968 KsAllocateObjectCreateItem(
3969 _In_ KSDEVICE_HEADER Header,
3970 _In_ PKSOBJECT_CREATE_ITEM CreateItem,
3971 _In_ BOOLEAN AllocateEntry,
3972 _In_opt_ PFNKSITEMFREECALLBACK ItemFreeCallback);
3973
3974 _IRQL_requires_max_(APC_LEVEL)
3975 KSDDKAPI
3976 NTSTATUS
3977 NTAPI
3978 KsAllocateObjectHeader(
3979 _Out_ KSOBJECT_HEADER *Header,
3980 _In_ ULONG ItemsCount,
3981 _In_reads_opt_(ItemsCount) PKSOBJECT_CREATE_ITEM ItemsList,
3982 _In_ PIRP Irp,
3983 _In_ KSDISPATCH_TABLE *Table);
3984
3985 _IRQL_requires_max_(DISPATCH_LEVEL)
3986 KSDDKAPI
3987 VOID
3988 NTAPI
3989 KsCancelIo(
3990 _Inout_ PLIST_ENTRY QueueHead,
3991 _In_ PKSPIN_LOCK SpinLock);
3992
3993 _IRQL_requires_max_(DISPATCH_LEVEL)
3994 KSDDKAPI
3995 VOID
3996 NTAPI
3997 KsCancelRoutine(
3998 _In_ PDEVICE_OBJECT DeviceObject,
3999 _In_ PIRP Irp);
4000
4001 _IRQL_requires_max_(PASSIVE_LEVEL)
4002 KSDDKAPI
4003 NTSTATUS
4004 NTAPI
4005 KsDefaultDeviceIoCompletion(
4006 _In_ PDEVICE_OBJECT DeviceObject,
4007 _In_ PIRP Irp);
4008
4009 _IRQL_requires_max_(PASSIVE_LEVEL)
4010 KSDDKAPI
4011 BOOLEAN
4012 NTAPI
4013 KsDispatchFastIoDeviceControlFailure(
4014 _In_ PFILE_OBJECT FileObject,
4015 _In_ BOOLEAN Wait,
4016 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
4017 _In_ ULONG InputBufferLength,
4018 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
4019 _In_ ULONG OutputBufferLength,
4020 _In_ ULONG IoControlCode,
4021 _Out_ PIO_STATUS_BLOCK IoStatus,
4022 _In_ PDEVICE_OBJECT DeviceObject); /* always return false */
4023
4024 _IRQL_requires_max_(PASSIVE_LEVEL)
4025 KSDDKAPI
4026 BOOLEAN
4027 NTAPI
4028 KsDispatchFastReadFailure(
4029 _In_ PFILE_OBJECT FileObject,
4030 _In_ PLARGE_INTEGER FileOffset,
4031 _In_ ULONG Length,
4032 _In_ BOOLEAN Wait,
4033 _In_ ULONG LockKey,
4034 _Out_ PVOID Buffer,
4035 _Out_ PIO_STATUS_BLOCK IoStatus,
4036 _In_ PDEVICE_OBJECT DeviceObject); /* always return false */
4037
4038 /* This function does the same as the above */
4039 #define KsDispatchFastWriteFailure KsDispatchFastReadFailure
4040
4041 _IRQL_requires_max_(PASSIVE_LEVEL)
4042 KSDDKAPI
4043 NTSTATUS
4044 NTAPI
4045 KsDispatchInvalidDeviceRequest(
4046 _In_ PDEVICE_OBJECT DeviceObject,
4047 _In_ PIRP Irp);
4048
4049 _IRQL_requires_max_(PASSIVE_LEVEL)
4050 KSDDKAPI
4051 NTSTATUS
4052 NTAPI
4053 KsDispatchIrp(
4054 _In_ PDEVICE_OBJECT DeviceObject,
4055 _In_ PIRP Irp);
4056
4057 _IRQL_requires_max_(PASSIVE_LEVEL)
4058 KSDDKAPI
4059 NTSTATUS
4060 NTAPI
4061 KsDispatchSpecificMethod(
4062 _In_ PIRP Irp,
4063 _In_ PFNKSHANDLER Handler);
4064
4065 _IRQL_requires_max_(PASSIVE_LEVEL)
4066 KSDDKAPI
4067 NTSTATUS
4068 NTAPI
4069 KsDispatchSpecificProperty(
4070 _In_ PIRP Irp,
4071 _In_ PFNKSHANDLER Handler);
4072
4073 _IRQL_requires_max_(PASSIVE_LEVEL)
4074 KSDDKAPI
4075 NTSTATUS
4076 NTAPI
4077 KsForwardAndCatchIrp(
4078 _In_ PDEVICE_OBJECT DeviceObject,
4079 _In_ PIRP Irp,
4080 _In_ PFILE_OBJECT FileObject,
4081 _In_ KSSTACK_USE StackUse);
4082
4083 _IRQL_requires_max_(PASSIVE_LEVEL)
4084 KSDDKAPI
4085 NTSTATUS
4086 NTAPI
4087 KsForwardIrp(
4088 _In_ PIRP Irp,
4089 _In_ PFILE_OBJECT FileObject,
4090 _In_ BOOLEAN ReuseStackLocation);
4091
4092 _IRQL_requires_max_(APC_LEVEL)
4093 KSDDKAPI
4094 VOID
4095 NTAPI
4096 KsFreeDeviceHeader(
4097 _In_ KSDEVICE_HEADER Header);
4098
4099 _IRQL_requires_max_(APC_LEVEL)
4100 KSDDKAPI
4101 VOID
4102 NTAPI
4103 KsFreeObjectHeader(
4104 _In_ PVOID Header);
4105
4106 KSDDKAPI
4107 NTSTATUS
4108 NTAPI
4109 KsGetChildCreateParameter(
4110 _In_ PIRP Irp,
4111 _Out_ PVOID *CreateParameter);
4112
4113 _IRQL_requires_max_(DISPATCH_LEVEL)
4114 KSDDKAPI
4115 NTSTATUS
4116 NTAPI
4117 KsMoveIrpsOnCancelableQueue(
4118 _Inout_ PLIST_ENTRY SourceList,
4119 _In_ PKSPIN_LOCK SourceLock,
4120 _Inout_ PLIST_ENTRY DestinationList,
4121 _In_opt_ PKSPIN_LOCK DestinationLock,
4122 _In_ KSLIST_ENTRY_LOCATION ListLocation,
4123 _In_ PFNKSIRPLISTCALLBACK ListCallback,
4124 _In_ PVOID Context);
4125
4126 _IRQL_requires_max_(PASSIVE_LEVEL)
4127 KSDDKAPI
4128 NTSTATUS
4129 NTAPI
4130 KsProbeStreamIrp(
4131 _Inout_ PIRP Irp,
4132 _In_ ULONG ProbeFlags,
4133 _In_ ULONG HeaderSize);
4134
4135 _IRQL_requires_max_(PASSIVE_LEVEL)
4136 KSDDKAPI
4137 NTSTATUS
4138 NTAPI
4139 KsQueryInformationFile(
4140 _In_ PFILE_OBJECT FileObject,
4141 _Out_writes_bytes_(Length) PVOID FileInformation,
4142 _In_ ULONG Length,
4143 _In_ FILE_INFORMATION_CLASS FileInformationClass);
4144
4145 _IRQL_requires_max_(PASSIVE_LEVEL)
4146 KSDDKAPI
4147 ACCESS_MASK
4148 NTAPI
4149 KsQueryObjectAccessMask(
4150 _In_ KSOBJECT_HEADER Header);
4151
4152 _IRQL_requires_max_(PASSIVE_LEVEL)
4153 KSDDKAPI
4154 PKSOBJECT_CREATE_ITEM
4155 NTAPI
4156 KsQueryObjectCreateItem(
4157 _In_ KSOBJECT_HEADER Header);
4158
4159 _IRQL_requires_max_(PASSIVE_LEVEL)
4160 KSDDKAPI
4161 NTSTATUS
4162 NTAPI
4163 KsReadFile(
4164 _In_ PFILE_OBJECT FileObject,
4165 _In_opt_ PKEVENT Event,
4166 _In_opt_ PVOID PortContext,
4167 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
4168 _Out_writes_bytes_(Length) PVOID Buffer,
4169 _In_ ULONG Length,
4170 _In_opt_ ULONG Key,
4171 _In_ KPROCESSOR_MODE RequestorMode);
4172
4173 _IRQL_requires_max_(DISPATCH_LEVEL)
4174 KSDDKAPI
4175 VOID
4176 NTAPI
4177 KsReleaseDevice(
4178 _In_ PKSDEVICE);
4179
4180 _IRQL_requires_max_(DISPATCH_LEVEL)
4181 KSDDKAPI
4182 VOID
4183 NTAPI
4184 KsReleaseIrpOnCancelableQueue(
4185 _In_ PIRP Irp,
4186 _In_opt_ PDRIVER_CANCEL DriverCancel);
4187
4188 _IRQL_requires_max_(DISPATCH_LEVEL)
4189 KSDDKAPI
4190 PIRP
4191 NTAPI
4192 KsRemoveIrpFromCancelableQueue(
4193 _Inout_ PLIST_ENTRY QueueHead,
4194 _In_ PKSPIN_LOCK SpinLock,
4195 _In_ KSLIST_ENTRY_LOCATION ListLocation,
4196 _In_ KSIRP_REMOVAL_OPERATION RemovalOperation);
4197
4198 _IRQL_requires_max_(DISPATCH_LEVEL)
4199 KSDDKAPI
4200 VOID
4201 NTAPI
4202 KsRemoveSpecificIrpFromCancelableQueue(
4203 _In_ PIRP Irp);
4204
4205 _IRQL_requires_max_(PASSIVE_LEVEL)
4206 KSDDKAPI
4207 NTSTATUS
4208 NTAPI
4209 KsSetInformationFile(
4210 _In_ PFILE_OBJECT FileObject,
4211 _In_reads_bytes_(Length) PVOID FileInformation,
4212 _In_ ULONG Length,
4213 _In_ FILE_INFORMATION_CLASS FileInformationClass);
4214
4215 _IRQL_requires_max_(PASSIVE_LEVEL)
4216 KSDDKAPI
4217 NTSTATUS
4218 NTAPI
4219 KsSetMajorFunctionHandler(
4220 _In_ PDRIVER_OBJECT DriverObject,
4221 _In_ ULONG MajorFunction);
4222
4223 _Check_return_
4224 _IRQL_requires_max_(PASSIVE_LEVEL)
4225 KSDDKAPI
4226 NTSTATUS
4227 NTAPI
4228 KsStreamIo(
4229 _In_ PFILE_OBJECT FileObject,
4230 _In_opt_ PKEVENT Event,
4231 _In_opt_ PVOID PortContext,
4232 _In_opt_ PIO_COMPLETION_ROUTINE CompletionRoutine,
4233 _In_opt_ PVOID CompletionContext,
4234 _In_opt_ KSCOMPLETION_INVOCATION CompletionInvocationFlags,
4235 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
4236 _Inout_updates_bytes_(Length) PVOID StreamHeaders,
4237 _In_ ULONG Length,
4238 _In_ ULONG Flags,
4239 _In_ KPROCESSOR_MODE RequestorMode);
4240
4241 _IRQL_requires_max_(DISPATCH_LEVEL)
4242 KSDDKAPI
4243 VOID
4244 NTAPI
4245 KsStreamPointerUnlock(
4246 _In_ PKSSTREAM_POINTER StreamPointer,
4247 _In_ BOOLEAN Eject);
4248
4249 _IRQL_requires_max_(DISPATCH_LEVEL)
4250 KSDDKAPI
4251 NTSTATUS
4252 NTAPI
4253 KsStreamPointerAdvanceOffsets(
4254 _In_ PKSSTREAM_POINTER StreamPointer,
4255 _In_ ULONG InUsed,
4256 _In_ ULONG OutUsed,
4257 _In_ BOOLEAN Eject);
4258
4259 _Check_return_
4260 _IRQL_requires_max_(DISPATCH_LEVEL)
4261 KSDDKAPI
4262 NTSTATUS
4263 NTAPI
4264 KsStreamPointerAdvance(
4265 _In_ PKSSTREAM_POINTER StreamPointer);
4266
4267 _IRQL_requires_max_(DISPATCH_LEVEL)
4268 KSDDKAPI
4269 VOID
4270 NTAPI
4271 KsStreamPointerAdvanceOffsetsAndUnlock(
4272 _In_ PKSSTREAM_POINTER StreamPointer,
4273 _In_ ULONG InUsed,
4274 _In_ ULONG OutUsed,
4275 _In_ BOOLEAN Eject
4276 );
4277
4278
4279 _IRQL_requires_max_(PASSIVE_LEVEL)
4280 KSDDKAPI
4281 NTSTATUS
4282 NTAPI
4283 KsWriteFile(
4284 _In_ PFILE_OBJECT FileObject,
4285 _In_opt_ PKEVENT Event,
4286 _In_opt_ PVOID PortContext,
4287 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
4288 _In_reads_bytes_(Length) PVOID Buffer,
4289 _In_ ULONG Length,
4290 _In_opt_ ULONG Key,
4291 _In_ KPROCESSOR_MODE RequestorMode);
4292
4293 KSDDKAPI
4294 NTSTATUS
4295 NTAPI
4296 KsDefaultForwardIrp(
4297 _In_ PDEVICE_OBJECT DeviceObject,
4298 _In_ PIRP Irp);
4299
4300 /* ===============================================================
4301 Worker Management Functions
4302 */
4303
4304 _IRQL_requires_max_(PASSIVE_LEVEL)
4305 KSDDKAPI
4306 NTSTATUS
4307 NTAPI
4308 KsRegisterWorker(
4309 _In_ WORK_QUEUE_TYPE WorkQueueType,
4310 _Out_ PKSWORKER* Worker);
4311
4312 _IRQL_requires_max_(PASSIVE_LEVEL)
4313 KSDDKAPI
4314 VOID
4315 NTAPI
4316 KsUnregisterWorker(
4317 _In_ PKSWORKER Worker);
4318
4319 _IRQL_requires_max_(PASSIVE_LEVEL)
4320 KSDDKAPI
4321 NTSTATUS
4322 NTAPI
4323 KsRegisterCountedWorker(
4324 _In_ WORK_QUEUE_TYPE WorkQueueType,
4325 _In_ PWORK_QUEUE_ITEM CountedWorkItem,
4326 _Out_ PKSWORKER *Worker);
4327
4328 _IRQL_requires_max_(PASSIVE_LEVEL)
4329 KSDDKAPI
4330 ULONG
4331 NTAPI
4332 KsDecrementCountedWorker(
4333 _In_ PKSWORKER Worker);
4334
4335 _IRQL_requires_max_(PASSIVE_LEVEL)
4336 KSDDKAPI
4337 ULONG
4338 NTAPI
4339 KsIncrementCountedWorker(
4340 _In_ PKSWORKER Worker);
4341
4342 _IRQL_requires_max_(DISPATCH_LEVEL)
4343 KSDDKAPI
4344 NTSTATUS
4345 NTAPI
4346 KsQueueWorkItem(
4347 _In_ PKSWORKER Worker,
4348 _In_ PWORK_QUEUE_ITEM WorkItem);
4349
4350 /* ===============================================================
4351 Resources / Images
4352 */
4353
4354 _IRQL_requires_max_(PASSIVE_LEVEL)
4355 KSDDKAPI
4356 NTSTATUS
4357 NTAPI
4358 KsLoadResource(
4359 _In_ PVOID ImageBase,
4360 _In_ POOL_TYPE PoolType,
4361 _In_ ULONG_PTR ResourceName,
4362 _In_ ULONG ResourceType,
4363 _Outptr_result_bytebuffer_(*ResourceSize) PVOID *Resource,
4364 _Out_opt_ PULONG ResourceSize);
4365
4366 _IRQL_requires_max_(PASSIVE_LEVEL)
4367 KSDDKAPI
4368 NTSTATUS
4369 NTAPI
4370 KsGetImageNameAndResourceId(
4371 _In_ HANDLE RegKey,
4372 _Out_ PUNICODE_STRING ImageName,
4373 _Out_ PULONG_PTR ResourceId,
4374 _Out_ PULONG ValueType);
4375
4376 _IRQL_requires_max_(PASSIVE_LEVEL)
4377 KSDDKAPI
4378 NTSTATUS
4379 NTAPI
4380 KsMapModuleName(
4381 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
4382 _In_ PUNICODE_STRING ModuleName,
4383 _Out_ PUNICODE_STRING ImageName,
4384 _Out_ PULONG_PTR ResourceId,
4385 _Out_ PULONG ValueType);
4386
4387 /* ===============================================================
4388 Misc. Helper Functions
4389 */
4390
4391 _IRQL_requires_max_(PASSIVE_LEVEL)
4392 KSDDKAPI
4393 PVOID
4394 NTAPI
4395 KsGetNextSibling(
4396 _In_ PVOID Object);
4397
4398 _IRQL_requires_max_(PASSIVE_LEVEL)
4399 KSDDKAPI
4400 NTSTATUS
4401 NTAPI
4402 KsCacheMedium(
4403 _In_ PUNICODE_STRING SymbolicLink,
4404 _In_ PKSPIN_MEDIUM Medium,
4405 _In_ ULONG PinDirection);
4406
4407 KSDDKAPI
4408 NTSTATUS
4409 NTAPI
4410 KsDefaultDispatchPnp(
4411 _In_ PDEVICE_OBJECT DeviceObject,
4412 _In_ PIRP Irp);
4413
4414 _IRQL_requires_max_(PASSIVE_LEVEL)
4415 KSDDKAPI
4416 VOID
4417 NTAPI
4418 KsSetDevicePnpAndBaseObject(
4419 _In_ KSDEVICE_HEADER Header,
4420 _In_ PDEVICE_OBJECT PnpDeviceObject,
4421 _In_ PDEVICE_OBJECT BaseDevice);
4422
4423 KSDDKAPI
4424 NTSTATUS
4425 NTAPI
4426 KsDefaultDispatchPower(
4427 _In_ PDEVICE_OBJECT DeviceObject,
4428 _In_ PIRP Irp);
4429
4430 _IRQL_requires_max_(PASSIVE_LEVEL)
4431 KSDDKAPI
4432 VOID
4433 NTAPI
4434 KsSetPowerDispatch(
4435 _In_ KSOBJECT_HEADER Header,
4436 _In_opt_ PFNKSCONTEXT_DISPATCH PowerDispatch,
4437 _In_opt_ PVOID PowerContext);
4438
4439 _IRQL_requires_max_(PASSIVE_LEVEL)
4440 KSDDKAPI
4441 NTSTATUS
4442 NTAPI
4443 KsReferenceBusObject(
4444 _In_ KSDEVICE_HEADER Header);
4445
4446 _IRQL_requires_max_(PASSIVE_LEVEL)
4447 KSDDKAPI
4448 VOID
4449 NTAPI
4450 KsDereferenceBusObject(
4451 _In_ KSDEVICE_HEADER Header);
4452
4453 _IRQL_requires_max_(PASSIVE_LEVEL)
4454 KSDDKAPI
4455 NTSTATUS
4456 NTAPI
4457 KsFreeObjectCreateItem(
4458 _In_ KSDEVICE_HEADER Header,
4459 _In_ PUNICODE_STRING CreateItem);
4460
4461 _IRQL_requires_max_(PASSIVE_LEVEL)
4462 KSDDKAPI
4463 NTSTATUS
4464 NTAPI
4465 KsFreeObjectCreateItemsByContext(
4466 _In_ KSDEVICE_HEADER Header,
4467 _In_ PVOID Context);
4468
4469 _IRQL_requires_max_(PASSIVE_LEVEL)
4470 KSDDKAPI
4471 VOID
4472 NTAPI
4473 KsNullDriverUnload(
4474 _In_ PDRIVER_OBJECT DriverObject);
4475
4476 _IRQL_requires_max_(PASSIVE_LEVEL)
4477 KSDDKAPI
4478 PDEVICE_OBJECT
4479 NTAPI
4480 KsQueryDevicePnpObject(
4481 _In_ KSDEVICE_HEADER Header);
4482
4483 _IRQL_requires_max_(PASSIVE_LEVEL)
4484 KSDDKAPI
4485 VOID
4486 NTAPI
4487 KsRecalculateStackDepth(
4488 _In_ KSDEVICE_HEADER Header,
4489 _In_ BOOLEAN ReuseStackLocation);
4490
4491 _IRQL_requires_max_(PASSIVE_LEVEL)
4492 KSDDKAPI
4493 VOID
4494 NTAPI
4495 KsSetTargetDeviceObject(
4496 _In_ KSOBJECT_HEADER Header,
4497 _In_opt_ PDEVICE_OBJECT TargetDevice);
4498
4499 _IRQL_requires_max_(PASSIVE_LEVEL)