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