[PSDK]
[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 /* ===============================================================
1503 Properties
1504 */
1505
1506 typedef struct {
1507 GUID PropertySet;
1508 ULONG Count;
1509 } KSPROPERTY_SERIALHDR, *PKSPROPERTY_SERIALHDR;
1510
1511 typedef struct {
1512 KSIDENTIFIER PropTypeSet;
1513 ULONG Id;
1514 ULONG PropertyLength;
1515 } KSPROPERTY_SERIAL, *PKSPROPERTY_SERIAL;
1516
1517 typedef union {
1518 struct {
1519 LONG SignedMinimum;
1520 LONG SignedMaximum;
1521 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1522 } _SIGNED;
1523 #else
1524 };
1525 #endif
1526 struct {
1527 ULONG UnsignedMinimum;
1528 ULONG UnsignedMaximum;
1529 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1530 } _UNSIGNED;
1531 #else
1532 };
1533 #endif
1534 } KSPROPERTY_BOUNDS_LONG, *PKSPROPERTY_BOUNDS_LONG;
1535
1536 typedef union {
1537 struct {
1538 LONGLONG SignedMinimum;
1539 LONGLONG SignedMaximum;
1540 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1541 } _SIGNED64;
1542 #else
1543 };
1544 #endif
1545 struct {
1546 #if defined(_NTDDK_)
1547 ULONGLONG UnsignedMinimum;
1548 ULONGLONG UnsignedMaximum;
1549 #else
1550 DWORDLONG UnsignedMinimum;
1551 DWORDLONG UnsignedMaximum;
1552 #endif
1553 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1554 } _UNSIGNED64;
1555 #else
1556 };
1557 #endif
1558 } KSPROPERTY_BOUNDS_LONGLONG, *PKSPROPERTY_BOUNDS_LONGLONG;
1559
1560 typedef struct {
1561 ULONG AccessFlags;
1562 ULONG DescriptionSize;
1563 KSIDENTIFIER PropTypeSet;
1564 ULONG MembersListCount;
1565 ULONG Reserved;
1566 } KSPROPERTY_DESCRIPTION, *PKSPROPERTY_DESCRIPTION;
1567
1568 typedef struct {
1569 ULONG MembersFlags;
1570 ULONG MembersSize;
1571 ULONG MembersCount;
1572 ULONG Flags;
1573 } KSPROPERTY_MEMBERSHEADER, *PKSPROPERTY_MEMBERSHEADER;
1574
1575 typedef struct {
1576 KSPROPERTY_MEMBERSHEADER MembersHeader;
1577 const VOID *Members;
1578 } KSPROPERTY_MEMBERSLIST, *PKSPROPERTY_MEMBERSLIST;
1579
1580 #define KSPROPERTY_MEMBER_RANGES 0x00000001
1581 #define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002
1582 #define KSPROPERTY_MEMBER_VALUES 0x00000003
1583
1584 #define KSPROPERTY_MEMBER_FLAG_DEFAULT 0x00000001
1585 #if (NTDDI_VERSION >= NTDDI_WINXP)
1586 #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_MULTICHANNEL 0x00000002
1587 #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM 0x00000004
1588 #endif
1589
1590 typedef struct {
1591 KSIDENTIFIER PropTypeSet;
1592 ULONG MembersListCount;
1593 _Field_size_(MembersListCount) const KSPROPERTY_MEMBERSLIST *MembersList;
1594 } KSPROPERTY_VALUES, *PKSPROPERTY_VALUES;
1595
1596 #if defined(_NTDDK_)
1597
1598 _IRQL_requires_max_(PASSIVE_LEVEL)
1599 typedef NTSTATUS
1600 (NTAPI *PFNKSCONTEXT_DISPATCH)(
1601 _In_ PVOID Context,
1602 _In_ PIRP Irp);
1603
1604 _IRQL_requires_max_(PASSIVE_LEVEL)
1605 typedef NTSTATUS
1606 (NTAPI *PFNKSHANDLER)(
1607 _In_ PIRP Irp,
1608 _In_ PKSIDENTIFIER Request,
1609 _Inout_ PVOID Data);
1610
1611 typedef struct {
1612 ULONG PropertyId;
1613 union {
1614 PFNKSHANDLER GetPropertyHandler;
1615 BOOLEAN GetSupported;
1616 };
1617 ULONG MinProperty;
1618 ULONG MinData;
1619 union {
1620 PFNKSHANDLER SetPropertyHandler;
1621 BOOLEAN SetSupported;
1622 };
1623 const KSPROPERTY_VALUES *Values;
1624 ULONG RelationsCount;
1625 _Field_size_(RelationsCount) const KSPROPERTY *Relations;
1626 PFNKSHANDLER SupportHandler;
1627 ULONG SerializedSize;
1628 } KSPROPERTY_ITEM, *PKSPROPERTY_ITEM;
1629
1630 _IRQL_requires_max_(PASSIVE_LEVEL)
1631 typedef BOOLEAN
1632 (NTAPI *PFNKSFASTHANDLER)(
1633 _In_ PFILE_OBJECT FileObject,
1634 _In_reads_bytes_(RequestLength) PKSIDENTIFIER Request,
1635 _In_ ULONG RequestLength,
1636 _Inout_updates_bytes_(DataLength) PVOID Data,
1637 _In_ ULONG DataLength,
1638 _Out_ PIO_STATUS_BLOCK IoStatus);
1639
1640 typedef struct {
1641 ULONG PropertyId;
1642 union {
1643 PFNKSFASTHANDLER GetPropertyHandler;
1644 BOOLEAN GetSupported;
1645 };
1646 union {
1647 PFNKSFASTHANDLER SetPropertyHandler;
1648 BOOLEAN SetSupported;
1649 };
1650 ULONG Reserved;
1651 } KSFASTPROPERTY_ITEM, *PKSFASTPROPERTY_ITEM;
1652
1653 typedef struct {
1654 const GUID *Set;
1655 ULONG PropertiesCount;
1656 _Field_size_(PropertiesCount) const KSPROPERTY_ITEM *PropertyItem;
1657 ULONG FastIoCount;
1658 const KSFASTPROPERTY_ITEM *FastIoTable;
1659 } KSPROPERTY_SET, *PKSPROPERTY_SET;
1660
1661 #endif /* _NTDDK_ */
1662
1663 typedef struct {
1664 ULONG SteppingDelta;
1665 ULONG Reserved;
1666 KSPROPERTY_BOUNDS_LONG Bounds;
1667 } KSPROPERTY_STEPPING_LONG, *PKSPROPERTY_STEPPING_LONG;
1668
1669 typedef struct {
1670 #if defined(_NTDDK_)
1671 ULONGLONG SteppingDelta;
1672 #else
1673 DWORDLONG SteppingDelta;
1674 #endif
1675 KSPROPERTY_BOUNDS_LONGLONG Bounds;
1676 } KSPROPERTY_STEPPING_LONGLONG, *PKSPROPERTY_STEPPING_LONGLONG;
1677
1678 /* ===============================================================
1679 Allocator Framing
1680 */
1681
1682 typedef struct {
1683 union {
1684 ULONG OptionsFlags;
1685 ULONG RequirementsFlags;
1686 };
1687 #if defined(_NTDDK_)
1688 POOL_TYPE PoolType;
1689 #else
1690 ULONG PoolType;
1691 #endif
1692 ULONG Frames;
1693 ULONG FrameSize;
1694 ULONG FileAlignment;
1695 ULONG Reserved;
1696 } KSALLOCATOR_FRAMING, *PKSALLOCATOR_FRAMING;
1697
1698 typedef struct {
1699 ULONG CountItems;
1700 ULONG PinFlags;
1701 KS_COMPRESSION OutputCompression;
1702 ULONG PinWeight;
1703 KS_FRAMING_ITEM FramingItem[1];
1704 } KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX;
1705
1706 #define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001
1707 #define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002
1708 #define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004
1709 #define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008
1710 #define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000
1711
1712 #define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001
1713 #define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002
1714 #define KSALLOCATOR_OPTIONF_VALID 0x00000003
1715
1716 #define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010
1717 #define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020
1718 #define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040
1719 #define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080
1720
1721 /* ===============================================================
1722 Quality
1723 */
1724
1725 typedef struct {
1726 PVOID Context;
1727 ULONG Proportion;
1728 LONGLONG DeltaTime;
1729 } KSQUALITY, *PKSQUALITY;
1730
1731 typedef struct {
1732 HANDLE QualityManager;
1733 PVOID Context;
1734 } KSQUALITY_MANAGER, *PKSQUALITY_MANAGER;
1735
1736 typedef struct {
1737 LONGLONG PresentationStart;
1738 LONGLONG Duration;
1739 KSPIN_INTERFACE Interface;
1740 LONG Rate;
1741 ULONG Flags;
1742 } KSRATE, *PKSRATE;
1743
1744 typedef struct {
1745 KSPROPERTY Property;
1746 KSRATE Rate;
1747 } KSRATE_CAPABILITY, *PKSRATE_CAPABILITY;
1748
1749 typedef struct {
1750 LONGLONG Granularity;
1751 LONGLONG Error;
1752 } KSRESOLUTION, *PKSRESOLUTION;
1753
1754 typedef struct {
1755 ULONG NotificationType;
1756 union {
1757 struct {
1758 HANDLE Event;
1759 ULONG_PTR Reserved[2];
1760 } EventHandle;
1761 struct {
1762 HANDLE Semaphore;
1763 ULONG Reserved;
1764 LONG Adjustment;
1765 } SemaphoreHandle;
1766 #if defined(_NTDDK_)
1767 struct {
1768 PVOID Event;
1769 KPRIORITY Increment;
1770 ULONG_PTR Reserved;
1771 } EventObject;
1772 struct {
1773 PVOID Semaphore;
1774 KPRIORITY Increment;
1775 LONG Adjustment;
1776 } SemaphoreObject;
1777 struct {
1778 PKDPC Dpc;
1779 ULONG ReferenceCount;
1780 ULONG_PTR Reserved;
1781 } Dpc;
1782 struct {
1783 PWORK_QUEUE_ITEM WorkQueueItem;
1784 WORK_QUEUE_TYPE WorkQueueType;
1785 ULONG_PTR Reserved;
1786 } WorkItem;
1787 struct {
1788 PWORK_QUEUE_ITEM WorkQueueItem;
1789 PKSWORKER KsWorkerObject;
1790 ULONG_PTR Reserved;
1791 } KsWorkItem;
1792 #endif
1793 struct {
1794 PVOID Unused;
1795 LONG_PTR Alignment[2];
1796 } Alignment;
1797 };
1798 } KSEVENTDATA, *PKSEVENTDATA;
1799
1800 #define KSEVENTF_EVENT_HANDLE 0x00000001
1801 #define KSEVENTF_SEMAPHORE_HANDLE 0x00000002
1802 #if defined(_NTDDK_)
1803 #define KSEVENTF_EVENT_OBJECT 0x00000004
1804 #define KSEVENTF_SEMAPHORE_OBJECT 0x00000008
1805 #define KSEVENTF_DPC 0x00000010
1806 #define KSEVENTF_WORKITEM 0x00000020
1807 #define KSEVENTF_KSWORKITEM 0x00000080
1808 #endif
1809
1810
1811 #define KSEVENT_TYPE_ENABLE 0x00000001
1812 #define KSEVENT_TYPE_ONESHOT 0x00000002
1813 #define KSEVENT_TYPE_ENABLEBUFFERED 0x00000004
1814 #define KSEVENT_TYPE_SETSUPPORT 0x00000100
1815 #define KSEVENT_TYPE_BASICSUPPORT 0x00000200
1816 #define KSEVENT_TYPE_QUERYBUFFER 0x00000400
1817
1818 #define KSEVENT_TYPE_TOPOLOGY 0x10000000
1819
1820 typedef struct {
1821 ULONG Size;
1822 ULONG Flags;
1823 union {
1824 HANDLE ObjectHandle;
1825 PVOID ObjectPointer;
1826 };
1827 PVOID Reserved;
1828 KSEVENT Event;
1829 KSEVENTDATA EventData;
1830 } KSRELATIVEEVENT, *PKSRELATIVEEVENT;
1831
1832 #define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001
1833 #define KSRELATIVEEVENT_FLAG_POINTER 0x00000002
1834
1835 /* ===============================================================
1836 Timing
1837 */
1838
1839 typedef struct {
1840 KSEVENTDATA EventData;
1841 LONGLONG MarkTime;
1842 } KSEVENT_TIME_MARK, *PKSEVENT_TIME_MARK;
1843
1844 typedef struct {
1845 KSEVENTDATA EventData;
1846 LONGLONG TimeBase;
1847 LONGLONG Interval;
1848 } KSEVENT_TIME_INTERVAL, *PKSEVENT_TIME_INTERVAL;
1849
1850 typedef struct {
1851 LONGLONG TimeBase;
1852 LONGLONG Interval;
1853 } KSINTERVAL, *PKSINTERVAL;
1854
1855 typedef struct {
1856 LONGLONG Time;
1857 ULONG Numerator;
1858 ULONG Denominator;
1859 } KSTIME, *PKSTIME;
1860
1861 typedef struct {
1862 LONGLONG Time;
1863 LONGLONG SystemTime;
1864 } KSCORRELATED_TIME, *PKSCORRELATED_TIME;
1865
1866 typedef struct {
1867 LONGLONG Duration;
1868 ULONG FrameFlags;
1869 ULONG Reserved;
1870 } KSFRAMETIME, *PKSFRAMETIME;
1871
1872 /* ===============================================================
1873 Clocks
1874 */
1875
1876 typedef PVOID PKSDEFAULTCLOCK;
1877
1878 typedef struct {
1879 ULONG CreateFlags;
1880 } KSCLOCK_CREATE, *PKSCLOCK_CREATE;
1881
1882 #if defined(_NTDDK_)
1883
1884 _IRQL_requires_max_(PASSIVE_LEVEL)
1885 typedef LONGLONG
1886 (FASTCALL *PFNKSCLOCK_GETTIME)(
1887 _In_ PFILE_OBJECT FileObject);
1888
1889 _IRQL_requires_max_(PASSIVE_LEVEL)
1890 typedef LONGLONG
1891 (FASTCALL *PFNKSCLOCK_CORRELATEDTIME)(
1892 _In_ PFILE_OBJECT FileObject,
1893 _Out_ PLONGLONG SystemTime);
1894
1895 typedef struct {
1896 PFNKSCLOCK_GETTIME GetTime;
1897 PFNKSCLOCK_GETTIME GetPhysicalTime;
1898 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime;
1899 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime;
1900 } KSCLOCK_FUNCTIONTABLE, *PKSCLOCK_FUNCTIONTABLE;
1901
1902 #define DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(Handler)\
1903 DEFINE_KSPROPERTY_ITEM(\
1904 KSPROPERTY_CLOCK_TIME,\
1905 (Handler),\
1906 sizeof(KSPROPERTY),\
1907 sizeof(LONGLONG),\
1908 NULL, NULL, 0, NULL, NULL, 0)
1909
1910 #define DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(Handler)\
1911 DEFINE_KSPROPERTY_ITEM(\
1912 KSPROPERTY_CLOCK_PHYSICALTIME,\
1913 (Handler),\
1914 sizeof(KSPROPERTY),\
1915 sizeof(LONGLONG),\
1916 NULL, NULL, 0, NULL, NULL, 0)
1917
1918 #define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(Handler)\
1919 DEFINE_KSPROPERTY_ITEM(\
1920 KSPROPERTY_CLOCK_CORRELATEDTIME,\
1921 (Handler),\
1922 sizeof(KSPROPERTY),\
1923 sizeof(KSCORRELATED_TIME),\
1924 NULL, NULL, 0, NULL, NULL, 0)
1925
1926 #define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(Handler)\
1927 DEFINE_KSPROPERTY_ITEM(\
1928 KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME,\
1929 (Handler),\
1930 sizeof(KSPROPERTY),\
1931 sizeof(KSCORRELATED_TIME),\
1932 NULL, NULL, 0, NULL, NULL, 0)
1933
1934 #define DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(Handler)\
1935 DEFINE_KSPROPERTY_ITEM(\
1936 KSPROPERTY_CLOCK_RESOLUTION,\
1937 (Handler),\
1938 sizeof(KSPROPERTY),\
1939 sizeof(KSRESOLUTION),\
1940 NULL, NULL, 0, NULL, NULL, 0)
1941
1942 #define DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(Handler)\
1943 DEFINE_KSPROPERTY_ITEM(\
1944 KSPROPERTY_CLOCK_STATE,\
1945 (Handler),\
1946 sizeof(KSPROPERTY),\
1947 sizeof(KSSTATE),\
1948 NULL, NULL, 0, NULL, NULL, 0)
1949
1950 #define DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(Handler)\
1951 DEFINE_KSPROPERTY_ITEM(\
1952 KSPROPERTY_CLOCK_FUNCTIONTABLE,\
1953 (Handler),\
1954 sizeof(KSPROPERTY),\
1955 sizeof(KSCLOCK_FUNCTIONTABLE),\
1956 NULL, NULL, 0, NULL, NULL, 0)
1957
1958 #define DEFINE_KSPROPERTY_CLOCKSET(ClockSet,\
1959 PropTime, PropPhysicalTime,\
1960 PropCorrelatedTime, PropCorrelatedPhysicalTime,\
1961 PropResolution, PropState, PropFunctionTable)\
1962 DEFINE_KSPROPERTY_TABLE(ClockSet) {\
1963 DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(PropTime),\
1964 DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(PropPhysicalTime),\
1965 DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(PropCorrelatedTime),\
1966 DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(PropCorrelatedPhysicalTime),\
1967 DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(PropResolution),\
1968 DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(PropState),\
1969 DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(PropFunctionTable)\
1970 }
1971
1972 /* ===============================================================
1973 Objects ??? SORT ME!
1974 */
1975
1976 #define KSCREATE_ITEM_SECURITYCHANGED 0x1
1977 #define KSCREATE_ITEM_WILDCARD 0x2
1978 #define KSCREATE_ITEM_NOPARAMETERS 0x4
1979 #define KSCREATE_ITEM_FREEONSTOP 0x8
1980
1981 typedef struct {
1982 PDRIVER_DISPATCH Create;
1983 PVOID Context;
1984 UNICODE_STRING ObjectClass;
1985 PSECURITY_DESCRIPTOR SecurityDescriptor;
1986 ULONG Flags;
1987 } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM;
1988
1989 typedef struct {
1990 ULONG CreateItemsCount;
1991 _Field_size_(CreateItemsCount) PKSOBJECT_CREATE_ITEM CreateItemsList;
1992 } KSOBJECT_CREATE, *PKSOBJECT_CREATE;
1993
1994 typedef VOID
1995 (NTAPI *PFNKSITEMFREECALLBACK)(
1996 _In_ PKSOBJECT_CREATE_ITEM CreateItem);
1997
1998 #endif /* _NTDDK_ */
1999
2000 typedef struct {
2001 ULONG Size;
2002 ULONG Count;
2003 } KSMULTIPLE_ITEM, *PKSMULTIPLE_ITEM;
2004
2005 typedef struct {
2006 KSEVENT Event;
2007 PKSEVENTDATA EventData;
2008 PVOID Reserved;
2009 } KSQUERYBUFFER, *PKSQUERYBUFFER;
2010
2011 typedef struct {
2012 PVOID Context;
2013 ULONG Status;
2014 } KSERROR, *PKSERROR;
2015
2016 /* ===============================================================
2017 Methods
2018 */
2019
2020 #if defined(_NTDDK_)
2021
2022 typedef struct {
2023 ULONG MethodId;
2024 union {
2025 PFNKSHANDLER MethodHandler;
2026 BOOLEAN MethodSupported;
2027 };
2028 ULONG MinMethod;
2029 ULONG MinData;
2030 PFNKSHANDLER SupportHandler;
2031 ULONG Flags;
2032 } KSMETHOD_ITEM, *PKSMETHOD_ITEM;
2033
2034 #ifndef _MSC_VER
2035
2036 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
2037 MethodHandler,\
2038 MinMethod, MinData, SupportHandler)\
2039 {\
2040 MethodId, {(PFNKSHANDLER)MethodHandler}, MinMethod, MinData,\
2041 SupportHandler, Flags\
2042 }
2043
2044 #else
2045
2046 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
2047 MethodHandler,\
2048 MinMethod, MinData, SupportHandler)\
2049 {\
2050 MethodId, (PFNKSHANDLER)MethodHandler, MinMethod, MinData,\
2051 SupportHandler, Flags\
2052 }
2053
2054 #endif
2055
2056 typedef struct {
2057 ULONG MethodId;
2058 union {
2059 PFNKSFASTHANDLER MethodHandler;
2060 BOOLEAN MethodSupported;
2061 };
2062 } KSFASTMETHOD_ITEM, *PKSFASTMETHOD_ITEM;
2063
2064 #define DEFINE_KSFASTMETHOD_ITEM(MethodId, MethodHandler)\
2065 {\
2066 MethodId, (PFNKSFASTHANDLER)MethodHandler\
2067 }
2068
2069 typedef struct {
2070 const GUID *Set;
2071 ULONG MethodsCount;
2072 _Field_size_(MethodsCount) const KSMETHOD_ITEM *MethodItem;
2073 ULONG FastIoCount;
2074 _Field_size_(FastIoCount) const KSFASTMETHOD_ITEM *FastIoTable;
2075 } KSMETHOD_SET, *PKSMETHOD_SET;
2076
2077 #define DEFINE_KSMETHOD_SET(Set,\
2078 MethodsCount,\
2079 MethodItem,\
2080 FastIoCount,\
2081 FastIoTable)\
2082 {\
2083 Set,\
2084 MethodsCount,\
2085 MethodItem,\
2086 FastIoCount,\
2087 FastIoTable\
2088 }
2089
2090 #endif /* _NTDDK_ */
2091
2092 /* ===============================================================
2093 Nodes
2094 */
2095
2096 typedef struct {
2097 KSPROPERTY Property;
2098 ULONG NodeId;
2099 ULONG Reserved;
2100 } KSP_NODE, *PKSP_NODE;
2101
2102 typedef struct {
2103 KSMETHOD Method;
2104 ULONG NodeID;
2105 ULONG Reserved;
2106 } KSM_NODE, *PKSM_NODE;
2107
2108 typedef struct {
2109 KSEVENT Event;
2110 ULONG NodeId;
2111 ULONG Reserved;
2112 } KSE_NODE, *PKSE_NODE;
2113
2114 typedef struct {
2115 ULONG CreateFlags;
2116 ULONG Node;
2117 } KSNODE_CREATE, *PKSNODE_CREATE;
2118
2119 /* ===============================================================
2120 Events
2121 */
2122
2123 typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, *PKSEVENT_ENTRY;
2124
2125 #if defined(_NTDDK_)
2126
2127 typedef NTSTATUS
2128 (NTAPI *PFNKSADDEVENT)(
2129 _In_ PIRP Irp,
2130 _In_ PKSEVENTDATA EventData,
2131 _In_ struct _KSEVENT_ENTRY *EventEntry);
2132
2133 typedef VOID
2134 (NTAPI *PFNKSREMOVEEVENT)(
2135 _In_ PFILE_OBJECT FileObject,
2136 _In_ struct _KSEVENT_ENTRY *EventEntry);
2137
2138 typedef struct {
2139 ULONG EventId;
2140 ULONG DataInput;
2141 ULONG ExtraEntryData;
2142 PFNKSADDEVENT AddHandler;
2143 PFNKSREMOVEEVENT RemoveHandler;
2144 PFNKSHANDLER SupportHandler;
2145 } KSEVENT_ITEM, *PKSEVENT_ITEM;
2146
2147 typedef struct {
2148 const GUID *Set;
2149 ULONG EventsCount;
2150 _Field_size_(EventsCount) const KSEVENT_ITEM *EventItem;
2151 } KSEVENT_SET, *PKSEVENT_SET;
2152
2153 struct _KSEVENT_ENTRY {
2154 LIST_ENTRY ListEntry;
2155 PVOID Object;
2156 union {
2157 PKSDPC_ITEM DpcItem;
2158 PKSBUFFER_ITEM BufferItem;
2159 };
2160 PKSEVENTDATA EventData;
2161 ULONG NotificationType;
2162 const KSEVENT_SET *EventSet;
2163 const KSEVENT_ITEM *EventItem;
2164 PFILE_OBJECT FileObject;
2165 ULONG SemaphoreAdjustment;
2166 ULONG Reserved;
2167 ULONG Flags;
2168 };
2169
2170 #endif /* _NTDDK_ */
2171
2172 /* ===============================================================
2173 Pins
2174 */
2175
2176 #if defined(_NTDDK_)
2177
2178 typedef struct _KSPIN KSPIN, *PKSPIN;
2179 typedef struct _KSSTREAM_POINTER KSSTREAM_POINTER, *PKSSTREAM_POINTER;
2180 typedef struct _KSSTREAM_POINTER_OFFSET KSSTREAM_POINTER_OFFSET, *PKSSTREAM_POINTER_OFFSET;
2181 typedef struct _KSMAPPING KSMAPPING, *PKSMAPPING;
2182 typedef struct _KSPROCESSPIN KSPROCESSPIN, *PKSPROCESSPIN;
2183
2184 #define IOCTL_KS_HANDSHAKE CTL_CODE(FILE_DEVICE_KS, 0x007, METHOD_NEITHER, FILE_ANY_ACCESS)
2185
2186 typedef struct {
2187 GUID ProtocolId;
2188 PVOID Argument1;
2189 PVOID Argument2;
2190 } KSHANDSHAKE, *PKSHANDSHAKE;
2191
2192 _IRQL_requires_max_(PASSIVE_LEVEL)
2193 typedef NTSTATUS
2194 (NTAPI *PFNKSPINHANDSHAKE)(
2195 _In_ PKSPIN Pin,
2196 _In_ PKSHANDSHAKE In,
2197 _In_ PKSHANDSHAKE Out);
2198
2199 _IRQL_requires_max_(PASSIVE_LEVEL)
2200 typedef void
2201 (NTAPI *PFNKSPINPOWER)(
2202 _In_ PKSPIN Pin,
2203 _In_ DEVICE_POWER_STATE State);
2204
2205 typedef void
2206 (NTAPI *PFNKSPINFRAMERETURN)(
2207 _In_ PKSPIN Pin,
2208 _In_reads_bytes_opt_(Size) PVOID Data,
2209 _In_opt_ ULONG Size,
2210 _In_opt_ PMDL Mdl,
2211 _In_opt_ PVOID Context,
2212 _In_ NTSTATUS Status);
2213
2214 _IRQL_requires_max_(DISPATCH_LEVEL)
2215 typedef void
2216 (NTAPI *PFNKSPINIRPCOMPLETION)(
2217 _In_ PKSPIN Pin,
2218 _In_ PIRP Irp);
2219
2220 _IRQL_requires_max_(PASSIVE_LEVEL)
2221 typedef NTSTATUS
2222 (NTAPI *PFNKSPINIRP)(
2223 _In_ PKSPIN Pin,
2224 _In_ PIRP Irp);
2225
2226 typedef NTSTATUS
2227 (NTAPI *PFNKSPIN)(
2228 _In_ PKSPIN Pin);
2229
2230 _IRQL_requires_max_(PASSIVE_LEVEL)
2231 typedef void
2232 (NTAPI *PFNKSPINVOID)(
2233 _In_ PKSPIN Pin);
2234
2235 _IRQL_requires_max_(DISPATCH_LEVEL)
2236 typedef void
2237 (NTAPI *PFNKSSTREAMPOINTER)(
2238 _In_ PKSSTREAM_POINTER StreamPointer);
2239
2240 typedef struct {
2241 ULONG Count;
2242 _Field_size_(Count) PKSATTRIBUTE *Attributes;
2243 } KSATTRIBUTE_LIST, *PKSATTRIBUTE_LIST;
2244
2245 _IRQL_requires_max_(PASSIVE_LEVEL)
2246 typedef NTSTATUS
2247 (NTAPI *PFNKSPINSETDATAFORMAT)(
2248 _In_ PKSPIN Pin,
2249 _In_opt_ PKSDATAFORMAT OldFormat,
2250 _In_opt_ PKSMULTIPLE_ITEM OldAttributeList,
2251 _In_ const KSDATARANGE* DataRange,
2252 _In_opt_ const KSATTRIBUTE_LIST* AttributeRange);
2253
2254 _IRQL_requires_max_(PASSIVE_LEVEL)
2255 typedef NTSTATUS
2256 (NTAPI *PFNKSPINSETDEVICESTATE)(
2257 _In_ PKSPIN Pin,
2258 _In_ KSSTATE ToState,
2259 _In_ KSSTATE FromState);
2260
2261 typedef struct _KSCLOCK_DISPATCH KSCLOCK_DISPATCH, *PKSCLOCK_DISPATCH;
2262 typedef struct _KSALLOCATOR_DISPATCH KSALLOCATOR_DISPATCH, *PKSALLOCATOR_DISPATCH;
2263
2264 typedef struct {
2265 PFNKSPINIRP Create;
2266 PFNKSPINIRP Close;
2267 PFNKSPIN Process;
2268 PFNKSPINVOID Reset;
2269 PFNKSPINSETDATAFORMAT SetDataFormat;
2270 PFNKSPINSETDEVICESTATE SetDeviceState;
2271 PFNKSPIN Connect;
2272 PFNKSPINVOID Disconnect;
2273 const KSCLOCK_DISPATCH* Clock;
2274 const KSALLOCATOR_DISPATCH* Allocator;
2275 } KSPIN_DISPATCH, *PKSPIN_DISPATCH;
2276
2277 _IRQL_requires_max_(DISPATCH_LEVEL)
2278 typedef BOOLEAN
2279 (NTAPI *PFNKSPINSETTIMER)(
2280 _In_ PKSPIN Pin,
2281 _In_ PKTIMER Timer,
2282 _In_ LARGE_INTEGER DueTime,
2283 _In_ PKDPC Dpc);
2284
2285 _IRQL_requires_max_(DISPATCH_LEVEL)
2286 typedef BOOLEAN
2287 (NTAPI *PFNKSPINCANCELTIMER)(
2288 _In_ PKSPIN Pin,
2289 _In_ PKTIMER Timer);
2290
2291 _IRQL_requires_max_(DISPATCH_LEVEL)
2292 typedef LONGLONG
2293 (FASTCALL *PFNKSPINCORRELATEDTIME)(
2294 _In_ PKSPIN Pin,
2295 _Out_ PLONGLONG SystemTime);
2296
2297 _IRQL_requires_max_(DISPATCH_LEVEL)
2298 typedef void
2299 (NTAPI *PFNKSPINRESOLUTION)(
2300 _In_ PKSPIN Pin,
2301 _Out_ PKSRESOLUTION Resolution);
2302
2303 struct _KSCLOCK_DISPATCH {
2304 PFNKSPINSETTIMER SetTimer;
2305 PFNKSPINCANCELTIMER CancelTimer;
2306 PFNKSPINCORRELATEDTIME CorrelatedTime;
2307 PFNKSPINRESOLUTION Resolution;
2308 };
2309
2310 _IRQL_requires_max_(PASSIVE_LEVEL)
2311 typedef NTSTATUS
2312 (NTAPI *PFNKSPININITIALIZEALLOCATOR)(
2313 _In_ PKSPIN Pin,
2314 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
2315 _Out_ PVOID *Context);
2316
2317 typedef PVOID
2318 (NTAPI *PFNKSDELETEALLOCATOR)(
2319 _In_ PVOID Context);
2320
2321 typedef PVOID
2322 (NTAPI *PFNKSDEFAULTALLOCATE)(
2323 _In_ PVOID Context);
2324
2325 typedef PVOID
2326 (NTAPI *PFNKSDEFAULTFREE)(
2327 _In_ PVOID Context,
2328 _In_ PVOID Buffer);
2329
2330 struct _KSALLOCATOR_DISPATCH {
2331 PFNKSPININITIALIZEALLOCATOR InitializeAllocator;
2332 PFNKSDELETEALLOCATOR DeleteAllocator;
2333 PFNKSDEFAULTALLOCATE Allocate;
2334 PFNKSDEFAULTFREE Free;
2335 };
2336
2337 typedef struct KSAUTOMATION_TABLE_ {
2338 ULONG PropertySetsCount;
2339 ULONG PropertyItemSize;
2340 _Field_size_bytes_(PropertySetsCount * PropertyItemSize) const KSPROPERTY_SET *PropertySets;
2341 ULONG MethodSetsCount;
2342 ULONG MethodItemSize;
2343 _Field_size_bytes_(MethodSetsCount * MethodItemSize) const KSMETHOD_SET *MethodSets;
2344 ULONG EventSetsCount;
2345 ULONG EventItemSize;
2346 _Field_size_bytes_(EventSetsCount * EventItemSize) const KSEVENT_SET *EventSets;
2347 #if !defined(_WIN64)
2348 PVOID Alignment;
2349 #endif
2350 } KSAUTOMATION_TABLE, *PKSAUTOMATION_TABLE;
2351
2352 typedef struct {
2353 ULONG InterfacesCount;
2354 _Field_size_(InterfacesCount) const KSPIN_INTERFACE *Interfaces;
2355 ULONG MediumsCount;
2356 _Field_size_(MediumsCount) const KSPIN_MEDIUM *Mediums;
2357 ULONG DataRangesCount;
2358 _Field_size_(DataRangesCount) const PKSDATARANGE *DataRanges;
2359 KSPIN_DATAFLOW DataFlow;
2360 KSPIN_COMMUNICATION Communication;
2361 const GUID *Category;
2362 const GUID *Name;
2363 union {
2364 LONGLONG Reserved;
2365 struct {
2366 ULONG ConstrainedDataRangesCount;
2367 _Field_size_(ConstrainedDataRangesCount) PKSDATARANGE *ConstrainedDataRanges;
2368 };
2369 };
2370 } KSPIN_DESCRIPTOR, *PKSPIN_DESCRIPTOR;
2371
2372 _Must_inspect_result_
2373 _IRQL_requires_max_(PASSIVE_LEVEL)
2374 typedef NTSTATUS
2375 (NTAPI *PFNKSINTERSECTHANDLER)(
2376 _In_ PIRP Irp,
2377 _In_ PKSP_PIN Pin,
2378 _In_ PKSDATARANGE DataRange,
2379 _Out_opt_ PVOID Data);
2380
2381 _Must_inspect_result_
2382 _IRQL_requires_max_(PASSIVE_LEVEL)
2383 typedef NTSTATUS
2384 (NTAPI *PFNKSINTERSECTHANDLEREX)(
2385 _In_ PVOID Context,
2386 _In_ PIRP Irp,
2387 _In_ PKSP_PIN Pin,
2388 _In_ PKSDATARANGE DataRange,
2389 _In_ PKSDATARANGE MatchingDataRange,
2390 _In_ ULONG DataBufferSize,
2391 _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data,
2392 _Out_ PULONG DataSize);
2393
2394 typedef struct {
2395 const KSPIN_DISPATCH* Dispatch;
2396 const KSAUTOMATION_TABLE* AutomationTable;
2397 KSPIN_DESCRIPTOR PinDescriptor;
2398 ULONG Flags;
2399 ULONG InstancesPossible;
2400 ULONG InstancesNecessary;
2401 const KSALLOCATOR_FRAMING_EX* AllocatorFraming;
2402 PFNKSINTERSECTHANDLEREX IntersectHandler;
2403 } KSPIN_DESCRIPTOR_EX, *PKSPIN_DESCRIPTOR_EX;
2404
2405 #define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001
2406 #define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002
2407 #define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004
2408 #define KSFILTER_FLAG_RECEIVE_ZERO_LENGTH_SAMPLES 0x00000008
2409 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
2410 #define KSFILTER_FLAG_DENY_USERMODE_ACCESS 0x80000000
2411 #endif
2412
2413 #define KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING
2414 #define KSPIN_FLAG_CRITICAL_PROCESSING KSFILTER_FLAG_CRITICAL_PROCESSING
2415 #define KSPIN_FLAG_HYPERCRITICAL_PROCESSING KSFILTER_FLAG_HYPERCRITICAL_PROCESSING
2416
2417 #define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008
2418 #define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010
2419 #define KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL 0x00000020
2420 #define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040
2421 #define KSPIN_FLAG_ENFORCE_FIFO 0x00000080
2422
2423 #define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100
2424 #define KSPIN_FLAG_DISTINCT_TRAILING_EDGE 0x00000200
2425
2426 #define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000
2427 #define KSPIN_FLAG_SPLITTER 0x00020000
2428 #define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000
2429 #define KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT 0x00080000
2430 #define KSPIN_FLAG_FIXED_FORMAT 0x00100000
2431 #define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000
2432
2433 #define KSPIN_FLAG_RENDERER (KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY|KSPIN_FLAG_GENERATE_EOS_EVENTS)
2434
2435 #define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000
2436 #define KSPIN_FLAG_SOME_FRAMES_REQUIRED_FOR_PROCESSING 0x00800000
2437 #define KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE 0x01000000
2438 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
2439 #define KSPIN_FLAG_DENY_USERMODE_ACCESS 0x80000000
2440 #endif
2441
2442 struct _KSPIN {
2443 const KSPIN_DESCRIPTOR_EX *Descriptor;
2444 KSOBJECT_BAG Bag;
2445 PVOID Context;
2446 ULONG Id;
2447 KSPIN_COMMUNICATION Communication;
2448 BOOLEAN ConnectionIsExternal;
2449 KSPIN_INTERFACE ConnectionInterface;
2450 KSPIN_MEDIUM ConnectionMedium;
2451 KSPRIORITY ConnectionPriority;
2452 PKSDATAFORMAT ConnectionFormat;
2453 PKSMULTIPLE_ITEM AttributeList;
2454 ULONG StreamHeaderSize;
2455 KSPIN_DATAFLOW DataFlow;
2456 KSSTATE DeviceState;
2457 KSRESET ResetState;
2458 KSSTATE ClientState;
2459 };
2460
2461 #define DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(Handler)\
2462 DEFINE_KSPROPERTY_ITEM(\
2463 KSPROPERTY_PIN_CINSTANCES,\
2464 (Handler),\
2465 sizeof(KSP_PIN),\
2466 sizeof(KSPIN_CINSTANCES),\
2467 NULL, NULL, 0, NULL, NULL, 0)
2468
2469 #define DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(Handler)\
2470 DEFINE_KSPROPERTY_ITEM(\
2471 KSPROPERTY_PIN_CTYPES,\
2472 (Handler),\
2473 sizeof(KSPROPERTY),\
2474 sizeof(ULONG),\
2475 NULL, NULL, 0, NULL, NULL, 0)
2476
2477 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(Handler)\
2478 DEFINE_KSPROPERTY_ITEM(\
2479 KSPROPERTY_PIN_DATAFLOW,\
2480 (Handler),\
2481 sizeof(KSP_PIN),\
2482 sizeof(KSPIN_DATAFLOW),\
2483 NULL, NULL, 0, NULL, NULL, 0)
2484
2485 #define DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(Handler)\
2486 DEFINE_KSPROPERTY_ITEM(\
2487 KSPROPERTY_PIN_DATARANGES,\
2488 (Handler),\
2489 sizeof(KSP_PIN),\
2490 0,\
2491 NULL, NULL, 0, NULL, NULL, 0)
2492
2493 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(Handler)\
2494 DEFINE_KSPROPERTY_ITEM(\
2495 KSPROPERTY_PIN_DATAINTERSECTION,\
2496 (Handler),\
2497 sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM),\
2498 0,\
2499 NULL, NULL, 0, NULL, NULL, 0)
2500
2501 #define DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(Handler)\
2502 DEFINE_KSPROPERTY_ITEM(\
2503 KSPROPERTY_PIN_INTERFACES,\
2504 (Handler),\
2505 sizeof(KSP_PIN),\
2506 0,\
2507 NULL, NULL, 0, NULL, NULL, 0)
2508
2509 #define DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(Handler)\
2510 DEFINE_KSPROPERTY_ITEM(\
2511 KSPROPERTY_PIN_MEDIUMS,\
2512 (Handler),\
2513 sizeof(KSP_PIN),\
2514 0,\
2515 NULL, NULL, 0, NULL, NULL, 0)
2516
2517 #define DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(Handler)\
2518 DEFINE_KSPROPERTY_ITEM(\
2519 KSPROPERTY_PIN_COMMUNICATION,\
2520 (Handler),\
2521 sizeof(KSP_PIN),\
2522 sizeof(KSPIN_COMMUNICATION),\
2523 NULL, NULL, 0, NULL, NULL, 0)
2524
2525 #define DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(Handler)\
2526 DEFINE_KSPROPERTY_ITEM(\
2527 KSPROPERTY_PIN_GLOBALCINSTANCES,\
2528 (Handler),\
2529 sizeof(KSP_PIN),\
2530 sizeof(KSPIN_CINSTANCES),\
2531 NULL, NULL, 0, NULL, NULL, 0)
2532
2533 #define DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(Handler)\
2534 DEFINE_KSPROPERTY_ITEM(\
2535 KSPROPERTY_PIN_NECESSARYINSTANCES,\
2536 (Handler),\
2537 sizeof(KSP_PIN),\
2538 sizeof(ULONG),\
2539 NULL, NULL, 0, NULL, NULL, 0)
2540
2541 #define DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(Handler)\
2542 DEFINE_KSPROPERTY_ITEM(\
2543 KSPROPERTY_PIN_PHYSICALCONNECTION,\
2544 (Handler),\
2545 sizeof(KSP_PIN),\
2546 0,\
2547 NULL, NULL, 0, NULL, NULL, 0)
2548
2549 #define DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(Handler)\
2550 DEFINE_KSPROPERTY_ITEM(\
2551 KSPROPERTY_PIN_CATEGORY,\
2552 (Handler),\
2553 sizeof(KSP_PIN),\
2554 sizeof(GUID),\
2555 NULL, NULL, 0, NULL, NULL, 0)
2556
2557 #define DEFINE_KSPROPERTY_ITEM_PIN_NAME(Handler)\
2558 DEFINE_KSPROPERTY_ITEM(\
2559 KSPROPERTY_PIN_NAME,\
2560 (Handler),\
2561 sizeof(KSP_PIN),\
2562 0,\
2563 NULL, NULL, 0, NULL, NULL, 0)
2564
2565 #define DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(Handler)\
2566 DEFINE_KSPROPERTY_ITEM(\
2567 KSPROPERTY_PIN_CONSTRAINEDDATARANGES,\
2568 (Handler),\
2569 sizeof(KSP_PIN),\
2570 0,\
2571 NULL, NULL, 0, NULL, NULL, 0)
2572
2573 #define DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(Handler)\
2574 DEFINE_KSPROPERTY_ITEM(\
2575 KSPROPERTY_PIN_PROPOSEDATAFORMAT,\
2576 NULL,\
2577 sizeof(KSP_PIN),\
2578 sizeof(KSDATAFORMAT),\
2579 (Handler), NULL, 0, NULL, NULL, 0)
2580
2581 #define DEFINE_KSPROPERTY_PINSET(PinSet,\
2582 PropGeneral, PropInstances, PropIntersection)\
2583 DEFINE_KSPROPERTY_TABLE(PinSet) {\
2584 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
2585 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
2586 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
2587 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
2588 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
2589 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
2590 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
2591 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
2592 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
2593 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral)\
2594 }
2595
2596 #define DEFINE_KSPROPERTY_PINSETCONSTRAINED(PinSet,\
2597 PropGeneral, PropInstances, PropIntersection)\
2598 DEFINE_KSPROPERTY_TABLE(PinSet) {\
2599 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
2600 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
2601 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
2602 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
2603 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
2604 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
2605 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
2606 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
2607 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
2608 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
2609 DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral)\
2610 }
2611
2612 typedef void
2613 (NTAPI *PFNKSFREE)(
2614 _In_ PVOID Data);
2615
2616 #define DEFINE_KSPROPERTY_TABLE(tablename) \
2617 const KSPROPERTY_ITEM tablename[] =
2618
2619 #endif /* _NTDDK_ */
2620
2621 typedef struct {
2622 KSPIN_INTERFACE Interface;
2623 KSPIN_MEDIUM Medium;
2624 ULONG PinId;
2625 HANDLE PinToHandle;
2626 KSPRIORITY Priority;
2627 } KSPIN_CONNECT, *PKSPIN_CONNECT;
2628
2629 /* ===============================================================
2630 Topology
2631 */
2632
2633 typedef struct {
2634 ULONG FromNode;
2635 ULONG FromNodePin;
2636 ULONG ToNode;
2637 ULONG ToNodePin;
2638 } KSTOPOLOGY_CONNECTION, *PKSTOPOLOGY_CONNECTION;
2639
2640 typedef struct {
2641 ULONG CategoriesCount;
2642 _Field_size_(CategoriesCount) const GUID *Categories;
2643 ULONG TopologyNodesCount;
2644 _Field_size_(TopologyNodesCount) const GUID *TopologyNodes;
2645 ULONG TopologyConnectionsCount;
2646 _Field_size_(TopologyConnectionsCount) const KSTOPOLOGY_CONNECTION *TopologyConnections;
2647 _Field_size_(TopologyNodesCount) const GUID *TopologyNodesNames;
2648 ULONG Reserved;
2649 } KSTOPOLOGY, *PKSTOPOLOGY;
2650
2651
2652 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler)\
2653 DEFINE_KSPROPERTY_ITEM(\
2654 KSPROPERTY_TOPOLOGY_CATEGORIES,\
2655 (Handler),\
2656 sizeof(KSPROPERTY),\
2657 0,\
2658 NULL, NULL, 0, NULL, NULL, 0)
2659
2660 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler)\
2661 DEFINE_KSPROPERTY_ITEM(\
2662 KSPROPERTY_TOPOLOGY_NODES,\
2663 (Handler),\
2664 sizeof(KSPROPERTY),\
2665 0,\
2666 NULL, NULL, 0, NULL, NULL, 0)
2667
2668 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler)\
2669 DEFINE_KSPROPERTY_ITEM(\
2670 KSPROPERTY_TOPOLOGY_CONNECTIONS,\
2671 (Handler),\
2672 sizeof(KSPROPERTY),\
2673 0,\
2674 NULL, NULL, 0, NULL, NULL, 0)
2675
2676 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
2677 DEFINE_KSPROPERTY_ITEM(\
2678 KSPROPERTY_TOPOLOGY_NAME,\
2679 (Handler),\
2680 sizeof(KSP_NODE),\
2681 0,\
2682 NULL, NULL, 0, NULL, NULL, 0)
2683
2684 #define DEFINE_KSPROPERTY_TOPOLOGYSET(TopologySet, Handler)\
2685 DEFINE_KSPROPERTY_TABLE(TopologySet) {\
2686 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler),\
2687 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler),\
2688 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler),\
2689 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
2690 }
2691
2692 /* ===============================================================
2693 ??? SORT ME
2694 */
2695
2696 /* TODO */
2697 typedef void* UNKNOWN;
2698
2699 typedef PVOID
2700 (NTAPI *PFNKSINITIALIZEALLOCATOR)(
2701 _In_ PVOID InitialContext,
2702 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
2703 _Outptr_ PVOID *Context);
2704
2705 #if defined(_NTDDK_)
2706
2707 _IRQL_requires_max_(PASSIVE_LEVEL)
2708 typedef NTSTATUS
2709 (NTAPI *PFNKSALLOCATOR)(
2710 _In_ PIRP Irp,
2711 _In_ ULONG BufferSize,
2712 _In_ BOOLEAN InputOperation);
2713
2714 _Must_inspect_result_
2715 _IRQL_requires_max_(PASSIVE_LEVEL)
2716 typedef NTSTATUS
2717 (NTAPI *PFNKINTERSECTHANDLEREX)(
2718 _In_ PVOID Context,
2719 _In_ PIRP Irp,
2720 _In_ PKSP_PIN Pin,
2721 _In_ PKSDATARANGE DataRange,
2722 _In_ PKSDATARANGE MatchingDataRange,
2723 _In_ ULONG DataBufferSize,
2724 _Out_writes_bytes_to_opt_(DataBufferSize, *DataSize) PVOID Data,
2725 _Out_ PULONG DataSize);
2726
2727 typedef NTSTATUS
2728 (NTAPI *PFNALLOCATOR_ALLOCATEFRAME)(
2729 _In_ PFILE_OBJECT FileObject,
2730 _Outptr_ PVOID *Frame);
2731
2732 typedef VOID
2733 (NTAPI *PFNALLOCATOR_FREEFRAME)(
2734 _In_ PFILE_OBJECT FileObject,
2735 _In_ PVOID Frame);
2736
2737 typedef struct {
2738 PFNALLOCATOR_ALLOCATEFRAME AllocateFrame;
2739 PFNALLOCATOR_FREEFRAME FreeFrame;
2740 } KSSTREAMALLOCATOR_FUNCTIONTABLE, *PKSSTREAMALLOCATOR_FUNCTIONTABLE;
2741
2742 #endif /* _NTDDK_ */
2743
2744 typedef struct {
2745 KSALLOCATOR_FRAMING Framing;
2746 ULONG AllocatedFrames;
2747 ULONG Reserved;
2748 } KSSTREAMALLOCATOR_STATUS, *PKSSTREAMALLOCATOR_STATUS;
2749
2750 typedef struct {
2751 KSALLOCATOR_FRAMING_EX Framing;
2752 ULONG AllocatedFrames;
2753 ULONG Reserved;
2754 } KSSTREAMALLOCATOR_STATUS_EX, *PKSSTREAMALLOCATOR_STATUS_EX;
2755
2756 typedef struct {
2757 ULONG Size;
2758 ULONG TypeSpecificFlags;
2759 KSTIME PresentationTime;
2760 LONGLONG Duration;
2761 ULONG FrameExtent;
2762 ULONG DataUsed;
2763 PVOID Data;
2764 ULONG OptionsFlags;
2765 #ifdef _WIN64
2766 ULONG Reserved;
2767 #endif
2768 } KSSTREAM_HEADER, *PKSSTREAM_HEADER;
2769
2770 #define KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT 0x00000001
2771 #define KSSTREAM_HEADER_OPTIONSF_PREROLL 0x00000002
2772 #define KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY 0x00000004
2773 #define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED 0x00000008
2774 #define KSSTREAM_HEADER_OPTIONSF_TIMEVALID 0x00000010
2775 #define KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY 0x00000040
2776 #define KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE 0x00000080
2777 #define KSSTREAM_HEADER_OPTIONSF_DURATIONVALID 0x00000100
2778 #define KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM 0x00000200
2779 #define KSSTREAM_HEADER_OPTIONSF_BUFFEREDTRANSFER 0x00000400
2780 #define KSSTREAM_HEADER_OPTIONSF_VRAM_DATA_TRANSFER 0x00000800
2781 #define KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA 0x80000000
2782
2783 /* ===============================================================
2784 XP / DX8
2785 */
2786
2787 #if defined(_NTDDK_)
2788
2789 typedef struct _KSGATE KSGATE, *PKSGATE;
2790
2791 struct _KSGATE {
2792 LONG Count;
2793 PKSGATE NextGate;
2794 };
2795
2796 #ifndef _NTOS_
2797
2798 _IRQL_requires_max_(HIGH_LEVEL)
2799 static
2800 __inline
2801 void
2802 KsGateTurnInputOn(
2803 _In_opt_ PKSGATE Gate)
2804 {
2805 while (Gate && (InterlockedIncrement(&Gate->Count) == 1))
2806 {
2807 Gate = Gate->NextGate;
2808 }
2809 }
2810
2811 _IRQL_requires_max_(HIGH_LEVEL)
2812 static
2813 __inline
2814 void
2815 KsGateTurnInputOff(
2816 _In_opt_ PKSGATE Gate)
2817 {
2818 while (Gate && (InterlockedDecrement(&Gate->Count) == 0))
2819 {
2820 Gate = Gate->NextGate;
2821 }
2822 }
2823
2824 _IRQL_requires_max_(HIGH_LEVEL)
2825 static
2826 __inline
2827 BOOLEAN
2828 KsGateGetStateUnsafe(
2829 _In_ PKSGATE Gate)
2830 {
2831 ASSERT(Gate);
2832 return((BOOLEAN)(Gate->Count > 0));
2833 }
2834
2835 _IRQL_requires_max_(HIGH_LEVEL)
2836 static
2837 __inline
2838 BOOLEAN
2839 KsGateCaptureThreshold(
2840 _In_ PKSGATE Gate)
2841 {
2842 BOOLEAN captured;
2843
2844 ASSERT(Gate);
2845
2846 captured = (BOOLEAN)(InterlockedCompareExchange(&Gate->Count,0,1) == 1);
2847
2848 if (captured)
2849 {
2850 KsGateTurnInputOff(Gate->NextGate);
2851 }
2852
2853 return captured;
2854 }
2855
2856 _IRQL_requires_max_(HIGH_LEVEL)
2857 static
2858 __inline
2859 void
2860 KsGateInitialize(
2861 _In_ PKSGATE Gate,
2862 _In_ LONG InitialCount,
2863 _In_opt_ PKSGATE NextGate,
2864 _In_ BOOLEAN StateToPropagate)
2865 {
2866 ASSERT(Gate);
2867 Gate->Count = InitialCount;
2868 Gate->NextGate = NextGate;
2869
2870 if (NextGate)
2871 {
2872 if (InitialCount > 0)
2873 {
2874 if (StateToPropagate)
2875 {
2876 KsGateTurnInputOn(NextGate);
2877 }
2878 }
2879 else
2880 {
2881 if (!StateToPropagate)
2882 {
2883 KsGateTurnInputOff(NextGate);
2884 }
2885 }
2886 }
2887 }
2888
2889 _IRQL_requires_max_(HIGH_LEVEL)
2890 static
2891 __inline
2892 void
2893 KsGateInitializeAnd(
2894 _In_ PKSGATE AndGate,
2895 _In_opt_ PKSGATE NextOrGate)
2896 {
2897 KsGateInitialize(AndGate,1,NextOrGate,TRUE);
2898 }
2899
2900 _IRQL_requires_max_(HIGH_LEVEL)
2901 static
2902 __inline
2903 void
2904 KsGateInitializeOr(
2905 _In_ PKSGATE OrGate,
2906 _In_opt_ PKSGATE NextAndGate)
2907 {
2908 KsGateInitialize(OrGate,0,NextAndGate,FALSE);
2909 }
2910
2911 _IRQL_requires_max_(HIGH_LEVEL)
2912 static
2913 __inline
2914 void
2915 KsGateAddOnInputToAnd(
2916 _In_ PKSGATE AndGate)
2917 {
2918 UNREFERENCED_PARAMETER (AndGate);
2919 }
2920
2921 _IRQL_requires_max_(HIGH_LEVEL)
2922 static
2923 __inline
2924 void
2925 KsGateAddOffInputToAnd(
2926 _In_ PKSGATE AndGate)
2927 {
2928 KsGateTurnInputOff(AndGate);
2929 }
2930
2931 _IRQL_requires_max_(HIGH_LEVEL)
2932 static
2933 __inline
2934 void
2935 KsGateRemoveOnInputFromAnd(
2936 _In_ PKSGATE AndGate)
2937 {
2938 UNREFERENCED_PARAMETER (AndGate);
2939 }
2940
2941 _IRQL_requires_max_(HIGH_LEVEL)
2942 static
2943 __inline
2944 void
2945 KsGateRemoveOffInputFromAnd(
2946 _In_ PKSGATE AndGate)
2947 {
2948 KsGateTurnInputOn(AndGate);
2949 }
2950
2951 _IRQL_requires_max_(HIGH_LEVEL)
2952 static
2953 __inline
2954 void
2955 KsGateAddOnInputToOr(
2956 _In_ PKSGATE OrGate)
2957 {
2958 KsGateTurnInputOn(OrGate);
2959 }
2960
2961 _IRQL_requires_max_(HIGH_LEVEL)
2962 static
2963 __inline
2964 void
2965 KsGateAddOffInputToOr(
2966 _In_ PKSGATE OrGate)
2967 {
2968 UNREFERENCED_PARAMETER (OrGate);
2969 }
2970
2971 _IRQL_requires_max_(HIGH_LEVEL)
2972 static
2973 __inline
2974 void
2975 KsGateRemoveOnInputFromOr(
2976 _In_ PKSGATE OrGate)
2977 {
2978 KsGateTurnInputOff(OrGate);
2979 }
2980
2981 _IRQL_requires_max_(HIGH_LEVEL)
2982 static
2983 __inline
2984 void
2985 KsGateRemoveOffInputFromOr(
2986 _In_ PKSGATE OrGate)
2987 {
2988 UNREFERENCED_PARAMETER (OrGate);
2989 }
2990
2991 _IRQL_requires_max_(HIGH_LEVEL)
2992 static
2993 __inline
2994 void
2995 KsGateTerminateAnd(
2996 _In_ PKSGATE AndGate)
2997 {
2998 ASSERT(AndGate);
2999 if (KsGateGetStateUnsafe(AndGate))
3000 {
3001 KsGateRemoveOnInputFromOr(AndGate->NextGate);
3002 }
3003 else
3004 {
3005 KsGateRemoveOffInputFromOr(AndGate->NextGate);
3006 }
3007 }
3008
3009 _IRQL_requires_max_(HIGH_LEVEL)
3010 static
3011 __inline
3012 void
3013 KsGateTerminateOr(
3014 _In_ PKSGATE OrGate)
3015 {
3016 ASSERT(OrGate);
3017 if (KsGateGetStateUnsafe(OrGate))
3018 {
3019 KsGateRemoveOnInputFromAnd(OrGate->NextGate);
3020 }
3021 else
3022 {
3023 KsGateRemoveOffInputFromAnd(OrGate->NextGate);
3024 }
3025 }
3026
3027 #endif /* !_NTOS_ */
3028
3029 struct _KSMAPPING {
3030 PHYSICAL_ADDRESS PhysicalAddress;
3031 ULONG ByteCount;
3032 ULONG Alignment;
3033 };
3034
3035 #endif /* _NTDDK_ */
3036
3037 typedef enum {
3038 KSSTREAM_POINTER_STATE_UNLOCKED = 0,
3039 KSSTREAM_POINTER_STATE_LOCKED
3040 } KSSTREAM_POINTER_STATE;
3041
3042 typedef struct _KSPROCESSPIN_INDEXENTRY KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY;
3043
3044 struct _KSSTREAM_POINTER_OFFSET {
3045 #if defined(_NTDDK_)
3046 union {
3047 PUCHAR Data;
3048 PKSMAPPING Mappings;
3049 };
3050 #else
3051 PUCHAR Data;
3052 #endif
3053 #if !defined(_WIN64)
3054 PVOID Alignment;
3055 #endif
3056 ULONG Count;
3057 ULONG Remaining;
3058 };
3059
3060 #if defined(_NTDDK_)
3061
3062 struct _KSSTREAM_POINTER {
3063 PVOID Context;
3064 PKSPIN Pin;
3065 PKSSTREAM_HEADER StreamHeader;
3066 PKSSTREAM_POINTER_OFFSET Offset;
3067 KSSTREAM_POINTER_OFFSET OffsetIn;
3068 KSSTREAM_POINTER_OFFSET OffsetOut;
3069 };
3070
3071 struct _KSPROCESSPIN {
3072 PKSPIN Pin;
3073 PKSSTREAM_POINTER StreamPointer;
3074 PKSPROCESSPIN InPlaceCounterpart;
3075 PKSPROCESSPIN DelegateBranch;
3076 PKSPROCESSPIN CopySource;
3077 _Field_size_bytes_(BytesAvailable) PVOID Data;
3078 ULONG BytesAvailable;
3079 ULONG BytesUsed;
3080 ULONG Flags;
3081 BOOLEAN Terminate;
3082 };
3083
3084 struct _KSPROCESSPIN_INDEXENTRY {
3085 _Field_size_(Count) PKSPROCESSPIN *Pins;
3086 ULONG Count;
3087 };
3088
3089 #endif /* _NTDDK_ */
3090
3091 /* ===============================================================
3092 Device Dispatch
3093 */
3094
3095 #if defined(_NTDDK_)
3096
3097 typedef struct _KSFILTER_DISPATCH KSFILTER_DISPATCH, *PKSFILTER_DISPATCH;
3098 typedef struct _KSDEVICE KSDEVICE, *PKSDEVICE;
3099 typedef struct _KSFILTER KSFILTER, *PKSFILTER;
3100 typedef struct _KSNODE_DESCRIPTOR KSNODE_DESCRIPTOR, *PKSNODE_DESCRIPTOR;
3101 typedef struct _KSFILTER_DESCRIPTOR KSFILTER_DESCRIPTOR, *PKSFILTER_DESCRIPTOR;
3102 typedef struct _KSDEVICE_DESCRIPTOR KSDEVICE_DESCRIPTOR, *PKSDEVICE_DESCRIPTOR;
3103
3104 _IRQL_requires_max_(PASSIVE_LEVEL)
3105 typedef NTSTATUS
3106 (NTAPI *PFNKSDEVICECREATE)(
3107 _In_ PKSDEVICE Device);
3108
3109 _IRQL_requires_max_(PASSIVE_LEVEL)
3110 typedef NTSTATUS
3111 (NTAPI *PFNKSDEVICEPNPSTART)(
3112 _In_ PKSDEVICE Device,
3113 _In_ PIRP Irp,
3114 _In_opt_ PCM_RESOURCE_LIST TranslatedResourceList,
3115 _In_opt_ PCM_RESOURCE_LIST UntranslatedResourceList);
3116
3117 _IRQL_requires_max_(PASSIVE_LEVEL)
3118 typedef NTSTATUS
3119 (NTAPI *PFNKSDEVICE)(
3120 _In_ PKSDEVICE Device);
3121
3122 _IRQL_requires_max_(PASSIVE_LEVEL)
3123 typedef NTSTATUS
3124 (NTAPI *PFNKSDEVICEIRP)(
3125 _In_ PKSDEVICE Device,
3126 _In_ PIRP Irp);
3127
3128 _IRQL_requires_max_(PASSIVE_LEVEL)
3129 typedef VOID
3130 (NTAPI *PFNKSDEVICEIRPVOID)(
3131 _In_ PKSDEVICE Device,
3132 _In_ PIRP Irp);
3133
3134 _IRQL_requires_max_(PASSIVE_LEVEL)
3135 typedef NTSTATUS
3136 (NTAPI *PFNKSDEVICEQUERYCAPABILITIES)(
3137 _In_ PKSDEVICE Device,
3138 _In_ PIRP Irp,
3139 _Inout_ PDEVICE_CAPABILITIES Capabilities);
3140
3141 _IRQL_requires_max_(PASSIVE_LEVEL)
3142 typedef NTSTATUS
3143 (NTAPI *PFNKSDEVICEQUERYPOWER)(
3144 _In_ PKSDEVICE Device,
3145 _In_ PIRP Irp,
3146 _In_ DEVICE_POWER_STATE DeviceTo,
3147 _In_ DEVICE_POWER_STATE DeviceFrom,
3148 _In_ SYSTEM_POWER_STATE SystemTo,
3149 _In_ SYSTEM_POWER_STATE SystemFrom,
3150 _In_ POWER_ACTION Action);
3151
3152 _IRQL_requires_max_(PASSIVE_LEVEL)
3153 typedef VOID
3154 (NTAPI *PFNKSDEVICESETPOWER)(
3155 _In_ PKSDEVICE Device,
3156 _In_ PIRP Irp,
3157 _In_ DEVICE_POWER_STATE To,
3158 _In_ DEVICE_POWER_STATE From);
3159
3160 typedef struct _KSDEVICE_DISPATCH {
3161 PFNKSDEVICECREATE Add;
3162 PFNKSDEVICEPNPSTART Start;
3163 PFNKSDEVICE PostStart;
3164 PFNKSDEVICEIRP QueryStop;
3165 PFNKSDEVICEIRPVOID CancelStop;
3166 PFNKSDEVICEIRPVOID Stop;
3167 PFNKSDEVICEIRP QueryRemove;
3168 PFNKSDEVICEIRPVOID CancelRemove;
3169 PFNKSDEVICEIRPVOID Remove;
3170 PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities;
3171 PFNKSDEVICEIRPVOID SurpriseRemoval;
3172 PFNKSDEVICEQUERYPOWER QueryPower;
3173 PFNKSDEVICESETPOWER SetPower;
3174 PFNKSDEVICEIRP QueryInterface;
3175 } KSDEVICE_DISPATCH, *PKSDEVICE_DISPATCH;
3176
3177 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
3178 #define KSDEVICE_DESCRIPTOR_VERSION_2 (0x110)
3179 #define MIN_DEV_VER_FOR_FLAGS (0x110)
3180 #endif
3181
3182 struct _KSDEVICE {
3183 const KSDEVICE_DESCRIPTOR* Descriptor;
3184 KSOBJECT_BAG Bag;
3185 PVOID Context;
3186 PDEVICE_OBJECT FunctionalDeviceObject;
3187 PDEVICE_OBJECT PhysicalDeviceObject;
3188 PDEVICE_OBJECT NextDeviceObject;
3189 BOOLEAN Started;
3190 SYSTEM_POWER_STATE SystemPowerState;
3191 DEVICE_POWER_STATE DevicePowerState;
3192 };
3193
3194 #endif /* _NTDDK_ */
3195
3196 /* ===============================================================
3197 Filter Dispatch
3198 */
3199
3200 #if defined(_NTDDK_)
3201
3202 struct _KSFILTER {
3203 const KSFILTER_DESCRIPTOR* Descriptor;
3204 KSOBJECT_BAG Bag;
3205 PVOID Context;
3206 };
3207
3208 _IRQL_requires_max_(PASSIVE_LEVEL)
3209 typedef void
3210 (NTAPI *PFNKSFILTERPOWER)(
3211 _In_ PKSFILTER Filter,
3212 _In_ DEVICE_POWER_STATE State);
3213
3214 _IRQL_requires_max_(PASSIVE_LEVEL)
3215 typedef NTSTATUS
3216 (NTAPI *PFNKSFILTERIRP)(
3217 _In_ PKSFILTER Filter,
3218 _In_ PIRP Irp);
3219
3220 typedef NTSTATUS
3221 (NTAPI *PFNKSFILTERPROCESS)(
3222 _In_ PKSFILTER Filter,
3223 _In_ PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex);
3224
3225 _IRQL_requires_max_(PASSIVE_LEVEL)
3226 typedef NTSTATUS
3227 (NTAPI *PFNKSFILTERVOID)(
3228 _In_ PKSFILTER Filter);
3229
3230 struct _KSFILTER_DISPATCH {
3231 PFNKSFILTERIRP Create;
3232 PFNKSFILTERIRP Close;
3233 PFNKSFILTERPROCESS Process;
3234 PFNKSFILTERVOID Reset;
3235 };
3236
3237 struct _KSNODE_DESCRIPTOR {
3238 const KSAUTOMATION_TABLE *AutomationTable;
3239 const GUID *Type;
3240 const GUID *Name;
3241 #if !defined(_WIN64)
3242 PVOID Alignment;
3243 #endif
3244 };
3245
3246 struct _KSFILTER_DESCRIPTOR {
3247 const KSFILTER_DISPATCH *Dispatch;
3248 const KSAUTOMATION_TABLE *AutomationTable;
3249 ULONG Version;
3250 ULONG Flags;
3251 const GUID *ReferenceGuid;
3252 ULONG PinDescriptorsCount;
3253 ULONG PinDescriptorSize;
3254 _Field_size_bytes_(PinDescriptorsCount * PinDescriptorSize) const KSPIN_DESCRIPTOR_EX *PinDescriptors;
3255 ULONG CategoriesCount;
3256 _Field_size_(CategoriesCount) const GUID *Categories;
3257 ULONG NodeDescriptorsCount;
3258 ULONG NodeDescriptorSize;
3259 _Field_size_bytes_(NodeDescriptorsCount * NodeDescriptorSize) const KSNODE_DESCRIPTOR *NodeDescriptors;
3260 ULONG ConnectionsCount;
3261 _Field_size_(ConnectionsCount) const KSTOPOLOGY_CONNECTION *Connections;
3262 const KSCOMPONENTID *ComponentId;
3263 };
3264
3265 #define KSFILTER_DESCRIPTOR_VERSION ((ULONG)-1)
3266
3267 struct _KSDEVICE_DESCRIPTOR {
3268 const KSDEVICE_DISPATCH *Dispatch;
3269 ULONG FilterDescriptorsCount;
3270 _Field_size_(FilterDescriptorsCount) const KSFILTER_DESCRIPTOR * const *FilterDescriptors;
3271 ULONG Version;
3272 ULONG Flags;
3273 };
3274
3275 struct _KSFILTERFACTORY {
3276 const KSFILTER_DESCRIPTOR* FilterDescriptor;
3277 KSOBJECT_BAG Bag;
3278 PVOID Context;
3279 };
3280
3281 #define DEFINE_KSFILTER_DESCRIPTOR(descriptor)\
3282 const KSFILTER_DESCRIPTOR descriptor =
3283
3284 #define DEFINE_KSFILTER_PIN_DESCRIPTORS(table)\
3285 SIZEOF_ARRAY(table),\
3286 sizeof(table[0]),\
3287 table
3288
3289 #define DEFINE_KSFILTER_CATEGORIES(table)\
3290 SIZEOF_ARRAY(table),\
3291 table
3292
3293 #define DEFINE_KSFILTER_CATEGORY(category)\
3294 1,\
3295 &(category)
3296
3297 #define DEFINE_KSFILTER_CATEGORIES_NULL\
3298 0,\
3299 NULL
3300
3301 #define DEFINE_KSFILTER_NODE_DESCRIPTORS(table)\
3302 SIZEOF_ARRAY(table),\
3303 sizeof(table[0]),\
3304 table
3305
3306 #define DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL\
3307 0,\
3308 sizeof(KSNODE_DESCRIPTOR),\
3309 NULL
3310
3311 #define DEFINE_KSFILTER_CONNECTIONS(table)\
3312 SIZEOF_ARRAY(table),\
3313 table
3314
3315 #define DEFINE_KSFILTER_DEFAULT_CONNECTIONS\
3316 0,\
3317 NULL
3318
3319 #endif /* _NTDDK_ */
3320
3321 /* ===============================================================
3322 Minidriver Callbacks
3323 */
3324
3325 #if defined(_NTDDK_)
3326
3327 typedef NTSTATUS
3328 (NTAPI *KStrMethodHandler)(
3329 IN PIRP Irp,
3330 IN PKSIDENTIFIER Request,
3331 IN OUT PVOID Data);
3332
3333 typedef NTSTATUS
3334 (NTAPI *KStrSupportHandler)(
3335 IN PIRP Irp,
3336 IN PKSIDENTIFIER Request,
3337 IN OUT PVOID Data);
3338
3339 #endif
3340
3341 /* ===============================================================
3342 Allocator Functions
3343 */
3344
3345 #if defined(_NTDDK_)
3346
3347 _IRQL_requires_max_(PASSIVE_LEVEL)
3348 KSDDKAPI
3349 NTSTATUS
3350 NTAPI
3351 KsCreateAllocator(
3352 _In_ HANDLE ConnectionHandle,
3353 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
3354 _Out_ PHANDLE AllocatorHandle);
3355
3356 _IRQL_requires_max_(PASSIVE_LEVEL)
3357 KSDDKAPI
3358 NTSTATUS
3359 NTAPI
3360 KsCreateDefaultAllocator(
3361 _In_ PIRP Irp);
3362
3363 _IRQL_requires_max_(PASSIVE_LEVEL)
3364 KSDDKAPI
3365 NTSTATUS
3366 NTAPI
3367 KsValidateAllocatorCreateRequest(
3368 _In_ PIRP Irp,
3369 _Out_ PKSALLOCATOR_FRAMING *AllocatorFraming);
3370
3371 _IRQL_requires_max_(PASSIVE_LEVEL)
3372 KSDDKAPI
3373 NTSTATUS
3374 NTAPI
3375 KsCreateDefaultAllocatorEx(
3376 _In_ PIRP Irp,
3377 _In_opt_ PVOID InitializeContext,
3378 _In_opt_ PFNKSDEFAULTALLOCATE DefaultAllocate,
3379 _In_opt_ PFNKSDEFAULTFREE DefaultFree,
3380 _In_opt_ PFNKSINITIALIZEALLOCATOR InitializeAllocator,
3381 _In_opt_ PFNKSDELETEALLOCATOR DeleteAllocator);
3382
3383 _IRQL_requires_max_(PASSIVE_LEVEL)
3384 KSDDKAPI
3385 NTSTATUS
3386 NTAPI
3387 KsValidateAllocatorFramingEx(
3388 _In_ PKSALLOCATOR_FRAMING_EX Framing,
3389 _In_ ULONG BufferSize,
3390 _In_ const KSALLOCATOR_FRAMING_EX *PinFraming);
3391
3392 #endif /* _NTDDK_ */
3393
3394 /* ===============================================================
3395 Clock Functions
3396 */
3397
3398 #if defined(_NTDDK_)
3399
3400 _IRQL_requires_max_(DISPATCH_LEVEL)
3401 typedef BOOLEAN
3402 (NTAPI *PFNKSSETTIMER)(
3403 _In_ PVOID Context,
3404 _In_ PKTIMER Timer,
3405 _In_ LARGE_INTEGER DueTime,
3406 _In_ PKDPC Dpc);
3407
3408 _IRQL_requires_max_(DISPATCH_LEVEL)
3409 typedef BOOLEAN
3410 (NTAPI *PFNKSCANCELTIMER)(
3411 _In_ PVOID Context,
3412 _In_ PKTIMER Timer);
3413
3414 typedef LONGLONG
3415 (FASTCALL *PFNKSCORRELATEDTIME)(
3416 _In_ PVOID Context,
3417 _Out_ PLONGLONG SystemTime);
3418
3419 _IRQL_requires_max_(PASSIVE_LEVEL)
3420 KSDDKAPI
3421 NTSTATUS
3422 NTAPI
3423 KsCreateClock(
3424 _In_ HANDLE ConnectionHandle,
3425 _In_ PKSCLOCK_CREATE ClockCreate,
3426 _Out_ PHANDLE ClockHandle);
3427
3428 _IRQL_requires_max_(PASSIVE_LEVEL)
3429 KSDDKAPI
3430 NTSTATUS
3431 NTAPI
3432 KsCreateDefaultClock(
3433 _In_ PIRP Irp,
3434 _In_ PKSDEFAULTCLOCK DefaultClock);
3435
3436 _IRQL_requires_max_(PASSIVE_LEVEL)
3437 KSDDKAPI
3438 NTSTATUS
3439 NTAPI
3440 KsAllocateDefaultClock(
3441 _Out_ PKSDEFAULTCLOCK *DefaultClock);
3442
3443 _IRQL_requires_max_(PASSIVE_LEVEL)
3444 KSDDKAPI
3445 NTSTATUS
3446 NTAPI
3447 KsAllocateDefaultClockEx(
3448 _Out_ PKSDEFAULTCLOCK *DefaultClock,
3449 _In_opt_ PVOID Context,
3450 _In_opt_ PFNKSSETTIMER SetTimer,
3451 _In_opt_ PFNKSCANCELTIMER CancelTimer,
3452 _In_opt_ PFNKSCORRELATEDTIME CorrelatedTime,
3453 _In_opt_ const KSRESOLUTION *Resolution,
3454 _In_ ULONG Flags);
3455
3456 _IRQL_requires_max_(PASSIVE_LEVEL)
3457 KSDDKAPI
3458 VOID
3459 NTAPI
3460 KsFreeDefaultClock(
3461 _In_ PKSDEFAULTCLOCK DefaultClock);
3462
3463 _IRQL_requires_max_(PASSIVE_LEVEL)
3464 KSDDKAPI
3465 NTSTATUS
3466 NTAPI
3467 KsValidateClockCreateRequest(
3468 _In_ PIRP Irp,
3469 _Outptr_ PKSCLOCK_CREATE *ClockCreate);
3470
3471 _IRQL_requires_max_(DISPATCH_LEVEL)
3472 KSDDKAPI
3473 KSSTATE
3474 NTAPI
3475 KsGetDefaultClockState(
3476 _In_ PKSDEFAULTCLOCK DefaultClock);
3477
3478 _IRQL_requires_max_(DISPATCH_LEVEL)
3479 KSDDKAPI
3480 VOID
3481 NTAPI
3482 KsSetDefaultClockState(
3483 _In_ PKSDEFAULTCLOCK DefaultClock,
3484 _In_ KSSTATE State);
3485
3486 _IRQL_requires_max_(DISPATCH_LEVEL)
3487 KSDDKAPI
3488 LONGLONG
3489 NTAPI
3490 KsGetDefaultClockTime(
3491 _In_ PKSDEFAULTCLOCK DefaultClock);
3492
3493 _IRQL_requires_max_(DISPATCH_LEVEL)
3494 KSDDKAPI
3495 VOID
3496 NTAPI
3497 KsSetDefaultClockTime(
3498 _In_ PKSDEFAULTCLOCK DefaultClock,
3499 _In_ LONGLONG Time);
3500
3501 #endif /* _NTDDK_ */
3502
3503 /* ===============================================================
3504 Method Functions
3505 */
3506
3507 /* Method sets - TODO: Make into macros! */
3508 #if defined(_NTDDK_)
3509
3510 #if 0
3511
3512 VOID
3513 KSMETHOD_SET_IRP_STORAGE(
3514 IN IRP Irp);
3515
3516 VOID
3517 KSMETHOD_ITEM_IRP_STORAGE(
3518 IN IRP Irp);
3519
3520 VOID
3521 KSMETHOD_TYPE_IRP_STORAGE(
3522 IN IRP Irp);
3523
3524 #endif
3525
3526 _IRQL_requires_max_(PASSIVE_LEVEL)
3527 KSDDKAPI
3528 NTSTATUS
3529 NTAPI
3530 KsMethodHandler(
3531 _In_ PIRP Irp,
3532 _In_ ULONG MethodSetsCount,
3533 _In_reads_(MethodSetsCount) const KSMETHOD_SET* MethodSet);
3534
3535 _IRQL_requires_max_(PASSIVE_LEVEL)
3536 KSDDKAPI
3537 NTSTATUS
3538 NTAPI
3539 KsMethodHandlerWithAllocator(
3540 _In_ PIRP Irp,
3541 _In_ ULONG MethodSetsCount,
3542 _In_reads_(MethodSetsCount) const KSMETHOD_SET* MethodSet,
3543 _In_opt_ PFNKSALLOCATOR Allocator,
3544 _In_opt_ ULONG MethodItemSize);
3545
3546 _IRQL_requires_max_(PASSIVE_LEVEL)
3547 KSDDKAPI
3548 BOOLEAN
3549 NTAPI
3550 KsFastMethodHandler(
3551 _In_ PFILE_OBJECT FileObject,
3552 _In_reads_bytes_(MethodLength) PKSMETHOD UNALIGNED Method,
3553 _In_ ULONG MethodLength,
3554 _Inout_updates_bytes_(DataLength) PVOID UNALIGNED Data,
3555 _In_ ULONG DataLength,
3556 _Out_ PIO_STATUS_BLOCK IoStatus,
3557 _In_ ULONG MethodSetsCount,
3558 _In_reads_(MethodSetsCount) const KSMETHOD_SET *MethodSet);
3559
3560 #endif /* _NTDDK_ */
3561
3562 /* ===============================================================
3563 Property Functions
3564 */
3565
3566 #if defined(_NTDDK_)
3567
3568 _IRQL_requires_max_(PASSIVE_LEVEL)
3569 KSDDKAPI
3570 NTSTATUS
3571 NTAPI
3572 KsPropertyHandler(
3573 _In_ PIRP Irp,
3574 _In_ ULONG PropertySetsCount,
3575 _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet);
3576
3577 _IRQL_requires_max_(PASSIVE_LEVEL)
3578 KSDDKAPI
3579 NTSTATUS
3580 NTAPI
3581 KsPropertyHandlerWithAllocator(
3582 _In_ PIRP Irp,
3583 _In_ ULONG PropertySetsCount,
3584 _In_reads_(PropertySetsCount) const KSPROPERTY_SET* PropertySet,
3585 _In_opt_ PFNKSALLOCATOR Allocator,
3586 _In_opt_ ULONG PropertyItemSize);
3587
3588 _IRQL_requires_max_(PASSIVE_LEVEL)
3589 KSDDKAPI
3590 NTSTATUS
3591 NTAPI
3592 KsUnserializeObjectPropertiesFromRegistry(
3593 _In_ PFILE_OBJECT FileObject,
3594 _In_opt_ HANDLE ParentKey,
3595 _In_opt_ PUNICODE_STRING RegistryPath);
3596
3597 _IRQL_requires_max_(PASSIVE_LEVEL)
3598 KSDDKAPI
3599 BOOLEAN
3600 NTAPI
3601 KsFastPropertyHandler(
3602 _In_ PFILE_OBJECT FileObject,
3603 _In_reads_bytes_(PropertyLength) PKSPROPERTY UNALIGNED Property,
3604 _In_ ULONG PropertyLength,
3605 _In_reads_bytes_(DataLength) PVOID UNALIGNED Data,
3606 _In_ ULONG DataLength,
3607 _Out_ PIO_STATUS_BLOCK IoStatus,
3608 _In_ ULONG PropertySetsCount,
3609 _In_reads_(PropertySetsCount) const KSPROPERTY_SET *PropertySet);
3610
3611 #endif /* _NTDDK_ */
3612
3613 /* ===============================================================
3614 Event Functions
3615 */
3616
3617 #if defined(_NTDDK_)
3618
3619 #define KSPROBE_STREAMREAD 0x00000000
3620 #define KSPROBE_STREAMWRITE 0x00000001
3621 #define KSPROBE_ALLOCATEMDL 0x00000010
3622 #define KSPROBE_PROBEANDLOCK 0x00000020
3623 #define KSPROBE_SYSTEMADDRESS 0x00000040
3624 #define KSPROBE_MODIFY 0x00000200
3625 #define KSPROBE_STREAMWRITEMODIFY (KSPROBE_MODIFY | KSPROBE_STREAMWRITE)
3626 #define KSPROBE_ALLOWFORMATCHANGE 0x00000080
3627
3628 #define KSSTREAM_READ KSPROBE_STREAMREAD
3629 #define KSSTREAM_WRITE KSPROBE_STREAMWRITE
3630 #define KSSTREAM_PAGED_DATA 0x00000000
3631 #define KSSTREAM_NONPAGED_DATA 0x00000100
3632 #define KSSTREAM_SYNCHRONOUS 0x00001000
3633 #define KSSTREAM_FAILUREEXCEPTION 0x00002000
3634
3635 _IRQL_requires_max_(DISPATCH_LEVEL)
3636 typedef BOOLEAN
3637 (NTAPI *PFNKSGENERATEEVENTCALLBACK)(
3638 _In_ PVOID Context,
3639 _In_ PKSEVENT_ENTRY EventEntry);
3640
3641 KSDDKAPI
3642 NTSTATUS
3643 NTAPI
3644 KsGenerateEvent(
3645 _In_ PKSEVENT_ENTRY EntryEvent);
3646
3647 _IRQL_requires_max_(DISPATCH_LEVEL)
3648 KSDDKAPI
3649 void
3650 NTAPI
3651 KsGenerateEvents(
3652 _In_ PVOID Object,
3653 _In_opt_ const GUID *EventSet,
3654 _In_ ULONG EventId,
3655 _In_ ULONG DataSize,
3656 _In_reads_bytes_opt_(DataSize) PVOID Data,
3657 _In_opt_ PFNKSGENERATEEVENTCALLBACK CallBack,
3658 _In_opt_ PVOID CallBackContext);
3659
3660 _IRQL_requires_max_(PASSIVE_LEVEL)
3661 KSDDKAPI
3662 NTSTATUS
3663 NTAPI
3664 KsEnableEventWithAllocator(
3665 _In_ PIRP Irp,
3666 _In_ ULONG EventSetsCount,
3667 _In_reads_(EventSetsCount) const KSEVENT_SET* EventSet,
3668 _Inout_opt_ PLIST_ENTRY EventsList,
3669 _In_opt_ KSEVENTS_LOCKTYPE EventsFlags,
3670 _In_opt_ PVOID EventsLock,
3671 _In_opt_ PFNKSALLOCATOR Allocator,
3672 _In_opt_ ULONG EventItemSize);
3673
3674 KSDDKAPI
3675 NTSTATUS
3676 NTAPI
3677 KsGenerateDataEvent(
3678 _In_ PKSEVENT_ENTRY EventEntry,
3679 _In_ ULONG DataSize,
3680 _In_reads_bytes_(DataSize) PVOID Data);
3681
3682 _IRQL_requires_max_(PASSIVE_LEVEL)
3683 KSDDKAPI
3684 NTSTATUS
3685 NTAPI
3686 KsEnableEvent(
3687 _In_ PIRP Irp,
3688 _In_ ULONG EventSetsCount,
3689 _In_reads_(EventSetsCount) KSEVENT_SET *EventSet,
3690 _Inout_opt_ PLIST_ENTRY EventsList,
3691 _In_opt_ KSEVENTS_LOCKTYPE EventsFlags,
3692 _In_opt_ PVOID EventsLock);
3693
3694 _IRQL_requires_max_(PASSIVE_LEVEL)
3695 KSDDKAPI
3696 VOID
3697 NTAPI
3698 KsDiscardEvent(
3699 _In_ PKSEVENT_ENTRY EventEntry);
3700
3701 _IRQL_requires_max_(PASSIVE_LEVEL)
3702 KSDDKAPI
3703 NTSTATUS
3704 NTAPI
3705 KsDisableEvent(
3706 _In_ PIRP Irp,
3707 _Inout_ PLIST_ENTRY EventsList,
3708 _In_ KSEVENTS_LOCKTYPE EventsFlags,
3709 _In_ PVOID EventsLock);
3710
3711 _IRQL_requires_max_(PASSIVE_LEVEL)
3712 KSDDKAPI
3713 VOID
3714 NTAPI
3715 KsFreeEventList(
3716 _In_ PFILE_OBJECT FileObject,
3717 _Inout_ PLIST_ENTRY EventsList,
3718 _In_ KSEVENTS_LOCKTYPE EventsFlags,
3719 _In_ PVOID EventsLock);
3720
3721 /* ===============================================================
3722 Topology Functions
3723 */
3724
3725 _IRQL_requires_max_(PASSIVE_LEVEL)
3726 KSDDKAPI
3727 NTSTATUS
3728 NTAPI
3729 KsValidateTopologyNodeCreateRequest(
3730 _In_ PIRP Irp,
3731 _In_ PKSTOPOLOGY Topology,
3732 _Out_ PKSNODE_CREATE *NodeCreate);
3733
3734 _IRQL_requires_max_(PASSIVE_LEVEL)
3735 KSDDKAPI
3736 NTSTATUS
3737 NTAPI
3738 KsCreateTopologyNode(
3739 _In_ HANDLE ParentHandle,
3740 _In_ PKSNODE_CREATE NodeCreate,
3741 _In_ ACCESS_MASK DesiredAccess,
3742 _Out_ PHANDLE NodeHandle);
3743
3744 _IRQL_requires_max_(PASSIVE_LEVEL)
3745 KSDDKAPI
3746 NTSTATUS
3747 NTAPI
3748 KsTopologyPropertyHandler(
3749 _In_ PIRP Irp,
3750 _In_ PKSPROPERTY Property,
3751 _Inout_ PVOID Data,
3752 _In_ const KSTOPOLOGY *Topology);
3753
3754 /* ===============================================================
3755 Connectivity Functions
3756 */
3757
3758 _IRQL_requires_max_(PASSIVE_LEVEL)
3759 KSDDKAPI
3760 NTSTATUS
3761 NTAPI
3762 KsCreatePin(
3763 _In_ HANDLE FilterHandle,
3764 _In_ PKSPIN_CONNECT Connect,
3765 _In_ ACCESS_MASK DesiredAccess,
3766 _Out_ PHANDLE ConnectionHandle);
3767
3768 _IRQL_requires_max_(PASSIVE_LEVEL)
3769 KSDDKAPI
3770 NTSTATUS
3771 NTAPI
3772 KsValidateConnectRequest(
3773 _In_ PIRP Irp,
3774 _In_ ULONG DescriptorsCount,
3775 _In_reads_(DescriptorsCount) KSPIN_DESCRIPTOR *Descriptor,
3776 _Out_ PKSPIN_CONNECT *Connect);
3777
3778 _IRQL_requires_max_(PASSIVE_LEVEL)
3779 KSDDKAPI
3780 NTSTATUS
3781 NTAPI
3782 KsPinPropertyHandler(
3783 _In_ PIRP Irp,
3784 _In_ PKSPROPERTY Property,
3785 _Inout_ PVOID Data,
3786 _In_ ULONG DescriptorsCount,
3787 _In_reads_(DescriptorsCount) const KSPIN_DESCRIPTOR *Descriptor);
3788
3789 _Must_inspect_result_
3790 _IRQL_requires_max_(PASSIVE_LEVEL)
3791 KSDDKAPI
3792 NTSTATUS
3793 NTAPI
3794 KsPinDataIntersection(
3795 _In_ PIRP Irp,
3796 _In_ PKSP_PIN Pin,
3797 _Out_opt_ PVOID Data,
3798 _In_ ULONG DescriptorsCount,
3799 _In_reads_(DescriptorsCount) const KSPIN_DESCRIPTOR *Descriptor,
3800 _In_ PFNKSINTERSECTHANDLER IntersectHandler);
3801
3802 _Must_inspect_result_
3803 _IRQL_requires_max_(PASSIVE_LEVEL)
3804 KSDDKAPI
3805 NTSTATUS
3806 NTAPI
3807 KsPinDataIntersectionEx(
3808 _In_ PIRP Irp,
3809 _In_ PKSP_PIN Pin,
3810 _Out_ PVOID Data,
3811 _In_ ULONG DescriptorsCount,
3812 _In_reads_bytes_(DescriptorsCount * DescriptorSize) const KSPIN_DESCRIPTOR *Descriptor,
3813 _In_ ULONG DescriptorSize,
3814 _In_opt_ PFNKSINTERSECTHANDLEREX IntersectHandler,
3815 _In_opt_ PVOID HandlerContext);
3816
3817 _IRQL_requires_max_(PASSIVE_LEVEL)
3818 KSDDKAPI
3819 PKSFILTER
3820 NTAPI
3821 KsPinGetParentFilter(
3822 _In_ PKSPIN Pin);
3823
3824 _IRQL_requires_max_(PASSIVE_LEVEL)
3825 KSDDKAPI
3826 PKSPIN
3827 NTAPI
3828 KsPinGetNextSiblingPin(
3829 _In_ PKSPIN Pin);
3830
3831 _IRQL_requires_max_(DISPATCH_LEVEL)
3832 KSDDKAPI
3833 PKSSTREAM_POINTER
3834 NTAPI
3835 KsPinGetLeadingEdgeStreamPointer(
3836 _In_ PKSPIN Pin,
3837 _In_ KSSTREAM_POINTER_STATE State);
3838
3839 /* Does this belong here? */
3840
3841 _IRQL_requires_max_(PASSIVE_LEVEL)
3842 KSDDKAPI
3843 NTSTATUS
3844 NTAPI
3845 KsHandleSizedListQuery(
3846 _In_ PIRP Irp,
3847 _In_ ULONG DataItemsCount,
3848 _In_ ULONG DataItemSize,
3849 _In_reads_bytes_(DataItemsCount * DataItemSize) const VOID *DataItems);
3850
3851 /* ===============================================================
3852 IRP Helper Functions
3853 */
3854
3855 _IRQL_requires_max_(DISPATCH_LEVEL)
3856 typedef NTSTATUS
3857 (NTAPI *PFNKSIRPLISTCALLBACK)(
3858 _In_ PIRP Irp,
3859 _In_ PVOID Context);
3860
3861 _IRQL_requires_max_(PASSIVE_LEVEL)
3862 KSDDKAPI
3863 NTSTATUS
3864 NTAPI
3865 KsAcquireResetValue(
3866 _In_ PIRP Irp,
3867 _Out_ KSRESET *ResetValue);
3868
3869 _IRQL_requires_max_(DISPATCH_LEVEL)
3870 KSDDKAPI
3871 VOID
3872 NTAPI
3873 KsAddIrpToCancelableQueue(
3874 _Inout_ PLIST_ENTRY QueueHead,
3875 _In_ PKSPIN_LOCK SpinLock,
3876 _In_ PIRP Irp,
3877 _In_ KSLIST_ENTRY_LOCATION ListLocation,
3878 _In_opt_ PDRIVER_CANCEL DriverCancel);
3879
3880 _IRQL_requires_max_(PASSIVE_LEVEL)
3881 KSDDKAPI
3882 NTSTATUS
3883 NTAPI
3884 KsAddObjectCreateItemToDeviceHeader(
3885 _In_ KSDEVICE_HEADER Header,
3886 _In_ PDRIVER_DISPATCH Create,
3887 _In_ PVOID Context,
3888 _In_ PWSTR ObjectClass,
3889 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor);
3890
3891 _IRQL_requires_max_(PASSIVE_LEVEL)
3892 KSDDKAPI
3893 NTSTATUS
3894 NTAPI
3895 KsAddObjectCreateItemToObjectHeader(
3896 _In_ KSOBJECT_HEADER Header,
3897 _In_ PDRIVER_DISPATCH Create,
3898 _In_ PVOID Context,
3899 _In_ PWSTR ObjectClass,
3900 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor);
3901
3902 _IRQL_requires_max_(APC_LEVEL)
3903 KSDDKAPI
3904 NTSTATUS
3905 NTAPI
3906 KsAllocateDeviceHeader(
3907 _Out_ KSDEVICE_HEADER *Header,
3908 _In_ ULONG ItemsCount,
3909 _In_reads_opt_(ItemsCount) PKSOBJECT_CREATE_ITEM ItemsList);
3910
3911 _IRQL_requires_max_(PASSIVE_LEVEL)
3912 KSDDKAPI
3913 NTSTATUS
3914 NTAPI
3915 KsAllocateExtraData(
3916 _Inout_ PIRP Irp,
3917 _In_ ULONG ExtraSize,
3918 _Out_ PVOID *ExtraBuffer);
3919
3920 _IRQL_requires_max_(PASSIVE_LEVEL)
3921 KSDDKAPI
3922 NTSTATUS
3923 NTAPI
3924 KsAllocateObjectCreateItem(
3925 _In_ KSDEVICE_HEADER Header,
3926 _In_ PKSOBJECT_CREATE_ITEM CreateItem,
3927 _In_ BOOLEAN AllocateEntry,
3928 _In_opt_ PFNKSITEMFREECALLBACK ItemFreeCallback);
3929
3930 _IRQL_requires_max_(APC_LEVEL)
3931 KSDDKAPI
3932 NTSTATUS
3933 NTAPI
3934 KsAllocateObjectHeader(
3935 _Out_ KSOBJECT_HEADER *Header,
3936 _In_ ULONG ItemsCount,
3937 _In_reads_opt_(ItemsCount) PKSOBJECT_CREATE_ITEM ItemsList,
3938 _In_ PIRP Irp,
3939 _In_ KSDISPATCH_TABLE *Table);
3940
3941 _IRQL_requires_max_(DISPATCH_LEVEL)
3942 KSDDKAPI
3943 VOID
3944 NTAPI
3945 KsCancelIo(
3946 _Inout_ PLIST_ENTRY QueueHead,
3947 _In_ PKSPIN_LOCK SpinLock);
3948
3949 _IRQL_requires_max_(DISPATCH_LEVEL)
3950 KSDDKAPI
3951 VOID
3952 NTAPI
3953 KsCancelRoutine(
3954 _In_ PDEVICE_OBJECT DeviceObject,
3955 _In_ PIRP Irp);
3956
3957 _IRQL_requires_max_(PASSIVE_LEVEL)
3958 KSDDKAPI
3959 NTSTATUS
3960 NTAPI
3961 KsDefaultDeviceIoCompletion(
3962 _In_ PDEVICE_OBJECT DeviceObject,
3963 _In_ PIRP Irp);
3964
3965 _IRQL_requires_max_(PASSIVE_LEVEL)
3966 KSDDKAPI
3967 BOOLEAN
3968 NTAPI
3969 KsDispatchFastIoDeviceControlFailure(
3970 _In_ PFILE_OBJECT FileObject,
3971 _In_ BOOLEAN Wait,
3972 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
3973 _In_ ULONG InputBufferLength,
3974 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
3975 _In_ ULONG OutputBufferLength,
3976 _In_ ULONG IoControlCode,
3977 _Out_ PIO_STATUS_BLOCK IoStatus,
3978 _In_ PDEVICE_OBJECT DeviceObject); /* always return false */
3979
3980 _IRQL_requires_max_(PASSIVE_LEVEL)
3981 KSDDKAPI
3982 BOOLEAN
3983 NTAPI
3984 KsDispatchFastReadFailure(
3985 _In_ PFILE_OBJECT FileObject,
3986 _In_ PLARGE_INTEGER FileOffset,
3987 _In_ ULONG Length,
3988 _In_ BOOLEAN Wait,
3989 _In_ ULONG LockKey,
3990 _Out_ PVOID Buffer,
3991 _Out_ PIO_STATUS_BLOCK IoStatus,
3992 _In_ PDEVICE_OBJECT DeviceObject); /* always return false */
3993
3994 /* This function does the same as the above */
3995 #define KsDispatchFastWriteFailure KsDispatchFastReadFailure
3996
3997 _IRQL_requires_max_(PASSIVE_LEVEL)
3998 KSDDKAPI
3999 NTSTATUS
4000 NTAPI
4001 KsDispatchInvalidDeviceRequest(
4002 _In_ PDEVICE_OBJECT DeviceObject,
4003 _In_ PIRP Irp);
4004
4005 _IRQL_requires_max_(PASSIVE_LEVEL)
4006 KSDDKAPI
4007 NTSTATUS
4008 NTAPI
4009 KsDispatchIrp(
4010 _In_ PDEVICE_OBJECT DeviceObject,
4011 _In_ PIRP Irp);
4012
4013 _IRQL_requires_max_(PASSIVE_LEVEL)
4014 KSDDKAPI
4015 NTSTATUS
4016 NTAPI
4017 KsDispatchSpecificMethod(
4018 _In_ PIRP Irp,
4019 _In_ PFNKSHANDLER Handler);
4020
4021 _IRQL_requires_max_(PASSIVE_LEVEL)
4022 KSDDKAPI
4023 NTSTATUS
4024 NTAPI
4025 KsDispatchSpecificProperty(
4026 _In_ PIRP Irp,
4027 _In_ PFNKSHANDLER Handler);
4028
4029 _IRQL_requires_max_(PASSIVE_LEVEL)
4030 KSDDKAPI
4031 NTSTATUS
4032 NTAPI
4033 KsForwardAndCatchIrp(
4034 _In_ PDEVICE_OBJECT DeviceObject,
4035 _In_ PIRP Irp,
4036 _In_ PFILE_OBJECT FileObject,
4037 _In_ KSSTACK_USE StackUse);
4038
4039 _IRQL_requires_max_(PASSIVE_LEVEL)
4040 KSDDKAPI
4041 NTSTATUS
4042 NTAPI
4043 KsForwardIrp(
4044 _In_ PIRP Irp,
4045 _In_ PFILE_OBJECT FileObject,
4046 _In_ BOOLEAN ReuseStackLocation);
4047
4048 _IRQL_requires_max_(APC_LEVEL)
4049 KSDDKAPI
4050 VOID
4051 NTAPI
4052 KsFreeDeviceHeader(
4053 _In_ KSDEVICE_HEADER Header);
4054
4055 _IRQL_requires_max_(APC_LEVEL)
4056 KSDDKAPI
4057 VOID
4058 NTAPI
4059 KsFreeObjectHeader(
4060 _In_ PVOID Header);
4061
4062 KSDDKAPI
4063 NTSTATUS
4064 NTAPI
4065 KsGetChildCreateParameter(
4066 _In_ PIRP Irp,
4067 _Out_ PVOID *CreateParameter);
4068
4069 _IRQL_requires_max_(DISPATCH_LEVEL)
4070 KSDDKAPI
4071 NTSTATUS
4072 NTAPI
4073 KsMoveIrpsOnCancelableQueue(
4074 _Inout_ PLIST_ENTRY SourceList,
4075 _In_ PKSPIN_LOCK SourceLock,
4076 _Inout_ PLIST_ENTRY DestinationList,
4077 _In_opt_ PKSPIN_LOCK DestinationLock,
4078 _In_ KSLIST_ENTRY_LOCATION ListLocation,
4079 _In_ PFNKSIRPLISTCALLBACK ListCallback,
4080 _In_ PVOID Context);
4081
4082 _IRQL_requires_max_(PASSIVE_LEVEL)
4083 KSDDKAPI
4084 NTSTATUS
4085 NTAPI
4086 KsProbeStreamIrp(
4087 _Inout_ PIRP Irp,
4088 _In_ ULONG ProbeFlags,
4089 _In_ ULONG HeaderSize);
4090
4091 _IRQL_requires_max_(PASSIVE_LEVEL)
4092 KSDDKAPI
4093 NTSTATUS
4094 NTAPI
4095 KsQueryInformationFile(
4096 _In_ PFILE_OBJECT FileObject,
4097 _Out_writes_bytes_(Length) PVOID FileInformation,
4098 _In_ ULONG Length,
4099 _In_ FILE_INFORMATION_CLASS FileInformationClass);
4100
4101 _IRQL_requires_max_(PASSIVE_LEVEL)
4102 KSDDKAPI
4103 ACCESS_MASK
4104 NTAPI
4105 KsQueryObjectAccessMask(
4106 _In_ KSOBJECT_HEADER Header);
4107
4108 _IRQL_requires_max_(PASSIVE_LEVEL)
4109 KSDDKAPI
4110 PKSOBJECT_CREATE_ITEM
4111 NTAPI
4112 KsQueryObjectCreateItem(
4113 _In_ KSOBJECT_HEADER Header);
4114
4115 _IRQL_requires_max_(PASSIVE_LEVEL)
4116 KSDDKAPI
4117 NTSTATUS
4118 NTAPI
4119 KsReadFile(
4120 _In_ PFILE_OBJECT FileObject,
4121 _In_opt_ PKEVENT Event,
4122 _In_opt_ PVOID PortContext,
4123 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
4124 _Out_writes_bytes_(Length) PVOID Buffer,
4125 _In_ ULONG Length,
4126 _In_opt_ ULONG Key,
4127 _In_ KPROCESSOR_MODE RequestorMode);
4128
4129 _IRQL_requires_max_(DISPATCH_LEVEL)
4130 KSDDKAPI
4131 VOID
4132 NTAPI
4133 KsReleaseDevice(
4134 _In_ PKSDEVICE);
4135
4136 _IRQL_requires_max_(DISPATCH_LEVEL)
4137 KSDDKAPI
4138 VOID
4139 NTAPI
4140 KsReleaseIrpOnCancelableQueue(
4141 _In_ PIRP Irp,
4142 _In_opt_ PDRIVER_CANCEL DriverCancel);
4143
4144 _IRQL_requires_max_(DISPATCH_LEVEL)
4145 KSDDKAPI
4146 PIRP
4147 NTAPI
4148 KsRemoveIrpFromCancelableQueue(
4149 _Inout_ PLIST_ENTRY QueueHead,
4150 _In_ PKSPIN_LOCK SpinLock,
4151 _In_ KSLIST_ENTRY_LOCATION ListLocation,
4152 _In_ KSIRP_REMOVAL_OPERATION RemovalOperation);
4153
4154 _IRQL_requires_max_(DISPATCH_LEVEL)
4155 KSDDKAPI
4156 VOID
4157 NTAPI
4158 KsRemoveSpecificIrpFromCancelableQueue(
4159 _In_ PIRP Irp);
4160
4161 _IRQL_requires_max_(PASSIVE_LEVEL)
4162 KSDDKAPI
4163 NTSTATUS
4164 NTAPI
4165 KsSetInformationFile(
4166 _In_ PFILE_OBJECT FileObject,
4167 _In_reads_bytes_(Length) PVOID FileInformation,
4168 _In_ ULONG Length,
4169 _In_ FILE_INFORMATION_CLASS FileInformationClass);
4170
4171 _IRQL_requires_max_(PASSIVE_LEVEL)
4172 KSDDKAPI
4173 NTSTATUS
4174 NTAPI
4175 KsSetMajorFunctionHandler(
4176 _In_ PDRIVER_OBJECT DriverObject,
4177 _In_ ULONG MajorFunction);
4178
4179 _IRQL_requires_max_(PASSIVE_LEVEL)
4180 KSDDKAPI
4181 NTSTATUS
4182 NTAPI
4183 KsStreamIo(
4184 _In_ PFILE_OBJECT FileObject,
4185 _In_opt_ PKEVENT Event,
4186 _In_opt_ PVOID PortContext,
4187 _In_opt_ PIO_COMPLETION_ROUTINE CompletionRoutine,
4188 _In_opt_ PVOID CompletionContext,
4189 _In_opt_ KSCOMPLETION_INVOCATION CompletionInvocationFlags,
4190 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
4191 _Inout_updates_bytes_(Length) PVOID StreamHeaders,
4192 _In_ ULONG Length,
4193 _In_ ULONG Flags,
4194 _In_ KPROCESSOR_MODE RequestorMode);
4195
4196 _IRQL_requires_max_(DISPATCH_LEVEL)
4197 KSDDKAPI
4198 VOID
4199 NTAPI
4200 KsStreamPointerUnlock(
4201 _In_ PKSSTREAM_POINTER StreamPointer,
4202 _In_ BOOLEAN Eject);
4203
4204 _IRQL_requires_max_(DISPATCH_LEVEL)
4205 KSDDKAPI
4206 NTSTATUS
4207 NTAPI
4208 KsStreamPointerAdvanceOffsets(
4209 _In_ PKSSTREAM_POINTER StreamPointer,
4210 _In_ ULONG InUsed,
4211 _In_ ULONG OutUsed,
4212 _In_ BOOLEAN Eject);
4213
4214 _IRQL_requires_max_(DISPATCH_LEVEL)
4215 KSDDKAPI
4216 VOID
4217 NTAPI
4218 KsStreamPointerAdvanceOffsetsAndUnlock(
4219 _In_ PKSSTREAM_POINTER StreamPointer,
4220 _In_ ULONG InUsed,
4221 _In_ ULONG OutUsed,
4222 _In_ BOOLEAN Eject
4223 );
4224
4225
4226 _IRQL_requires_max_(PASSIVE_LEVEL)
4227 KSDDKAPI
4228 NTSTATUS
4229 NTAPI
4230 KsWriteFile(
4231 _In_ PFILE_OBJECT FileObject,
4232 _In_opt_ PKEVENT Event,
4233 _In_opt_ PVOID PortContext,
4234 _Out_ PIO_STATUS_BLOCK IoStatusBlock,
4235 _In_reads_bytes_(Length) PVOID Buffer,
4236 _In_ ULONG Length,
4237 _In_opt_ ULONG Key,
4238 _In_ KPROCESSOR_MODE RequestorMode);
4239
4240 KSDDKAPI
4241 NTSTATUS
4242 NTAPI
4243 KsDefaultForwardIrp(
4244 _In_ PDEVICE_OBJECT DeviceObject,
4245 _In_ PIRP Irp);
4246
4247 /* ===============================================================
4248 Worker Management Functions
4249 */
4250
4251 _IRQL_requires_max_(PASSIVE_LEVEL)
4252 KSDDKAPI
4253 NTSTATUS
4254 NTAPI
4255 KsRegisterWorker(
4256 _In_ WORK_QUEUE_TYPE WorkQueueType,
4257 _Out_ PKSWORKER* Worker);
4258
4259 _IRQL_requires_max_(PASSIVE_LEVEL)
4260 KSDDKAPI
4261 VOID
4262 NTAPI
4263 KsUnregisterWorker(
4264 _In_ PKSWORKER Worker);
4265
4266 _IRQL_requires_max_(PASSIVE_LEVEL)
4267 KSDDKAPI
4268 NTSTATUS
4269 NTAPI
4270 KsRegisterCountedWorker(
4271 _In_ WORK_QUEUE_TYPE WorkQueueType,
4272 _In_ PWORK_QUEUE_ITEM CountedWorkItem,
4273 _Out_ PKSWORKER *Worker);
4274
4275 _IRQL_requires_max_(PASSIVE_LEVEL)
4276 KSDDKAPI
4277 ULONG
4278 NTAPI
4279 KsDecrementCountedWorker(
4280 _In_ PKSWORKER Worker);
4281
4282 _IRQL_requires_max_(PASSIVE_LEVEL)
4283 KSDDKAPI
4284 ULONG
4285 NTAPI
4286 KsIncrementCountedWorker(
4287 _In_ PKSWORKER Worker);
4288
4289 _IRQL_requires_max_(DISPATCH_LEVEL)
4290 KSDDKAPI
4291 NTSTATUS
4292 NTAPI
4293 KsQueueWorkItem(
4294 _In_ PKSWORKER Worker,
4295 _In_ PWORK_QUEUE_ITEM WorkItem);
4296
4297 /* ===============================================================
4298 Resources / Images
4299 */
4300
4301 _IRQL_requires_max_(PASSIVE_LEVEL)
4302 KSDDKAPI
4303 NTSTATUS
4304 NTAPI
4305 KsLoadResource(
4306 _In_ PVOID ImageBase,
4307 _In_ POOL_TYPE PoolType,
4308 _In_ ULONG_PTR ResourceName,
4309 _In_ ULONG ResourceType,
4310 _Outptr_result_bytebuffer_(*ResourceSize) PVOID *Resource,
4311 _Out_opt_ PULONG ResourceSize);
4312
4313 _IRQL_requires_max_(PASSIVE_LEVEL)
4314 KSDDKAPI
4315 NTSTATUS
4316 NTAPI
4317 KsGetImageNameAndResourceId(
4318 _In_ HANDLE RegKey,
4319 _Out_ PUNICODE_STRING ImageName,
4320 _Out_ PULONG_PTR ResourceId,
4321 _Out_ PULONG ValueType);
4322
4323 _IRQL_requires_max_(PASSIVE_LEVEL)
4324 KSDDKAPI
4325 NTSTATUS
4326 NTAPI
4327 KsMapModuleName(
4328 _In_ PDEVICE_OBJECT PhysicalDeviceObject,
4329 _In_ PUNICODE_STRING ModuleName,
4330 _Out_ PUNICODE_STRING ImageName,
4331 _Out_ PULONG_PTR ResourceId,
4332 _Out_ PULONG ValueType);
4333
4334 /* ===============================================================
4335 Misc. Helper Functions
4336 */
4337
4338 _IRQL_requires_max_(PASSIVE_LEVEL)
4339 KSDDKAPI
4340 PVOID
4341 NTAPI
4342 KsGetNextSibling(
4343 _In_ PVOID Object);
4344
4345 _IRQL_requires_max_(PASSIVE_LEVEL)
4346 KSDDKAPI
4347 NTSTATUS
4348 NTAPI
4349 KsCacheMedium(
4350 _In_ PUNICODE_STRING SymbolicLink,
4351 _In_ PKSPIN_MEDIUM Medium,
4352 _In_ ULONG PinDirection);
4353
4354 KSDDKAPI
4355 NTSTATUS
4356 NTAPI
4357 KsDefaultDispatchPnp(
4358 _In_ PDEVICE_OBJECT DeviceObject,
4359 _In_ PIRP Irp);
4360
4361 _IRQL_requires_max_(PASSIVE_LEVEL)
4362 KSDDKAPI
4363 VOID
4364 NTAPI
4365 KsSetDevicePnpAndBaseObject(
4366 _In_ KSDEVICE_HEADER Header,
4367 _In_ PDEVICE_OBJECT PnpDeviceObject,
4368 _In_ PDEVICE_OBJECT BaseDevice);
4369
4370 KSDDKAPI
4371 NTSTATUS
4372 NTAPI
4373 KsDefaultDispatchPower(
4374 _In_ PDEVICE_OBJECT DeviceObject,
4375 _In_ PIRP Irp);
4376
4377 _IRQL_requires_max_(PASSIVE_LEVEL)
4378 KSDDKAPI
4379 VOID
4380 NTAPI
4381 KsSetPowerDispatch(
4382 _In_ KSOBJECT_HEADER Header,
4383 _In_opt_ PFNKSCONTEXT_DISPATCH PowerDispatch,
4384 _In_opt_ PVOID PowerContext);
4385
4386 _IRQL_requires_max_(PASSIVE_LEVEL)
4387 KSDDKAPI
4388 NTSTATUS
4389 NTAPI
4390 KsReferenceBusObject(
4391 _In_ KSDEVICE_HEADER Header);
4392
4393 _IRQL_requires_max_(PASSIVE_LEVEL)
4394 KSDDKAPI
4395 VOID
4396 NTAPI
4397 KsDereferenceBusObject(
4398 _In_ KSDEVICE_HEADER Header);
4399
4400 _IRQL_requires_max_(PASSIVE_LEVEL)
4401 KSDDKAPI
4402 NTSTATUS
4403 NTAPI
4404 KsFreeObjectCreateItem(
4405 _In_ KSDEVICE_HEADER Header,
4406 _In_ PUNICODE_STRING CreateItem);
4407
4408 _IRQL_requires_max_(PASSIVE_LEVEL)
4409 KSDDKAPI
4410 NTSTATUS
4411 NTAPI
4412 KsFreeObjectCreateItemsByContext(
4413 _In_ KSDEVICE_HEADER Header,
4414 _In_ PVOID Context);
4415
4416 _IRQL_requires_max_(PASSIVE_LEVEL)
4417 KSDDKAPI
4418 VOID
4419 NTAPI
4420 KsNullDriverUnload(
4421 _In_ PDRIVER_OBJECT DriverObject);
4422
4423 _IRQL_requires_max_(PASSIVE_LEVEL)
4424 KSDDKAPI
4425 PDEVICE_OBJECT
4426 NTAPI
4427 KsQueryDevicePnpObject(
4428 _In_ KSDEVICE_HEADER Header);
4429
4430 _IRQL_requires_max_(PASSIVE_LEVEL)
4431 KSDDKAPI
4432 VOID
4433 NTAPI
4434 KsRecalculateStackDepth(
4435 _In_ KSDEVICE_HEADER Header,
4436 _In_ BOOLEAN ReuseStackLocation);
4437
4438 _IRQL_requires_max_(PASSIVE_LEVEL)
4439 KSDDKAPI
4440 VOID
4441 NTAPI
4442 KsSetTargetDeviceObject(
4443 _In_ KSOBJECT_HEADER Header,
4444 _In_opt_ PDEVICE_OBJECT TargetDevice);
4445
4446 _IRQL_requires_max_(PASSIVE_LEVEL)
4447 KSDDKAPI
4448 VOID
4449 NTAPI
4450 KsSetTargetState(
4451 _In_ KSOBJECT_HEADER Header,
4452 _In_ KSTARGET_STATE TargetState);
4453
4454 _Must_inspect_result_
4455 _IRQL_requires_max_(PASSIVE_LEVEL)
4456 KSDDKAPI
4457 NTSTATUS
4458 NTAPI
4459 KsSynchronousIoControlDevice(
4460 _In_ PFILE_OBJECT FileObject,
4461 _In_ KPROCESSOR_MODE RequestorMode,
4462 _In_ ULONG IoControl,
4463 _In_reads_bytes_(InSize) PVOID InBuffer,
4464 _In_ ULONG InSize,
4465 _Out_writes_bytes_to_(OutSize, *BytesReturned) PVOID OutBuffer,
4466 _In_ ULONG OutSize,
4467 _Out_ PULONG BytesReturned);
4468
4469 _IRQL_requires_max_(PASSIVE_LEVEL)
4470 KSDDKAPI
4471 PKSPIN
4472 NTAPI
4473 KsFilterGetFirstChildPin(
4474 _In_ PKSFILTER Filter,
4475 _In_ ULONG PinId);
4476
4477 _IRQL_requires_max_(PASSIVE_LEVEL)
4478 KSDDKAPI
4479 PFILE_OBJECT
4480 NTAPI
4481 KsPinGetConnectedPinFileObject(
4482 _In_ PKSPIN Pin);
4483
4484 #else /* _NTDDK_ */
4485
4486 #if !defined( KS_NO_CREATE_FUNCTIONS )
4487
4488 _IRQL_requires_max_(PASSIVE_LEVEL)
4489 KSDDKAPI
4490 DWORD
4491 WINAPI
4492 KsCreateAllocator(
4493 _In_ HANDLE ConnectionHandle,
4494 _In_ PKSALLOCATOR_FRAMING AllocatorFraming,
4495 _Out_ PHANDLE AllocatorHandle);
4496
4497 _IRQL_requires_max_(PASSIVE_LEVEL)