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