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