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