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