09b09b8cc4f5412332ef8b3bf9b6c81e5999b66c
[reactos.git] / reactos / 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 KSPROPSETID_Stream \
728 0x65aaba60L, 0x98ae, 0x11cf, 0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
729
730 typedef enum
731 {
732 KSPROPERTY_STREAM_ALLOCATOR,
733 KSPROPERTY_STREAM_QUALITY,
734 KSPROPERTY_STREAM_DEGRADATION,
735 KSPROPERTY_STREAM_MASTERCLOCK,
736 KSPROPERTY_STREAM_TIMEFORMAT,
737 KSPROPERTY_STREAM_PRESENTATIONTIME,
738 KSPROPERTY_STREAM_PRESENTATIONEXTENT,
739 KSPROPERTY_STREAM_FRAMETIME,
740 KSPROPERTY_STREAM_RATECAPABILITY,
741 KSPROPERTY_STREAM_RATE,
742 KSPROPERTY_STREAM_PIPE_ID
743 } KSPROPERTY_STREAM;
744
745
746 /* ===============================================================
747 StreamAllocator
748 Properties/Methods/Events
749 */
750
751 #define STATIC_KSPROPSETID_StreamAllocator\
752 0xcf6e4342L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
753 DEFINE_GUIDSTRUCT("cf6e4342-ec87-11cf-a130-0020afd156e4", KSPROPSETID_StreamAllocator);
754 #define KSPROPSETID_StreamAllocator DEFINE_GUIDNAMED(KSPROPSETID_StreamAllocator)
755
756 typedef enum
757 {
758 KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE,
759 KSPROPERTY_STREAMALLOCATOR_STATUS
760 } KSPROPERTY_STREAMALLOCATOR;
761
762 #define KSMETHODSETID_StreamAllocator \
763 0xcf6e4341L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
764
765 typedef enum
766 {
767 KSMETHOD_STREAMALLOCATOR_ALLOC,
768 KSMETHOD_STREAMALLOCATOR_FREE
769 } KSMETHOD_STREAMALLOCATOR;
770
771
772 #define KSEVENTSETID_StreamAllocator
773
774 typedef enum
775 {
776 KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME,
777 KSEVENT_STREAMALLOCATOR_FREEFRAME
778 } KSEVENT_STREAMALLOCATOR;
779
780
781 /* ===============================================================
782 StreamInterface
783 Properties/Methods/Events
784 */
785
786 #define KSPROPSETID_StreamInterface \
787 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a
788
789 typedef enum
790 {
791 KSPROPERTY_STREAMINTERFACE_HEADERSIZE
792 } KSPROPERTY_STREAMINTERFACE;
793
794
795 /* ===============================================================
796 Topology
797 Properties/Methods/Events
798 */
799
800 #define STATIC_KSPROPSETID_Topology\
801 0x720D4AC0L, 0x7533, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
802 DEFINE_GUIDSTRUCT("720D4AC0-7533-11D0-A5D6-28DB04C10000", KSPROPSETID_Topology);
803 #define KSPROPSETID_Topology DEFINE_GUIDNAMED(KSPROPSETID_Topology)
804
805 typedef enum {
806 KSPROPERTY_TOPOLOGY_CATEGORIES,
807 KSPROPERTY_TOPOLOGY_NODES,
808 KSPROPERTY_TOPOLOGY_CONNECTIONS,
809 KSPROPERTY_TOPOLOGY_NAME
810 } KSPROPERTY_TOPOLOGY;
811
812 /* ===============================================================
813 Property Sets for audio drivers - TODO
814 */
815
816 #define STATIC_KSPROPTYPESETID_General \
817 0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}
818 DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_General);
819 #define KSPROPTYPESETID_General DEFINE_GUIDNAMED(KSPROPTYPESETID_General)
820
821 /*
822 KSPROPERTY_AC3_ALTERNATE_AUDIO
823 KSPROPERTY_AC3_BIT_STREAM_MODE
824 KSPROPERTY_AC3_DIALOGUE_LEVEL
825 KSPROPERTY_AC3_DOWNMIX
826 KSPROPERTY_AC3_ERROR_CONCEALMENT
827 KSPROPERTY_AC3_LANGUAGE_CODE
828 KSPROPERTY_AC3_ROOM_TYPE
829 */
830
831 #define KSPROPSETID_Acoustic_Echo_Cancel
832 /*
833 KSPROPERTY_AEC_MODE
834 KSPROPERTY_AEC_NOISE_FILL_ENABLE
835 KSPROPERTY_AEC_STATUS
836 */
837
838 /*
839 KSPROPERTY_AUDIO_3D_INTERFACE
840 KSPROPERTY_AUDIO_AGC
841 KSPROPERTY_AUDIO_ALGORITHM_INSTANCE
842 KSPROPERTY_AUDIO_BASS
843 KSPROPERTY_AUDIO_BASS_BOOST
844 KSPROPERTY_AUDIO_CHANNEL_CONFIG
845 KSPROPERTY_AUDIO_CHORUS_LEVEL
846 KSPROPERTY_AUDIO_COPY_PROTECTION
847 KSPROPERTY_AUDIO_CPU_RESOURCES
848 KSPROPERTY_AUDIO_DELAY
849 KSPROPERTY_AUDIO_DEMUX_DEST
850 KSPROPERTY_AUDIO_DEV_SPECIFIC
851 KSPROPERTY_AUDIO_DYNAMIC_RANGE
852 KSPROPERTY_AUDIO_DYNAMIC_SAMPLING_RATE
853 KSPROPERTY_AUDIO_EQ_BANDS
854 KSPROPERTY_AUDIO_EQ_LEVEL
855 KSPROPERTY_AUDIO_FILTER_STATE
856 KSPROPERTY_AUDIO_LATENCY
857 KSPROPERTY_AUDIO_LOUDNESS
858 KSPROPERTY_AUDIO_MANUFACTURE_GUID
859 KSPROPERTY_AUDIO_MID
860 KSPROPERTY_AUDIO_MIX_LEVEL_CAPS
861 KSPROPERTY_AUDIO_MIX_LEVEL_TABLE
862 KSPROPERTY_AUDIO_MUTE
863 KSPROPERTY_AUDIO_MUX_SOURCE
864 KSPROPERTY_AUDIO_NUM_EQ_BANDS
865 KSPROPERTY_AUDIO_PEAKMETER
866 KSPROPERTY_AUDIO_POSITION
867 KSPROPERTY_AUDIO_PREFERRED_STATUS
868 KSPROPERTY_AUDIO_PRODUCT_GUID
869 KSPROPERTY_AUDIO_QUALITY
870 KSPROPERTY_AUDIO_REVERB_LEVEL
871 KSPROPERTY_AUDIO_SAMPLING_RATE
872 KSPROPERTY_AUDIO_STEREO_ENHANCE
873 KSPROPERTY_AUDIO_STEREO_SPEAKER_GEOMETRY
874 KSPROPERTY_AUDIO_SURROUND_ENCODE
875 KSPROPERTY_AUDIO_TREBLE
876 KSPROPERTY_AUDIO_VOLUMELEVEL
877 KSPROPERTY_AUDIO_WIDE_MODE
878 KSPROPERTY_AUDIO_WIDENESS
879 */
880
881 #define KSPROPSETID_AudioGfx
882 /*
883 KSPROPERTY_AUDIOGFX_CAPTURETARGETDEVICEID
884 KSPROPERTY_AUDIOGFX_RENDERTARGETDEVICEID
885 */
886
887 #define KSPROPSETID_DirectSound3DBuffer
888 /*
889 KSPROPERTY_DIRECTSOUND3DBUFFER_ALL
890 KSPROPERTY_DIRECTSOUND3DBUFFER_CONEANGLES
891 KSPROPERTY_DIRECTSOUND3DBUFFER_CONEORIENTATION
892 KSPROPERTY_DIRECTSOUND3DBUFFER_CONEOUTSIDEVOLUME
893 KSPROPERTY_DIRECTSOUND3DBUFFER_MAXDISTANCE
894 KSPROPERTY_DIRECTSOUND3DBUFFER_MINDISTANCE
895 KSPROPERTY_DIRECTSOUND3DBUFFER_MODE
896 KSPROPERTY_DIRECTSOUND3DBUFFER_POSITION
897 KSPROPERTY_DIRECTSOUND3DBUFFER_VELOCITY
898 */
899
900 #define KSPROPSETID_DirectSound3DListener
901 /*
902 KSPROPERTY_DIRECTSOUND3DLISTENER_ALL
903 KSPROPERTY_DIRECTSOUND3DLISTENER_ALLOCATION
904 KSPROPERTY_DIRECTSOUND3DLISTENER_BATCH
905 KSPROPERTY_DIRECTSOUND3DLISTENER_DISTANCEFACTOR
906 KSPROPERTY_DIRECTSOUND3DLISTENER_DOPPLERFACTOR
907 KSPROPERTY_DIRECTSOUND3DLISTENER_ORIENTATION
908 KSPROPERTY_DIRECTSOUND3DLISTENER_POSITION
909 KSPROPERTY_DIRECTSOUND3DLISTENER_ROLLOFFFACTOR
910 KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
911 */
912
913 #define KSPROPSETID_DrmAudioStream
914 /*
915 KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
916 */
917
918 #define KSPROPSETID_Hrtf3d
919 /*
920 KSPROPERTY_HRTF3D_FILTER_FORMAT
921 KSPROPERTY_HRTF3D_INITIALIZE
922 KSPROPERTY_HRTF3D_PARAMS
923 */
924
925 #define KSPROPSETID_Itd3d
926 /*
927 KSPROPERTY_ITD3D_PARAMS
928 */
929
930 #define KSPROPSETID_Synth
931 /*
932 KSPROPERTY_SYNTH_CAPS
933 KSPROPERTY_SYNTH_CHANNELGROUPS
934 KSPROPERTY_SYNTH_LATENCYCLOCK
935 KSPROPERTY_SYNTH_MASTERCLOCK
936 KSPROPERTY_SYNTH_PORTPARAMETERS
937 KSPROPERTY_SYNTH_RUNNINGSTATS
938 KSPROPERTY_SYNTH_VOICEPRIORITY
939 KSPROPERTY_SYNTH_VOLUME
940 KSPROPERTY_SYNTH_VOLUMEBOOST
941 */
942
943 #define KSPROPSETID_Synth_Dls
944 /*
945 KSPROPERTY_SYNTH_DLS_APPEND
946 KSPROPERTY_SYNTH_DLS_COMPACT
947 KSPROPERTY_SYNTH_DLS_DOWNLOAD
948 KSPROPERTY_SYNTH_DLS_UNLOAD
949 KSPROPERTY_SYNTH_DLS_WAVEFORMAT
950 */
951
952 #define KSPROPSETID_TopologyNode
953 /*
954 KSPROPERTY_TOPOLOGYNODE_ENABLE
955 KSPROPERTY_TOPOLOGYNODE_RESET
956 */
957
958
959 /* ===============================================================
960 Node Types
961 */
962 /*
963 KSNODETYPE_3D_EFFECTS
964 KSNODETYPE_ACOUSTIC_ECHO_CANCEL
965 KSNODETYPE_ADC
966 KSNODETYPE_AGC
967 KSNODETYPE_CHORUS
968 KSNODETYPE_DAC
969 KSNODETYPE_DELAY
970 KSNODETYPE_DEMUX
971 KSNODETYPE_DEV_SPECIFIC
972 KSNODETYPE_DMSYNTH
973 KSNODETYPE_DMSYNTH_CAPS
974 KSNODETYPE_DRM_DESCRAMBLE
975 KSNODETYPE_EQUALIZER
976 KSNODETYPE_LOUDNESS
977 KSNODETYPE_MUTE
978 KSNODETYPE_MUX
979 KSNODETYPE_PEAKMETER
980 KSNODETYPE_PROLOGIC_DECODER
981 KSNODETYPE_PROLOGIC_ENCODER
982 KSNODETYPE_REVERB
983 KSNODETYPE_SRC
984 KSNODETYPE_STEREO_ENHANCE
985 KSNODETYPE_STEREO_WIDE
986 KSNODETYPE_SUM
987 KSNODETYPE_SUPERMIX
988 KSNODETYPE_SWMIDI
989 KSNODETYPE_SWSYNTH
990 KSNODETYPE_SYNTHESIZER
991 KSNODETYPE_TONE
992 KSNODETYPE_VOLUME
993 */
994
995
996 typedef PVOID KSDEVICE_HEADER,
997 KSOBJECT_HEADER,
998 KSOBJECT_BAG;
999
1000
1001
1002
1003 /* ===============================================================
1004 Method Types
1005 */
1006
1007 #define KSMETHOD_TYPE_NONE 0x00000000
1008 #define KSMETHOD_TYPE_READ 0x00000001
1009 #define KSMETHOD_TYPE_WRITE 0x00000002
1010 #define KSMETHOD_TYPE_MODIFY 0x00000003
1011 #define KSMETHOD_TYPE_SOURCE 0x00000004
1012 #define KSMETHOD_TYPE_SEND 0x00000001
1013 #define KSMETHOD_TYPE_SETSUPPORT 0x00000100
1014 #define KSMETHOD_TYPE_BASICSUPPORT 0x00000200
1015
1016
1017 /* ===============================================================
1018 Property Types
1019 */
1020
1021 #define KSPROPERTY_TYPE_GET 0x00000001
1022 #define KSPROPERTY_TYPE_SET 0x00000002
1023 #define KSPROPERTY_TYPE_SETSUPPORT 0x00000100
1024 #define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200
1025 #define KSPROPERTY_TYPE_RELATIONS 0x00000400
1026 #define KSPROPERTY_TYPE_SERIALIZESET 0x00000800
1027 #define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000
1028 #define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000
1029 #define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000
1030 #define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000
1031 #define KSPROPERTY_TYPE_DEFAULT_VALUES 0x00010000
1032
1033
1034 /* ===============================================================
1035 Topology Methods/Properties
1036 */
1037
1038 #define KSMETHOD_TYPE_TOPOLOGY 0x10000000
1039 #define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
1040
1041 /*
1042 #define DEFINE_KS_GUID(GA,GB,GC,GD,GE,GF,GG,GH,GI,GJ,GK) \
1043 DEFINE_GUID(??, 0x#GA#L, 0xGB, 0xGC, 0xGD, 0xGE, 0xGF, 0xGG, 0xGH, 0xGI, 0xGJ, 0xGK) \
1044 "GA-GB-GC-GDGE-GFGGGHGIGJGK"
1045 */
1046
1047 /* ===============================================================
1048 KS Category GUIDs
1049
1050 BRIDGE - 0x085AFF00L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1051 CAPTURE - 0x65E8773DL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1052 RENDER - 0x65E8773EL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1053 MIXER - 0xAD809C00L, 0x7B88, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1054 SPLITTER - 0x0A4252A0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1055 DATACOMPRESSOR - 0x1E84C900L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1056 DATADECOMPRESSOR - 0x2721AE20L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1057 DATATRANSFORM - 0x2EB07EA0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1058 COMMUNICATIONSTRANSFORM - 0xCF1DDA2CL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1059 INTERFACETRANSFORM - 0xCF1DDA2DL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1060 MEDIUMTRANSFORM - 0xCF1DDA2EL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1061 FILESYSTEM - 0x760FED5EL, 0x9357, 0x11D0, 0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1062 CLOCK - 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1063 PROXY - 0x97EBAACAL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1064 QUALITY - 0x97EBAACBL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1065 */
1066
1067 /* ===============================================================
1068 KSNAME GUIDs (defined also as KSSTRING_Xxx L"{...}"
1069
1070 Filter - 0x9b365890L, 0x165f, 0x11d0, 0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1071 Pin - 0x146F1A80L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1072 Clock - 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1073 Allocator - 0x642F5D00L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1074 TopologyNode - 0x0621061AL, 0xEE75, 0x11D0, 0xB9, 0x15, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1075 */
1076
1077 /* ===============================================================
1078 Interface GUIDs
1079
1080 Standard - 0x1A8766A0L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1081 FileIo - 0x8C6F932CL, 0xE771, 0x11D0, 0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1082 */
1083
1084 /* ===============================================================
1085 Medium Type GUIDs
1086
1087 Standard - 0x4747B320L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1088 */
1089
1090 /* ===============================================================
1091 Property Set GUIDs
1092
1093 General - 0x1464EDA5L, 0x6A8F, 0x11D1, 0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1094 StreamIo - 0x65D003CAL, 0x1523, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1095 MediaSeeking - 0xEE904F0CL, 0xD09B, 0x11D0, 0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1096 Topology - 0x720D4AC0L, 0x7533, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1097 GM - 0xAF627536L, 0xE719, 0x11D2, 0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D
1098 Quality - 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1099 Connection - 0x1D58C920L, 0xAC9B, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1100 */
1101
1102 /* ===============================================================
1103 StreamAllocator Sets
1104
1105 Event set - 0x75d95571L, 0x073c, 0x11d0, 0xa1, 0x61, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1106 Method set - 0xcf6e4341L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1107 Property set - 0xcf6e4342L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1108 */
1109
1110 /* ===============================================================
1111 StreamInterface Sets
1112
1113 Property set - 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a
1114 */
1115
1116 /* ===============================================================
1117 Clock Sets
1118
1119 Property set - 0xDF12A4C0L, 0xAC17, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1120 Event sets - 0x364D8E20L, 0x62C7, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1121 */
1122
1123 /* ===============================================================
1124 Connection Sets
1125
1126 Event set - 0x7f4bcbe0L, 0x9ea5, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00
1127 */
1128
1129 /* ===============================================================
1130 Time Format GUIDs
1131
1132 KSTIME_FORMAT_NONE (null guid)
1133 FRAME - 0x7b785570L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1134 BYTE - 0x7b785571L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1135 SAMPLE - 0x7b785572L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1136 FIELD - 0x7b785573L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1137 MEDIA_TIME - 0x7b785574L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
1138 */
1139
1140 /* ===============================================================
1141 Media Type GUIDs
1142
1143 NULL
1144 Stream -
1145 None -
1146
1147 TODO ...
1148 */
1149
1150 #define STATIC_KSDATAFORMAT_SPECIFIER_NONE\
1151 0x0F6417D6L, 0xC318, 0x11D0, 0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1152 DEFINE_GUIDSTRUCT("0F6417D6-C318-11D0-A43F-00A0C9223196", KSDATAFORMAT_SPECIFIER_NONE);
1153 #define KSDATAFORMAT_SPECIFIER_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_NONE)
1154
1155
1156 /* ===============================================================
1157 KSMEMORY_TYPE_xxx
1158
1159 WILDCARD, DONT_CARE = NULL
1160 SYSTEM - 0x091bb638L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1161 USER - 0x8cb0fc28L, 0x7893, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1162 KERNEL_PAGED - 0xd833f8f8L, 0x7894, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1163 KERNEL_NONPAGED - 0x4a6d5fc4L, 0x7895, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1164 DEVICE_UNKNOWN - 0x091bb639L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1165 */
1166
1167 /* ===============================================================
1168 Enums
1169 (values have been checked)
1170 */
1171
1172 #ifndef _MSC_VER
1173
1174 #define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler,\
1175 MinProperty,\
1176 MinData,\
1177 SetHandler,\
1178 Values, RelationsCount, Relations, SupportHandler,\
1179 SerializedSize)\
1180 {\
1181 PropertyId, {(PFNKSHANDLER)GetHandler}, MinProperty, MinData,\
1182 {(PFNKSHANDLER)SetHandler},\
1183 (PKSPROPERTY_VALUES)Values, RelationsCount, (PKSPROPERTY)Relations,\
1184 (PFNKSHANDLER)SupportHandler, (ULONG)SerializedSize\
1185 }
1186
1187 #else
1188
1189 #define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler,\
1190 MinProperty,\
1191 MinData,\
1192 SetHandler,\
1193 Values, RelationsCount, Relations, SupportHandler,\
1194 SerializedSize)\
1195 {\
1196 PropertyId, (PFNKSHANDLER)GetHandler, MinProperty, MinData,\
1197 (PFNKSHANDLER)SetHandler,\
1198 (PKSPROPERTY_VALUES)Values, RelationsCount, (PKSPROPERTY)Relations,\
1199 (PFNKSHANDLER)SupportHandler, (ULONG)SerializedSize\
1200 }
1201
1202 #endif
1203
1204
1205 typedef enum
1206 {
1207 KsObjectTypeDevice,
1208 KsObjectTypeFilterFactory,
1209 KsObjectTypeFilter,
1210 KsObjectTypePin
1211 } KSOBJECTTYPE;
1212
1213 typedef enum
1214 {
1215 KSSTATE_STOP,
1216 KSSTATE_ACQUIRE,
1217 KSSTATE_PAUSE,
1218 KSSTATE_RUN
1219 } KSSTATE, *PKSSTATE;
1220
1221 typedef enum
1222 {
1223 KSTARGET_STATE_DISABLED,
1224 KSTARGET_STATE_ENABLED
1225 } KSTARGET_STATE;
1226
1227 typedef enum
1228 {
1229 KSRESET_BEGIN,
1230 KSRESET_END
1231 } KSRESET;
1232
1233 typedef enum
1234 {
1235 KSEVENTS_NONE,
1236 KSEVENTS_SPINLOCK,
1237 KSEVENTS_MUTEX,
1238 KSEVENTS_FMUTEX,
1239 KSEVENTS_FMUTEXUNSAFE,
1240 KSEVENTS_INTERRUPT,
1241 KSEVENTS_ERESOURCE
1242 } KSEVENTS_LOCKTYPE;
1243
1244 typedef enum
1245 {
1246 KSDEGRADE_STANDARD_SIMPLE,
1247 KSDEGRADE_STANDARD_QUALITY,
1248 KSDEGRADE_STANDARD_COMPUTATION,
1249 KSDEGRADE_STANDARD_SKIP
1250 } KSDEGRADE_STANDARD;
1251
1252 typedef enum
1253 {
1254 KSPIN_DATAFLOW_IN = 1,
1255 KSPIN_DATAFLOW_OUT
1256 } KSPIN_DATAFLOW, *PKSPIN_DATAFLOW;
1257
1258 typedef enum
1259 {
1260 KSPIN_COMMUNICATION_NONE,
1261 KSPIN_COMMUNICATION_SINK,
1262 KSPIN_COMMUNICATION_SOURCE,
1263 KSPIN_COMMUNICATION_BOTH,
1264 KSPIN_COMMUNICATION_BRIDGE
1265 } KSPIN_COMMUNICATION, *PKSPIN_COMMUNICATION;
1266
1267 typedef enum
1268 {
1269 KsListEntryTail,
1270 KsListEntryHead
1271 } KSLIST_ENTRY_LOCATION;
1272
1273 typedef enum
1274 {
1275 KsStackCopyToNewLocation,
1276 KsStackReuseCurrentLocation,
1277 KsStackUseNewLocation
1278 } KSSTACK_USE;
1279
1280 typedef enum
1281 {
1282 KsAcquireOnly,
1283 KsAcquireAndRemove,
1284 KsAcquireOnlySingleItem,
1285 KsAcquireAndRemoveOnlySingleItem
1286 } KSIRP_REMOVAL_OPERATION;
1287
1288 typedef enum
1289 {
1290 KsInvokeOnSuccess = 1,
1291 KsInvokeOnError = 2,
1292 KsInvokeOnCancel = 4
1293 } KSCOMPLETION_INVOCATION;
1294
1295
1296 #if defined(_NTDDK_)
1297 /* MOVE ME */
1298 typedef NTSTATUS (NTAPI *PFNKSCONTEXT_DISPATCH)(
1299 IN PVOID Context,
1300 IN PIRP Irp);
1301 #endif
1302
1303 #if defined(_NTDDK_) && !defined(__wtypes_h__)
1304 enum VARENUM {
1305 VT_EMPTY = 0,
1306 VT_NULL = 1,
1307 VT_I2 = 2,
1308 VT_I4 = 3,
1309 VT_R4 = 4,
1310 VT_R8 = 5,
1311 VT_CY = 6,
1312 VT_DATE = 7,
1313 VT_BSTR = 8,
1314 VT_DISPATCH = 9,
1315 VT_ERROR = 10,
1316 VT_BOOL = 11,
1317 VT_VARIANT = 12,
1318 VT_UNKNOWN = 13,
1319 VT_DECIMAL = 14,
1320 VT_I1 = 16,
1321 VT_UI1 = 17,
1322 VT_UI2 = 18,
1323 VT_UI4 = 19,
1324 VT_I8 = 20,
1325 VT_UI8 = 21,
1326 VT_INT = 22,
1327 VT_UINT = 23,
1328 VT_VOID = 24,
1329 VT_HRESULT = 25,
1330 VT_PTR = 26,
1331 VT_SAFEARRAY = 27,
1332 VT_CARRAY = 28,
1333 VT_USERDEFINED = 29,
1334 VT_LPSTR = 30,
1335 VT_LPWSTR = 31,
1336 VT_FILETIME = 64,
1337 VT_BLOB = 65,
1338 VT_STREAM = 66,
1339 VT_STORAGE = 67,
1340 VT_STREAMED_OBJECT = 68,
1341 VT_STORED_OBJECT = 69,
1342 VT_BLOB_OBJECT = 70,
1343 VT_CF = 71,
1344 VT_CLSID = 72,
1345 VT_VECTOR = 0x1000,
1346 VT_ARRAY = 0x2000,
1347 VT_BYREF = 0x4000,
1348 VT_RESERVED = 0x8000,
1349 VT_ILLEGAL = 0xffff,
1350 VT_ILLEGALMASKED = 0xfff,
1351 VT_TYPEMASK = 0xfff
1352 };
1353 #endif
1354
1355 #define STATIC_KSDATAFORMAT_TYPE_WILDCARD STATIC_GUID_NULL
1356 #define KSDATAFORMAT_TYPE_WILDCARD GUID_NULL
1357
1358 #define STATIC_KSDATAFORMAT_SUBTYPE_WILDCARD STATIC_GUID_NULL
1359 #define KSDATAFORMAT_SUBTYPE_WILDCARD GUID_NULL
1360
1361 #define STATIC_KSDATAFORMAT_SPECIFIER_WILDCARD STATIC_GUID_NULL
1362 #define KSDATAFORMAT_SPECIFIER_WILDCARD GUID_NULL
1363
1364 /* ===============================================================
1365 Framing
1366 */
1367
1368 typedef struct
1369 {
1370 ULONG MinFrameSize;
1371 ULONG MaxFrameSize;
1372 ULONG Stepping;
1373 } KS_FRAMING_RANGE, *PKS_FRAMING_RANGE;
1374
1375 typedef struct
1376 {
1377 KS_FRAMING_RANGE Range;
1378 ULONG InPlaceWeight;
1379 ULONG NotInPlaceWeight;
1380 } KS_FRAMING_RANGE_WEIGHTED, *PKS_FRAMING_RANGE_WEIGHTED;
1381
1382 typedef struct
1383 {
1384 GUID MemoryType;
1385 GUID BusType;
1386 ULONG MemoryFlags;
1387 ULONG BusFlags;
1388 ULONG Flags;
1389 ULONG Frames;
1390 ULONG FileAlignment;
1391 ULONG MemoryTypeWeight;
1392 KS_FRAMING_RANGE PhysicalRange;
1393 KS_FRAMING_RANGE_WEIGHTED FramingRange;
1394 } KS_FRAMING_ITEM, *PKS_FRAMING_ITEM;
1395
1396 typedef struct
1397 {
1398 ULONG RatioNumerator;
1399 ULONG RatioDenominator;
1400 ULONG RatioConstantMargin;
1401 } KS_COMPRESSION, *PKS_COMPRESSION;
1402
1403
1404 /* ===============================================================
1405 Priorities
1406 */
1407
1408 #define KSPRIORITY_LOW 0x00000001
1409 #define KSPRIORITY_NORMAL 0x40000000
1410 #define KSPRIORITY_HIGH 0x80000000
1411 #define KSPRIORITY_EXCLUSIVE 0xFFFFFFFF
1412
1413 typedef struct
1414 {
1415 ULONG PriorityClass;
1416 ULONG PrioritySubClass;
1417 } KSPRIORITY, *PKSPRIORITY;
1418
1419
1420 /* ===============================================================
1421 Dispatch Table
1422 http://www.osronline.com/DDKx/stream/ks-struct_494j.htm
1423 */
1424 #if defined(_NTDDK_)
1425 typedef struct
1426 {
1427 PDRIVER_DISPATCH DeviceIoControl;
1428 PDRIVER_DISPATCH Read;
1429 PDRIVER_DISPATCH Write;
1430 PDRIVER_DISPATCH Flush;
1431 PDRIVER_DISPATCH Close;
1432 PDRIVER_DISPATCH QuerySecurity;
1433 PDRIVER_DISPATCH SetSecurity;
1434 PFAST_IO_DEVICE_CONTROL FastDeviceIoControl;
1435 PFAST_IO_READ FastRead;
1436 PFAST_IO_WRITE FastWrite;
1437 } KSDISPATCH_TABLE, *PKSDISPATCH_TABLE;
1438
1439
1440 #define KSCREATE_ITEM_IRP_STORAGE(Irp) (*(PKSOBJECT_CREATE_ITEM*)&(Irp)->Tail.Overlay.DriverContext[0])
1441 #define KSEVENT_SET_IRP_STORAGE(Irp) (*(const KSEVENT_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
1442 #define KSEVENT_ITEM_IRP_STORAGE(Irp) (*(const KSEVENT_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
1443 #define KSEVENT_ENTRY_IRP_STORAGE(Irp) (*(PKSEVENT_ENTRY*)&(Irp)->Tail.Overlay.DriverContext[0])
1444 #define KSMETHOD_SET_IRP_STORAGE(Irp) (*(const KSMETHOD_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
1445 #define KSMETHOD_ITEM_IRP_STORAGE(Irp) (*(const KSMETHOD_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
1446 #define KSMETHOD_TYPE_IRP_STORAGE(Irp) (*(ULONG_PTR*)(&(Irp)->Tail.Overlay.DriverContext[2]))
1447 #define KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) (*(PKSPIN_LOCK*)&(Irp)->Tail.Overlay.DriverContext[1])
1448 #define KSPROPERTY_SET_IRP_STORAGE(Irp) (*(const KSPROPERTY_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
1449 #define KSPROPERTY_ITEM_IRP_STORAGE(Irp) (*(const KSPROPERTY_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
1450 #define KSPROPERTY_ATTRIBUTES_IRP_STORAGE(Irp) (*(PKSATTRIBUTE_LIST*)&(Irp)->Tail.Overlay.DriverContext[2])
1451
1452 typedef
1453 VOID
1454 (NTAPI *PFNREFERENCEDEVICEOBJECT)(
1455 IN PVOID Context
1456 );
1457
1458 typedef
1459 VOID
1460 (NTAPI *PFNDEREFERENCEDEVICEOBJECT)(
1461 IN PVOID Context
1462 );
1463
1464 typedef
1465 NTSTATUS
1466 (NTAPI *PFNQUERYREFERENCESTRING)(
1467 IN PVOID Context,
1468 IN OUT PWCHAR *String
1469 );
1470
1471 typedef struct
1472 {
1473 INTERFACE Interface;
1474 PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject;
1475 PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject;
1476 PFNQUERYREFERENCESTRING QueryReferenceString;
1477 } BUS_INTERFACE_REFERENCE, *PBUS_INTERFACE_REFERENCE;
1478
1479 typedef struct
1480 {
1481 KDPC Dpc;
1482 ULONG ReferenceCount;
1483 KSPIN_LOCK AccessLock;
1484 } KSDPC_ITEM, *PKSDPC_ITEM;
1485
1486 typedef struct
1487 {
1488 KSDPC_ITEM DpcItem;
1489 LIST_ENTRY BufferList;
1490 } KSBUFFER_ITEM, *PKSBUFFER_ITEM;
1491
1492 #endif
1493
1494 typedef struct
1495 {
1496 GUID Manufacturer;
1497 GUID Product;
1498 GUID Component;
1499 GUID Name;
1500 ULONG Version;
1501 ULONG Revision;
1502 } KSCOMPONENTID, *PKSCOMPONENTID;
1503
1504 /* ===============================================================
1505 Properties
1506 */
1507
1508 #define KSPROPERTY_MEMBER_RANGES 0x00000001
1509 #define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002
1510 #define KSPROPERTY_MEMBER_VALUES 0x00000003
1511 #define KSPROPERTY_MEMBER_FLAG_DEFAULT KSPROPERTY_MEMBER_RANGES
1512
1513 typedef struct
1514 {
1515 GUID PropertySet;
1516 ULONG Count;
1517 } KSPROPERTY_SERIALHDR, *PKSPROPERTY_SERIALHDR;
1518
1519 typedef struct
1520 {
1521 KSIDENTIFIER PropTypeSet;
1522 ULONG Id;
1523 ULONG PropertyLength;
1524 } KSPROPERTY_SERIAL, *PKSPROPERTY_SERIAL;
1525
1526
1527 typedef union
1528 {
1529 struct {
1530 LONG SignedMinimum;
1531 LONG SignedMaximum;
1532
1533 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1534 }_SIGNED;
1535 #else
1536 };
1537 #endif
1538
1539 struct {
1540 ULONG UnsignedMinimum;
1541 ULONG UnsignedMaximum;
1542 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1543 }_UNSIGNED;
1544 #else
1545 };
1546 #endif
1547
1548 } KSPROPERTY_BOUNDS_LONG, *PKSPROPERTY_BOUNDS_LONG;
1549
1550 typedef union
1551 {
1552 struct {
1553 LONGLONG SignedMinimum;
1554 LONGLONG SignedMaximum;
1555 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1556 }_SIGNED64;
1557 #else
1558 };
1559 #endif
1560
1561 struct {
1562 #if defined(_NTDDK_)
1563 ULONGLONG UnsignedMinimum;
1564 ULONGLONG UnsignedMaximum;
1565 #else
1566 DWORDLONG UnsignedMinimum;
1567 DWORDLONG UnsignedMaximum;
1568 #endif
1569 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
1570 }_UNSIGNED64;
1571 #else
1572 };
1573 #endif
1574 } KSPROPERTY_BOUNDS_LONGLONG, *PKSPROPERTY_BOUNDS_LONGLONG;
1575
1576 typedef struct
1577 {
1578 ULONG AccessFlags;
1579 ULONG DescriptionSize;
1580 KSIDENTIFIER PropTypeSet;
1581 ULONG MembersListCount;
1582 ULONG Reserved;
1583 } KSPROPERTY_DESCRIPTION, *PKSPROPERTY_DESCRIPTION;
1584
1585 typedef struct
1586 {
1587 ULONG MembersFlags;
1588 ULONG MembersSize;
1589 ULONG MembersCount;
1590 ULONG Flags;
1591 } KSPROPERTY_MEMBERSHEADER, *PKSPROPERTY_MEMBERSHEADER;
1592
1593 typedef struct {
1594 KSPROPERTY_MEMBERSHEADER MembersHeader;
1595 const VOID* Members;
1596 } KSPROPERTY_MEMBERSLIST, *PKSPROPERTY_MEMBERSLIST;
1597
1598 typedef struct {
1599 KSIDENTIFIER PropTypeSet;
1600 ULONG MembersListCount;
1601 const KSPROPERTY_MEMBERSLIST* MembersList;
1602 } KSPROPERTY_VALUES, *PKSPROPERTY_VALUES;
1603
1604 #if defined(_NTDDK_)
1605 typedef NTSTATUS (NTAPI *PFNKSHANDLER)(
1606 IN PIRP Irp,
1607 IN PKSIDENTIFIER Request,
1608 IN OUT PVOID Data);
1609
1610 typedef struct
1611 {
1612 ULONG PropertyId;
1613 union
1614 {
1615 PFNKSHANDLER GetPropertyHandler;
1616 BOOLEAN GetSupported;
1617 };
1618 ULONG MinProperty;
1619 ULONG MinData;
1620 union {
1621 PFNKSHANDLER SetPropertyHandler;
1622 BOOLEAN SetSupported;
1623 };
1624 const KSPROPERTY_VALUES * Values;
1625 ULONG RelationsCount;
1626 const KSPROPERTY * Relations;
1627 PFNKSHANDLER SupportHandler;
1628 ULONG SerializedSize;
1629 } KSPROPERTY_ITEM, *PKSPROPERTY_ITEM;
1630
1631
1632 typedef
1633 BOOLEAN
1634 (NTAPI *PFNKSFASTHANDLER)(
1635 IN PFILE_OBJECT FileObject,
1636 IN PKSIDENTIFIER Request,
1637 IN ULONG RequestLength,
1638 IN OUT PVOID Data,
1639 IN ULONG DataLength,
1640 OUT PIO_STATUS_BLOCK IoStatus
1641 );
1642
1643 typedef struct {
1644 ULONG PropertyId;
1645 union {
1646 PFNKSFASTHANDLER GetPropertyHandler;
1647 BOOLEAN GetSupported;
1648 };
1649 union {
1650 PFNKSFASTHANDLER SetPropertyHandler;
1651 BOOLEAN SetSupported;
1652 };
1653 ULONG Reserved;
1654 } KSFASTPROPERTY_ITEM, *PKSFASTPROPERTY_ITEM;
1655
1656 typedef struct
1657 {
1658 const GUID* Set;
1659 ULONG PropertiesCount;
1660 const KSPROPERTY_ITEM * PropertyItem;
1661 ULONG FastIoCount;
1662 const KSFASTPROPERTY_ITEM* FastIoTable;
1663 } KSPROPERTY_SET, *PKSPROPERTY_SET;
1664
1665 #endif
1666
1667 typedef struct
1668 {
1669 ULONG SteppingDelta;
1670 ULONG Reserved;
1671 KSPROPERTY_BOUNDS_LONG Bounds;
1672 } KSPROPERTY_STEPPING_LONG, *PKSPROPERTY_STEPPING_LONG;
1673
1674 typedef struct
1675 {
1676 #if defined(_NTDDK_)
1677 ULONGLONG SteppingDelta;
1678 #else
1679 DWORDLONG SteppingDelta;
1680 #endif
1681 KSPROPERTY_BOUNDS_LONGLONG Bounds;
1682 } KSPROPERTY_STEPPING_LONGLONG, *PKSPROPERTY_STEPPING_LONGLONG;
1683
1684 /* ===============================================================
1685 Allocator Framing
1686 */
1687
1688 typedef struct
1689 {
1690 union {
1691 ULONG OptionsFlags;
1692 ULONG RequirementsFlags;
1693 };
1694 #if defined(_NTDDK_)
1695 POOL_TYPE PoolType;
1696 #else
1697 ULONG PoolType;
1698 #endif
1699 ULONG Frames;
1700 ULONG FrameSize;
1701 ULONG FileAlignment;
1702 ULONG Reserved;
1703 } KSALLOCATOR_FRAMING, *PKSALLOCATOR_FRAMING;
1704
1705 typedef struct
1706 {
1707 ULONG CountItems;
1708 ULONG PinFlags;
1709 KS_COMPRESSION OutputCompression;
1710 ULONG PinWeight;
1711 KS_FRAMING_ITEM FramingItem[1];
1712 } KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX;
1713
1714 #define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001
1715 #define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002
1716 #define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004
1717 #define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008
1718 #define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000
1719
1720 #define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001
1721 #define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002
1722 #define KSALLOCATOR_OPTIONF_VALID 0x00000003
1723
1724 #define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010
1725 #define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020
1726 #define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040
1727 #define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080
1728
1729 /* ===============================================================
1730 Quality
1731 */
1732
1733 typedef struct
1734 {
1735 PVOID Context;
1736 ULONG Proportion;
1737 LONGLONG DeltaTime;
1738 } KSQUALITY, *PKSQUALITY;
1739
1740 typedef struct
1741 {
1742 HANDLE QualityManager;
1743 PVOID Context;
1744 } KSQUALITY_MANAGER, *PKSQUALITY_MANAGER;
1745
1746 typedef struct
1747 {
1748 LONGLONG PresentationStart;
1749 LONGLONG Duration;
1750 KSPIN_INTERFACE Interface;
1751 LONG Rate;
1752 ULONG Flags;
1753 } KSRATE, *PKSRATE;
1754
1755 typedef struct
1756 {
1757 KSPROPERTY Property;
1758 KSRATE Rate;
1759 } KSRATE_CAPABILITY, *PKSRATE_CAPABILITY;
1760
1761 typedef struct
1762 {
1763 LONGLONG Granularity;
1764 LONGLONG Error;
1765 } KSRESOLUTION, *PKSRESOLUTION;
1766
1767 typedef struct
1768 {
1769 ULONG NotificationType;
1770 union {
1771 struct {
1772 HANDLE Event;
1773 ULONG_PTR Reserved[2];
1774 } EventHandle;
1775 struct {
1776 HANDLE Semaphore;
1777 ULONG Reserved;
1778 LONG Adjustment;
1779 } SemaphoreHandle;
1780 #if defined(_NTDDK_)
1781 struct {
1782 PVOID Event;
1783 KPRIORITY Increment;
1784 ULONG_PTR Reserved;
1785 } EventObject;
1786 struct {
1787 PVOID Semaphore;
1788 KPRIORITY Increment;
1789 LONG Adjustment;
1790 } SemaphoreObject;
1791 struct {
1792 PKDPC Dpc;
1793 ULONG ReferenceCount;
1794 ULONG_PTR Reserved;
1795 } Dpc;
1796 struct {
1797 PWORK_QUEUE_ITEM WorkQueueItem;
1798 WORK_QUEUE_TYPE WorkQueueType;
1799 ULONG_PTR Reserved;
1800 } WorkItem;
1801 struct {
1802 PWORK_QUEUE_ITEM WorkQueueItem;
1803 PKSWORKER KsWorkerObject;
1804 ULONG_PTR Reserved;
1805 } KsWorkItem;
1806 #endif
1807 struct {
1808 PVOID Unused;
1809 LONG_PTR Alignment[2];
1810 } Alignment;
1811 };
1812 } KSEVENTDATA, *PKSEVENTDATA;
1813
1814 #define KSEVENTF_EVENT_HANDLE 0x00000001
1815 #define KSEVENTF_SEMAPHORE_HANDLE 0x00000002
1816 #if defined(_NTDDK_)
1817 #define KSEVENTF_EVENT_OBJECT 0x00000004
1818 #define KSEVENTF_SEMAPHORE_OBJECT 0x00000008
1819 #define KSEVENTF_DPC 0x00000010
1820 #define KSEVENTF_WORKITEM 0x00000020
1821 #define KSEVENTF_KSWORKITEM 0x00000080
1822 #endif
1823
1824
1825 #define KSEVENT_TYPE_ENABLE 0x00000001
1826 #define KSEVENT_TYPE_ONESHOT 0x00000002
1827 #define KSEVENT_TYPE_ENABLEBUFFERED 0x00000004
1828 #define KSEVENT_TYPE_SETSUPPORT 0x00000100
1829 #define KSEVENT_TYPE_BASICSUPPORT 0x00000200
1830 #define KSEVENT_TYPE_QUERYBUFFER 0x00000400
1831
1832 #define KSEVENT_TYPE_TOPOLOGY 0x10000000
1833
1834 typedef struct
1835 {
1836 ULONG Size;
1837 ULONG Flags;
1838 union {
1839 HANDLE ObjectHandle;
1840 PVOID ObjectPointer;
1841 };
1842 PVOID Reserved;
1843 KSEVENT Event;
1844 KSEVENTDATA EventData;
1845 } KSRELATIVEEVENT, *PKSRELATIVEEVENT;
1846
1847 #define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001
1848 #define KSRELATIVEEVENT_FLAG_POINTER 0x00000002
1849
1850 /* ===============================================================
1851 Timing
1852 */
1853
1854
1855 typedef struct {
1856 KSEVENTDATA EventData;
1857 LONGLONG MarkTime;
1858 } KSEVENT_TIME_MARK, *PKSEVENT_TIME_MARK;
1859
1860 typedef struct {
1861 KSEVENTDATA EventData;
1862 LONGLONG TimeBase;
1863 LONGLONG Interval;
1864 } KSEVENT_TIME_INTERVAL, *PKSEVENT_TIME_INTERVAL;
1865
1866 typedef struct {
1867 LONGLONG TimeBase;
1868 LONGLONG Interval;
1869 } KSINTERVAL, *PKSINTERVAL;
1870
1871
1872
1873 typedef struct
1874 {
1875 LONGLONG Time;
1876 ULONG Numerator;
1877 ULONG Denominator;
1878 } KSTIME, *PKSTIME;
1879
1880 typedef struct
1881 {
1882 LONGLONG Time;
1883 LONGLONG SystemTime;
1884 } KSCORRELATED_TIME, *PKSCORRELATED_TIME;
1885
1886 typedef struct
1887 {
1888 LONGLONG Duration;
1889 ULONG FrameFlags;
1890 ULONG Reserved;
1891 } KSFRAMETIME, *PKSFRAMETIME;
1892
1893
1894 /* ===============================================================
1895 Clocks
1896 */
1897
1898 typedef PVOID PKSDEFAULTCLOCK;
1899
1900 typedef struct
1901 {
1902 ULONG CreateFlags;
1903 } KSCLOCK_CREATE, *PKSCLOCK_CREATE;
1904
1905 #if defined(_NTDDK_)
1906
1907 typedef
1908 LONGLONG
1909 (FASTCALL *PFNKSCLOCK_GETTIME)(
1910 IN PFILE_OBJECT FileObject
1911 );
1912 typedef
1913 LONGLONG
1914 (FASTCALL *PFNKSCLOCK_CORRELATEDTIME)(
1915 IN PFILE_OBJECT FileObject,
1916 OUT PLONGLONG SystemTime);
1917
1918 typedef struct
1919 {
1920 PFNKSCLOCK_GETTIME GetTime;
1921 PFNKSCLOCK_GETTIME GetPhysicalTime;
1922 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime;
1923 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime;
1924 } KSCLOCK_FUNCTIONTABLE, *PKSCLOCK_FUNCTIONTABLE;
1925
1926
1927 /* ===============================================================
1928 Objects ??? SORT ME!
1929 */
1930
1931 #define KSCREATE_ITEM_SECURITYCHANGED 0x1
1932 #define KSCREATE_ITEM_WILDCARD 0x2
1933 #define KSCREATE_ITEM_NOPARAMETERS 0x4
1934 #define KSCREATE_ITEM_FREEONSTOP 0x8
1935
1936 typedef struct
1937 {
1938 PDRIVER_DISPATCH Create;
1939 PVOID Context;
1940 UNICODE_STRING ObjectClass;
1941 PSECURITY_DESCRIPTOR SecurityDescriptor;
1942 ULONG Flags;
1943 } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM;
1944
1945 typedef struct
1946 {
1947 ULONG CreateItemsCount;
1948 PKSOBJECT_CREATE_ITEM CreateItemsList;
1949 } KSOBJECT_CREATE, *PKSOBJECT_CREATE;
1950
1951 typedef VOID (NTAPI *PFNKSITEMFREECALLBACK)(
1952 IN PKSOBJECT_CREATE_ITEM CreateItem);
1953
1954 #endif
1955
1956 typedef struct
1957 {
1958 ULONG Size;
1959 ULONG Count;
1960 } KSMULTIPLE_ITEM, *PKSMULTIPLE_ITEM;
1961
1962 typedef struct
1963 {
1964 KSEVENT Event;
1965 PKSEVENTDATA EventData;
1966 PVOID Reserved;
1967 } KSQUERYBUFFER, *PKSQUERYBUFFER;
1968
1969 typedef struct
1970 {
1971 PVOID Context;
1972 ULONG Status;
1973 } KSERROR, *PKSERROR;
1974
1975 /* ===============================================================
1976 Methods
1977 */
1978 #if defined(_NTDDK_)
1979
1980 typedef struct
1981 {
1982 ULONG MethodId;
1983 union {
1984 PFNKSHANDLER MethodHandler;
1985 BOOLEAN MethodSupported;
1986 };
1987 ULONG MinMethod;
1988 ULONG MinData;
1989 PFNKSHANDLER SupportHandler;
1990 ULONG Flags;
1991 } KSMETHOD_ITEM, *PKSMETHOD_ITEM;
1992
1993 #ifndef _MSC_VER
1994
1995 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
1996 MethodHandler,\
1997 MinMethod, MinData, SupportHandler)\
1998 {\
1999 MethodId, {(PFNKSHANDLER)MethodHandler}, MinMethod, MinData,\
2000 SupportHandler, Flags\
2001 }
2002
2003 #else
2004
2005 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
2006 MethodHandler,\
2007 MinMethod, MinData, SupportHandler)\
2008 {\
2009 MethodId, (PFNKSHANDLER)MethodHandler, MinMethod, MinData,\
2010 SupportHandler, Flags\
2011 }
2012
2013
2014
2015 #endif
2016
2017
2018 typedef struct
2019 {
2020 ULONG MethodId;
2021 union {
2022 PFNKSFASTHANDLER MethodHandler;
2023 BOOLEAN MethodSupported;
2024 };
2025 } KSFASTMETHOD_ITEM, *PKSFASTMETHOD_ITEM;
2026
2027 #define DEFINE_KSFASTMETHOD_ITEM(MethodId, MethodHandler)\
2028 {\
2029 MethodId, (PFNKSFASTHANDLER)MethodHandler\
2030 }
2031
2032
2033 typedef struct
2034 {
2035 const GUID* Set;
2036 ULONG MethodsCount;
2037 const KSMETHOD_ITEM* MethodItem;
2038 ULONG FastIoCount;
2039 const KSFASTMETHOD_ITEM*FastIoTable;
2040 } KSMETHOD_SET, *PKSMETHOD_SET;
2041
2042
2043 #define DEFINE_KSMETHOD_SET(Set,\
2044 MethodsCount,\
2045 MethodItem,\
2046 FastIoCount,\
2047 FastIoTable)\
2048 {\
2049 Set,\
2050 MethodsCount,\
2051 MethodItem,\
2052 FastIoCount,\
2053 FastIoTable\
2054 }
2055
2056 #endif
2057 /* ===============================================================
2058 Nodes
2059 */
2060
2061 typedef struct
2062 {
2063 KSPROPERTY Property;
2064 ULONG NodeId;
2065 ULONG Reserved;
2066 } KSP_NODE, *PKSP_NODE;
2067
2068 typedef struct
2069 {
2070 KSMETHOD Method;
2071 ULONG NodeID;
2072 ULONG Reserved;
2073 } KSM_NODE, *PKSM_NODE;
2074
2075 typedef struct
2076 {
2077 KSEVENT Event;
2078 ULONG NodeId;
2079 ULONG Reserved;
2080 } KSE_NODE, *PKSE_NODE;
2081
2082 typedef struct {
2083 ULONG CreateFlags;
2084 ULONG Node;
2085 } KSNODE_CREATE, *PKSNODE_CREATE;
2086
2087
2088 /* ===============================================================
2089 Events
2090 */
2091 typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, *PKSEVENT_ENTRY;
2092
2093 #if defined(_NTDDK_)
2094
2095 typedef NTSTATUS (NTAPI *PFNKSADDEVENT)(
2096 IN PIRP Irp,
2097 IN PKSEVENTDATA EventData,
2098 IN struct _KSEVENT_ENTRY* EventEntry);
2099
2100 typedef
2101 VOID
2102 (NTAPI *PFNKSREMOVEEVENT)(
2103 IN PFILE_OBJECT FileObject,
2104 IN struct _KSEVENT_ENTRY* EventEntry
2105 );
2106
2107 typedef struct
2108 {
2109 ULONG EventId;
2110 ULONG DataInput;
2111 ULONG ExtraEntryData;
2112 PFNKSADDEVENT AddHandler;
2113 PFNKSREMOVEEVENT RemoveHandler;
2114 PFNKSHANDLER SupportHandler;
2115 } KSEVENT_ITEM, *PKSEVENT_ITEM;
2116
2117 typedef struct
2118 {
2119 const GUID* Set;
2120 ULONG EventsCount;
2121 const KSEVENT_ITEM* EventItem;
2122 } KSEVENT_SET, *PKSEVENT_SET;
2123
2124 struct _KSEVENT_ENTRY
2125 {
2126 LIST_ENTRY ListEntry;
2127 PVOID Object;
2128 union {
2129 PKSDPC_ITEM DpcItem;
2130 PKSBUFFER_ITEM BufferItem;
2131 };
2132 PKSEVENTDATA EventData;
2133 ULONG NotificationType;
2134 const KSEVENT_SET* EventSet;
2135 const KSEVENT_ITEM* EventItem;
2136 PFILE_OBJECT FileObject;
2137 ULONG SemaphoreAdjustment;
2138 ULONG Reserved;
2139 ULONG Flags;
2140 };
2141
2142 #endif
2143 /* ===============================================================
2144 Pins
2145 */
2146
2147 #if defined(_NTDDK_)
2148
2149 typedef struct _KSPIN KSPIN, *PKSPIN;
2150 typedef struct _KSSTREAM_POINTER KSSTREAM_POINTER, *PKSSTREAM_POINTER;
2151 typedef struct _KSSTREAM_POINTER_OFFSET KSSTREAM_POINTER_OFFSET, *PKSSTREAM_POINTER_OFFSET;
2152 typedef struct _KSMAPPING KSMAPPING, *PKSMAPPING;
2153 typedef struct _KSPROCESSPIN KSPROCESSPIN, *PKSPROCESSPIN;
2154
2155 #define IOCTL_KS_HANDSHAKE CTL_CODE(FILE_DEVICE_KS, 0x007, METHOD_NEITHER, FILE_ANY_ACCESS)
2156
2157 typedef struct {
2158 GUID ProtocolId;
2159 PVOID Argument1;
2160 PVOID Argument2;
2161 } KSHANDSHAKE, *PKSHANDSHAKE;
2162
2163 typedef
2164 NTSTATUS
2165 (NTAPI *PFNKSPINHANDSHAKE)(
2166 IN PKSPIN Pin,
2167 IN PKSHANDSHAKE In,
2168 IN PKSHANDSHAKE Out
2169 );
2170
2171 typedef
2172 void
2173 (NTAPI *PFNKSPINPOWER)(
2174 IN PKSPIN Pin,
2175 IN DEVICE_POWER_STATE State
2176 );
2177
2178 typedef
2179 void
2180 (NTAPI *PFNKSPINFRAMERETURN)(
2181 IN PKSPIN Pin,
2182 IN PVOID Data OPTIONAL,
2183 IN ULONG Size OPTIONAL,
2184 IN PMDL Mdl OPTIONAL,
2185 IN PVOID Context OPTIONAL,
2186 IN NTSTATUS Status
2187 );
2188
2189 typedef
2190 void
2191 (NTAPI *PFNKSPINIRPCOMPLETION)(
2192 IN PKSPIN Pin,
2193 IN PIRP Irp
2194 );
2195
2196 typedef
2197 NTSTATUS
2198 (NTAPI *PFNKSPINIRP)(
2199 IN PKSPIN Pin,
2200 IN PIRP Irp
2201 );
2202
2203 typedef
2204 NTSTATUS
2205 (NTAPI *PFNKSPIN)(
2206 IN PKSPIN Pin
2207 );
2208
2209 typedef
2210 void
2211 (NTAPI *PFNKSPINVOID)(
2212 IN PKSPIN Pin
2213 );
2214
2215 typedef
2216 void
2217 (NTAPI *PFNKSSTREAMPOINTER)(
2218 IN PKSSTREAM_POINTER StreamPointer
2219 );
2220
2221 typedef struct {
2222 ULONG Count;
2223 PKSATTRIBUTE* Attributes;
2224 } KSATTRIBUTE_LIST, *PKSATTRIBUTE_LIST;
2225
2226 typedef
2227 NTSTATUS
2228 (NTAPI *PFNKSPINSETDATAFORMAT)(
2229 IN PKSPIN Pin,
2230 IN PKSDATAFORMAT OldFormat OPTIONAL,
2231 IN PKSMULTIPLE_ITEM OldAttributeList OPTIONAL,
2232 IN const KSDATARANGE* DataRange,
2233 IN const KSATTRIBUTE_LIST* AttributeRange OPTIONAL
2234 );
2235
2236 typedef
2237 NTSTATUS
2238 (NTAPI *PFNKSPINSETDEVICESTATE)(
2239 IN PKSPIN Pin,
2240 IN KSSTATE ToState,
2241 IN KSSTATE FromState
2242 );
2243
2244 typedef struct _KSCLOCK_DISPATCH KSCLOCK_DISPATCH, *PKSCLOCK_DISPATCH;
2245 typedef struct _KSALLOCATOR_DISPATCH KSALLOCATOR_DISPATCH, *PKSALLOCATOR_DISPATCH;
2246
2247 typedef struct
2248 {
2249 PFNKSPINIRP Create;
2250 PFNKSPINIRP Close;
2251 PFNKSPIN Process;
2252 PFNKSPINVOID Reset;
2253 PFNKSPINSETDATAFORMAT SetDataFormat;
2254 PFNKSPINSETDEVICESTATE SetDeviceState;
2255 PFNKSPIN Connect;
2256 PFNKSPINVOID Disconnect;
2257 const KSCLOCK_DISPATCH* Clock;
2258 const KSALLOCATOR_DISPATCH* Allocator;
2259 } KSPIN_DISPATCH, *PKSPIN_DISPATCH;
2260
2261 typedef
2262 BOOLEAN
2263 (NTAPI *PFNKSPINSETTIMER)(
2264 IN PKSPIN Pin,
2265 IN PKTIMER Timer,
2266 IN LARGE_INTEGER DueTime,
2267 IN PKDPC Dpc
2268 );
2269
2270 typedef
2271 BOOLEAN
2272 (NTAPI *PFNKSPINCANCELTIMER)(
2273 IN PKSPIN Pin,
2274 IN PKTIMER Timer
2275 );
2276
2277 typedef
2278 LONGLONG
2279 (FASTCALL *PFNKSPINCORRELATEDTIME)(
2280 IN PKSPIN Pin,
2281 OUT PLONGLONG SystemTime
2282 );
2283
2284 typedef
2285 void
2286 (NTAPI *PFNKSPINRESOLUTION)(
2287 IN PKSPIN Pin,
2288 OUT PKSRESOLUTION Resolution
2289 );
2290
2291 struct _KSCLOCK_DISPATCH {
2292 PFNKSPINSETTIMER SetTimer;
2293 PFNKSPINCANCELTIMER CancelTimer;
2294 PFNKSPINCORRELATEDTIME CorrelatedTime;
2295 PFNKSPINRESOLUTION Resolution;
2296 };
2297
2298 typedef
2299 NTSTATUS
2300 (NTAPI *PFNKSPININITIALIZEALLOCATOR)(
2301 IN PKSPIN Pin,
2302 IN PKSALLOCATOR_FRAMING AllocatorFraming,
2303 OUT PVOID* Context
2304 );
2305
2306 typedef PVOID (NTAPI *PFNKSDELETEALLOCATOR)(
2307 IN PVOID Context);
2308
2309 typedef PVOID (NTAPI *PFNKSDEFAULTALLOCATE)(
2310 IN PVOID Context);
2311
2312 typedef PVOID (NTAPI *PFNKSDEFAULTFREE)(
2313 IN PVOID Context,
2314 IN PVOID Buffer);
2315
2316 struct _KSALLOCATOR_DISPATCH {
2317 PFNKSPININITIALIZEALLOCATOR InitializeAllocator;
2318 PFNKSDELETEALLOCATOR DeleteAllocator;
2319 PFNKSDEFAULTALLOCATE Allocate;
2320 PFNKSDEFAULTFREE Free;
2321 };
2322
2323 typedef struct
2324 {
2325 ULONG PropertySetsCount;
2326 ULONG PropertyItemSize;
2327 const KSPROPERTY_SET* PropertySets;
2328 ULONG MethodSetsCount;
2329 ULONG MethodItemSize;
2330 const KSMETHOD_SET* MethodSets;
2331 ULONG EventSetsCount;
2332 ULONG EventItemSize;
2333 const KSEVENT_SET* EventSets;
2334 #if !defined(_WIN64)
2335 PVOID Alignment;
2336 #endif
2337 } KSAUTOMATION_TABLE, *PKSAUTOMATION_TABLE;
2338
2339
2340
2341 typedef struct
2342 {
2343 ULONG InterfacesCount;
2344 const KSPIN_INTERFACE* Interfaces;
2345 ULONG MediumsCount;
2346 const KSPIN_MEDIUM* Mediums;
2347 ULONG DataRangesCount;
2348 const PKSDATARANGE* DataRanges;
2349 KSPIN_DATAFLOW DataFlow;
2350 KSPIN_COMMUNICATION Communication;
2351 const GUID* Category;
2352 const GUID* Name;
2353 union {
2354 LONGLONG Reserved;
2355 struct {
2356 ULONG ConstrainedDataRangesCount;
2357 PKSDATARANGE* ConstrainedDataRanges;
2358 };
2359 };
2360 } KSPIN_DESCRIPTOR, *PKSPIN_DESCRIPTOR;
2361
2362 typedef
2363 NTSTATUS
2364 (NTAPI *PFNKSINTERSECTHANDLER)(
2365 IN PIRP Irp,
2366 IN PKSP_PIN Pin,
2367 IN PKSDATARANGE DataRange,
2368 OUT PVOID Data OPTIONAL
2369 );
2370
2371 typedef
2372 NTSTATUS
2373 (NTAPI *PFNKSINTERSECTHANDLEREX)(
2374 IN PVOID Context,
2375 IN PIRP Irp,
2376 IN PKSP_PIN Pin,
2377 IN PKSDATARANGE DataRange,
2378 IN PKSDATARANGE MatchingDataRange,
2379 IN ULONG DataBufferSize,
2380 OUT PVOID Data OPTIONAL,
2381 OUT PULONG DataSize
2382 );
2383
2384 typedef struct
2385 {
2386 const KSPIN_DISPATCH* Dispatch;
2387 const KSAUTOMATION_TABLE* AutomationTable;
2388 KSPIN_DESCRIPTOR PinDescriptor;
2389 ULONG Flags;
2390 ULONG InstancesPossible;
2391 ULONG InstancesNecessary;
2392 const KSALLOCATOR_FRAMING_EX* AllocatorFraming;
2393 PFNKSINTERSECTHANDLEREX IntersectHandler;
2394 } KSPIN_DESCRIPTOR_EX, *PKSPIN_DESCRIPTOR_EX;
2395
2396 #define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001
2397 #define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002
2398 #define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004
2399 #define KSFILTER_FLAG_RECEIVE_ZERO_LENGTH_SAMPLES 0x00000008
2400 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
2401 #define KSFILTER_FLAG_DENY_USERMODE_ACCESS 0x80000000
2402 #endif
2403
2404
2405 #define KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING
2406 #define KSPIN_FLAG_CRITICAL_PROCESSING KSFILTER_FLAG_CRITICAL_PROCESSING
2407 #define KSPIN_FLAG_HYPERCRITICAL_PROCESSING KSFILTER_FLAG_HYPERCRITICAL_PROCESSING
2408 #define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008
2409 #define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010
2410 #define KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL 0x00000020
2411 #define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040
2412 #define KSPIN_FLAG_ENFORCE_FIFO 0x00000080
2413
2414 #define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100
2415 #define KSPIN_FLAG_DISTINCT_TRAILING_EDGE 0x00000200
2416
2417 #define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000
2418 #define KSPIN_FLAG_SPLITTER 0x00020000
2419 #define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000
2420 #define KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT 0x00080000
2421 #define KSPIN_FLAG_FIXED_FORMAT 0x00100000
2422 #define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000
2423 #define KSPIN_FLAG_RENDERER (KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY|KSPIN_FLAG_GENERATE_EOS_EVENTS)
2424 #define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000
2425 #define KSPIN_FLAG_SOME_FRAMES_REQUIRED_FOR_PROCESSING 0x00800000
2426 #define KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE 0x01000000
2427 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
2428 #define KSPIN_FLAG_DENY_USERMODE_ACCESS 0x80000000
2429 #endif
2430
2431 struct _KSPIN
2432 {
2433 const KSPIN_DESCRIPTOR_EX* Descriptor;
2434 KSOBJECT_BAG Bag;
2435 PVOID Context;
2436 ULONG Id;
2437 KSPIN_COMMUNICATION Communication;
2438 BOOLEAN ConnectionIsExternal;
2439 KSPIN_INTERFACE ConnectionInterface;
2440 KSPIN_MEDIUM ConnectionMedium;
2441 KSPRIORITY ConnectionPriority;
2442 PKSDATAFORMAT ConnectionFormat;
2443 PKSMULTIPLE_ITEM AttributeList;
2444 ULONG StreamHeaderSize;
2445 KSPIN_DATAFLOW DataFlow;
2446 KSSTATE DeviceState;
2447 KSRESET ResetState;
2448 KSSTATE ClientState;
2449 };
2450
2451 #define DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(Handler)\
2452 DEFINE_KSPROPERTY_ITEM(\
2453 KSPROPERTY_PIN_CINSTANCES,\
2454 (Handler),\
2455 sizeof(KSP_PIN),\
2456 sizeof(KSPIN_CINSTANCES),\
2457 NULL, NULL, 0, NULL, NULL, 0)
2458
2459 #define DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(Handler)\
2460 DEFINE_KSPROPERTY_ITEM(\
2461 KSPROPERTY_PIN_CTYPES,\
2462 (Handler),\
2463 sizeof(KSPROPERTY),\
2464 sizeof(ULONG),\
2465 NULL, NULL, 0, NULL, NULL, 0)
2466
2467 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(Handler)\
2468 DEFINE_KSPROPERTY_ITEM(\
2469 KSPROPERTY_PIN_DATAFLOW,\
2470 (Handler),\
2471 sizeof(KSP_PIN),\
2472 sizeof(KSPIN_DATAFLOW),\
2473 NULL, NULL, 0, NULL, NULL, 0)
2474
2475 #define DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(Handler)\
2476 DEFINE_KSPROPERTY_ITEM(\
2477 KSPROPERTY_PIN_DATARANGES,\
2478 (Handler),\
2479 sizeof(KSP_PIN),\
2480 0,\
2481 NULL, NULL, 0, NULL, NULL, 0)
2482
2483 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(Handler)\
2484 DEFINE_KSPROPERTY_ITEM(\
2485 KSPROPERTY_PIN_DATAINTERSECTION,\
2486 (Handler),\
2487 sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM),\
2488 0,\
2489 NULL, NULL, 0, NULL, NULL, 0)
2490
2491 #define DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(Handler)\
2492 DEFINE_KSPROPERTY_ITEM(\
2493 KSPROPERTY_PIN_INTERFACES,\
2494 (Handler),\
2495 sizeof(KSP_PIN),\
2496 0,\
2497 NULL, NULL, 0, NULL, NULL, 0)
2498
2499 #define DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(Handler)\
2500 DEFINE_KSPROPERTY_ITEM(\
2501 KSPROPERTY_PIN_MEDIUMS,\
2502 (Handler),\
2503 sizeof(KSP_PIN),\
2504 0,\
2505 NULL, NULL, 0, NULL, NULL, 0)
2506
2507 #define DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(Handler)\
2508 DEFINE_KSPROPERTY_ITEM(\
2509 KSPROPERTY_PIN_COMMUNICATION,\
2510 (Handler),\
2511 sizeof(KSP_PIN),\
2512 sizeof(KSPIN_COMMUNICATION),\
2513 NULL, NULL, 0, NULL, NULL, 0)
2514
2515 #define DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(Handler)\
2516 DEFINE_KSPROPERTY_ITEM(\
2517 KSPROPERTY_PIN_GLOBALCINSTANCES,\
2518 (Handler),\
2519 sizeof(KSP_PIN),\
2520 sizeof(KSPIN_CINSTANCES),\
2521 NULL, NULL, 0, NULL, NULL, 0)
2522
2523 #define DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(Handler)\
2524 DEFINE_KSPROPERTY_ITEM(\
2525 KSPROPERTY_PIN_NECESSARYINSTANCES,\
2526 (Handler),\
2527 sizeof(KSP_PIN),\
2528 sizeof(ULONG),\
2529 NULL, NULL, 0, NULL, NULL, 0)
2530
2531 #define DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(Handler)\
2532 DEFINE_KSPROPERTY_ITEM(\
2533 KSPROPERTY_PIN_PHYSICALCONNECTION,\
2534 (Handler),\
2535 sizeof(KSP_PIN),\
2536 0,\
2537 NULL, NULL, 0, NULL, NULL, 0)
2538
2539 #define DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(Handler)\
2540 DEFINE_KSPROPERTY_ITEM(\
2541 KSPROPERTY_PIN_CATEGORY,\
2542 (Handler),\
2543 sizeof(KSP_PIN),\
2544 sizeof(GUID),\
2545 NULL, NULL, 0, NULL, NULL, 0)
2546
2547 #define DEFINE_KSPROPERTY_ITEM_PIN_NAME(Handler)\
2548 DEFINE_KSPROPERTY_ITEM(\
2549 KSPROPERTY_PIN_NAME,\
2550 (Handler),\
2551 sizeof(KSP_PIN),\
2552 0,\
2553 NULL, NULL, 0, NULL, NULL, 0)
2554
2555 #define DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(Handler)\
2556 DEFINE_KSPROPERTY_ITEM(\
2557 KSPROPERTY_PIN_CONSTRAINEDDATARANGES,\
2558 (Handler),\
2559 sizeof(KSP_PIN),\
2560 0,\
2561 NULL, NULL, 0, NULL, NULL, 0)
2562
2563 #define DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(Handler)\
2564 DEFINE_KSPROPERTY_ITEM(\
2565 KSPROPERTY_PIN_PROPOSEDATAFORMAT,\
2566 NULL,\
2567 sizeof(KSP_PIN),\
2568 sizeof(KSDATAFORMAT),\
2569 (Handler), NULL, 0, NULL, NULL, 0)
2570
2571 #define DEFINE_KSPROPERTY_PINSET(PinSet,\
2572 PropGeneral, PropInstances, PropIntersection)\
2573 DEFINE_KSPROPERTY_TABLE(PinSet) {\
2574 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
2575 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
2576 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
2577 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
2578 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
2579 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
2580 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
2581 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
2582 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
2583 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral)\
2584 }
2585
2586 #define DEFINE_KSPROPERTY_PINSETCONSTRAINED(PinSet,\
2587 PropGeneral, PropInstances, PropIntersection)\
2588 DEFINE_KSPROPERTY_TABLE(PinSet) {\
2589 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
2590 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
2591 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
2592 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
2593 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
2594 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
2595 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
2596 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
2597 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
2598 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
2599 DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral)\
2600 }
2601
2602
2603
2604 typedef
2605 void
2606 (NTAPI *PFNKSFREE)(
2607 IN PVOID Data
2608 );
2609
2610
2611
2612 #define DEFINE_KSPROPERTY_TABLE(tablename)\
2613 const KSPROPERTY_ITEM tablename[] =
2614
2615 #endif
2616
2617 typedef struct
2618 {
2619 KSPIN_INTERFACE Interface;
2620 KSPIN_MEDIUM Medium;
2621 ULONG PinId;
2622 HANDLE PinToHandle;
2623 KSPRIORITY Priority;
2624 } KSPIN_CONNECT, *PKSPIN_CONNECT;
2625
2626 /* ===============================================================
2627 Topology
2628 */
2629
2630 typedef struct
2631 {
2632 ULONG FromNode;
2633 ULONG FromNodePin;
2634 ULONG ToNode;
2635 ULONG ToNodePin;
2636 } KSTOPOLOGY_CONNECTION, *PKSTOPOLOGY_CONNECTION;
2637
2638 typedef struct
2639 {
2640 ULONG CategoriesCount;
2641 const GUID* Categories;
2642 ULONG TopologyNodesCount;
2643 const GUID* TopologyNodes;
2644 ULONG TopologyConnectionsCount;
2645 const KSTOPOLOGY_CONNECTION* TopologyConnections;
2646 const GUID* TopologyNodesNames;
2647 ULONG Reserved;
2648 } KSTOPOLOGY, *PKSTOPOLOGY;
2649
2650
2651 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler)\
2652 DEFINE_KSPROPERTY_ITEM(\
2653 KSPROPERTY_TOPOLOGY_CATEGORIES,\
2654 (Handler),\
2655 sizeof(KSPROPERTY),\
2656 0,\
2657 NULL, NULL, 0, NULL, NULL, 0)
2658
2659 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler)\
2660 DEFINE_KSPROPERTY_ITEM(\
2661 KSPROPERTY_TOPOLOGY_NODES,\
2662 (Handler),\
2663 sizeof(KSPROPERTY),\
2664 0,\
2665 NULL, NULL, 0, NULL, NULL, 0)
2666
2667 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler)\
2668 DEFINE_KSPROPERTY_ITEM(\
2669 KSPROPERTY_TOPOLOGY_CONNECTIONS,\
2670 (Handler),\
2671 sizeof(KSPROPERTY),\
2672 0,\
2673 NULL, NULL, 0, NULL, NULL, 0)
2674
2675 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
2676 DEFINE_KSPROPERTY_ITEM(\
2677 KSPROPERTY_TOPOLOGY_NAME,\
2678 (Handler),\
2679 sizeof(KSP_NODE),\
2680 0,\
2681 NULL, NULL, 0, NULL, NULL, 0)
2682
2683 #define DEFINE_KSPROPERTY_TOPOLOGYSET(TopologySet, Handler)\
2684 DEFINE_KSPROPERTY_TABLE(TopologySet) {\
2685 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler),\
2686 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler),\
2687 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler),\
2688 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
2689 }
2690
2691 /* ===============================================================
2692 ??? SORT ME
2693 */
2694
2695 /* TODO */
2696 typedef void* UNKNOWN;
2697
2698 typedef PVOID (NTAPI *PFNKSINITIALIZEALLOCATOR)(
2699 IN PVOID InitialContext,
2700 IN PKSALLOCATOR_FRAMING AllocatorFraming,
2701 OUT PVOID* Context);
2702
2703 #if defined(_NTDDK_)
2704 typedef NTSTATUS (NTAPI *PFNKSALLOCATOR)(
2705 IN PIRP Irp,
2706 IN ULONG BufferSize,
2707 IN BOOLEAN InputOperation);
2708
2709 typedef NTSTATUS (NTAPI *PFNKINTERSECTHANDLEREX)(
2710 IN PVOID Context,
2711 IN PIRP Irp,
2712 IN PKSP_PIN Pin,
2713 IN PKSDATARANGE DataRange,
2714 IN PKSDATARANGE MatchingDataRange,
2715 IN ULONG DataBufferSize,
2716 OUT PVOID Data OPTIONAL,
2717 OUT PULONG DataSize);
2718
2719
2720 typedef
2721 NTSTATUS
2722 (NTAPI *PFNALLOCATOR_ALLOCATEFRAME)(
2723 IN PFILE_OBJECT FileObject,
2724 PVOID *Frame
2725 );
2726
2727 typedef
2728 VOID
2729 (NTAPI *PFNALLOCATOR_FREEFRAME)(
2730 IN PFILE_OBJECT FileObject,
2731 IN PVOID Frame
2732 );
2733
2734 typedef struct {
2735 PFNALLOCATOR_ALLOCATEFRAME AllocateFrame;
2736 PFNALLOCATOR_FREEFRAME FreeFrame;
2737 } KSSTREAMALLOCATOR_FUNCTIONTABLE, *PKSSTREAMALLOCATOR_FUNCTIONTABLE;
2738
2739 #endif
2740
2741 typedef struct
2742 {
2743 KSALLOCATOR_FRAMING Framing;
2744 ULONG AllocatedFrames;
2745 ULONG Reserved;
2746 } KSSTREAMALLOCATOR_STATUS, *PKSSTREAMALLOCATOR_STATUS;
2747
2748 typedef struct
2749 {
2750 KSALLOCATOR_FRAMING_EX Framing;
2751 ULONG AllocatedFrames;
2752 ULONG Reserved;
2753 } KSSTREAMALLOCATOR_STATUS_EX, *PKSSTREAMALLOCATOR_STATUS_EX;
2754
2755 typedef struct
2756 {
2757 ULONG Size;
2758 ULONG TypeSpecificFlags;
2759 KSTIME PresentationTime;
2760 LONGLONG Duration;
2761 ULONG FrameExtent;
2762 ULONG DataUsed;
2763 PVOID Data;
2764 ULONG OptionsFlags;
2765 #ifdef _WIN64
2766 ULONG Reserved;
2767 #endif
2768 } KSSTREAM_HEADER, *PKSSTREAM_HEADER;
2769
2770 #define KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT 0x00000001
2771 #define KSSTREAM_HEADER_OPTIONSF_PREROLL 0x00000002
2772 #define KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY 0x00000004
2773 #define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED 0x00000008
2774 #define KSSTREAM_HEADER_OPTIONSF_TIMEVALID 0x00000010
2775 #define KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY 0x00000040
2776 #define KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE 0x00000080
2777 #define KSSTREAM_HEADER_OPTIONSF_DURATIONVALID 0x00000100
2778 #define KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM 0x00000200
2779 #define KSSTREAM_HEADER_OPTIONSF_BUFFEREDTRANSFER 0x00000400
2780 #define KSSTREAM_HEADER_OPTIONSF_VRAM_DATA_TRANSFER 0x00000800
2781 #define KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA 0x80000000
2782
2783 /* ===============================================================
2784 XP / DX8
2785 */
2786 #if defined(_NTDDK_)
2787 struct _KSMAPPING {
2788 PHYSICAL_ADDRESS PhysicalAddress;
2789 ULONG ByteCount;
2790 ULONG Alignment;
2791 };
2792 #endif
2793
2794 typedef enum {
2795 KSSTREAM_POINTER_STATE_UNLOCKED = 0,
2796 KSSTREAM_POINTER_STATE_LOCKED
2797 } KSSTREAM_POINTER_STATE;
2798
2799 typedef struct _KSGATE KSGATE, *PKSGATE;
2800 typedef struct _KSPROCESSPIN_INDEXENTRY KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY;
2801
2802 struct _KSGATE {
2803 LONG Count;
2804 PKSGATE NextGate;
2805 };
2806
2807 struct _KSSTREAM_POINTER_OFFSET
2808 {
2809 #if defined(_NTDDK_)
2810 union {
2811 PUCHAR Data;
2812 PKSMAPPING Mappings;
2813 };
2814 #else
2815 PUCHAR Data;
2816 #endif
2817 #if !defined(_WIN64)
2818 PVOID Alignment;
2819 #endif
2820 ULONG Count;
2821 ULONG Remaining;
2822 };
2823 #if defined(_NTDDK_)
2824 struct _KSSTREAM_POINTER
2825 {
2826 PVOID Context;
2827 PKSPIN Pin;
2828 PKSSTREAM_HEADER StreamHeader;
2829 PKSSTREAM_POINTER_OFFSET Offset;
2830 KSSTREAM_POINTER_OFFSET OffsetIn;
2831 KSSTREAM_POINTER_OFFSET OffsetOut;
2832 };
2833
2834 struct _KSPROCESSPIN
2835 {
2836 PKSPIN Pin;
2837 PKSSTREAM_POINTER StreamPointer;
2838 PKSPROCESSPIN InPlaceCounterpart;
2839 PKSPROCESSPIN DelegateBranch;
2840 PKSPROCESSPIN CopySource;
2841 PVOID Data;
2842 ULONG BytesAvailable;
2843 ULONG BytesUsed;
2844 ULONG Flags;
2845 BOOLEAN Terminate;
2846 };
2847
2848 struct _KSPROCESSPIN_INDEXENTRY
2849 {
2850 PKSPROCESSPIN* Pins;
2851 ULONG Count;
2852 };
2853 #endif
2854
2855 /* ===============================================================
2856 Device Dispatch
2857 */
2858
2859
2860
2861 #if defined(_NTDDK_)
2862
2863 typedef struct _KSFILTER_DISPATCH KSFILTER_DISPATCH, *PKSFILTER_DISPATCH;
2864 typedef struct _KSDEVICE KSDEVICE, *PKSDEVICE;
2865 typedef struct _KSFILTER KSFILTER, *PKSFILTER;
2866 typedef struct _KSNODE_DESCRIPTOR KSNODE_DESCRIPTOR, *PKSNODE_DESCRIPTOR;
2867 typedef struct _KSFILTER_DESCRIPTOR KSFILTER_DESCRIPTOR, *PKSFILTER_DESCRIPTOR;
2868 typedef struct _KSDEVICE_DESCRIPTOR KSDEVICE_DESCRIPTOR, *PKSDEVICE_DESCRIPTOR;
2869
2870 typedef NTSTATUS (NTAPI *PFNKSDEVICECREATE)(
2871 IN PKSDEVICE Device);
2872
2873 typedef NTSTATUS (NTAPI *PFNKSDEVICEPNPSTART)(
2874 IN PKSDEVICE Device,
2875 IN PIRP Irp,
2876 IN PCM_RESOURCE_LIST TranslatedResourceList OPTIONAL,
2877 IN PCM_RESOURCE_LIST UntranslatedResourceList OPTIONAL);
2878
2879 typedef NTSTATUS (NTAPI *PFNKSDEVICE)(
2880 IN PKSDEVICE Device);
2881
2882 typedef NTSTATUS (NTAPI *PFNKSDEVICEIRP)(
2883 IN PKSDEVICE Device,
2884 IN PIRP Irp);
2885
2886 typedef VOID (NTAPI *PFNKSDEVICEIRPVOID)(
2887 IN PKSDEVICE Device,
2888 IN PIRP Irp);
2889
2890 typedef NTSTATUS (NTAPI *PFNKSDEVICEQUERYCAPABILITIES)(
2891 IN PKSDEVICE Device,
2892 IN PIRP Irp,
2893 IN OUT PDEVICE_CAPABILITIES Capabilities);
2894
2895 typedef NTSTATUS (NTAPI *PFNKSDEVICEQUERYPOWER)(
2896 IN PKSDEVICE Device,
2897 IN PIRP Irp,
2898 IN DEVICE_POWER_STATE DeviceTo,
2899 IN DEVICE_POWER_STATE DeviceFrom,
2900 IN SYSTEM_POWER_STATE SystemTo,
2901 IN SYSTEM_POWER_STATE SystemFrom,
2902 IN POWER_ACTION Action);
2903
2904 typedef VOID (NTAPI *PFNKSDEVICESETPOWER)(
2905 IN PKSDEVICE Device,
2906 IN PIRP Irp,
2907 IN DEVICE_POWER_STATE To,
2908 IN DEVICE_POWER_STATE From);
2909
2910 typedef struct _KSDEVICE_DISPATCH {
2911 PFNKSDEVICECREATE Add;
2912 PFNKSDEVICEPNPSTART Start;
2913 PFNKSDEVICE PostStart;
2914 PFNKSDEVICEIRP QueryStop;
2915 PFNKSDEVICEIRPVOID CancelStop;
2916 PFNKSDEVICEIRPVOID Stop;
2917 PFNKSDEVICEIRP QueryRemove;
2918 PFNKSDEVICEIRPVOID CancelRemove;
2919 PFNKSDEVICEIRPVOID Remove;
2920 PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities;
2921 PFNKSDEVICEIRPVOID SurpriseRemoval;
2922 PFNKSDEVICEQUERYPOWER QueryPower;
2923 PFNKSDEVICESETPOWER SetPower;
2924 PFNKSDEVICEIRP QueryInterface;
2925 }KSDEVICE_DISPATCH, *PKSDEVICE_DISPATCH;
2926
2927 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
2928 #define KSDEVICE_DESCRIPTOR_VERSION_2 (0x110)
2929 #define MIN_DEV_VER_FOR_FLAGS (0x110)
2930 #endif
2931
2932 struct _KSDEVICE
2933 {
2934 const KSDEVICE_DESCRIPTOR* Descriptor;
2935 KSOBJECT_BAG Bag;
2936 PVOID Context;
2937 PDEVICE_OBJECT FunctionalDeviceObject;
2938 PDEVICE_OBJECT PhysicalDeviceObject;
2939 PDEVICE_OBJECT NextDeviceObject;
2940 BOOLEAN Started;
2941 SYSTEM_POWER_STATE SystemPowerState;
2942 DEVICE_POWER_STATE DevicePowerState;
2943 };
2944 #endif
2945
2946 /* ===============================================================
2947 Filter Dispatch
2948 */
2949 #if defined(_NTDDK_)
2950 struct _KSFILTER
2951 {
2952 const KSFILTER_DESCRIPTOR* Descriptor;
2953 KSOBJECT_BAG Bag;
2954 PVOID Context;
2955 };
2956
2957 typedef
2958 void
2959 (NTAPI *PFNKSFILTERPOWER)(
2960 IN PKSFILTER Filter,
2961 IN DEVICE_POWER_STATE State
2962 );
2963
2964 typedef NTSTATUS (NTAPI *PFNKSFILTERIRP)(
2965 IN PKSFILTER Filter,
2966 IN PIRP Irp);
2967
2968 typedef NTSTATUS (NTAPI *PFNKSFILTERPROCESS)(
2969 IN PKSFILTER Filter,
2970 IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex);
2971
2972 typedef NTSTATUS (NTAPI *PFNKSFILTERVOID)(
2973 IN PKSFILTER Filter);
2974
2975 struct _KSFILTER_DISPATCH
2976 {
2977 PFNKSFILTERIRP Create;
2978 PFNKSFILTERIRP Close;
2979 PFNKSFILTERPROCESS Process;
2980 PFNKSFILTERVOID Reset;
2981 };
2982
2983 struct _KSNODE_DESCRIPTOR
2984 {
2985 const KSAUTOMATION_TABLE* AutomationTable;
2986 const GUID* Type;
2987 const GUID* Name;
2988 };
2989
2990 struct _KSFILTER_DESCRIPTOR
2991 {
2992 const KSFILTER_DISPATCH* Dispatch;
2993 const KSAUTOMATION_TABLE* AutomationTable;
2994 ULONG Version;
2995 ULONG Flags;
2996 const GUID* ReferenceGuid;
2997 ULONG PinDescriptorsCount;
2998 ULONG PinDescriptorSize;
2999 const KSPIN_DESCRIPTOR_EX* PinDescriptors;
3000 ULONG CategoriesCount;
3001 const GUID* Categories;
3002 ULONG NodeDescriptorsCount;
3003 ULONG NodeDescriptorSize;
3004 const KSNODE_DESCRIPTOR* NodeDescriptors;
3005 ULONG ConnectionsCount;
3006 const KSTOPOLOGY_CONNECTION* Connections;
3007 const KSCOMPONENTID* ComponentId;
3008 };
3009
3010 #define KSFILTER_DESCRIPTOR_VERSION ((ULONG)-1)
3011
3012 struct _KSDEVICE_DESCRIPTOR
3013 {
3014 const KSDEVICE_DISPATCH* Dispatch;
3015 ULONG FilterDescriptorsCount;
3016 const KSFILTER_DESCRIPTOR*const* FilterDescriptors;
3017 ULONG Version;
3018 ULONG Flags;
3019 };
3020
3021 struct _KSFILTERFACTORY {
3022 const KSFILTER_DESCRIPTOR* FilterDescriptor;
3023 KSOBJECT_BAG Bag;
3024 PVOID Context;
3025 };
3026
3027 #define DEFINE_KSFILTER_DESCRIPTOR(descriptor)\
3028 const KSFILTER_DESCRIPTOR descriptor =
3029
3030 #define DEFINE_KSFILTER_PIN_DESCRIPTORS(table)\
3031 SIZEOF_ARRAY(table),\
3032 sizeof(table[0]),\
3033 table
3034
3035 #define DEFINE_KSFILTER_CATEGORIES(table)\
3036 SIZEOF_ARRAY(table),\
3037 table
3038
3039 #define DEFINE_KSFILTER_CATEGORY(category)\
3040 1,\
3041 &(category)
3042
3043 #define DEFINE_KSFILTER_CATEGORIES_NULL\
3044 0,\
3045 NULL
3046
3047 #define DEFINE_KSFILTER_NODE_DESCRIPTORS(table)\
3048 SIZEOF_ARRAY(table),\
3049 sizeof(table[0]),\
3050 table
3051
3052 #define DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL\
3053 0,\
3054 sizeof(KSNODE_DESCRIPTOR),\
3055 NULL
3056
3057 #define DEFINE_KSFILTER_CONNECTIONS(table)\
3058 SIZEOF_ARRAY(table),\
3059 table
3060
3061 #define DEFINE_KSFILTER_DEFAULT_CONNECTIONS\
3062 0,\
3063 NULL
3064
3065 #endif
3066 /* ===============================================================
3067 Minidriver Callbacks
3068 */
3069 #if defined(_NTDDK_)
3070 typedef NTSTATUS (NTAPI *KStrMethodHandler)(
3071 IN PIRP Irp,
3072 IN PKSIDENTIFIER Request,
3073 IN OUT PVOID Data);
3074
3075 typedef NTSTATUS (NTAPI *KStrSupportHandler)(
3076 IN PIRP Irp,
3077 IN PKSIDENTIFIER Request,
3078 IN OUT PVOID Data);
3079 #endif
3080
3081 /* ===============================================================
3082 Allocator Functions
3083 */
3084 #if defined(_NTDDK_)
3085 KSDDKAPI NTSTATUS NTAPI
3086 KsCreateAllocator(
3087 IN HANDLE ConnectionHandle,
3088 IN PKSALLOCATOR_FRAMING AllocatorFraming,
3089 OUT PHANDLE AllocatorHandle);
3090
3091 KSDDKAPI NTSTATUS NTAPI
3092 KsCreateDefaultAllocator(
3093 IN PIRP Irp);
3094
3095 KSDDKAPI NTSTATUS NTAPI
3096 KsValidateAllocatorCreateRequest(
3097 IN PIRP Irp,
3098 OUT PKSALLOCATOR_FRAMING* AllocatorFraming);
3099
3100 KSDDKAPI NTSTATUS NTAPI
3101 KsCreateDefaultAllocatorEx(
3102 IN PIRP Irp,
3103 IN PVOID InitializeContext OPTIONAL,
3104 IN PFNKSDEFAULTALLOCATE DefaultAllocate OPTIONAL,
3105 IN PFNKSDEFAULTFREE DefaultFree OPTIONAL,
3106 IN PFNKSINITIALIZEALLOCATOR InitializeAllocator OPTIONAL,
3107 IN PFNKSDELETEALLOCATOR DeleteAllocator OPTIONAL);
3108
3109 KSDDKAPI NTSTATUS NTAPI
3110 KsValidateAllocatorFramingEx(
3111 IN PKSALLOCATOR_FRAMING_EX Framing,
3112 IN ULONG BufferSize,
3113 IN const KSALLOCATOR_FRAMING_EX* PinFraming);
3114 #endif
3115
3116 /* ===============================================================
3117 Clock Functions
3118 */
3119 #if defined(_NTDDK_)
3120 typedef BOOLEAN (NTAPI *PFNKSSETTIMER)(
3121 IN PVOID Context,
3122 IN PKTIMER Timer,
3123 IN LARGE_INTEGER DueTime,
3124 IN PKDPC Dpc);
3125
3126 typedef BOOLEAN (NTAPI *PFNKSCANCELTIMER)(
3127 IN PVOID Context,
3128 IN PKTIMER Timer);
3129
3130 typedef LONGLONG (FASTCALL *PFNKSCORRELATEDTIME)(
3131 IN PVOID Context,
3132 OUT PLONGLONG SystemTime);
3133
3134 KSDDKAPI NTSTATUS NTAPI
3135 KsCreateClock(
3136 IN HANDLE ConnectionHandle,
3137 IN PKSCLOCK_CREATE ClockCreate,
3138 OUT PHANDLE ClockHandle);
3139
3140 KSDDKAPI NTSTATUS NTAPI
3141 KsCreateDefaultClock(
3142 IN PIRP Irp,
3143 IN PKSDEFAULTCLOCK DefaultClock);
3144
3145 KSDDKAPI NTSTATUS NTAPI
3146 KsAllocateDefaultClock(
3147 OUT PKSDEFAULTCLOCK* DefaultClock);
3148
3149 KSDDKAPI NTSTATUS NTAPI
3150 KsAllocateDefaultClockEx(
3151 OUT PKSDEFAULTCLOCK* DefaultClock,
3152 IN PVOID Context OPTIONAL,
3153 IN PFNKSSETTIMER SetTimer OPTIONAL,
3154 IN PFNKSCANCELTIMER CancelTimer OPTIONAL,
3155 IN PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL,
3156 IN const KSRESOLUTION* Resolution OPTIONAL,
3157 IN ULONG Flags);
3158
3159 KSDDKAPI VOID NTAPI
3160 KsFreeDefaultClock(
3161 IN PKSDEFAULTCLOCK DefaultClock);
3162
3163 KSDDKAPI NTSTATUS NTAPI
3164 KsValidateClockCreateRequest(
3165 IN PIRP Irp,
3166 OUT PKSCLOCK_CREATE* ClockCreate);
3167
3168 KSDDKAPI KSSTATE NTAPI
3169 KsGetDefaultClockState(
3170 IN PKSDEFAULTCLOCK DefaultClock);
3171
3172 KSDDKAPI VOID NTAPI
3173 KsSetDefaultClockState(
3174 IN PKSDEFAULTCLOCK DefaultClock,
3175 IN KSSTATE State);
3176
3177 KSDDKAPI LONGLONG NTAPI
3178 KsGetDefaultClockTime(
3179 IN PKSDEFAULTCLOCK DefaultClock);
3180
3181 KSDDKAPI VOID NTAPI
3182 KsSetDefaultClockTime(
3183 IN PKSDEFAULTCLOCK DefaultClock,
3184 IN LONGLONG Time);
3185 #endif
3186
3187 /* ===============================================================
3188 Method Functions
3189 */
3190
3191 /* Method sets - TODO: Make into macros! */
3192 #if defined(_NTDDK_)
3193 #if 0
3194 VOID
3195 KSMETHOD_SET_IRP_STORAGE(
3196 IN IRP Irp);
3197
3198 VOID
3199 KSMETHOD_ITEM_IRP_STORAGE(
3200 IN IRP Irp);
3201
3202 VOID
3203 KSMETHOD_TYPE_IRP_STORAGE(
3204 IN IRP Irp);
3205 #endif
3206
3207 KSDDKAPI NTSTATUS NTAPI
3208 KsMethodHandler(
3209 IN PIRP Irp,
3210 IN ULONG MethodSetsCount,
3211 IN PKSMETHOD_SET MethodSet);
3212
3213 KSDDKAPI NTSTATUS NTAPI
3214 KsMethodHandlerWithAllocator(
3215 IN PIRP Irp,
3216 IN ULONG MethodSetsCount,
3217 IN PKSMETHOD_SET MethodSet,
3218 IN PFNKSALLOCATOR Allocator OPTIONAL,
3219 IN ULONG MethodItemSize OPTIONAL);
3220
3221 KSDDKAPI BOOLEAN NTAPI
3222 KsFastMethodHandler(
3223 IN PFILE_OBJECT FileObject,
3224 IN PKSMETHOD UNALIGNED Method,
3225 IN ULONG MethodLength,
3226 IN OUT PVOID UNALIGNED Data,
3227 IN ULONG DataLength,
3228 OUT PIO_STATUS_BLOCK IoStatus,
3229 IN ULONG MethodSetsCount,
3230 IN const KSMETHOD_SET* MethodSet);
3231 #endif
3232
3233 /* ===============================================================
3234 Property Functions
3235 */
3236 #if defined(_NTDDK_)
3237 KSDDKAPI NTSTATUS NTAPI
3238 KsPropertyHandler(
3239 IN PIRP Irp,
3240 IN ULONG PropertySetsCount,
3241 IN const KSPROPERTY_SET* PropertySet);
3242
3243 KSDDKAPI NTSTATUS NTAPI
3244 KsPropertyHandlerWithAllocator(
3245 IN PIRP Irp,
3246 IN ULONG PropertySetsCount,
3247 IN PKSPROPERTY_SET PropertySet,
3248 IN PFNKSALLOCATOR Allocator OPTIONAL,
3249 IN ULONG PropertyItemSize OPTIONAL);
3250
3251 KSDDKAPI NTSTATUS NTAPI
3252 KsUnserializeObjectPropertiesFromRegistry(
3253 IN PFILE_OBJECT FileObject,
3254 IN HANDLE ParentKey OPTIONAL,
3255 IN PUNICODE_STRING RegistryPath OPTIONAL);
3256
3257 KSDDKAPI BOOLEAN NTAPI
3258 KsFastPropertyHandler(
3259 IN PFILE_OBJECT FileObject,
3260 IN PKSPROPERTY UNALIGNED Property,
3261 IN ULONG PropertyLength,
3262 IN OUT PVOID UNALIGNED Data,
3263 IN ULONG DataLength,
3264 OUT PIO_STATUS_BLOCK IoStatus,
3265 IN ULONG PropertySetsCount,
3266 IN const KSPROPERTY_SET* PropertySet);
3267 #endif
3268
3269 /* ===============================================================
3270 Event Functions
3271 */
3272
3273 #if defined(_NTDDK_)
3274
3275 #define KSPROBE_STREAMREAD 0x00000000
3276 #define KSPROBE_STREAMWRITE 0x00000001
3277 #define KSPROBE_ALLOCATEMDL 0x00000010
3278 #define KSPROBE_PROBEANDLOCK 0x00000020
3279 #define KSPROBE_SYSTEMADDRESS 0x00000040
3280 #define KSPROBE_MODIFY 0x00000200
3281 #define KSPROBE_STREAMWRITEMODIFY (KSPROBE_MODIFY | KSPROBE_STREAMWRITE)
3282 #define KSPROBE_ALLOWFORMATCHANGE 0x00000080
3283
3284 #define KSSTREAM_READ KSPROBE_STREAMREAD
3285 #define KSSTREAM_WRITE KSPROBE_STREAMWRITE
3286 #define KSSTREAM_PAGED_DATA 0x00000000
3287 #define KSSTREAM_NONPAGED_DATA 0x00000100
3288 #define KSSTREAM_SYNCHRONOUS 0x00001000
3289 #define KSSTREAM_FAILUREEXCEPTION 0x00002000
3290
3291 typedef
3292 BOOLEAN
3293 (NTAPI *PFNKSGENERATEEVENTCALLBACK)(
3294 IN PVOID Context,
3295 IN PKSEVENT_ENTRY EventEntry
3296 );
3297
3298 KSDDKAPI NTSTATUS NTAPI
3299 KsGenerateEvent(
3300 IN PKSEVENT_ENTRY EntryEvent);
3301
3302 KSDDKAPI void NTAPI
3303 KsGenerateEvents(
3304 IN PVOID Object,
3305 IN const GUID* EventSet OPTIONAL,
3306 IN ULONG EventId,
3307 IN ULONG DataSize,
3308 IN PVOID Data OPTIONAL,
3309 IN PFNKSGENERATEEVENTCALLBACK CallBack OPTIONAL,
3310 IN PVOID CallBackContext OPTIONAL
3311 );
3312
3313
3314 KSDDKAPI NTSTATUS NTAPI
3315 KsEnableEventWithAllocator(
3316 IN PIRP Irp,
3317 IN ULONG EventSetsCount,
3318 IN PKSEVENT_SET EventSet,
3319 IN OUT PLIST_ENTRY EventsList OPTIONAL,
3320 IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL,
3321 IN PVOID EventsLock OPTIONAL,
3322 IN PFNKSALLOCATOR Allocator OPTIONAL,
3323 IN ULONG EventItemSize OPTIONAL);
3324
3325 KSDDKAPI NTSTATUS NTAPI
3326 KsGenerateDataEvent(
3327 IN PKSEVENT_ENTRY EventEntry,
3328 IN ULONG DataSize,
3329 IN PVOID Data);
3330
3331 KSDDKAPI NTSTATUS NTAPI
3332 KsEnableEvent(
3333 IN PIRP Irp,
3334 IN ULONG EventSetsCount,
3335 IN KSEVENT_SET* EventSet,
3336 IN OUT PLIST_ENTRY EventsList OPTIONAL,
3337 IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL,
3338 IN PVOID EventsLock OPTIONAL);
3339
3340 KSDDKAPI VOID NTAPI
3341 KsDiscardEvent(
3342 IN PKSEVENT_ENTRY EventEntry);
3343
3344 KSDDKAPI NTSTATUS NTAPI
3345 KsDisableEvent(
3346 IN PIRP Irp,
3347 IN OUT PLIST_ENTRY EventsList,
3348 IN KSEVENTS_LOCKTYPE EventsFlags,
3349 IN PVOID EventsLock);
3350
3351 KSDDKAPI VOID NTAPI
3352 KsFreeEventList(
3353 IN PFILE_OBJECT FileObject,
3354 IN OUT PLIST_ENTRY EventsList,
3355 IN KSEVENTS_LOCKTYPE EVentsFlags,
3356 IN PVOID EventsLock);
3357
3358 /* ===============================================================
3359 Topology Functions
3360 */
3361
3362 KSDDKAPI NTSTATUS NTAPI
3363 KsValidateTopologyNodeCreateRequest(
3364 IN PIRP Irp,
3365 IN PKSTOPOLOGY Topology,
3366 OUT PKSNODE_CREATE* NodeCreate);
3367
3368 KSDDKAPI NTSTATUS NTAPI
3369 KsCreateTopologyNode(
3370 IN HANDLE ParentHandle,
3371 IN PKSNODE_CREATE NodeCreate,
3372 IN ACCESS_MASK DesiredAccess,
3373 OUT PHANDLE NodeHandle);
3374
3375 KSDDKAPI NTSTATUS NTAPI
3376 KsTopologyPropertyHandler(
3377 IN PIRP Irp,
3378 IN PKSPROPERTY Property,
3379 IN OUT PVOID Data,
3380 IN const KSTOPOLOGY* Topology);
3381
3382
3383
3384 /* ===============================================================
3385 Connectivity Functions
3386 */
3387
3388 KSDDKAPI NTSTATUS NTAPI
3389 KsCreatePin(
3390 IN HANDLE FilterHandle,
3391 IN PKSPIN_CONNECT Connect,
3392 IN ACCESS_MASK DesiredAccess,
3393 OUT PHANDLE ConnectionHandle);
3394
3395 KSDDKAPI NTSTATUS NTAPI
3396 KsValidateConnectRequest(
3397 IN PIRP Irp,
3398 IN ULONG DescriptorsCount,
3399 IN KSPIN_DESCRIPTOR* Descriptor,
3400 OUT PKSPIN_CONNECT* Connect);
3401
3402 KSDDKAPI NTSTATUS NTAPI
3403 KsPinPropertyHandler(
3404 IN PIRP Irp,
3405 IN PKSPROPERTY Property,
3406 IN OUT PVOID Data,
3407 IN ULONG DescriptorsCount,
3408 IN const KSPIN_DESCRIPTOR* Descriptor);
3409
3410 KSDDKAPI NTSTATUS NTAPI
3411 KsPinDataIntersection(
3412 IN PIRP Irp,
3413 IN PKSP_PIN Pin,
3414 OUT PVOID Data,
3415 IN ULONG DescriptorsCount,
3416 IN const KSPIN_DESCRIPTOR* Descriptor,
3417 IN PFNKSINTERSECTHANDLER IntersectHandler);
3418
3419 KSDDKAPI NTSTATUS NTAPI
3420 KsPinDataIntersectionEx(
3421 IN PIRP Irp,
3422 IN PKSP_PIN Pin,
3423 OUT PVOID Data,
3424 IN ULONG DescriptorsCount,
3425 IN const KSPIN_DESCRIPTOR* Descriptor,
3426 IN ULONG DescriptorSize,
3427 IN PFNKSINTERSECTHANDLEREX IntersectHandler OPTIONAL,
3428 IN PVOID HandlerContext OPTIONAL);
3429
3430 KSDDKAPI PKSFILTER NTAPI
3431 KsPinGetParentFilter(
3432 IN PKSPIN Pin
3433 );
3434
3435 KSDDKAPI PKSPIN NTAPI
3436 KsPinGetNextSiblingPin(
3437 IN PKSPIN Pin
3438 );
3439
3440
3441 /* Does this belong here? */
3442
3443 KSDDKAPI NTSTATUS NTAPI
3444 KsHandleSizedListQuery(
3445 IN PIRP Irp,
3446 IN ULONG DataItemsCount,
3447 IN ULONG DataItemSize,
3448 IN const VOID* DataItems);
3449
3450
3451 /* ===============================================================
3452 IRP Helper Functions
3453 */
3454
3455 typedef NTSTATUS (NTAPI *PFNKSIRPLISTCALLBACK)(
3456 IN PIRP Irp,
3457 IN PVOID Context);
3458
3459 KSDDKAPI NTSTATUS NTAPI
3460 KsAcquireResetValue(
3461 IN PIRP Irp,
3462 OUT KSRESET* ResetValue);
3463
3464 KSDDKAPI VOID NTAPI
3465 KsAddIrpToCancelableQueue(
3466 IN OUT PLIST_ENTRY QueueHead,
3467 IN PKSPIN_LOCK SpinLock,
3468 IN PIRP Irp,
3469 IN KSLIST_ENTRY_LOCATION ListLocation,
3470 IN PDRIVER_CANCEL DriverCancel OPTIONAL);
3471
3472 KSDDKAPI NTSTATUS NTAPI
3473 KsAddObjectCreateItemToDeviceHeader(
3474 IN KSDEVICE_HEADER Header,
3475 IN PDRIVER_DISPATCH Create,
3476 IN PVOID Context,
3477 IN PWCHAR ObjectClass,
3478 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
3479
3480 KSDDKAPI NTSTATUS NTAPI
3481 KsAddObjectCreateItemToObjectHeader(
3482 IN KSOBJECT_HEADER Header,
3483 IN PDRIVER_DISPATCH Create,
3484 IN PVOID Context,
3485 IN PWCHAR ObjectClass,
3486 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
3487
3488 KSDDKAPI NTSTATUS NTAPI
3489 KsAllocateDeviceHeader(
3490 OUT KSDEVICE_HEADER* Header,
3491 IN ULONG ItemsCount,
3492 IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL);
3493
3494 KSDDKAPI NTSTATUS NTAPI
3495 KsAllocateExtraData(
3496 IN PIRP Irp,
3497 IN ULONG ExtraSize,
3498 OUT PVOID* ExtraBuffer);
3499
3500 KSDDKAPI NTSTATUS NTAPI
3501 KsAllocateObjectCreateItem(
3502 IN KSDEVICE_HEADER Header,
3503 IN PKSOBJECT_CREATE_ITEM CreateItem,
3504 IN BOOLEAN AllocateEntry,
3505 IN PFNKSITEMFREECALLBACK ItemFreeCallback OPTIONAL);
3506
3507 KSDDKAPI NTSTATUS NTAPI
3508 KsAllocateObjectHeader(
3509 OUT KSOBJECT_HEADER *Header,
3510 IN ULONG ItemsCount,
3511 IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL,
3512 IN PIRP Irp,
3513 IN KSDISPATCH_TABLE* Table);
3514
3515 KSDDKAPI VOID NTAPI
3516 KsCancelIo(
3517 IN OUT PLIST_ENTRY QueueHead,
3518 IN PKSPIN_LOCK SpinLock);
3519
3520 KSDDKAPI VOID NTAPI
3521 KsCancelRoutine(
3522 IN PDEVICE_OBJECT DeviceObject,
3523 IN PIRP Irp);
3524
3525 KSDDKAPI NTSTATUS NTAPI
3526 KsDefaultDeviceIoCompletion(
3527 IN PDEVICE_OBJECT DeviceObject,
3528 IN PIRP Irp);
3529
3530 /* ELSEWHERE
3531 KSDDKAPI ULONG NTAPI
3532 KsDecrementCountedWorker(
3533 IN PKSWORKER Worker);
3534 */
3535
3536 KSDDKAPI BOOLEAN NTAPI
3537 KsDispatchFastIoDeviceControlFailure(
3538 IN PFILE_OBJECT FileObject,
3539 IN BOOLEAN Wait,
3540 IN PVOID InputBuffer OPTIONAL,
3541 IN ULONG InputBufferLength,
3542 OUT PVOID OutputBuffer OPTIONAL,
3543 IN ULONG OutputBufferLength,
3544 IN ULONG IoControlCode,
3545 OUT PIO_STATUS_BLOCK IoStatus,
3546 IN PDEVICE_OBJECT DeviceObject); /* always return false */
3547
3548 KSDDKAPI BOOLEAN NTAPI
3549 KsDispatchFastReadFailure(
3550 IN PFILE_OBJECT FileObject,
3551 IN PLARGE_INTEGER FileOffset,
3552 IN ULONG Length,
3553 IN BOOLEAN Wait,
3554 IN ULONG LockKey,
3555 OUT PVOID Buffer,
3556 OUT PIO_STATUS_BLOCK IoStatus,
3557 IN PDEVICE_OBJECT DeviceObject); /* always return false */
3558
3559 /* This function does the same as the above */
3560 #define KsDispatchFastWriteFailure KsDispatchFastReadFailure
3561
3562 KSDDKAPI NTSTATUS NTAPI
3563 KsDispatchInvalidDeviceRequest(
3564 IN PDEVICE_OBJECT DeviceObject,
3565 IN PIRP Irp);
3566
3567 KSDDKAPI NTSTATUS NTAPI
3568 KsDispatchIrp(
3569 IN PDEVICE_OBJECT DeviceObject,
3570 IN PIRP Irp);
3571
3572 KSDDKAPI NTSTATUS NTAPI
3573 KsDispatchSpecificMethod(
3574 IN PIRP Irp,
3575 IN PFNKSHANDLER Handler);
3576
3577 KSDDKAPI NTSTATUS NTAPI
3578 KsDispatchSpecificProperty(
3579 IN PIRP Irp,
3580 IN PFNKSHANDLER Handler);
3581
3582 KSDDKAPI NTSTATUS NTAPI
3583 KsForwardAndCatchIrp(
3584 IN PDEVICE_OBJECT DeviceObject,
3585 IN PIRP Irp,
3586 IN PFILE_OBJECT FileObject,
3587 IN KSSTACK_USE StackUse);
3588
3589 KSDDKAPI NTSTATUS NTAPI
3590 KsForwardIrp(
3591 IN PIRP Irp,
3592 IN PFILE_OBJECT FileObject,
3593 IN BOOLEAN ReuseStackLocation);
3594
3595 KSDDKAPI VOID NTAPI
3596 KsFreeDeviceHeader(
3597 IN KSDEVICE_HEADER Header);
3598
3599 KSDDKAPI VOID NTAPI
3600 KsFreeObjectHeader(
3601 IN PVOID Header);
3602
3603 KSDDKAPI NTSTATUS NTAPI
3604 KsGetChildCreateParameter(
3605 IN PIRP Irp,
3606 OUT PVOID* CreateParameter);
3607
3608 KSDDKAPI NTSTATUS NTAPI
3609 KsMoveIrpsOnCancelableQueue(
3610 IN OUT PLIST_ENTRY SourceList,
3611 IN PKSPIN_LOCK SourceLock,
3612 IN OUT PLIST_ENTRY DestinationList,
3613 IN PKSPIN_LOCK DestinationLock OPTIONAL,
3614 IN KSLIST_ENTRY_LOCATION ListLocation,
3615 IN PFNKSIRPLISTCALLBACK ListCallback,
3616 IN PVOID Context);
3617
3618 KSDDKAPI NTSTATUS NTAPI
3619 KsProbeStreamIrp(
3620 IN PIRP Irp,
3621 IN ULONG ProbeFlags,
3622 IN ULONG HeaderSize);
3623
3624 KSDDKAPI NTSTATUS NTAPI
3625 KsQueryInformationFile(
3626 IN PFILE_OBJECT FileObject,
3627 OUT PVOID FileInformation,
3628 IN ULONG Length,
3629 IN FILE_INFORMATION_CLASS FileInformationClass);
3630
3631 KSDDKAPI ACCESS_MASK NTAPI
3632 KsQueryObjectAccessMask(
3633 IN KSOBJECT_HEADER Header);
3634
3635 KSDDKAPI PKSOBJECT_CREATE_ITEM NTAPI
3636 KsQueryObjectCreateItem(
3637 IN KSOBJECT_HEADER Header);
3638
3639 KSDDKAPI NTSTATUS NTAPI
3640 KsReadFile(
3641 IN PFILE_OBJECT FileObject,
3642 IN PKEVENT Event OPTIONAL,
3643 IN PVOID PortContext OPTIONAL,
3644 OUT PIO_STATUS_BLOCK IoStatusBlock,
3645 OUT PVOID Buffer,
3646 IN ULONG Length,
3647 IN ULONG Key OPTIONAL,
3648 IN KPROCESSOR_MODE RequestorMode);
3649
3650 KSDDKAPI VOID NTAPI
3651 KsReleaseIrpOnCancelableQueue(
3652 IN PIRP Irp,
3653 IN PDRIVER_CANCEL DriverCancel OPTIONAL);
3654
3655 KSDDKAPI PIRP NTAPI
3656 KsRemoveIrpFromCancelableQueue(
3657 IN OUT PLIST_ENTRY QueueHead,
3658 IN PKSPIN_LOCK SpinLock,
3659 IN KSLIST_ENTRY_LOCATION ListLocation,
3660 IN KSIRP_REMOVAL_OPERATION RemovalOperation);
3661
3662 KSDDKAPI VOID NTAPI
3663 KsRemoveSpecificIrpFromCancelableQueue(
3664 IN PIRP Irp);
3665
3666 KSDDKAPI NTSTATUS NTAPI
3667 KsSetInformationFile(
3668 IN PFILE_OBJECT FileObject,
3669 IN PVOID FileInformation,
3670 IN ULONG Length,
3671 IN FILE_INFORMATION_CLASS FileInformationClass);
3672
3673 KSDDKAPI NTSTATUS NTAPI
3674 KsSetMajorFunctionHandler(
3675 IN PDRIVER_OBJECT DriverObject,
3676 IN ULONG MajorFunction);
3677
3678 KSDDKAPI NTSTATUS NTAPI
3679 KsStreamIo(
3680 IN PFILE_OBJECT FileObject,
3681 IN PKEVENT Event OPTIONAL,
3682 IN PVOID PortContext OPTIONAL,
3683 IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
3684 IN PVOID CompletionContext OPTIONAL,
3685 IN KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL,
3686 OUT PIO_STATUS_BLOCK IoStatusBlock,
3687 IN OUT PVOID StreamHeaders,
3688 IN ULONG Length,
3689 IN ULONG Flags,
3690 IN KPROCESSOR_MODE RequestorMode);
3691
3692 KSDDKAPI NTSTATUS NTAPI
3693 KsWriteFile(
3694 IN PFILE_OBJECT FileObject,
3695 IN PKEVENT Event OPTIONAL,
3696 IN PVOID PortContext OPTIONAL,
3697 OUT PIO_STATUS_BLOCK IoStatusBlock,
3698 IN PVOID Buffer,
3699 IN ULONG Length,
3700 IN ULONG Key OPTIONAL,
3701 IN KPROCESSOR_MODE RequestorMode);
3702
3703
3704 KSDDKAPI NTSTATUS NTAPI
3705 KsDefaultForwardIrp(
3706 IN PDEVICE_OBJECT DeviceObject,
3707 IN PIRP Irp);
3708
3709 /* ===============================================================
3710 Worker Management Functions
3711 */
3712
3713 KSDDKAPI NTSTATUS NTAPI
3714 KsRegisterWorker(
3715 IN WORK_QUEUE_TYPE WorkQueueType,
3716 OUT PKSWORKER* Worker);
3717
3718 KSDDKAPI VOID NTAPI
3719 KsUnregisterWorker(
3720 IN PKSWORKER Worker);
3721
3722 KSDDKAPI NTSTATUS NTAPI
3723 KsRegisterCountedWorker(
3724 IN WORK_QUEUE_TYPE WorkQueueType,
3725 IN PWORK_QUEUE_ITEM CountedWorkItem,
3726 OUT PKSWORKER* Worker);
3727
3728 KSDDKAPI ULONG NTAPI
3729 KsDecrementCountedWorker(
3730 IN PKSWORKER Worker);
3731
3732 KSDDKAPI ULONG NTAPI
3733 KsIncrementCountedWorker(
3734 IN PKSWORKER Worker);
3735
3736 KSDDKAPI NTSTATUS NTAPI
3737 KsQueueWorkItem(
3738 IN PKSWORKER Worker,
3739 IN PWORK_QUEUE_ITEM WorkItem);
3740
3741
3742 /* ===============================================================
3743 Resources / Images
3744 */
3745
3746 KSDDKAPI NTSTATUS NTAPI
3747 KsLoadResource(
3748 IN PVOID ImageBase,
3749 IN POOL_TYPE PoolType,
3750 IN ULONG_PTR ResourceName,
3751 IN ULONG ResourceType,
3752 OUT PVOID* Resource,
3753 OUT PULONG ResourceSize);
3754
3755 /* TODO: Implement
3756 KSDDKAPI NTSTATUS NTAPI
3757 KsGetImageNameAndResourceId(
3758 IN HANDLE RegKey,
3759 OUT PUNICODE_STRING ImageName,
3760 OUT PULONG_PTR ResourceId,
3761 OUT PULONG ValueType);
3762
3763 KSDDKAPI NTSTATUS NTAPI
3764 KsMapModuleName(
3765 IN PDEVICE_OBJECT PhysicalDeviceObject,
3766 IN PUNICODE_STRING ModuleName,
3767 OUT PUNICODE_STRING ImageName,
3768 OUT PULONG_PTR ResourceId,
3769 OUT PULONG ValueType);
3770 */
3771
3772
3773 /* ===============================================================
3774 Misc. Helper Functions
3775 */
3776
3777 KSDDKAPI PVOID NTAPI
3778 KsGetNextSibling(
3779 IN PVOID Object);
3780
3781
3782 KSDDKAPI NTSTATUS NTAPI
3783 KsCacheMedium(
3784 IN PUNICODE_STRING SymbolicLink,
3785 IN PKSPIN_MEDIUM Medium,
3786 IN ULONG PinDirection);
3787
3788 KSDDKAPI NTSTATUS NTAPI
3789 KsDefaultDispatchPnp(
3790 IN PDEVICE_OBJECT DeviceObject,
3791 IN PIRP Irp);
3792
3793 KSDDKAPI VOID NTAPI
3794 KsSetDevicePnpAndBaseObject(
3795 IN KSDEVICE_HEADER Header,
3796 IN PDEVICE_OBJECT PnpDeviceObject,
3797 IN PDEVICE_OBJECT BaseDevice);
3798
3799 KSDDKAPI NTSTATUS NTAPI
3800 KsDefaultDispatchPower(
3801 IN PDEVICE_OBJECT DeviceObject,
3802 IN PIRP Irp);
3803
3804 KSDDKAPI VOID NTAPI
3805 KsSetPowerDispatch(
3806 IN KSOBJECT_HEADER Header,
3807 IN PFNKSCONTEXT_DISPATCH PowerDispatch OPTIONAL,
3808 IN PVOID PowerContext OPTIONAL);
3809
3810 KSDDKAPI NTSTATUS NTAPI
3811 KsReferenceBusObject(
3812 IN KSDEVICE_HEADER Header);
3813
3814 KSDDKAPI VOID NTAPI
3815 KsDereferenceBusObject(
3816 IN KSDEVICE_HEADER Header);
3817
3818 KSDDKAPI NTSTATUS NTAPI
3819 KsFreeObjectCreateItem(
3820 IN KSDEVICE_HEADER Header,
3821 IN PUNICODE_STRING CreateItem);
3822
3823 KSDDKAPI NTSTATUS NTAPI
3824 KsFreeObjectCreateItemsByContext(
3825 IN KSDEVICE_HEADER Header,
3826 IN PVOID Context);
3827
3828 KSDDKAPI VOID NTAPI
3829 KsNullDriverUnload(
3830 IN PDRIVER_OBJECT DriverObject);
3831
3832 KSDDKAPI PDEVICE_OBJECT NTAPI
3833 KsQueryDevicePnpObject(
3834 IN KSDEVICE_HEADER Header);
3835
3836 KSDDKAPI VOID NTAPI
3837 KsRecalculateStackDepth(
3838 IN KSDEVICE_HEADER Header,
3839 IN BOOLEAN ReuseStackLocation);
3840
3841 KSDDKAPI VOID NTAPI
3842 KsSetTargetDeviceObject(
3843 IN KSOBJECT_HEADER Header,
3844 IN PDEVICE_OBJECT TargetDevice OPTIONAL);
3845
3846 KSDDKAPI VOID NTAPI
3847 KsSetTargetState(
3848 IN KSOBJECT_HEADER Header,
3849 IN KSTARGET_STATE TargetState);
3850
3851 KSDDKAPI NTSTATUS NTAPI
3852 KsSynchronousIoControlDevice(
3853 IN PFILE_OBJECT FileObject,
3854 IN KPROCESSOR_MODE RequestorMode,
3855 IN ULONG IoControl,
3856 IN PVOID InBuffer,
3857 IN ULONG InSize,
3858 OUT PVOID OutBuffer,
3859 IN ULONG OUtSize,
3860 OUT PULONG BytesReturned);
3861
3862 KSDDKAPI
3863 PKSPIN
3864 NTAPI
3865 KsFilterGetFirstChildPin(
3866 IN PKSFILTER Filter,
3867 IN ULONG PinId
3868 );
3869
3870 KSDDKAPI
3871 PFILE_OBJECT
3872 NTAPI
3873 KsPinGetConnectedPinFileObject(
3874 IN PKSPIN Pin
3875 );
3876
3877 #else
3878
3879 #if !defined( KS_NO_CREATE_FUNCTIONS )
3880
3881 KSDDKAPI
3882 DWORD
3883 WINAPI
3884 KsCreateAllocator(
3885 IN HANDLE ConnectionHandle,
3886 IN PKSALLOCATOR_FRAMING AllocatorFraming,
3887 OUT PHANDLE AllocatorHandle
3888 );
3889
3890 KSDDKAPI
3891 DWORD
3892 NTAPI
3893 KsCreateClock(
3894 IN HANDLE ConnectionHandle,
3895 IN PKSCLOCK_CREATE ClockCreate,
3896 OUT PHANDLE ClockHandle
3897 );
3898
3899 KSDDKAPI
3900 DWORD
3901 WINAPI
3902 KsCreatePin(
3903 IN HANDLE FilterHandle,
3904 IN PKSPIN_CONNECT Connect,
3905 IN ACCESS_MASK DesiredAccess,
3906 OUT PHANDLE ConnectionHandle
3907 );
3908
3909 KSDDKAPI
3910 DWORD
3911 WINAPI
3912 KsCreateTopologyNode(
3913 IN HANDLE ParentHandle,
3914 IN PKSNODE_CREATE NodeCreate,
3915 IN ACCESS_MASK DesiredAccess,
3916 OUT PHANDLE NodeHandle
3917 );
3918
3919 #endif
3920
3921 #endif
3922
3923 /* ===============================================================
3924 AVStream Functions (XP / DirectX 8)
3925 NOT IMPLEMENTED YET
3926 http://www.osronline.com/ddkx/stream/avstream_5q9f.htm
3927 */
3928
3929 #if defined(_NTDDK_)
3930
3931 KSDDKAPI
3932 NTSTATUS
3933 NTAPI
3934 KsMergeAutomationTables(
3935 OUT PKSAUTOMATION_TABLE* AutomationTableAB,
3936 IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL,
3937 IN PKSAUTOMATION_TABLE AutomationTableB OPTIONAL,
3938 IN KSOBJECT_BAG Bag OPTIONAL
3939 );
3940
3941 KSDDKAPI
3942 NTSTATUS
3943 NTAPI
3944 KsInitializeDriver(
3945 IN PDRIVER_OBJECT DriverObject,
3946 IN PUNICODE_STRING RegistryPath,
3947 IN const KSDEVICE_DESCRIPTOR *Descriptor OPTIONAL);
3948
3949 typedef struct _KSFILTERFACTORY KSFILTERFACTORY, *PKSFILTERFACTORY; //FIXME
3950
3951
3952
3953 KSDDKAPI
3954 NTSTATUS
3955 NTAPI
3956 KsInitializeDevice (
3957 IN PDEVICE_OBJECT FunctionalDeviceObject,
3958 IN PDEVICE_OBJECT PhysicalDeviceObject,
3959 IN PDEVICE_OBJECT NextDeviceObject,
3960 IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL);
3961
3962
3963 typedef void (NTAPI *PFNKSFILTERFACTORYPOWER)(
3964 IN PKSFILTERFACTORY FilterFactory,
3965 IN DEVICE_POWER_STATE State);
3966
3967 KSDDKAPI
3968 NTSTATUS
3969 NTAPI
3970 _KsEdit(
3971 IN KSOBJECT_BAG ObjectBag,
3972 IN OUT PVOID* PointerToPointerToItem,
3973 IN ULONG NewSize,
3974 IN ULONG OldSize,
3975 IN ULONG Tag);
3976
3977 KSDDKAPI
3978 VOID
3979 NTAPI
3980 KsAcquireControl(
3981 IN PVOID Object);
3982
3983 KSDDKAPI
3984 VOID
3985 NTAPI
3986 KsAcquireDevice(
3987 IN PKSDEVICE Device);
3988
3989 KSDDKAPI
3990 NTSTATUS
3991 NTAPI
3992 KsAddDevice(
3993 IN PDRIVER_OBJECT DriverObject,
3994 IN PDEVICE_OBJECT PhysicalDeviceObject);
3995
3996 KSDDKAPI
3997 VOID
3998 NTAPI
3999 KsAddEvent(
4000 IN PVOID Object,
4001 IN PKSEVENT_ENTRY EventEntry);
4002
4003 KSDDKAPI
4004 NTSTATUS
4005 NTAPI
4006 KsAddItemToObjectBag(
4007 IN KSOBJECT_BAG ObjectBag,
4008 IN PVOID Item,
4009 IN PFNKSFREE Free OPTIONAL);
4010
4011 KSDDKAPI
4012 ULONG
4013 NTAPI
4014 KsRemoveItemFromObjectBag(
4015 IN KSOBJECT_BAG ObjectBag,
4016 IN PVOID Item,
4017 IN BOOLEAN Free);
4018
4019 KSDDKAPI
4020 NTSTATUS
4021 NTAPI
4022 KsAllocateObjectBag(
4023 IN PKSDEVICE Device,
4024 OUT KSOBJECT_BAG* ObjectBag);
4025
4026 KSDDKAPI
4027 VOID
4028 NTAPI
4029 KsFreeObjectBag(
4030 IN KSOBJECT_BAG ObjectBag
4031 );
4032
4033 KSDDKAPI
4034 VOID
4035 NTAPI
4036 KsCompletePendingRequest(
4037 IN PIRP Irp);
4038
4039 KSDDKAPI
4040 NTSTATUS
4041 NTAPI
4042 KsCopyObjectBagItems(
4043 IN KSOBJECT_BAG ObjectBagDestination,
4044 IN KSOBJECT_BAG ObjectBagSource);
4045
4046 KSDDKAPI
4047 NTSTATUS
4048 NTAPI
4049 KsCreateDevice(
4050 IN PDRIVER_OBJECT DriverObject,
4051 IN PDEVICE_OBJECT PhysicalDeviceObject,
4052 IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL,
4053 IN ULONG ExtensionSize OPTIONAL,
4054 OUT PKSDEVICE* Device OPTIONAL);
4055
4056 KSDDKAPI
4057 NTSTATUS
4058 NTAPI
4059 KsCreateFilterFactory(
4060 IN PDEVICE_OBJECT DeviceObject,
4061 IN const KSFILTER_DESCRIPTOR* Descriptor,
4062 IN PWCHAR RefString OPTIONAL,
4063 IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL,
4064 IN ULONG CreateItemFlags,
4065 IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL,
4066 IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL,
4067 OUT PKSFILTERFACTORY *FilterFactory OPTIONAL);
4068
4069 KSDDKAPI
4070 NTSTATUS
4071 NTAPI
4072 KsFilterFactoryUpdateCacheData(
4073 IN PKSFILTERFACTORY FilterFactory,
4074 IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL
4075 );
4076
4077 KSDDKAPI
4078 PKSPIN
4079 NTAPI
4080 KsGetPinFromIrp(
4081 IN PIRP Irp
4082 );
4083
4084 KSDDKAPI
4085 PKSFILTER
4086 NTAPI
4087 KsGetFilterFromIrp(
4088 IN PIRP Irp
4089 );
4090
4091 KSDDKAPI
4092 NTSTATUS
4093 NTAPI
4094 KsDefaultAddEventHandler(
4095 IN PIRP Irp,
4096 IN PKSEVENTDATA EventData,
4097 IN OUT PKSEVENT_ENTRY EventEntry);
4098
4099 KSDDKAPI
4100 NTSTATUS
4101 NTAPI
4102 KsDispatchQuerySecurity(
4103 IN PDEVICE_OBJECT DeviceObject,
4104 IN PIRP Irp
4105 );
4106
4107 KSDDKAPI
4108 NTSTATUS
4109 NTAPI
4110 KsDispatchSetSecurity(
4111 IN PDEVICE_OBJECT DeviceObject,
4112 IN PIRP Irp
4113 );
4114
4115 KSDDKAPI
4116 PVOID
4117 NTAPI
4118 KsGetParent(
4119 IN PVOID Object
4120 );
4121
4122
4123 static
4124 PKSFILTERFACTORY
4125 __inline
4126 KsFilterGetParentFilterFactory(
4127 IN PKSFILTER Filter
4128 )
4129 {
4130 return (PKSFILTERFACTORY) KsGetParent((PVOID) Filter);
4131 }
4132
4133 static
4134 PKSDEVICE
4135 __inline
4136 KsFilterFactoryGetParentDevice(
4137 IN PKSFILTERFACTORY FilterFactory
4138 )
4139 {
4140 return (PKSDEVICE) KsGetParent((PVOID) FilterFactory);
4141 }
4142
4143
4144
4145 #define KsDeleteFilterFactory(FilterFactory) \
4146 KsFreeObjectCreateItemsByContext( \
4147 *(KSDEVICE_HEADER *)( \
4148 KsFilterFactoryGetParentDevice(FilterFactory)->FunctionalDeviceObject-> \
4149 DeviceExtension), \
4150 FilterFactory)
4151
4152 KSDDKAPI
4153 ULONG
4154 NTAPI
4155 KsDeviceGetBusData(
4156 IN PKSDEVICE Device,
4157 IN ULONG DataType,
4158 IN PVOID Buffer,
4159 IN ULONG Offset,
4160 IN ULONG Length);
4161
4162
4163 KSDDKAPI
4164 PVOID
4165 NTAPI
4166 KsGetFirstChild(
4167 IN PVOID Object
4168 );
4169
4170 KSDDKAPI
4171 PKSFILTERFACTORY
4172 NTAPI
4173 KsDeviceGetFirstChildFilterFactory(
4174 IN PKSDEVICE Device);
4175
4176 #if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
4177
4178 KSDDKAPI
4179 PUNKNOWN
4180 NTAPI
4181 KsGetOuterUnknown(
4182 IN PVOID Object
4183 );
4184
4185 static
4186 __inline
4187 PUNKNOWN
4188 KsDeviceGetOuterUnknown(
4189 IN PKSDEVICE Device)
4190 {
4191 return KsGetOuterUnknown((PVOID) Device);
4192 }
4193
4194 KSDDKAPI
4195 PUNKNOWN
4196 NTAPI
4197 KsDeviceRegisterAggregatedClientUnknown(
4198 IN PKSDEVICE Device,
4199 IN PUNKNOWN ClientUnknown);
4200
4201
4202 #endif
4203
4204 #if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
4205
4206 typedef interface IKsReferenceClock* PIKSREFERENCECLOCK;
4207
4208 #undef INTERFACE
4209 #define INTERFACE IKsReferenceClock
4210 DECLARE_INTERFACE_(IKsReferenceClock,IUnknown)
4211 {
4212 DEFINE_ABSTRACT_UNKNOWN() // For C
4213
4214 STDMETHOD_(LONGLONG,GetTime)(THIS
4215 ) PURE;
4216 STDMETHOD_(LONGLONG,GetPhysicalTime)(THIS
4217 ) PURE;
4218 STDMETHOD_(LONGLONG,GetCorrelatedTime)(THIS_
4219 OUT PLONGLONG SystemTime
4220 ) PURE;
4221 STDMETHOD_(LONGLONG,GetCorrelatedPhysicalTime)(THIS_
4222 OUT PLONGLONG SystemTime
4223 ) PURE;
4224 STDMETHOD_(NTSTATUS, GetResolution)(THIS_
4225 OUT PKSRESOLUTION Resolution
4226 ) PURE;
4227 STDMETHOD_(NTSTATUS, GetState)(THIS_
4228 OUT PKSSTATE State
4229 ) PURE;
4230 };
4231
4232 #undef INTERFACE
4233 #define INTERFACE IKsControl
4234
4235 DEFINE_GUID(IID_IKsControl, 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96);
4236
4237 DECLARE_INTERFACE_(IKsControl,IUnknown)
4238 {
4239 STDMETHOD_(NTSTATUS, QueryInterface)( THIS_
4240 REFIID InterfaceId,
4241 PVOID* Interface)PURE;
4242
4243 STDMETHOD_(ULONG, AddRef)(THIS) PURE;
4244
4245 STDMETHOD_(ULONG, Release)(THIS) PURE;
4246
4247 STDMETHOD_(NTSTATUS, KsProperty)(THIS_
4248 IN PKSPROPERTY Property,
4249 IN ULONG PropertyLength,
4250 IN OUT PVOID PropertyData,
4251 IN ULONG DataLength,
4252 OUT ULONG* BytesReturned
4253 ) PURE;
4254 STDMETHOD_(NTSTATUS, KsMethod)(THIS_
4255 IN PKSMETHOD Method,
4256 IN ULONG MethodLength,
4257 IN OUT PVOID MethodData,
4258 IN ULONG DataLength,
4259 OUT ULONG* BytesReturned
4260 ) PURE;
4261 STDMETHOD_(NTSTATUS, KsEvent)(THIS_
4262 IN PKSEVENT Event OPTIONAL,
4263 IN ULONG EventLength,
4264 IN OUT PVOID EventData,
4265 IN ULONG DataLength,
4266 OUT ULONG* BytesReturned
4267 ) PURE;
4268 };
4269
4270 #undef INTERFACE
4271 typedef IKsControl* PIKSCONTROL;
4272
4273 #endif
4274
4275 KSDDKAPI
4276 VOID
4277 NTAPI
4278 KsDeviceRegisterAdapterObject(
4279 IN PKSDEVICE Device,
4280 IN PADAPTER_OBJECT AdapterObject,
4281 IN ULONG MaxMappingByteCount,
4282 IN ULONG MappingTableStride);
4283
4284 KSDDKAPI
4285 ULONG
4286 NTAPI
4287 KsDeviceSetBusData(
4288 IN PKSDEVICE Device,
4289 IN ULONG DataType,
4290 IN PVOID Buffer,
4291 IN ULONG Offset,
4292 IN ULONG Length);
4293
4294
4295 KSDDKAPI
4296 VOID
4297 NTAPI
4298 KsReleaseControl(
4299 IN PVOID Object
4300 );
4301
4302 #define KsDiscard(object, pointer) \
4303 KsRemoveItemFromObjectBag(object->Bag, pointer, TRUE)
4304
4305 #define KsFilterAcquireControl(Filter) \
4306 KsAcquireControl((PVOID) Filter);
4307
4308 #define KsFilterReleaseControl(Filter) \
4309 KsReleaseControl((PVOID) Filter);
4310
4311 #define KsFilterAddEvent(Filter, EventEntry) \
4312 KsAddEvent(Filter,EventEntry);
4313
4314 KSDDKAPI
4315 VOID
4316 NTAPI
4317 KsFilterAcquireProcessingMutex(
4318 IN PKSFILTER Filter);
4319
4320
4321 KSDDKAPI
4322 NTSTATUS
4323 NTAPI
4324 KsFilterAddTopologyConnections(
4325 IN PKSFILTER Filter,
4326 IN ULONG NewConnectionsCount,
4327 IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections);
4328
4329 KSDDKAPI
4330 VOID
4331 NTAPI
4332 KsFilterAttemptProcessing(
4333 IN PKSFILTER Filter,
4334 IN BOOLEAN Asynchronous);
4335
4336 KSDDKAPI
4337 NTSTATUS
4338 NTAPI
4339 KsFilterCreateNode(
4340 IN PKSFILTER Filter,
4341 IN const KSNODE_DESCRIPTOR *const NodeDescriptor,
4342 OUT PULONG NodeID);
4343
4344 KSDDKAPI
4345 NTSTATUS
4346 NTAPI
4347 KsFilterCreatePinFactory(
4348 IN PKSFILTER Filter,
4349 IN const KSPIN_DESCRIPTOR_EX *const PinDescriptor,
4350 OUT PULONG PinID);
4351
4352 KSDDKAPI
4353 PKSDEVICE
4354 __inline
4355 KsFilterFactoryGetDevice(
4356 IN PKSFILTERFACTORY FilterFactory);
4357
4358 /* etc. */
4359 #endif /* avstream */
4360
4361 #ifdef __cplusplus
4362 }
4363 #endif
4364
4365 #endif