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