/[cvs]/api/include/ks.h
ViewVC logotype

Contents of /api/include/ks.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sun Jul 1 20:47:59 2001 UTC (23 years, 4 months ago) by bearsoft
Branch: lazy, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
First import

1 /*++
2
3 Copyright (C) Microsoft Corporation, 1996 - 1999
4
5 Module Name:
6
7 ks.h
8
9 Abstract:
10
11 Windows Driver Model/Connection and Streaming Architecture (WDM-CSA)
12 core definitions.
13
14 --*/
15
16 #if !defined(_KS_)
17 #define _KS_
18
19 #if defined(__TCS__)
20 #define _KS_NO_ANONYMOUS_STRUCTURES_ 1
21 #endif
22
23 #if !defined(_NTRTL_)
24 #ifndef DEFINE_GUIDEX
25 #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
26 #endif // !defined(DEFINE_GUIDEX)
27
28 #ifndef STATICGUIDOF
29 #define STATICGUIDOF(guid) STATIC_##guid
30 #endif // !defined(STATICGUIDOF)
31 #endif // !defined(_NTRTL_)
32
33 #ifndef SIZEOF_ARRAY
34 #define SIZEOF_ARRAY(ar) (sizeof(ar)/sizeof((ar)[0]))
35 #endif // !defined(SIZEOF_ARRAY)
36
37 #if defined(__cplusplus) && _MSC_VER >= 1100
38 #define DEFINE_GUIDSTRUCT(g, n) struct __declspec(uuid(g)) n
39 #define DEFINE_GUIDNAMED(n) __uuidof(struct n)
40 #else // !defined(__cplusplus)
41 #define DEFINE_GUIDSTRUCT(g, n) DEFINE_GUIDEX(n)
42 #define DEFINE_GUIDNAMED(n) n
43 #endif // !defined(__cplusplus)
44
45 //===========================================================================
46
47 #define STATIC_GUID_NULL \
48 0x00000000L, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
49
50 DEFINE_GUIDSTRUCT("00000000-0000-0000-0000-000000000000", GUID_NULL);
51 #define GUID_NULL DEFINE_GUIDNAMED(GUID_NULL)
52
53 //===========================================================================
54
55 #define IOCTL_KS_PROPERTY CTL_CODE(FILE_DEVICE_KS, 0x000, METHOD_NEITHER, FILE_ANY_ACCESS)
56 #define IOCTL_KS_ENABLE_EVENT CTL_CODE(FILE_DEVICE_KS, 0x001, METHOD_NEITHER, FILE_ANY_ACCESS)
57 #define IOCTL_KS_DISABLE_EVENT CTL_CODE(FILE_DEVICE_KS, 0x002, METHOD_NEITHER, FILE_ANY_ACCESS)
58 #define IOCTL_KS_METHOD CTL_CODE(FILE_DEVICE_KS, 0x003, METHOD_NEITHER, FILE_ANY_ACCESS)
59 #define IOCTL_KS_WRITE_STREAM CTL_CODE(FILE_DEVICE_KS, 0x004, METHOD_NEITHER, FILE_WRITE_ACCESS)
60 #define IOCTL_KS_READ_STREAM CTL_CODE(FILE_DEVICE_KS, 0x005, METHOD_NEITHER, FILE_READ_ACCESS)
61 #define IOCTL_KS_RESET_STATE CTL_CODE(FILE_DEVICE_KS, 0x006, METHOD_NEITHER, FILE_ANY_ACCESS)
62
63 //===========================================================================
64
65 typedef enum {
66 KSRESET_BEGIN,
67 KSRESET_END
68 } KSRESET;
69
70 typedef enum {
71 KSSTATE_STOP,
72 KSSTATE_ACQUIRE,
73 KSSTATE_PAUSE,
74 KSSTATE_RUN
75 } KSSTATE, *PKSSTATE;
76
77 #define KSPRIORITY_LOW 0x00000001
78 #define KSPRIORITY_NORMAL 0x40000000
79 #define KSPRIORITY_HIGH 0x80000000
80 #define KSPRIORITY_EXCLUSIVE 0xFFFFFFFF
81
82 typedef struct {
83 ULONG PriorityClass;
84 ULONG PrioritySubClass;
85 } KSPRIORITY, *PKSPRIORITY;
86
87 typedef struct {
88 union {
89 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
90 struct _IDENTIFIER {
91 #else
92 struct {
93 #endif
94 GUID Set;
95 ULONG Id;
96 ULONG Flags;
97 };
98 LONGLONG Alignment;
99 };
100 } KSIDENTIFIER, *PKSIDENTIFIER;
101
102 typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY, KSMETHOD, *PKSMETHOD, KSEVENT, *PKSEVENT;
103
104 #define KSMETHOD_TYPE_NONE 0x00000000
105 #define KSMETHOD_TYPE_READ 0x00000001
106 #define KSMETHOD_TYPE_WRITE 0x00000002
107 #define KSMETHOD_TYPE_MODIFY 0x00000003
108 #define KSMETHOD_TYPE_SOURCE 0x00000004
109
110 #define KSMETHOD_TYPE_SEND 0x00000001
111 #define KSMETHOD_TYPE_SETSUPPORT 0x00000100
112 #define KSMETHOD_TYPE_BASICSUPPORT 0x00000200
113
114 #define KSMETHOD_TYPE_TOPOLOGY 0x10000000
115
116 #define KSPROPERTY_TYPE_GET 0x00000001
117 #define KSPROPERTY_TYPE_SET 0x00000002
118 #define KSPROPERTY_TYPE_SETSUPPORT 0x00000100
119 #define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200
120 #define KSPROPERTY_TYPE_RELATIONS 0x00000400
121 #define KSPROPERTY_TYPE_SERIALIZESET 0x00000800
122 #define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000
123 #define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000
124 #define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000
125 #define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000
126 #define KSPROPERTY_TYPE_DEFAULTVALUES 0x00010000
127
128 #define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
129
130 typedef struct {
131 KSPROPERTY Property;
132 ULONG NodeId;
133 ULONG Reserved;
134 } KSP_NODE, *PKSP_NODE;
135
136 typedef struct {
137 KSMETHOD Method;
138 ULONG NodeId;
139 ULONG Reserved;
140 } KSM_NODE, *PKSM_NODE;
141
142 typedef struct {
143 KSEVENT Event;
144 ULONG NodeId;
145 ULONG Reserved;
146 } KSE_NODE, *PKSE_NODE;
147
148 #define STATIC_KSPROPTYPESETID_General \
149 0x97E99BA0L, 0xBDEA, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
150 DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_General);
151 #define KSPROPTYPESETID_General DEFINE_GUIDNAMED(KSPROPTYPESETID_General)
152
153 #if defined(_NTDDK_) && !defined(__wtypes_h__)
154 enum VARENUM {
155 VT_EMPTY = 0,
156 VT_NULL = 1,
157 VT_I2 = 2,
158 VT_I4 = 3,
159 VT_R4 = 4,
160 VT_R8 = 5,
161 VT_CY = 6,
162 VT_DATE = 7,
163 VT_BSTR = 8,
164 VT_DISPATCH = 9,
165 VT_ERROR = 10,
166 VT_BOOL = 11,
167 VT_VARIANT = 12,
168 VT_UNKNOWN = 13,
169 VT_DECIMAL = 14,
170 VT_I1 = 16,
171 VT_UI1 = 17,
172 VT_UI2 = 18,
173 VT_UI4 = 19,
174 VT_I8 = 20,
175 VT_UI8 = 21,
176 VT_INT = 22,
177 VT_UINT = 23,
178 VT_VOID = 24,
179 VT_HRESULT = 25,
180 VT_PTR = 26,
181 VT_SAFEARRAY = 27,
182 VT_CARRAY = 28,
183 VT_USERDEFINED = 29,
184 VT_LPSTR = 30,
185 VT_LPWSTR = 31,
186 VT_FILETIME = 64,
187 VT_BLOB = 65,
188 VT_STREAM = 66,
189 VT_STORAGE = 67,
190 VT_STREAMED_OBJECT = 68,
191 VT_STORED_OBJECT = 69,
192 VT_BLOB_OBJECT = 70,
193 VT_CF = 71,
194 VT_CLSID = 72,
195 VT_VECTOR = 0x1000,
196 VT_ARRAY = 0x2000,
197 VT_BYREF = 0x4000,
198 VT_RESERVED = 0x8000,
199 VT_ILLEGAL = 0xffff,
200 VT_ILLEGALMASKED = 0xfff,
201 VT_TYPEMASK = 0xfff
202 };
203 #endif // _NTDDK_ && !__wtypes_h__
204
205 typedef struct {
206 ULONG Size;
207 ULONG Count;
208 } KSMULTIPLE_ITEM, *PKSMULTIPLE_ITEM;
209
210 typedef struct {
211 ULONG AccessFlags;
212 ULONG DescriptionSize;
213 KSIDENTIFIER PropTypeSet;
214 ULONG MembersListCount;
215 ULONG Reserved;
216 } KSPROPERTY_DESCRIPTION, *PKSPROPERTY_DESCRIPTION;
217
218 #define KSPROPERTY_MEMBER_RANGES 0x00000001
219 #define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002
220 #define KSPROPERTY_MEMBER_VALUES 0x00000003
221
222 #define KSPROPERTY_MEMBER_FLAG_DEFAULT 0x00000001
223
224 typedef struct {
225 ULONG MembersFlags;
226 ULONG MembersSize;
227 ULONG MembersCount;
228 ULONG Flags;
229 } KSPROPERTY_MEMBERSHEADER, *PKSPROPERTY_MEMBERSHEADER;
230
231 typedef union {
232 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
233 struct _SIGNED {
234 #else
235 struct {
236 #endif
237 LONG SignedMinimum;
238 LONG SignedMaximum;
239 };
240 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
241 struct _UNSIGNED {
242 #else
243 struct {
244 #endif
245 ULONG UnsignedMinimum;
246 ULONG UnsignedMaximum;
247 };
248 } KSPROPERTY_BOUNDS_LONG, *PKSPROPERTY_BOUNDS_LONG;
249
250 typedef union {
251 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
252 struct _SIGNED64 {
253 #else
254 struct {
255 #endif
256 LONGLONG SignedMinimum;
257 LONGLONG SignedMaximum;
258 };
259 #if defined( _KS_NO_ANONYMOUS_STRUCTURES_ )
260 struct _UNSIGNED64 {
261 #else
262 struct {
263 #endif
264 #if defined(_NTDDK_)
265 ULONGLONG UnsignedMinimum;
266 ULONGLONG UnsignedMaximum;
267 #else // !_NTDDK_
268 DWORDLONG UnsignedMinimum;
269 DWORDLONG UnsignedMaximum;
270 #endif // !_NTDDK_
271 };
272 } KSPROPERTY_BOUNDS_LONGLONG, *PKSPROPERTY_BOUNDS_LONGLONG;
273
274 typedef struct {
275 ULONG SteppingDelta;
276 ULONG Reserved;
277 KSPROPERTY_BOUNDS_LONG Bounds;
278 } KSPROPERTY_STEPPING_LONG, *PKSPROPERTY_STEPPING_LONG;
279
280 typedef struct {
281 #if defined(_NTDDK_)
282 ULONGLONG SteppingDelta;
283 #else // !_NTDDK_
284 DWORDLONG SteppingDelta;
285 #endif // !_NTDDK_
286 KSPROPERTY_BOUNDS_LONGLONG Bounds;
287 } KSPROPERTY_STEPPING_LONGLONG, *PKSPROPERTY_STEPPING_LONGLONG;
288
289 //===========================================================================
290
291 #if defined(_NTDDK_)
292 //
293 // Structure forward declarations.
294 //
295 typedef struct _KSDEVICE_DESCRIPTOR
296 KSDEVICE_DESCRIPTOR, *PKSDEVICE_DESCRIPTOR;
297 typedef struct _KSDEVICE_DISPATCH
298 KSDEVICE_DISPATCH, *PKSDEVICE_DISPATCH;
299 typedef struct _KSDEVICE
300 KSDEVICE, *PKSDEVICE;
301 typedef struct _KSFILTERFACTORY
302 KSFILTERFACTORY, *PKSFILTERFACTORY;
303 typedef struct _KSFILTER_DESCRIPTOR
304 KSFILTER_DESCRIPTOR, *PKSFILTER_DESCRIPTOR;
305 typedef struct _KSFILTER_DISPATCH
306 KSFILTER_DISPATCH, *PKSFILTER_DISPATCH;
307 typedef struct _KSFILTER
308 KSFILTER, *PKSFILTER;
309 typedef struct _KSPIN_DESCRIPTOR_EX
310 KSPIN_DESCRIPTOR_EX, *PKSPIN_DESCRIPTOR_EX;
311 typedef struct _KSPIN_DISPATCH
312 KSPIN_DISPATCH, *PKSPIN_DISPATCH;
313 typedef struct _KSCLOCK_DISPATCH
314 KSCLOCK_DISPATCH, *PKSCLOCK_DISPATCH;
315 typedef struct _KSALLOCATOR_DISPATCH
316 KSALLOCATOR_DISPATCH, *PKSALLOCATOR_DISPATCH;
317 typedef struct _KSPIN
318 KSPIN, *PKSPIN;
319 typedef struct _KSNODE_DESCRIPTOR
320 KSNODE_DESCRIPTOR, *PKSNODE_DESCRIPTOR;
321 typedef struct _KSSTREAM_POINTER_OFFSET
322 KSSTREAM_POINTER_OFFSET, *PKSSTREAM_POINTER_OFFSET;
323 typedef struct _KSSTREAM_POINTER
324 KSSTREAM_POINTER, *PKSSTREAM_POINTER;
325 typedef struct _KSMAPPING
326 KSMAPPING, *PKSMAPPING;
327 typedef struct _KSPROCESSPIN
328 KSPROCESSPIN, *PKSPROCESSPIN;
329 typedef struct _KSPROCESSPIN_INDEXENTRY
330 KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY;
331 #endif // _NTDDK_
332
333 typedef PVOID PKSWORKER;
334
335 typedef struct {
336 ULONG NotificationType;
337 union {
338 struct {
339 HANDLE Event;
340 ULONG_PTR Reserved[2];
341 } EventHandle;
342 struct {
343 HANDLE Semaphore;
344 ULONG Reserved;
345 LONG Adjustment;
346 } SemaphoreHandle;
347 #if defined(_NTDDK_)
348 struct {
349 PVOID Event;
350 KPRIORITY Increment;
351 ULONG_PTR Reserved;
352 } EventObject;
353 struct {
354 PVOID Semaphore;
355 KPRIORITY Increment;
356 LONG Adjustment;
357 } SemaphoreObject;
358 struct {
359 PKDPC Dpc;
360 ULONG ReferenceCount;
361 ULONG_PTR Reserved;
362 } Dpc;
363 struct {
364 PWORK_QUEUE_ITEM WorkQueueItem;
365 WORK_QUEUE_TYPE WorkQueueType;
366 ULONG_PTR Reserved;
367 } WorkItem;
368 struct {
369 PWORK_QUEUE_ITEM WorkQueueItem;
370 PKSWORKER KsWorkerObject;
371 ULONG_PTR Reserved;
372 } KsWorkItem;
373 // @@BEGIN_DDKSPLIT
374 struct {
375 PKSFILTER Filter;
376 ULONG_PTR Reserved[2];
377 } KsFilterProcessing;
378 struct {
379 PKSPIN Pin;
380 ULONG_PTR Reserved[2];
381 } KsPinProcessing;
382 // @@END_DDKSPLIT
383 #endif // defined(_NTDDK_)
384 struct {
385 PVOID Unused;
386 LONG_PTR Alignment[2];
387 } Alignment;
388 };
389 } KSEVENTDATA, *PKSEVENTDATA;
390
391 #define KSEVENTF_EVENT_HANDLE 0x00000001
392 #define KSEVENTF_SEMAPHORE_HANDLE 0x00000002
393 #if defined(_NTDDK_)
394 #define KSEVENTF_EVENT_OBJECT 0x00000004
395 #define KSEVENTF_SEMAPHORE_OBJECT 0x00000008
396 #define KSEVENTF_DPC 0x00000010
397 #define KSEVENTF_WORKITEM 0x00000020
398 #define KSEVENTF_KSWORKITEM 0x00000080
399 // @@BEGIN_DDKSPLIT
400 #define KSEVENTF_KSFILTERPROCESSING 0x00000100
401 #define KSEVENTF_KSPINPROCESSING 0x00000200
402 // @@END_DDKSPLIT
403 #endif // defined(_NTDDK_)
404
405 #define KSEVENT_TYPE_ENABLE 0x00000001
406 #define KSEVENT_TYPE_ONESHOT 0x00000002
407 #define KSEVENT_TYPE_ENABLEBUFFERED 0x00000004
408 #define KSEVENT_TYPE_SETSUPPORT 0x00000100
409 #define KSEVENT_TYPE_BASICSUPPORT 0x00000200
410 #define KSEVENT_TYPE_QUERYBUFFER 0x00000400
411
412 #define KSEVENT_TYPE_TOPOLOGY 0x10000000
413
414 typedef struct {
415 KSEVENT Event;
416 PKSEVENTDATA EventData;
417 PVOID Reserved;
418 } KSQUERYBUFFER, *PKSQUERYBUFFER;
419
420 typedef struct {
421 ULONG Size;
422 ULONG Flags;
423 union {
424 HANDLE ObjectHandle;
425 PVOID ObjectPointer;
426 };
427 PVOID Reserved;
428 KSEVENT Event;
429 KSEVENTDATA EventData;
430 } KSRELATIVEEVENT;
431
432 #define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001
433 #define KSRELATIVEEVENT_FLAG_POINTER 0x00000002
434
435 //===========================================================================
436
437 typedef struct {
438 KSEVENTDATA EventData;
439 LONGLONG MarkTime;
440 } KSEVENT_TIME_MARK, *PKSEVENT_TIME_MARK;
441
442 typedef struct {
443 KSEVENTDATA EventData;
444 LONGLONG TimeBase;
445 LONGLONG Interval;
446 } KSEVENT_TIME_INTERVAL, *PKSEVENT_TIME_INTERVAL;
447
448 typedef struct {
449 LONGLONG TimeBase;
450 LONGLONG Interval;
451 } KSINTERVAL, *PKSINTERVAL;
452
453 //===========================================================================
454
455 #define STATIC_KSPROPSETID_General\
456 0x1464EDA5L, 0x6A8F, 0x11D1, 0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
457 DEFINE_GUIDSTRUCT("1464EDA5-6A8F-11D1-9AA7-00A0C9223196", KSPROPSETID_General);
458 #define KSPROPSETID_General DEFINE_GUIDNAMED(KSPROPSETID_General)
459
460 typedef enum {
461 KSPROPERTY_GENERAL_COMPONENTID
462 } KSPROPERTY_GENERAL;
463
464 typedef struct {
465 GUID Manufacturer;
466 GUID Product;
467 GUID Component;
468 GUID Name;
469 ULONG Version;
470 ULONG Revision;
471 } KSCOMPONENTID, *PKSCOMPONENTID;
472
473 #define DEFINE_KSPROPERTY_ITEM_GENERAL_COMPONENTID(Handler)\
474 DEFINE_KSPROPERTY_ITEM(\
475 KSPROPERTY_GENERAL_COMPONENTID,\
476 (Handler),\
477 sizeof(KSPROPERTY),\
478 sizeof(KSCOMPONENTID),\
479 NULL, NULL, 0, NULL, NULL, 0)
480
481 #define STATIC_KSMETHODSETID_StreamIo\
482 0x65D003CAL, 0x1523, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
483 DEFINE_GUIDSTRUCT("65D003CA-1523-11D2-B27A-00A0C9223196", KSMETHODSETID_StreamIo);
484 #define KSMETHODSETID_StreamIo DEFINE_GUIDNAMED(KSMETHODSETID_StreamIo)
485
486 typedef enum {
487 KSMETHOD_STREAMIO_READ,
488 KSMETHOD_STREAMIO_WRITE
489 } KSMETHOD_STREAMIO;
490
491 #define DEFINE_KSMETHOD_ITEM_STREAMIO_READ(Handler)\
492 DEFINE_KSMETHOD_ITEM(\
493 KSMETHOD_STREAMIO_READ,\
494 KSMETHOD_TYPE_WRITE,\
495 (Handler),\
496 sizeof(KSMETHOD),\
497 0,\
498 NULL)
499
500 #define DEFINE_KSMETHOD_ITEM_STREAMIO_WRITE(Handler)\
501 DEFINE_KSMETHOD_ITEM(\
502 KSMETHOD_STREAMIO_WRITE,\
503 KSMETHOD_TYPE_READ,\
504 (Handler),\
505 sizeof(KSMETHOD),\
506 0,\
507 NULL)
508
509 #define STATIC_KSPROPSETID_MediaSeeking\
510 0xEE904F0CL, 0xD09B, 0x11D0, 0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
511 DEFINE_GUIDSTRUCT("EE904F0C-D09B-11D0-ABE9-00A0C9223196", KSPROPSETID_MediaSeeking);
512 #define KSPROPSETID_MediaSeeking DEFINE_GUIDNAMED(KSPROPSETID_MediaSeeking)
513
514 typedef enum {
515 KSPROPERTY_MEDIASEEKING_CAPABILITIES,
516 KSPROPERTY_MEDIASEEKING_FORMATS,
517 KSPROPERTY_MEDIASEEKING_TIMEFORMAT,
518 KSPROPERTY_MEDIASEEKING_POSITION,
519 KSPROPERTY_MEDIASEEKING_STOPPOSITION,
520 KSPROPERTY_MEDIASEEKING_POSITIONS,
521 KSPROPERTY_MEDIASEEKING_DURATION,
522 KSPROPERTY_MEDIASEEKING_AVAILABLE,
523 KSPROPERTY_MEDIASEEKING_PREROLL,
524 KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT
525 } KSPROPERTY_MEDIASEEKING;
526
527 typedef enum {
528 KS_SEEKING_NoPositioning,
529 KS_SEEKING_AbsolutePositioning,
530 KS_SEEKING_RelativePositioning,
531 KS_SEEKING_IncrementalPositioning,
532 KS_SEEKING_PositioningBitsMask = 0x3,
533 KS_SEEKING_SeekToKeyFrame,
534 KS_SEEKING_ReturnTime = 0x8
535 } KS_SEEKING_FLAGS;
536
537 typedef enum {
538 KS_SEEKING_CanSeekAbsolute = 0x1,
539 KS_SEEKING_CanSeekForwards = 0x2,
540 KS_SEEKING_CanSeekBackwards = 0x4,
541 KS_SEEKING_CanGetCurrentPos = 0x8,
542 KS_SEEKING_CanGetStopPos = 0x10,
543 KS_SEEKING_CanGetDuration = 0x20,
544 KS_SEEKING_CanPlayBackwards = 0x40
545 } KS_SEEKING_CAPABILITIES;
546
547 typedef struct {
548 LONGLONG Current;
549 LONGLONG Stop;
550 KS_SEEKING_FLAGS CurrentFlags;
551 KS_SEEKING_FLAGS StopFlags;
552 } KSPROPERTY_POSITIONS, *PKSPROPERTY_POSITIONS;
553
554 typedef struct {
555 LONGLONG Earliest;
556 LONGLONG Latest;
557 } KSPROPERTY_MEDIAAVAILABLE, *PKSPROPERTY_MEDIAAVAILABLE;
558
559 typedef struct {
560 KSPROPERTY Property;
561 GUID SourceFormat;
562 GUID TargetFormat;
563 LONGLONG Time;
564 } KSP_TIMEFORMAT, *PKSP_TIMEFORMAT;
565
566 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CAPABILITIES(Handler)\
567 DEFINE_KSPROPERTY_ITEM(\
568 KSPROPERTY_MEDIASEEKING_CAPABILITIES,\
569 (Handler),\
570 sizeof(KSPROPERTY),\
571 sizeof(KS_SEEKING_CAPABILITIES),\
572 NULL, NULL, 0, NULL, NULL, 0)
573
574 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_FORMATS(Handler)\
575 DEFINE_KSPROPERTY_ITEM(\
576 KSPROPERTY_MEDIASEEKING_FORMATS,\
577 (Handler),\
578 sizeof(KSPROPERTY),\
579 0,\
580 NULL, NULL, 0, NULL, NULL, 0)
581
582 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_TIMEFORMAT(GetHandler, SetHandler)\
583 DEFINE_KSPROPERTY_ITEM(\
584 KSPROPERTY_MEDIASEEKING_TIMEFORMAT,\
585 (GetHandler),\
586 sizeof(KSPROPERTY),\
587 sizeof(GUID),\
588 (SetHandler),\
589 NULL, 0, NULL, NULL, 0)
590
591 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_POSITION(Handler)\
592 DEFINE_KSPROPERTY_ITEM(\
593 KSPROPERTY_MEDIASEEKING_POSITION,\
594 (Handler),\
595 sizeof(KSPROPERTY),\
596 sizeof(LONGLONG),\
597 NULL, NULL, 0, NULL, NULL, 0)
598
599 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_STOPPOSITION(Handler)\
600 DEFINE_KSPROPERTY_ITEM(\
601 KSPROPERTY_MEDIASEEKING_STOPPOSITION,\
602 (Handler),\
603 sizeof(KSPROPERTY),\
604 sizeof(LONGLONG),\
605 NULL, NULL, 0, NULL, NULL, 0)
606
607 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_POSITIONS(Handler)\
608 DEFINE_KSPROPERTY_ITEM(\
609 KSPROPERTY_MEDIASEEKING_POSITIONS,\
610 NULL,\
611 sizeof(KSPROPERTY),\
612 sizeof(KSPROPERTY_POSITIONS),\
613 (Handler),\
614 NULL, 0, NULL, NULL, 0)
615
616 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_DURATION(Handler)\
617 DEFINE_KSPROPERTY_ITEM(\
618 KSPROPERTY_MEDIASEEKING_DURATION,\
619 (Handler),\
620 sizeof(KSPROPERTY),\
621 sizeof(LONGLONG),\
622 NULL, NULL, 0, NULL, NULL, 0)
623
624 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_AVAILABLE(Handler)\
625 DEFINE_KSPROPERTY_ITEM(\
626 KSPROPERTY_MEDIASEEKING_AVAILABLE,\
627 (Handler),\
628 sizeof(KSPROPERTY),\
629 sizeof(KSPROPERTY_MEDIAAVAILABLE),\
630 NULL, NULL, 0, NULL, NULL, 0)
631
632 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_PREROLL(Handler)\
633 DEFINE_KSPROPERTY_ITEM(\
634 KSPROPERTY_MEDIASEEKING_PREROLL,\
635 (Handler),\
636 sizeof(KSPROPERTY),\
637 sizeof(LONGLONG),\
638 NULL, NULL, 0, NULL, NULL, 0)
639
640 #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CONVERTTIMEFORMAT(Handler)\
641 DEFINE_KSPROPERTY_ITEM(\
642 KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT,\
643 (Handler),\
644 sizeof(KSP_TIMEFORMAT),\
645 sizeof(LONGLONG),\
646 NULL, NULL, 0, NULL, NULL, 0)
647
648 //===========================================================================
649
650 #define STATIC_KSPROPSETID_Topology\
651 0x720D4AC0L, 0x7533, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
652 DEFINE_GUIDSTRUCT("720D4AC0-7533-11D0-A5D6-28DB04C10000", KSPROPSETID_Topology);
653 #define KSPROPSETID_Topology DEFINE_GUIDNAMED(KSPROPSETID_Topology)
654
655 typedef enum {
656 KSPROPERTY_TOPOLOGY_CATEGORIES,
657 KSPROPERTY_TOPOLOGY_NODES,
658 KSPROPERTY_TOPOLOGY_CONNECTIONS,
659 KSPROPERTY_TOPOLOGY_NAME
660 } KSPROPERTY_TOPOLOGY;
661
662 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler)\
663 DEFINE_KSPROPERTY_ITEM(\
664 KSPROPERTY_TOPOLOGY_CATEGORIES,\
665 (Handler),\
666 sizeof(KSPROPERTY),\
667 0,\
668 NULL, NULL, 0, NULL, NULL, 0)
669
670 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler)\
671 DEFINE_KSPROPERTY_ITEM(\
672 KSPROPERTY_TOPOLOGY_NODES,\
673 (Handler),\
674 sizeof(KSPROPERTY),\
675 0,\
676 NULL, NULL, 0, NULL, NULL, 0)
677
678 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler)\
679 DEFINE_KSPROPERTY_ITEM(\
680 KSPROPERTY_TOPOLOGY_CONNECTIONS,\
681 (Handler),\
682 sizeof(KSPROPERTY),\
683 0,\
684 NULL, NULL, 0, NULL, NULL, 0)
685
686 #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
687 DEFINE_KSPROPERTY_ITEM(\
688 KSPROPERTY_TOPOLOGY_NAME,\
689 (Handler),\
690 sizeof(KSP_NODE),\
691 0,\
692 NULL, NULL, 0, NULL, NULL, 0)
693
694 #define DEFINE_KSPROPERTY_TOPOLOGYSET(TopologySet, Handler)\
695 DEFINE_KSPROPERTY_TABLE(TopologySet) {\
696 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler),\
697 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler),\
698 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler),\
699 DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler)\
700 }
701
702 //=============================================================================
703
704 //
705 // properties used by graph manager to talk to particular filters
706 //
707 #if defined(_NTDDK_)
708
709 #define STATIC_KSPROPSETID_GM \
710 0xAF627536L, 0xE719, 0x11D2, 0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D
711 DEFINE_GUIDSTRUCT("AF627536-E719-11D2-8A1D-006097D2DF5D", KSPROPSETID_GM);
712 #define KSPROPSETID_GM DEFINE_GUIDNAMED(KSPROPSETID_GM)
713
714 typedef VOID (*PFNKSGRAPHMANAGER_NOTIFY)(IN PFILE_OBJECT GraphManager,
715 IN ULONG EventId,
716 IN PVOID Filter,
717 IN PVOID Pin,
718 IN PVOID Frame,
719 IN ULONG Duration);
720
721 typedef struct KSGRAPHMANAGER_FUNCTIONTABLE {
722 PFNKSGRAPHMANAGER_NOTIFY NotifyEvent;
723 } KSGRAPHMANAGER_FUNCTIONTABLE, PKSGRAPHMANAGER_FUNCTIONTABLE;
724
725 typedef struct _KSPROPERTY_GRAPHMANAGER_INTERFACE {
726 PFILE_OBJECT GraphManager;
727 KSGRAPHMANAGER_FUNCTIONTABLE FunctionTable;
728 } KSPROPERTY_GRAPHMANAGER_INTERFACE, *PKSPROPERTY_GRAPHMANAGER_INTERFACE;
729
730
731 //
732 // Commands
733 //
734 typedef enum {
735 KSPROPERTY_GM_GRAPHMANAGER,
736 KSPROPERTY_GM_TIMESTAMP_CLOCK,
737 KSPROPERTY_GM_RATEMATCH,
738 KSPROPERTY_GM_RENDER_CLOCK,
739 } KSPROPERTY_GM;
740
741 #endif
742
743 //===========================================================================
744
745
746 #define STATIC_KSCATEGORY_BRIDGE \
747 0x085AFF00L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
748 DEFINE_GUIDSTRUCT("085AFF00-62CE-11CF-A5D6-28DB04C10000", KSCATEGORY_BRIDGE);
749 #define KSCATEGORY_BRIDGE DEFINE_GUIDNAMED(KSCATEGORY_BRIDGE)
750
751 #define STATIC_KSCATEGORY_CAPTURE \
752 0x65E8773DL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
753 DEFINE_GUIDSTRUCT("65E8773D-8F56-11D0-A3B9-00A0C9223196", KSCATEGORY_CAPTURE);
754 #define KSCATEGORY_CAPTURE DEFINE_GUIDNAMED(KSCATEGORY_CAPTURE)
755
756 #define STATIC_KSCATEGORY_RENDER \
757 0x65E8773EL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
758 DEFINE_GUIDSTRUCT("65E8773E-8F56-11D0-A3B9-00A0C9223196", KSCATEGORY_RENDER);
759 #define KSCATEGORY_RENDER DEFINE_GUIDNAMED(KSCATEGORY_RENDER)
760
761 #define STATIC_KSCATEGORY_MIXER \
762 0xAD809C00L, 0x7B88, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
763 DEFINE_GUIDSTRUCT("AD809C00-7B88-11D0-A5D6-28DB04C10000", KSCATEGORY_MIXER);
764 #define KSCATEGORY_MIXER DEFINE_GUIDNAMED(KSCATEGORY_MIXER)
765
766 #define STATIC_KSCATEGORY_SPLITTER \
767 0x0A4252A0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
768 DEFINE_GUIDSTRUCT("0A4252A0-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_SPLITTER);
769 #define KSCATEGORY_SPLITTER DEFINE_GUIDNAMED(KSCATEGORY_SPLITTER)
770
771 #define STATIC_KSCATEGORY_DATACOMPRESSOR \
772 0x1E84C900L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
773 DEFINE_GUIDSTRUCT("1E84C900-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATACOMPRESSOR);
774 #define KSCATEGORY_DATACOMPRESSOR DEFINE_GUIDNAMED(KSCATEGORY_DATACOMPRESSOR)
775
776 #define STATIC_KSCATEGORY_DATADECOMPRESSOR \
777 0x2721AE20L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
778 DEFINE_GUIDSTRUCT("2721AE20-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATADECOMPRESSOR);
779 #define KSCATEGORY_DATADECOMPRESSOR DEFINE_GUIDNAMED(KSCATEGORY_DATADECOMPRESSOR)
780
781 #define STATIC_KSCATEGORY_DATATRANSFORM \
782 0x2EB07EA0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
783 DEFINE_GUIDSTRUCT("2EB07EA0-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATATRANSFORM);
784 #define KSCATEGORY_DATATRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_DATATRANSFORM)
785
786 #define STATIC_KSCATEGORY_COMMUNICATIONSTRANSFORM \
787 0xCF1DDA2CL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
788 DEFINE_GUIDSTRUCT("CF1DDA2C-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_COMMUNICATIONSTRANSFORM);
789 #define KSCATEGORY_COMMUNICATIONSTRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_COMMUNICATIONSTRANSFORM)
790
791 #define STATIC_KSCATEGORY_INTERFACETRANSFORM \
792 0xCF1DDA2DL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
793 DEFINE_GUIDSTRUCT("CF1DDA2D-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_INTERFACETRANSFORM);
794 #define KSCATEGORY_INTERFACETRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_INTERFACETRANSFORM)
795
796 #define STATIC_KSCATEGORY_MEDIUMTRANSFORM \
797 0xCF1DDA2EL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
798 DEFINE_GUIDSTRUCT("CF1DDA2E-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_MEDIUMTRANSFORM);
799 #define KSCATEGORY_MEDIUMTRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_MEDIUMTRANSFORM)
800
801 #define STATIC_KSCATEGORY_FILESYSTEM \
802 0x760FED5EL, 0x9357, 0x11D0, 0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
803 DEFINE_GUIDSTRUCT("760FED5E-9357-11D0-A3CC-00A0C9223196", KSCATEGORY_FILESYSTEM);
804 #define KSCATEGORY_FILESYSTEM DEFINE_GUIDNAMED(KSCATEGORY_FILESYSTEM)
805
806 // KSNAME_Clock
807 #define STATIC_KSCATEGORY_CLOCK \
808 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
809 DEFINE_GUIDSTRUCT("53172480-4791-11D0-A5D6-28DB04C10000", KSCATEGORY_CLOCK);
810 #define KSCATEGORY_CLOCK DEFINE_GUIDNAMED(KSCATEGORY_CLOCK)
811
812 #define STATIC_KSCATEGORY_PROXY \
813 0x97EBAACAL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
814 DEFINE_GUIDSTRUCT("97EBAACA-95BD-11D0-A3EA-00A0C9223196", KSCATEGORY_PROXY);
815 #define KSCATEGORY_PROXY DEFINE_GUIDNAMED(KSCATEGORY_PROXY)
816
817 #define STATIC_KSCATEGORY_QUALITY \
818 0x97EBAACBL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
819 DEFINE_GUIDSTRUCT("97EBAACB-95BD-11D0-A3EA-00A0C9223196", KSCATEGORY_QUALITY);
820 #define KSCATEGORY_QUALITY DEFINE_GUIDNAMED(KSCATEGORY_QUALITY)
821
822 typedef struct {
823 ULONG FromNode;
824 ULONG FromNodePin;
825 ULONG ToNode;
826 ULONG ToNodePin;
827 } KSTOPOLOGY_CONNECTION, *PKSTOPOLOGY_CONNECTION;
828
829 typedef struct {
830 ULONG CategoriesCount;
831 const GUID* Categories;
832 ULONG TopologyNodesCount;
833 const GUID* TopologyNodes;
834 ULONG TopologyConnectionsCount;
835 const KSTOPOLOGY_CONNECTION* TopologyConnections;
836 const GUID* TopologyNodesNames;
837 ULONG Reserved;
838 } KSTOPOLOGY, *PKSTOPOLOGY;
839
840 #define KSFILTER_NODE ((ULONG)-1)
841 #define KSALL_NODES ((ULONG)-1)
842
843 typedef struct {
844 ULONG CreateFlags;
845 ULONG Node;
846 } KSNODE_CREATE, *PKSNODE_CREATE;
847
848 //===========================================================================
849
850 // TIME_FORMAT_NONE
851 #define STATIC_KSTIME_FORMAT_NONE STATIC_GUID_NULL
852 #define KSTIME_FORMAT_NONE GUID_NULL
853
854 // TIME_FORMAT_FRAME
855 #define STATIC_KSTIME_FORMAT_FRAME\
856 0x7b785570L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
857 DEFINE_GUIDSTRUCT("7b785570-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_FRAME);
858 #define KSTIME_FORMAT_FRAME DEFINE_GUIDNAMED(KSTIME_FORMAT_FRAME)
859
860 // TIME_FORMAT_BYTE
861 #define STATIC_KSTIME_FORMAT_BYTE\
862 0x7b785571L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
863 DEFINE_GUIDSTRUCT("7b785571-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_BYTE);
864 #define KSTIME_FORMAT_BYTE DEFINE_GUIDNAMED(KSTIME_FORMAT_BYTE)
865
866 // TIME_FORMAT_SAMPLE
867 #define STATIC_KSTIME_FORMAT_SAMPLE\
868 0x7b785572L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
869 DEFINE_GUIDSTRUCT("7b785572-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_SAMPLE);
870 #define KSTIME_FORMAT_SAMPLE DEFINE_GUIDNAMED(KSTIME_FORMAT_SAMPLE)
871
872 // TIME_FORMAT_FIELD
873 #define STATIC_KSTIME_FORMAT_FIELD\
874 0x7b785573L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
875 DEFINE_GUIDSTRUCT("7b785573-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_FIELD);
876 #define KSTIME_FORMAT_FIELD DEFINE_GUIDNAMED(KSTIME_FORMAT_FIELD)
877
878 // TIME_FORMAT_MEDIA_TIME
879 #define STATIC_KSTIME_FORMAT_MEDIA_TIME\
880 0x7b785574L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
881 DEFINE_GUIDSTRUCT("7b785574-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_MEDIA_TIME);
882 #define KSTIME_FORMAT_MEDIA_TIME DEFINE_GUIDNAMED(KSTIME_FORMAT_MEDIA_TIME)
883
884 //===========================================================================
885
886 typedef KSIDENTIFIER KSPIN_INTERFACE, *PKSPIN_INTERFACE;
887
888 #define STATIC_KSINTERFACESETID_Standard \
889 0x1A8766A0L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
890 DEFINE_GUIDSTRUCT("1A8766A0-62CE-11CF-A5D6-28DB04C10000", KSINTERFACESETID_Standard);
891 #define KSINTERFACESETID_Standard DEFINE_GUIDNAMED(KSINTERFACESETID_Standard)
892
893 typedef enum {
894 KSINTERFACE_STANDARD_STREAMING,
895 KSINTERFACE_STANDARD_LOOPED_STREAMING,
896 KSINTERFACE_STANDARD_CONTROL
897 } KSINTERFACE_STANDARD;
898
899 #define STATIC_KSINTERFACESETID_FileIo \
900 0x8C6F932CL, 0xE771, 0x11D0, 0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
901 DEFINE_GUIDSTRUCT("8C6F932C-E771-11D0-B8FF-00A0C9223196", KSINTERFACESETID_FileIo);
902 #define KSINTERFACESETID_FileIo DEFINE_GUIDNAMED(KSINTERFACESETID_FileIo)
903
904 typedef enum {
905 KSINTERFACE_FILEIO_STREAMING
906 } KSINTERFACE_FILEIO;
907
908 //===========================================================================
909
910 #define KSMEDIUM_TYPE_ANYINSTANCE 0
911
912 #define STATIC_KSMEDIUMSETID_Standard \
913 0x4747B320L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
914 DEFINE_GUIDSTRUCT("4747B320-62CE-11CF-A5D6-28DB04C10000", KSMEDIUMSETID_Standard);
915 #define KSMEDIUMSETID_Standard DEFINE_GUIDNAMED(KSMEDIUMSETID_Standard)
916
917 //For compatibility only
918 #define KSMEDIUM_STANDARD_DEVIO KSMEDIUM_TYPE_ANYINSTANCE
919
920 //===========================================================================
921
922 #define STATIC_KSPROPSETID_Pin\
923 0x8C134960L, 0x51AD, 0x11CF, 0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00
924 DEFINE_GUIDSTRUCT("8C134960-51AD-11CF-878A-94F801C10000", KSPROPSETID_Pin);
925 #define KSPROPSETID_Pin DEFINE_GUIDNAMED(KSPROPSETID_Pin)
926
927 typedef enum {
928 KSPROPERTY_PIN_CINSTANCES,
929 KSPROPERTY_PIN_CTYPES,
930 KSPROPERTY_PIN_DATAFLOW,
931 KSPROPERTY_PIN_DATARANGES,
932 KSPROPERTY_PIN_DATAINTERSECTION,
933 KSPROPERTY_PIN_INTERFACES,
934 KSPROPERTY_PIN_MEDIUMS,
935 KSPROPERTY_PIN_COMMUNICATION,
936 KSPROPERTY_PIN_GLOBALCINSTANCES,
937 KSPROPERTY_PIN_NECESSARYINSTANCES,
938 KSPROPERTY_PIN_PHYSICALCONNECTION,
939 KSPROPERTY_PIN_CATEGORY,
940 KSPROPERTY_PIN_NAME,
941 KSPROPERTY_PIN_CONSTRAINEDDATARANGES,
942 KSPROPERTY_PIN_PROPOSEDATAFORMAT
943 } KSPROPERTY_PIN;
944
945 typedef struct {
946 KSPROPERTY Property;
947 ULONG PinId;
948 ULONG Reserved;
949 } KSP_PIN, *PKSP_PIN;
950
951 #define KSINSTANCE_INDETERMINATE ((ULONG)-1)
952
953 typedef struct {
954 ULONG PossibleCount;
955 ULONG CurrentCount;
956 } KSPIN_CINSTANCES, *PKSPIN_CINSTANCES;
957
958 typedef enum {
959 KSPIN_DATAFLOW_IN = 1,
960 KSPIN_DATAFLOW_OUT
961 } KSPIN_DATAFLOW, *PKSPIN_DATAFLOW;
962
963 #define KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION 0
964 #define KSDATAFORMAT_TEMPORAL_COMPRESSION (1 << KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION)
965 #define KSDATAFORMAT_BIT_ATTRIBUTES 1
966 #define KSDATAFORMAT_ATTRIBUTES (1 << KSDATAFORMAT_BIT_ATTRIBUTES)
967
968 #define KSDATARANGE_BIT_ATTRIBUTES 1
969 #define KSDATARANGE_ATTRIBUTES (1 << KSDATARANGE_BIT_ATTRIBUTES)
970 #define KSDATARANGE_BIT_REQUIRED_ATTRIBUTES 2
971 #define KSDATARANGE_REQUIRED_ATTRIBUTES (1 << KSDATARANGE_BIT_REQUIRED_ATTRIBUTES)
972
973 #if !defined( _MSC_VER )
974 typedef struct {
975 ULONG FormatSize;
976 ULONG Flags;
977 ULONG SampleSize;
978 ULONG Reserved;
979 GUID MajorFormat;
980 GUID SubFormat;
981 GUID Specifier;
982 } KSDATAFORMAT, *PKSDATAFORMAT, KSDATARANGE, *PKSDATARANGE;
983 #else
984 typedef union {
985 struct {
986 ULONG FormatSize;
987 ULONG Flags;
988 ULONG SampleSize;
989 ULONG Reserved;
990 GUID MajorFormat;
991 GUID SubFormat;
992 GUID Specifier;
993 };
994 LONGLONG Alignment;
995 } KSDATAFORMAT, *PKSDATAFORMAT, KSDATARANGE, *PKSDATARANGE;
996 #endif
997
998 #define KSATTRIBUTE_REQUIRED 0x00000001
999
1000 typedef struct {
1001 ULONG Size;
1002 ULONG Flags;
1003 GUID Attribute;
1004 } KSATTRIBUTE, *PKSATTRIBUTE;
1005
1006 #if defined(_NTDDK_)
1007 typedef struct {
1008 ULONG Count;
1009 PKSATTRIBUTE* Attributes;
1010 } KSATTRIBUTE_LIST, *PKSATTRIBUTE_LIST;
1011 #endif // _NTDDK_
1012
1013 typedef enum {
1014 KSPIN_COMMUNICATION_NONE,
1015 KSPIN_COMMUNICATION_SINK,
1016 KSPIN_COMMUNICATION_SOURCE,
1017 KSPIN_COMMUNICATION_BOTH,
1018 KSPIN_COMMUNICATION_BRIDGE
1019 } KSPIN_COMMUNICATION, *PKSPIN_COMMUNICATION;
1020
1021 typedef KSIDENTIFIER KSPIN_MEDIUM, *PKSPIN_MEDIUM;
1022
1023 typedef struct {
1024 KSPIN_INTERFACE Interface;
1025 KSPIN_MEDIUM Medium;
1026 ULONG PinId;
1027 HANDLE PinToHandle;
1028 KSPRIORITY Priority;
1029 } KSPIN_CONNECT, *PKSPIN_CONNECT;
1030
1031 typedef struct {
1032 ULONG Size;
1033 ULONG Pin;
1034 WCHAR SymbolicLinkName[1];
1035 } KSPIN_PHYSICALCONNECTION, *PKSPIN_PHYSICALCONNECTION;
1036
1037 #if defined(_NTDDK_)
1038 typedef
1039 NTSTATUS
1040 (*PFNKSINTERSECTHANDLER)(
1041 IN PIRP Irp,
1042 IN PKSP_PIN Pin,
1043 IN PKSDATARANGE DataRange,
1044 OUT PVOID Data OPTIONAL
1045 );
1046 typedef
1047 NTSTATUS
1048 (*PFNKSINTERSECTHANDLEREX)(
1049 IN PVOID Context,
1050 IN PIRP Irp,
1051 IN PKSP_PIN Pin,
1052 IN PKSDATARANGE DataRange,
1053 IN PKSDATARANGE MatchingDataRange,
1054 IN ULONG DataBufferSize,
1055 OUT PVOID Data OPTIONAL,
1056 OUT PULONG DataSize
1057 );
1058 #endif // _NTDDK_
1059
1060 #define DEFINE_KSPIN_INTERFACE_TABLE(tablename)\
1061 const KSPIN_INTERFACE tablename[] =
1062
1063 #define DEFINE_KSPIN_INTERFACE_ITEM(guid, interface)\
1064 {\
1065 STATICGUIDOF(guid),\
1066 (interface),\
1067 0\
1068 }
1069
1070 #define DEFINE_KSPIN_MEDIUM_TABLE( tablename )\
1071 const KSPIN_MEDIUM tablename[] =
1072
1073 #define DEFINE_KSPIN_MEDIUM_ITEM(guid, medium)\
1074 DEFINE_KSPIN_INTERFACE_ITEM(guid, medium)
1075
1076 #define DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(Handler)\
1077 DEFINE_KSPROPERTY_ITEM(\
1078 KSPROPERTY_PIN_CINSTANCES,\
1079 (Handler),\
1080 sizeof(KSP_PIN),\
1081 sizeof(KSPIN_CINSTANCES),\
1082 NULL, NULL, 0, NULL, NULL, 0)
1083
1084 #define DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(Handler)\
1085 DEFINE_KSPROPERTY_ITEM(\
1086 KSPROPERTY_PIN_CTYPES,\
1087 (Handler),\
1088 sizeof(KSPROPERTY),\
1089 sizeof(ULONG),\
1090 NULL, NULL, 0, NULL, NULL, 0)
1091
1092 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(Handler)\
1093 DEFINE_KSPROPERTY_ITEM(\
1094 KSPROPERTY_PIN_DATAFLOW,\
1095 (Handler),\
1096 sizeof(KSP_PIN),\
1097 sizeof(KSPIN_DATAFLOW),\
1098 NULL, NULL, 0, NULL, NULL, 0)
1099
1100 #define DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(Handler)\
1101 DEFINE_KSPROPERTY_ITEM(\
1102 KSPROPERTY_PIN_DATARANGES,\
1103 (Handler),\
1104 sizeof(KSP_PIN),\
1105 0,\
1106 NULL, NULL, 0, NULL, NULL, 0)
1107
1108 #define DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(Handler)\
1109 DEFINE_KSPROPERTY_ITEM(\
1110 KSPROPERTY_PIN_DATAINTERSECTION,\
1111 (Handler),\
1112 sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM),\
1113 0,\
1114 NULL, NULL, 0, NULL, NULL, 0)
1115
1116 #define DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(Handler)\
1117 DEFINE_KSPROPERTY_ITEM(\
1118 KSPROPERTY_PIN_INTERFACES,\
1119 (Handler),\
1120 sizeof(KSP_PIN),\
1121 0,\
1122 NULL, NULL, 0, NULL, NULL, 0)
1123
1124 #define DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(Handler)\
1125 DEFINE_KSPROPERTY_ITEM(\
1126 KSPROPERTY_PIN_MEDIUMS,\
1127 (Handler),\
1128 sizeof(KSP_PIN),\
1129 0,\
1130 NULL, NULL, 0, NULL, NULL, 0)
1131
1132 #define DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(Handler)\
1133 DEFINE_KSPROPERTY_ITEM(\
1134 KSPROPERTY_PIN_COMMUNICATION,\
1135 (Handler),\
1136 sizeof(KSP_PIN),\
1137 sizeof(KSPIN_COMMUNICATION),\
1138 NULL, NULL, 0, NULL, NULL, 0)
1139
1140 #define DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(Handler)\
1141 DEFINE_KSPROPERTY_ITEM(\
1142 KSPROPERTY_PIN_GLOBALCINSTANCES,\
1143 (Handler),\
1144 sizeof(KSP_PIN),\
1145 sizeof(KSPIN_CINSTANCES),\
1146 NULL, NULL, 0, NULL, NULL, 0)
1147
1148 #define DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(Handler)\
1149 DEFINE_KSPROPERTY_ITEM(\
1150 KSPROPERTY_PIN_NECESSARYINSTANCES,\
1151 (Handler),\
1152 sizeof(KSP_PIN),\
1153 sizeof(ULONG),\
1154 NULL, NULL, 0, NULL, NULL, 0)
1155
1156 #define DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(Handler)\
1157 DEFINE_KSPROPERTY_ITEM(\
1158 KSPROPERTY_PIN_PHYSICALCONNECTION,\
1159 (Handler),\
1160 sizeof(KSP_PIN),\
1161 0,\
1162 NULL, NULL, 0, NULL, NULL, 0)
1163
1164 #define DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(Handler)\
1165 DEFINE_KSPROPERTY_ITEM(\
1166 KSPROPERTY_PIN_CATEGORY,\
1167 (Handler),\
1168 sizeof(KSP_PIN),\
1169 sizeof(GUID),\
1170 NULL, NULL, 0, NULL, NULL, 0)
1171
1172 #define DEFINE_KSPROPERTY_ITEM_PIN_NAME(Handler)\
1173 DEFINE_KSPROPERTY_ITEM(\
1174 KSPROPERTY_PIN_NAME,\
1175 (Handler),\
1176 sizeof(KSP_PIN),\
1177 0,\
1178 NULL, NULL, 0, NULL, NULL, 0)
1179
1180 #define DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(Handler)\
1181 DEFINE_KSPROPERTY_ITEM(\
1182 KSPROPERTY_PIN_CONSTRAINEDDATARANGES,\
1183 (Handler),\
1184 sizeof(KSP_PIN),\
1185 0,\
1186 NULL, NULL, 0, NULL, NULL, 0)
1187
1188 #define DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(Handler)\
1189 DEFINE_KSPROPERTY_ITEM(\
1190 KSPROPERTY_PIN_PROPOSEDATAFORMAT,\
1191 NULL,\
1192 sizeof(KSP_PIN),\
1193 sizeof(KSDATAFORMAT),\
1194 (Handler), NULL, 0, NULL, NULL, 0)
1195
1196 #define DEFINE_KSPROPERTY_PINSET(PinSet,\
1197 PropGeneral, PropInstances, PropIntersection)\
1198 DEFINE_KSPROPERTY_TABLE(PinSet) {\
1199 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
1200 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
1201 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
1202 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
1203 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
1204 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
1205 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
1206 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
1207 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
1208 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral)\
1209 }
1210
1211 #define DEFINE_KSPROPERTY_PINSETCONSTRAINED(PinSet,\
1212 PropGeneral, PropInstances, PropIntersection)\
1213 DEFINE_KSPROPERTY_TABLE(PinSet) {\
1214 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
1215 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
1216 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
1217 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
1218 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
1219 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
1220 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
1221 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
1222 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
1223 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
1224 DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral)\
1225 }
1226
1227 #define STATIC_KSNAME_Filter\
1228 0x9b365890L, 0x165f, 0x11d0, 0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1229 DEFINE_GUIDSTRUCT("9b365890-165f-11d0-a195-0020afd156e4", KSNAME_Filter);
1230 #define KSNAME_Filter DEFINE_GUIDNAMED(KSNAME_Filter)
1231
1232 #define KSSTRING_Filter L"{9B365890-165F-11D0-A195-0020AFD156E4}"
1233
1234 #define STATIC_KSNAME_Pin\
1235 0x146F1A80L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1236 DEFINE_GUIDSTRUCT("146F1A80-4791-11D0-A5D6-28DB04C10000", KSNAME_Pin);
1237 #define KSNAME_Pin DEFINE_GUIDNAMED(KSNAME_Pin)
1238
1239 #define KSSTRING_Pin L"{146F1A80-4791-11D0-A5D6-28DB04C10000}"
1240
1241 #define STATIC_KSNAME_Clock\
1242 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1243 DEFINE_GUIDSTRUCT("53172480-4791-11D0-A5D6-28DB04C10000", KSNAME_Clock);
1244 #define KSNAME_Clock DEFINE_GUIDNAMED(KSNAME_Clock)
1245
1246 #define KSSTRING_Clock L"{53172480-4791-11D0-A5D6-28DB04C10000}"
1247
1248 #define STATIC_KSNAME_Allocator\
1249 0x642F5D00L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1250 DEFINE_GUIDSTRUCT("642F5D00-4791-11D0-A5D6-28DB04C10000", KSNAME_Allocator);
1251 #define KSNAME_Allocator DEFINE_GUIDNAMED(KSNAME_Allocator)
1252
1253 #define KSSTRING_Allocator L"{642F5D00-4791-11D0-A5D6-28DB04C10000}"
1254
1255 #define KSSTRING_AllocatorEx L"{091BB63B-603F-11D1-B067-00A0C9062802}"
1256
1257 #define STATIC_KSNAME_TopologyNode\
1258 0x0621061AL, 0xEE75, 0x11D0, 0xB9, 0x15, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1259 DEFINE_GUIDSTRUCT("0621061A-EE75-11D0-B915-00A0C9223196", KSNAME_TopologyNode);
1260 #define KSNAME_TopologyNode DEFINE_GUIDNAMED(KSNAME_TopologyNode)
1261
1262 #define KSSTRING_TopologyNode L"{0621061A-EE75-11D0-B915-00A0C9223196}"
1263
1264 #if defined(_NTDDK_)
1265
1266 typedef struct {
1267 ULONG InterfacesCount;
1268 const KSPIN_INTERFACE* Interfaces;
1269 ULONG MediumsCount;
1270 const KSPIN_MEDIUM* Mediums;
1271 ULONG DataRangesCount;
1272 const PKSDATARANGE* DataRanges;
1273 KSPIN_DATAFLOW DataFlow;
1274 KSPIN_COMMUNICATION Communication;
1275 const GUID* Category;
1276 const GUID* Name;
1277 union {
1278 LONGLONG Reserved;
1279 struct {
1280 ULONG ConstrainedDataRangesCount;
1281 PKSDATARANGE* ConstrainedDataRanges;
1282 };
1283 };
1284 } KSPIN_DESCRIPTOR, *PKSPIN_DESCRIPTOR;
1285 typedef const KSPIN_DESCRIPTOR *PCKSPIN_DESCRIPTOR;
1286
1287 #define DEFINE_KSPIN_DESCRIPTOR_TABLE(tablename)\
1288 const KSPIN_DESCRIPTOR tablename[] =
1289
1290 #define DEFINE_KSPIN_DESCRIPTOR_ITEM(\
1291 InterfacesCount, Interfaces,\
1292 MediumsCount, Mediums,\
1293 DataRangesCount, DataRanges,\
1294 DataFlow, Communication)\
1295 {\
1296 InterfacesCount, Interfaces, MediumsCount, Mediums,\
1297 DataRangesCount, DataRanges, DataFlow, Communication,\
1298 NULL, NULL, 0\
1299 }
1300 #define DEFINE_KSPIN_DESCRIPTOR_ITEMEX(\
1301 InterfacesCount, Interfaces,\
1302 MediumsCount, Mediums,\
1303 DataRangesCount, DataRanges,\
1304 DataFlow, Communication,\
1305 Category, Name)\
1306 {\
1307 InterfacesCount, Interfaces, MediumsCount, Mediums,\
1308 DataRangesCount, DataRanges, DataFlow, Communication,\
1309 Category, Name, 0\
1310 }
1311
1312 #endif // defined(_NTDDK_)
1313
1314 //===========================================================================
1315
1316 // MEDIATYPE_NULL
1317 #define STATIC_KSDATAFORMAT_TYPE_WILDCARD STATIC_GUID_NULL
1318 #define KSDATAFORMAT_TYPE_WILDCARD GUID_NULL
1319
1320 // MEDIASUBTYPE_NULL
1321 #define STATIC_KSDATAFORMAT_SUBTYPE_WILDCARD STATIC_GUID_NULL
1322 #define KSDATAFORMAT_SUBTYPE_WILDCARD GUID_NULL
1323
1324 // MEDIATYPE_Stream
1325 #define STATIC_KSDATAFORMAT_TYPE_STREAM\
1326 0xE436EB83L, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70
1327 DEFINE_GUIDSTRUCT("E436EB83-524F-11CE-9F53-0020AF0BA770", KSDATAFORMAT_TYPE_STREAM);
1328 #define KSDATAFORMAT_TYPE_STREAM DEFINE_GUIDNAMED(KSDATAFORMAT_TYPE_STREAM)
1329
1330 // MEDIASUBTYPE_None
1331 #define STATIC_KSDATAFORMAT_SUBTYPE_NONE\
1332 0xE436EB8EL, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70
1333 DEFINE_GUIDSTRUCT("E436EB8E-524F-11CE-9F53-0020AF0BA770", KSDATAFORMAT_SUBTYPE_NONE);
1334 #define KSDATAFORMAT_SUBTYPE_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_NONE)
1335
1336 #define STATIC_KSDATAFORMAT_SPECIFIER_WILDCARD STATIC_GUID_NULL
1337 #define KSDATAFORMAT_SPECIFIER_WILDCARD GUID_NULL
1338
1339 #define STATIC_KSDATAFORMAT_SPECIFIER_FILENAME\
1340 0xAA797B40L, 0xE974, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1341 DEFINE_GUIDSTRUCT("AA797B40-E974-11CF-A5D6-28DB04C10000", KSDATAFORMAT_SPECIFIER_FILENAME);
1342 #define KSDATAFORMAT_SPECIFIER_FILENAME DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_FILENAME)
1343
1344 #define STATIC_KSDATAFORMAT_SPECIFIER_FILEHANDLE\
1345 0x65E8773CL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1346 DEFINE_GUIDSTRUCT("65E8773C-8F56-11D0-A3B9-00A0C9223196", KSDATAFORMAT_SPECIFIER_FILEHANDLE);
1347 #define KSDATAFORMAT_SPECIFIER_FILEHANDLE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_FILEHANDLE)
1348
1349 // FORMAT_None
1350 #define STATIC_KSDATAFORMAT_SPECIFIER_NONE\
1351 0x0F6417D6L, 0xC318, 0x11D0, 0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
1352 DEFINE_GUIDSTRUCT("0F6417D6-C318-11D0-A43F-00A0C9223196", KSDATAFORMAT_SPECIFIER_NONE);
1353 #define KSDATAFORMAT_SPECIFIER_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_NONE)
1354
1355 //===========================================================================
1356
1357 #define STATIC_KSPROPSETID_Quality \
1358 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1359 DEFINE_GUIDSTRUCT("D16AD380-AC1A-11CF-A5D6-28DB04C10000", KSPROPSETID_Quality);
1360 #define KSPROPSETID_Quality DEFINE_GUIDNAMED(KSPROPSETID_Quality)
1361
1362 typedef enum {
1363 KSPROPERTY_QUALITY_REPORT,
1364 KSPROPERTY_QUALITY_ERROR
1365 } KSPROPERTY_QUALITY;
1366
1367 #define DEFINE_KSPROPERTY_ITEM_QUALITY_REPORT(GetHandler, SetHandler)\
1368 DEFINE_KSPROPERTY_ITEM(\
1369 KSPROPERTY_QUALITY_REPORT,\
1370 (GetHandler),\
1371 sizeof(KSPROPERTY),\
1372 sizeof(KSQUALITY),\
1373 (SetHandler),\
1374 NULL, 0, NULL, NULL, 0)
1375
1376 #define DEFINE_KSPROPERTY_ITEM_QUALITY_ERROR(GetHandler, SetHandler)\
1377 DEFINE_KSPROPERTY_ITEM(\
1378 KSPROPERTY_QUALITY_ERROR,\
1379 (GetHandler),\
1380 sizeof(KSPROPERTY),\
1381 sizeof(KSERROR),\
1382 (SetHandler),\
1383 NULL, 0, NULL, NULL, 0)
1384
1385 //===========================================================================
1386
1387 #define STATIC_KSPROPSETID_Connection \
1388 0x1D58C920L, 0xAC9B, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
1389 DEFINE_GUIDSTRUCT("1D58C920-AC9B-11CF-A5D6-28DB04C10000", KSPROPSETID_Connection);
1390 #define KSPROPSETID_Connection DEFINE_GUIDNAMED(KSPROPSETID_Connection)
1391
1392 typedef enum {
1393 KSPROPERTY_CONNECTION_STATE,
1394 KSPROPERTY_CONNECTION_PRIORITY,
1395 KSPROPERTY_CONNECTION_DATAFORMAT,
1396 KSPROPERTY_CONNECTION_ALLOCATORFRAMING,
1397 KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT,
1398 KSPROPERTY_CONNECTION_ACQUIREORDERING,
1399 KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX,
1400 KSPROPERTY_CONNECTION_STARTAT
1401 } KSPROPERTY_CONNECTION;
1402
1403 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(GetHandler, SetHandler)\
1404 DEFINE_KSPROPERTY_ITEM(\
1405 KSPROPERTY_CONNECTION_STATE,\
1406 (GetHandler),\
1407 sizeof(KSPROPERTY),\
1408 sizeof(KSSTATE),\
1409 (SetHandler),\
1410 NULL, 0, NULL, NULL, 0)
1411
1412 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_PRIORITY(GetHandler, SetHandler)\
1413 DEFINE_KSPROPERTY_ITEM(\
1414 KSPROPERTY_CONNECTION_PRIORITY,\
1415 (GetHandler),\
1416 sizeof(KSPROPERTY),\
1417 sizeof(KSPRIORITY),\
1418 (SetHandler),\
1419 NULL, 0, NULL, NULL, 0)
1420
1421 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_DATAFORMAT(GetHandler, SetHandler)\
1422 DEFINE_KSPROPERTY_ITEM(\
1423 KSPROPERTY_CONNECTION_DATAFORMAT,\
1424 (GetHandler),\
1425 sizeof(KSPROPERTY),\
1426 0,\
1427 (SetHandler),\
1428 NULL, 0, NULL, NULL, 0)
1429
1430 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING(Handler)\
1431 DEFINE_KSPROPERTY_ITEM(\
1432 KSPROPERTY_CONNECTION_ALLOCATORFRAMING,\
1433 (Handler),\
1434 sizeof(KSPROPERTY),\
1435 sizeof(KSALLOCATOR_FRAMING),\
1436 NULL, NULL, 0, NULL, NULL, 0)
1437
1438 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING_EX(Handler)\
1439 DEFINE_KSPROPERTY_ITEM(\
1440 KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX,\
1441 (Handler),\
1442 sizeof(KSPROPERTY),\
1443 sizeof(KSALLOCATOR_FRAMING_EX),\
1444 NULL, NULL, 0, NULL, NULL, 0)
1445
1446 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_PROPOSEDATAFORMAT(Handler)\
1447 DEFINE_KSPROPERTY_ITEM(\
1448 KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT,\
1449 NULL,\
1450 sizeof(KSPROPERTY),\
1451 sizeof(KSDATAFORMAT),\
1452 (Handler),\
1453 NULL, 0, NULL, NULL, 0)
1454
1455 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ACQUIREORDERING(Handler)\
1456 DEFINE_KSPROPERTY_ITEM(\
1457 KSPROPERTY_CONNECTION_ACQUIREORDERING,\
1458 (Handler),\
1459 sizeof(KSPROPERTY),\
1460 sizeof(int),\
1461 NULL, NULL, 0, NULL, NULL, 0)
1462
1463 #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STARTAT(Handler)\
1464 DEFINE_KSPROPERTY_ITEM(\
1465 KSPROPERTY_CONNECTION_STARTAT,\
1466 NULL,\
1467 sizeof(KSPROPERTY),\
1468 sizeof(KSRELATIVEEVENT),\
1469 (Handler),\
1470 NULL, 0, NULL, NULL, 0)
1471
1472 //===========================================================================
1473 //
1474 // pins flags
1475 //
1476 #define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001
1477 #define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002
1478 #define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004
1479 #define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008
1480 #define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000
1481
1482 #define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001
1483 #define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002
1484 #define KSALLOCATOR_OPTIONF_VALID 0x00000003
1485 //
1486 // pins extended framing flags
1487 //
1488 #define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010
1489 #define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020
1490 #define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040
1491 #define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080
1492 //
1493 // allocator pipes flags
1494 //
1495 // there is at least one data modification in a pipe
1496 #define KSALLOCATOR_FLAG_NO_FRAME_INTEGRITY 0x00000100
1497 #define KSALLOCATOR_FLAG_MULTIPLE_OUTPUT 0x00000200
1498 #define KSALLOCATOR_FLAG_CYCLE 0x00000400
1499 #define KSALLOCATOR_FLAG_ALLOCATOR_EXISTS 0x00000800
1500 // there is no framing dependency between neighbouring pipes.
1501 #define KSALLOCATOR_FLAG_INDEPENDENT_RANGES 0x00001000
1502 #define KSALLOCATOR_FLAG_ATTENTION_STEPPING 0x00002000
1503
1504
1505 //
1506 // old Framing structure
1507 //
1508 typedef struct {
1509 union {
1510 ULONG OptionsFlags; // allocator options (create)
1511 ULONG RequirementsFlags; // allocation requirements (query)
1512 };
1513 #if defined(_NTDDK_)
1514 POOL_TYPE PoolType;
1515 #else // !_NTDDK_
1516 ULONG PoolType;
1517 #endif // !_NTDDK_
1518 ULONG Frames; // total number of allowable outstanding frames
1519 ULONG FrameSize; // total size of frame
1520 ULONG FileAlignment;
1521 ULONG Reserved;
1522 } KSALLOCATOR_FRAMING, *PKSALLOCATOR_FRAMING;
1523
1524 #if defined(_NTDDK_)
1525 typedef
1526 PVOID
1527 (*PFNKSDEFAULTALLOCATE)(
1528 IN PVOID Context
1529 );
1530
1531 typedef
1532 VOID
1533 (*PFNKSDEFAULTFREE)(
1534 IN PVOID Context,
1535 IN PVOID Buffer
1536 );
1537
1538 typedef
1539 NTSTATUS
1540 (*PFNKSINITIALIZEALLOCATOR)(
1541 IN PVOID InitialContext,
1542 IN PKSALLOCATOR_FRAMING AllocatorFraming,
1543 OUT PVOID* Context
1544 );
1545
1546 typedef
1547 VOID
1548 (*PFNKSDELETEALLOCATOR)(
1549 IN PVOID Context
1550 );
1551 #endif // !_NTDDK_
1552
1553 //
1554 // new Framing structure, eventually will replace KSALLOCATOR_FRAMING.
1555 //
1556 typedef struct {
1557 ULONG MinFrameSize;
1558 ULONG MaxFrameSize;
1559 ULONG Stepping;
1560 } KS_FRAMING_RANGE, *PKS_FRAMING_RANGE;
1561
1562
1563 typedef struct {
1564 KS_FRAMING_RANGE Range;
1565 ULONG InPlaceWeight;
1566 ULONG NotInPlaceWeight;
1567 } KS_FRAMING_RANGE_WEIGHTED, *PKS_FRAMING_RANGE_WEIGHTED;
1568
1569
1570 typedef struct {
1571 ULONG RatioNumerator; // compression/expansion ratio
1572 ULONG RatioDenominator;
1573 ULONG RatioConstantMargin;
1574 } KS_COMPRESSION, *PKS_COMPRESSION;
1575
1576
1577 //
1578 // Memory Types and Buses are repeated in each entry.
1579 // Easiest to use but takes a little more memory than the varsize layout Pin\Memories\Buses\Ranges.
1580 //
1581 typedef struct {
1582 GUID MemoryType;
1583 GUID BusType;
1584 ULONG MemoryFlags;
1585 ULONG BusFlags;
1586 ULONG Flags;
1587 ULONG Frames; // total number of allowable outstanding frames
1588 ULONG FileAlignment;
1589 ULONG MemoryTypeWeight; // this memory type Weight pin-wide
1590 KS_FRAMING_RANGE PhysicalRange;
1591 KS_FRAMING_RANGE_WEIGHTED FramingRange;
1592 } KS_FRAMING_ITEM, *PKS_FRAMING_ITEM;
1593
1594
1595 typedef struct {
1596 ULONG CountItems; // count of FramingItem-s below.
1597 ULONG PinFlags;
1598 KS_COMPRESSION OutputCompression;
1599 ULONG PinWeight; // this pin framing's Weight graph-wide
1600 KS_FRAMING_ITEM FramingItem[1];
1601 } KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX;
1602
1603
1604
1605 //
1606 // define memory type GUIDs
1607 //
1608 #define KSMEMORY_TYPE_WILDCARD GUID_NULL
1609 #define STATIC_KSMEMORY_TYPE_WILDCARD STATIC_GUID_NULL
1610
1611 #define KSMEMORY_TYPE_DONT_CARE GUID_NULL
1612 #define STATIC_KSMEMORY_TYPE_DONT_CARE STATIC_GUID_NULL
1613
1614 #define KS_TYPE_DONT_CARE GUID_NULL
1615 #define STATIC_KS_TYPE_DONT_CARE STATIC_GUID_NULL
1616
1617 #define STATIC_KSMEMORY_TYPE_SYSTEM \
1618 0x091bb638L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1619 DEFINE_GUIDSTRUCT("091bb638-603f-11d1-b067-00a0c9062802", KSMEMORY_TYPE_SYSTEM);
1620 #define KSMEMORY_TYPE_SYSTEM DEFINE_GUIDNAMED(KSMEMORY_TYPE_SYSTEM)
1621
1622 #define STATIC_KSMEMORY_TYPE_USER \
1623 0x8cb0fc28L, 0x7893, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1624 DEFINE_GUIDSTRUCT("8cb0fc28-7893-11d1-b069-00a0c9062802", KSMEMORY_TYPE_USER);
1625 #define KSMEMORY_TYPE_USER DEFINE_GUIDNAMED(KSMEMORY_TYPE_USER)
1626
1627 #define STATIC_KSMEMORY_TYPE_KERNEL_PAGED \
1628 0xd833f8f8L, 0x7894, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1629 DEFINE_GUIDSTRUCT("d833f8f8-7894-11d1-b069-00a0c9062802", KSMEMORY_TYPE_KERNEL_PAGED);
1630 #define KSMEMORY_TYPE_KERNEL_PAGED DEFINE_GUIDNAMED(KSMEMORY_TYPE_KERNEL_PAGED)
1631
1632 #define STATIC_KSMEMORY_TYPE_KERNEL_NONPAGED \
1633 0x4a6d5fc4L, 0x7895, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1634 DEFINE_GUIDSTRUCT("4a6d5fc4-7895-11d1-b069-00a0c9062802", KSMEMORY_TYPE_KERNEL_NONPAGED);
1635 #define KSMEMORY_TYPE_KERNEL_NONPAGED DEFINE_GUIDNAMED(KSMEMORY_TYPE_KERNEL_NONPAGED)
1636
1637 // old KS clients did not specify the device memory type
1638 #define STATIC_KSMEMORY_TYPE_DEVICE_UNKNOWN \
1639 0x091bb639L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
1640 DEFINE_GUIDSTRUCT("091bb639-603f-11d1-b067-00a0c9062802", KSMEMORY_TYPE_DEVICE_UNKNOWN);
1641 #define KSMEMORY_TYPE_DEVICE_UNKNOWN DEFINE_GUIDNAMED(KSMEMORY_TYPE_DEVICE_UNKNOWN)
1642
1643 //
1644 // Helper framing macros.
1645 //
1646 #define DECLARE_SIMPLE_FRAMING_EX(FramingExName, MemoryType, Flags, Frames, Alignment, MinFrameSize, MaxFrameSize) \
1647 const KSALLOCATOR_FRAMING_EX FramingExName = \
1648 {\
1649 1, \
1650 0, \
1651 {\
1652 1, \
1653 1, \
1654 0 \
1655 }, \
1656 0, \
1657 {\
1658 {\
1659 MemoryType, \
1660 STATIC_KS_TYPE_DONT_CARE, \
1661 0, \
1662 0, \
1663 Flags, \
1664 Frames, \
1665 Alignment, \
1666 0, \
1667 {\
1668 0, \
1669 (ULONG)-1, \
1670 1 \
1671 }, \
1672 {\
1673 {\
1674 MinFrameSize, \
1675 MaxFrameSize, \
1676 1 \
1677 }, \
1678 0, \
1679 0 \
1680 }\
1681 }\
1682 }\
1683 }
1684
1685 #define SetDefaultKsCompression(KsCompressionPointer) \
1686 {\
1687 KsCompressionPointer->RatioNumerator = 1;\
1688 KsCompressionPointer->RatioDenominator = 1;\
1689 KsCompressionPointer->RatioConstantMargin = 0;\
1690 }
1691
1692 #define SetDontCareKsFramingRange(KsFramingRangePointer) \
1693 {\
1694 KsFramingRangePointer->MinFrameSize = 0;\
1695 KsFramingRangePointer->MaxFrameSize = (ULONG) -1;\
1696 KsFramingRangePointer->Stepping = 1;\
1697 }
1698
1699 #define SetKsFramingRange(KsFramingRangePointer, P_MinFrameSize, P_MaxFrameSize) \
1700 {\
1701 KsFramingRangePointer->MinFrameSize = P_MinFrameSize;\
1702 KsFramingRangePointer->MaxFrameSize = P_MaxFrameSize;\
1703 KsFramingRangePointer->Stepping = 1;\
1704 }
1705
1706 #define SetKsFramingRangeWeighted(KsFramingRangeWeightedPointer, P_MinFrameSize, P_MaxFrameSize) \
1707 {\
1708 KS_FRAMING_RANGE *KsFramingRange = &KsFramingRangeWeightedPointer->Range;\
1709 SetKsFramingRange(KsFramingRange, P_MinFrameSize, P_MaxFrameSize);\
1710 KsFramingRangeWeightedPointer->InPlaceWeight = 0;\
1711 KsFramingRangeWeightedPointer->NotInPlaceWeight = 0;\
1712 }
1713
1714 #define INITIALIZE_SIMPLE_FRAMING_EX(FramingExPointer, P_MemoryType, P_Flags, P_Frames, P_Alignment, P_MinFrameSize, P_MaxFrameSize) \
1715 {\
1716 KS_COMPRESSION *KsCompression = &FramingExPointer->OutputCompression;\
1717 KS_FRAMING_RANGE *KsFramingRange = &FramingExPointer->FramingItem[0].PhysicalRange;\
1718 KS_FRAMING_RANGE_WEIGHTED *KsFramingRangeWeighted = &FramingExPointer->FramingItem[0].FramingRange;\
1719 FramingExPointer->CountItems = 1;\
1720 FramingExPointer->PinFlags = 0;\
1721 SetDefaultKsCompression(KsCompression);\
1722 FramingExPointer->PinWeight = 0;\
1723 FramingExPointer->FramingItem[0].MemoryType = P_MemoryType;\
1724 FramingExPointer->FramingItem[0].BusType = KS_TYPE_DONT_CARE;\
1725 FramingExPointer->FramingItem[0].MemoryFlags = 0;\
1726 FramingExPointer->FramingItem[0].BusFlags = 0;\
1727 FramingExPointer->FramingItem[0].Flags = P_Flags;\
1728 FramingExPointer->FramingItem[0].Frames = P_Frames;\
1729 FramingExPointer->FramingItem[0].FileAlignment = P_Alignment;\
1730 FramingExPointer->FramingItem[0].MemoryTypeWeight = 0;\
1731 SetDontCareKsFramingRange(KsFramingRange);\
1732 SetKsFramingRangeWeighted(KsFramingRangeWeighted, P_MinFrameSize, P_MaxFrameSize);\
1733 }
1734
1735
1736
1737 // KSEVENTSETID_StreamAllocator: {75D95571-073C-11d0-A161-0020AFD156E4}
1738
1739 #define STATIC_KSEVENTSETID_StreamAllocator\
1740 0x75d95571L, 0x073c, 0x11d0, 0xa1, 0x61, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1741 DEFINE_GUIDSTRUCT("75d95571-073c-11d0-a161-0020afd156e4", KSEVENTSETID_StreamAllocator);
1742 #define KSEVENTSETID_StreamAllocator DEFINE_GUIDNAMED(KSEVENTSETID_StreamAllocator)
1743
1744 typedef enum {
1745 KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME,
1746 KSEVENT_STREAMALLOCATOR_FREEFRAME
1747 } KSEVENT_STREAMALLOCATOR;
1748
1749 #define STATIC_KSMETHODSETID_StreamAllocator\
1750 0xcf6e4341L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1751 DEFINE_GUIDSTRUCT("cf6e4341-ec87-11cf-a130-0020afd156e4", KSMETHODSETID_StreamAllocator);
1752 #define KSMETHODSETID_StreamAllocator DEFINE_GUIDNAMED(KSMETHODSETID_StreamAllocator)
1753
1754 typedef enum {
1755 KSMETHOD_STREAMALLOCATOR_ALLOC,
1756 KSMETHOD_STREAMALLOCATOR_FREE
1757 } KSMETHOD_STREAMALLOCATOR;
1758
1759 #define DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_ALLOC(Handler)\
1760 DEFINE_KSMETHOD_ITEM(\
1761 KSMETHOD_STREAMALLOCATOR_ALLOC,\
1762 KSMETHOD_TYPE_WRITE,\
1763 (Handler),\
1764 sizeof(KSMETHOD),\
1765 sizeof(PVOID),\
1766 NULL)
1767
1768 #define DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_FREE(Handler)\
1769 DEFINE_KSMETHOD_ITEM(\
1770 KSMETHOD_STREAMALLOCATOR_FREE,\
1771 KSMETHOD_TYPE_READ,\
1772 (Handler),\
1773 sizeof(KSMETHOD),\
1774 sizeof(PVOID),\
1775 NULL)
1776
1777 #define DEFINE_KSMETHOD_ALLOCATORSET(AllocatorSet, MethodAlloc, MethodFree)\
1778 DEFINE_KSMETHOD_TABLE(AllocatorSet) {\
1779 DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_ALLOC(MethodAlloc),\
1780 DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_FREE(MethodFree)\
1781 }
1782
1783 #define STATIC_KSPROPSETID_StreamAllocator\
1784 0xcf6e4342L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1785 DEFINE_GUIDSTRUCT("cf6e4342-ec87-11cf-a130-0020afd156e4", KSPROPSETID_StreamAllocator);
1786 #define KSPROPSETID_StreamAllocator DEFINE_GUIDNAMED(KSPROPSETID_StreamAllocator)
1787
1788 #if defined(_NTDDK_)
1789 typedef enum {
1790 KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE,
1791 KSPROPERTY_STREAMALLOCATOR_STATUS
1792 } KSPROPERTY_STREAMALLOCATOR;
1793
1794 #define DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_FUNCTIONTABLE(Handler)\
1795 DEFINE_KSPROPERTY_ITEM(\
1796 KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE,\
1797 (Handler),\
1798 sizeof(KSPROPERTY),\
1799 sizeof(KSSTREAMALLOCATOR_FUNCTIONTABLE),\
1800 NULL, NULL, 0, NULL, NULL, 0)
1801
1802 #define DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_STATUS(Handler)\
1803 DEFINE_KSPROPERTY_ITEM(\
1804 KSPROPERTY_STREAMALLOCATOR_STATUS,\
1805 (Handler),\
1806 sizeof(KSPROPERTY),\
1807 sizeof(KSSTREAMALLOCATOR_STATUS),\
1808 NULL, NULL, 0, NULL, NULL, 0)
1809
1810 #define DEFINE_KSPROPERTY_ALLOCATORSET(AllocatorSet, PropFunctionTable, PropStatus)\
1811 DEFINE_KSPROPERTY_TABLE(AllocatorSet) {\
1812 DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_STATUS(PropStatus),\
1813 DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_FUNCTIONTABLE(PropFunctionTable)\
1814 }
1815
1816 typedef
1817 NTSTATUS
1818 (*PFNALLOCATOR_ALLOCATEFRAME)(
1819 IN PFILE_OBJECT FileObject,
1820 PVOID *Frame
1821 );
1822
1823 typedef
1824 VOID
1825 (*PFNALLOCATOR_FREEFRAME)(
1826 IN PFILE_OBJECT FileObject,
1827 IN PVOID Frame
1828 );
1829
1830 typedef struct {
1831 PFNALLOCATOR_ALLOCATEFRAME AllocateFrame;
1832 PFNALLOCATOR_FREEFRAME FreeFrame;
1833 } KSSTREAMALLOCATOR_FUNCTIONTABLE, *PKSSTREAMALLOCATOR_FUNCTIONTABLE;
1834 #endif // defined(_NTDDK_)
1835
1836 typedef struct {
1837 KSALLOCATOR_FRAMING Framing;
1838 ULONG AllocatedFrames;
1839 ULONG Reserved;
1840 } KSSTREAMALLOCATOR_STATUS, *PKSSTREAMALLOCATOR_STATUS;
1841
1842 typedef struct {
1843 KSALLOCATOR_FRAMING_EX Framing;
1844 ULONG AllocatedFrames;
1845 ULONG Reserved;
1846 } KSSTREAMALLOCATOR_STATUS_EX, *PKSSTREAMALLOCATOR_STATUS_EX;
1847
1848
1849 #define KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT 0x00000001
1850 #define KSSTREAM_HEADER_OPTIONSF_PREROLL 0x00000002
1851 #define KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY 0x00000004
1852 #define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED 0x00000008
1853 #define KSSTREAM_HEADER_OPTIONSF_TIMEVALID 0x00000010
1854 #define KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY 0x00000040
1855 #define KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE 0x00000080
1856 #define KSSTREAM_HEADER_OPTIONSF_DURATIONVALID 0x00000100
1857 #define KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM 0x00000200
1858 #define KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA 0x80000000
1859
1860 typedef struct {
1861 LONGLONG Time;
1862 ULONG Numerator;
1863 ULONG Denominator;
1864 } KSTIME, *PKSTIME;
1865
1866 typedef struct {
1867 ULONG Size;
1868 ULONG TypeSpecificFlags;
1869 KSTIME PresentationTime;
1870 LONGLONG Duration;
1871 ULONG FrameExtent;
1872 ULONG DataUsed;
1873 PVOID Data;
1874 ULONG OptionsFlags;
1875 #if _WIN64
1876 ULONG Reserved;
1877 #endif
1878 } KSSTREAM_HEADER, *PKSSTREAM_HEADER;
1879
1880 #define STATIC_KSPROPSETID_StreamInterface\
1881 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a
1882 DEFINE_GUIDSTRUCT("1fdd8ee1-9cd3-11d0-82aa-0000f822fe8a", KSPROPSETID_StreamInterface);
1883 #define KSPROPSETID_StreamInterface DEFINE_GUIDNAMED(KSPROPSETID_StreamInterface)
1884
1885 typedef enum {
1886 KSPROPERTY_STREAMINTERFACE_HEADERSIZE
1887 } KSPROPERTY_STREAMINTERFACE;
1888
1889 #define DEFINE_KSPROPERTY_ITEM_STREAMINTERFACE_HEADERSIZE( GetHandler )\
1890 DEFINE_KSPROPERTY_ITEM(\
1891 KSPROPERTY_STREAMINTERFACE_HEADERSIZE,\
1892 (GetHandler),\
1893 sizeof(KSPROPERTY),\
1894 sizeof(ULONG),\
1895 NULL, NULL, 0, NULL, NULL, 0)
1896
1897 #define DEFINE_KSPROPERTY_STREAMINTERFACESET(StreamInterfaceSet,\
1898 HeaderSizeHandler)\
1899 DEFINE_KSPROPERTY_TABLE(StreamInterfaceSet) {\
1900 DEFINE_KSPROPERTY_ITEM_STREAMINTERFACE_HEADERSIZE( HeaderSizeHandler )\
1901 }
1902
1903 #define STATIC_KSPROPSETID_Stream\
1904 0x65aaba60L, 0x98ae, 0x11cf, 0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
1905 DEFINE_GUIDSTRUCT("65aaba60-98ae-11cf-a10d-0020afd156e4", KSPROPSETID_Stream);
1906 #define KSPROPSETID_Stream DEFINE_GUIDNAMED(KSPROPSETID_Stream)
1907
1908 typedef enum {
1909 KSPROPERTY_STREAM_ALLOCATOR,
1910 KSPROPERTY_STREAM_QUALITY,
1911 KSPROPERTY_STREAM_DEGRADATION,
1912 KSPROPERTY_STREAM_MASTERCLOCK,
1913 KSPROPERTY_STREAM_TIMEFORMAT,
1914 KSPROPERTY_STREAM_PRESENTATIONTIME,
1915 KSPROPERTY_STREAM_PRESENTATIONEXTENT,
1916 KSPROPERTY_STREAM_FRAMETIME,
1917 KSPROPERTY_STREAM_RATECAPABILITY,
1918 KSPROPERTY_STREAM_RATE,
1919 KSPROPERTY_STREAM_PIPE_ID
1920 } KSPROPERTY_STREAM;
1921
1922 #define DEFINE_KSPROPERTY_ITEM_STREAM_ALLOCATOR(GetHandler, SetHandler)\
1923 DEFINE_KSPROPERTY_ITEM(\
1924 KSPROPERTY_STREAM_ALLOCATOR,\
1925 (GetHandler),\
1926 sizeof(KSPROPERTY),\
1927 sizeof(HANDLE),\
1928 (SetHandler),\
1929 NULL, 0, NULL, NULL, 0)
1930
1931 #define DEFINE_KSPROPERTY_ITEM_STREAM_QUALITY(Handler)\
1932 DEFINE_KSPROPERTY_ITEM(\
1933 KSPROPERTY_STREAM_QUALITY,\
1934 (Handler),\
1935 sizeof(KSPROPERTY),\
1936 sizeof(KSQUALITY_MANAGER),\
1937 NULL, NULL, 0, NULL, NULL, 0)
1938
1939 #define DEFINE_KSPROPERTY_ITEM_STREAM_DEGRADATION(GetHandler, SetHandler)\
1940 DEFINE_KSPROPERTY_ITEM(\
1941 KSPROPERTY_STREAM_DEGRADATION,\
1942 (GetHandler),\
1943 sizeof(KSPROPERTY),\
1944 0,\
1945 (SetHandler),\
1946 NULL, 0, NULL, NULL, 0)
1947
1948 #define DEFINE_KSPROPERTY_ITEM_STREAM_MASTERCLOCK(GetHandler, SetHandler)\
1949 DEFINE_KSPROPERTY_ITEM(\
1950 KSPROPERTY_STREAM_MASTERCLOCK,\
1951 (GetHandler),\
1952 sizeof(KSPROPERTY),\
1953 sizeof(HANDLE),\
1954 (SetHandler),\
1955 NULL, 0, NULL, NULL, 0)
1956
1957 #define DEFINE_KSPROPERTY_ITEM_STREAM_TIMEFORMAT(Handler)\
1958 DEFINE_KSPROPERTY_ITEM(\
1959 KSPROPERTY_STREAM_TIMEFORMAT,\
1960 (Handler),\
1961 sizeof(KSPROPERTY),\
1962 sizeof(GUID),\
1963 NULL, NULL, 0, NULL, NULL, 0)
1964
1965 #define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONTIME(GetHandler, SetHandler)\
1966 DEFINE_KSPROPERTY_ITEM(\
1967 KSPROPERTY_STREAM_PRESENTATIONTIME,\
1968 (GetHandler),\
1969 sizeof(KSPROPERTY),\
1970 sizeof(KSTIME),\
1971 (SetHandler),\
1972 NULL, 0, NULL, NULL, 0)
1973
1974 #define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONEXTENT(Handler)\
1975 DEFINE_KSPROPERTY_ITEM(\
1976 KSPROPERTY_STREAM_PRESENTATIONEXTENT,\
1977 (Handler),\
1978 sizeof(KSPROPERTY),\
1979 sizeof(LONGLONG),\
1980 NULL, NULL, 0, NULL, NULL, 0)
1981
1982 #define DEFINE_KSPROPERTY_ITEM_STREAM_FRAMETIME(Handler)\
1983 DEFINE_KSPROPERTY_ITEM(\
1984 KSPROPERTY_STREAM_FRAMETIME,\
1985 (Handler),\
1986 sizeof(KSPROPERTY),\
1987 sizeof(KSFRAMETIME),\
1988 NULL, NULL, 0, NULL, NULL, 0)
1989
1990 #define DEFINE_KSPROPERTY_ITEM_STREAM_RATECAPABILITY(Handler)\
1991 DEFINE_KSPROPERTY_ITEM(\
1992 KSPROPERTY_STREAM_RATECAPABILITY,\
1993 (Handler),\
1994 sizeof(KSRATE_CAPABILITY),\
1995 sizeof(KSRATE),\
1996 NULL, NULL, 0, NULL, NULL, 0)
1997
1998 #define DEFINE_KSPROPERTY_ITEM_STREAM_RATE(GetHandler, SetHandler)\
1999 DEFINE_KSPROPERTY_ITEM(\
2000 KSPROPERTY_STREAM_RATE,\
2001 (GetHandler),\
2002 sizeof(KSPROPERTY),\
2003 sizeof(KSRATE),\
2004 (SetHandler),\
2005 NULL, 0, NULL, NULL, 0)
2006
2007 #define DEFINE_KSPROPERTY_ITEM_STREAM_PIPE_ID(GetHandler, SetHandler)\
2008 DEFINE_KSPROPERTY_ITEM(\
2009 KSPROPERTY_STREAM_PIPE_ID,\
2010 (GetHandler),\
2011 sizeof(KSPROPERTY),\
2012 sizeof(HANDLE),\
2013 (SetHandler),\
2014 NULL, 0, NULL, NULL, 0)
2015
2016 typedef struct {
2017 HANDLE QualityManager;
2018 PVOID Context;
2019 } KSQUALITY_MANAGER, *PKSQUALITY_MANAGER;
2020
2021 typedef struct {
2022 LONGLONG Duration;
2023 ULONG FrameFlags;
2024 ULONG Reserved;
2025 } KSFRAMETIME, *PKSFRAMETIME;
2026
2027 #define KSFRAMETIME_VARIABLESIZE 0x00000001
2028
2029 typedef struct {
2030 LONGLONG PresentationStart;
2031 LONGLONG Duration;
2032 KSPIN_INTERFACE Interface;
2033 LONG Rate;
2034 ULONG Flags;
2035 } KSRATE, *PKSRATE;
2036
2037 #define KSRATE_NOPRESENTATIONSTART 0x00000001
2038 #define KSRATE_NOPRESENTATIONDURATION 0x00000002
2039
2040 typedef struct {
2041 KSPROPERTY Property;
2042 KSRATE Rate;
2043 } KSRATE_CAPABILITY, *PKSRATE_CAPABILITY;
2044
2045 #define STATIC_KSPROPSETID_Clock \
2046 0xDF12A4C0L, 0xAC17, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
2047 DEFINE_GUIDSTRUCT("DF12A4C0-AC17-11CF-A5D6-28DB04C10000", KSPROPSETID_Clock);
2048 #define KSPROPSETID_Clock DEFINE_GUIDNAMED(KSPROPSETID_Clock)
2049
2050 //
2051 // Performs a x*y/z operation on 64 bit quantities by splitting the operation. The equation
2052 // is simplified with respect to adding in the remainder for the upper 32 bits.
2053 //
2054 // (xh * 10000000 / Frequency) * 2^32 + ((((xh * 10000000) % Frequency) * 2^32 + (xl * 10000000)) / Frequency)
2055 //
2056 #define NANOSECONDS 10000000
2057 #define KSCONVERT_PERFORMANCE_TIME(Frequency, PerformanceTime) \
2058 ((((ULONGLONG)(ULONG)(PerformanceTime).HighPart * NANOSECONDS / (Frequency)) << 32) + \
2059 ((((((ULONGLONG)(ULONG)(PerformanceTime).HighPart * NANOSECONDS) % (Frequency)) << 32) + \
2060 ((ULONGLONG)(PerformanceTime).LowPart * NANOSECONDS)) / (Frequency)))
2061
2062 typedef struct {
2063 ULONG CreateFlags;
2064 } KSCLOCK_CREATE, *PKSCLOCK_CREATE;
2065
2066 typedef struct {
2067 LONGLONG Time;
2068 LONGLONG SystemTime;
2069 } KSCORRELATED_TIME, *PKSCORRELATED_TIME;
2070
2071 typedef struct {
2072 LONGLONG Granularity;
2073 LONGLONG Error;
2074 } KSRESOLUTION, *PKSRESOLUTION;
2075
2076 typedef enum {
2077 KSPROPERTY_CLOCK_TIME,
2078 KSPROPERTY_CLOCK_PHYSICALTIME,
2079 KSPROPERTY_CLOCK_CORRELATEDTIME,
2080 KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME,
2081 KSPROPERTY_CLOCK_RESOLUTION,
2082 KSPROPERTY_CLOCK_STATE,
2083 #if defined(_NTDDK_)
2084 KSPROPERTY_CLOCK_FUNCTIONTABLE
2085 #endif // defined(_NTDDK_)
2086 } KSPROPERTY_CLOCK;
2087
2088 #if defined(_NTDDK_)
2089
2090 typedef
2091 LONGLONG
2092 (FASTCALL *PFNKSCLOCK_GETTIME)(
2093 IN PFILE_OBJECT FileObject
2094 );
2095 typedef
2096 LONGLONG
2097 (FASTCALL *PFNKSCLOCK_CORRELATEDTIME)(
2098 IN PFILE_OBJECT FileObject,
2099 OUT PLONGLONG SystemTime);
2100
2101 typedef struct {
2102 PFNKSCLOCK_GETTIME GetTime;
2103 PFNKSCLOCK_GETTIME GetPhysicalTime;
2104 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime;
2105 PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime;
2106 } KSCLOCK_FUNCTIONTABLE, *PKSCLOCK_FUNCTIONTABLE;
2107
2108 typedef
2109 BOOLEAN
2110 (*PFNKSSETTIMER)(
2111 IN PVOID Context,
2112 IN PKTIMER Timer,
2113 IN LARGE_INTEGER DueTime,
2114 IN PKDPC Dpc
2115 );
2116
2117 typedef
2118 BOOLEAN
2119 (*PFNKSCANCELTIMER)(
2120 IN PVOID Context,
2121 IN PKTIMER Timer
2122 );
2123
2124 typedef
2125 LONGLONG
2126 (FASTCALL *PFNKSCORRELATEDTIME)(
2127 IN PVOID Context,
2128 OUT PLONGLONG SystemTime);
2129
2130 typedef PVOID PKSDEFAULTCLOCK;
2131
2132 #define DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(Handler)\
2133 DEFINE_KSPROPERTY_ITEM(\
2134 KSPROPERTY_CLOCK_TIME,\
2135 (Handler),\
2136 sizeof(KSPROPERTY),\
2137 sizeof(LONGLONG),\
2138 NULL, NULL, 0, NULL, NULL, 0)
2139
2140 #define DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(Handler)\
2141 DEFINE_KSPROPERTY_ITEM(\
2142 KSPROPERTY_CLOCK_PHYSICALTIME,\
2143 (Handler),\
2144 sizeof(KSPROPERTY),\
2145 sizeof(LONGLONG),\
2146 NULL, NULL, 0, NULL, NULL, 0)
2147
2148 #define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(Handler)\
2149 DEFINE_KSPROPERTY_ITEM(\
2150 KSPROPERTY_CLOCK_CORRELATEDTIME,\
2151 (Handler),\
2152 sizeof(KSPROPERTY),\
2153 sizeof(KSCORRELATED_TIME),\
2154 NULL, NULL, 0, NULL, NULL, 0)
2155
2156 #define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(Handler)\
2157 DEFINE_KSPROPERTY_ITEM(\
2158 KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME,\
2159 (Handler),\
2160 sizeof(KSPROPERTY),\
2161 sizeof(KSCORRELATED_TIME),\
2162 NULL, NULL, 0, NULL, NULL, 0)
2163
2164 #define DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(Handler)\
2165 DEFINE_KSPROPERTY_ITEM(\
2166 KSPROPERTY_CLOCK_RESOLUTION,\
2167 (Handler),\
2168 sizeof(KSPROPERTY),\
2169 sizeof(KSRESOLUTION),\
2170 NULL, NULL, 0, NULL, NULL, 0)
2171
2172 #define DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(Handler)\
2173 DEFINE_KSPROPERTY_ITEM(\
2174 KSPROPERTY_CLOCK_STATE,\
2175 (Handler),\
2176 sizeof(KSPROPERTY),\
2177 sizeof(KSSTATE),\
2178 NULL, NULL, 0, NULL, NULL, 0)
2179
2180 #define DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(Handler)\
2181 DEFINE_KSPROPERTY_ITEM(\
2182 KSPROPERTY_CLOCK_FUNCTIONTABLE,\
2183 (Handler),\
2184 sizeof(KSPROPERTY),\
2185 sizeof(KSCLOCK_FUNCTIONTABLE),\
2186 NULL, NULL, 0, NULL, NULL, 0)
2187
2188 #define DEFINE_KSPROPERTY_CLOCKSET(ClockSet,\
2189 PropTime, PropPhysicalTime,\
2190 PropCorrelatedTime, PropCorrelatedPhysicalTime,\
2191 PropResolution, PropState, PropFunctionTable)\
2192 DEFINE_KSPROPERTY_TABLE(ClockSet) {\
2193 DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(PropTime),\
2194 DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(PropPhysicalTime),\
2195 DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(PropCorrelatedTime),\
2196 DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(PropCorrelatedPhysicalTime),\
2197 DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(PropResolution),\
2198 DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(PropState),\
2199 DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(PropFunctionTable),\
2200 }
2201
2202 #endif // defined(_NTDDK_)
2203
2204 #define STATIC_KSEVENTSETID_Clock \
2205 0x364D8E20L, 0x62C7, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
2206 DEFINE_GUIDSTRUCT("364D8E20-62C7-11CF-A5D6-28DB04C10000", KSEVENTSETID_Clock);
2207 #define KSEVENTSETID_Clock DEFINE_GUIDNAMED(KSEVENTSETID_Clock)
2208
2209 typedef enum {
2210 KSEVENT_CLOCK_INTERVAL_MARK,
2211 KSEVENT_CLOCK_POSITION_MARK
2212 } KSEVENT_CLOCK_POSITION;
2213
2214 #define STATIC_KSEVENTSETID_Connection\
2215 0x7f4bcbe0L, 0x9ea5, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00
2216 DEFINE_GUIDSTRUCT("7f4bcbe0-9ea5-11cf-a5d6-28db04c10000", KSEVENTSETID_Connection);
2217 #define KSEVENTSETID_Connection DEFINE_GUIDNAMED(KSEVENTSETID_Connection)
2218
2219 typedef enum {
2220 KSEVENT_CONNECTION_POSITIONUPDATE,
2221 KSEVENT_CONNECTION_DATADISCONTINUITY,
2222 KSEVENT_CONNECTION_TIMEDISCONTINUITY,
2223 KSEVENT_CONNECTION_PRIORITY,
2224 KSEVENT_CONNECTION_ENDOFSTREAM
2225 } KSEVENT_CONNECTION;
2226
2227 typedef struct {
2228 PVOID Context;
2229 ULONG Proportion;
2230 LONGLONG DeltaTime;
2231 } KSQUALITY, *PKSQUALITY;
2232
2233 typedef struct {
2234 PVOID Context;
2235 ULONG Status;
2236 } KSERROR, *PKSERROR;
2237
2238 typedef KSIDENTIFIER KSDEGRADE, *PKSDEGRADE;
2239
2240 #define STATIC_KSDEGRADESETID_Standard\
2241 0x9F564180L, 0x704C, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
2242 DEFINE_GUIDSTRUCT("9F564180-704C-11D0-A5D6-28DB04C10000", KSDEGRADESETID_Standard);
2243 #define KSDEGRADESETID_Standard DEFINE_GUIDNAMED(KSDEGRADESETID_Standard)
2244
2245 typedef enum {
2246 KSDEGRADE_STANDARD_SAMPLE,
2247 KSDEGRADE_STANDARD_QUALITY,
2248 KSDEGRADE_STANDARD_COMPUTATION,
2249 KSDEGRADE_STANDARD_SKIP
2250 } KSDEGRADE_STANDARD;
2251
2252 #if defined(_NTDDK_)
2253
2254 #define KSPROBE_STREAMREAD 0x00000000
2255 #define KSPROBE_STREAMWRITE 0x00000001
2256 #define KSPROBE_ALLOCATEMDL 0x00000010
2257 #define KSPROBE_PROBEANDLOCK 0x00000020
2258 #define KSPROBE_SYSTEMADDRESS 0x00000040
2259 #define KSPROBE_MODIFY 0x00000200
2260 #define KSPROBE_STREAMWRITEMODIFY (KSPROBE_MODIFY | KSPROBE_STREAMWRITE)
2261 #define KSPROBE_ALLOWFORMATCHANGE 0x00000080
2262
2263 #define KSSTREAM_READ KSPROBE_STREAMREAD
2264 #define KSSTREAM_WRITE KSPROBE_STREAMWRITE
2265 #define KSSTREAM_PAGED_DATA 0x00000000
2266 #define KSSTREAM_NONPAGED_DATA 0x00000100
2267 #define KSSTREAM_SYNCHRONOUS 0x00001000
2268 #define KSSTREAM_FAILUREEXCEPTION 0x00002000
2269
2270 typedef
2271 NTSTATUS
2272 (*PFNKSCONTEXT_DISPATCH)(
2273 IN PVOID Context,
2274 IN PIRP Irp
2275 );
2276
2277 typedef
2278 NTSTATUS
2279 (*PFNKSHANDLER)(
2280 IN PIRP Irp,
2281 IN PKSIDENTIFIER Request,
2282 IN OUT PVOID Data
2283 );
2284
2285 typedef
2286 BOOLEAN
2287 (*PFNKSFASTHANDLER)(
2288 IN PFILE_OBJECT FileObject,
2289 IN PKSIDENTIFIER UNALIGNED Request,
2290 IN ULONG RequestLength,
2291 IN OUT PVOID UNALIGNED Data,
2292 IN ULONG DataLength,
2293 OUT PIO_STATUS_BLOCK IoStatus
2294 );
2295
2296 typedef
2297 NTSTATUS
2298 (*PFNKSALLOCATOR)(
2299 IN PIRP Irp,
2300 IN ULONG BufferSize,
2301 IN BOOLEAN InputOperation
2302 );
2303
2304 typedef struct {
2305 KSPROPERTY_MEMBERSHEADER MembersHeader;
2306 const VOID* Members;
2307 } KSPROPERTY_MEMBERSLIST, *PKSPROPERTY_MEMBERSLIST;
2308
2309 typedef struct {
2310 KSIDENTIFIER PropTypeSet;
2311 ULONG MembersListCount;
2312 const KSPROPERTY_MEMBERSLIST* MembersList;
2313 } KSPROPERTY_VALUES, *PKSPROPERTY_VALUES;
2314
2315 #define DEFINE_KSPROPERTY_TABLE(tablename)\
2316 const KSPROPERTY_ITEM tablename[] =
2317
2318 #define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler,\
2319 MinProperty,\
2320 MinData,\
2321 SetHandler,\
2322 Values, RelationsCount, Relations, SupportHandler,\
2323 SerializedSize)\
2324 {\
2325 PropertyId, (PFNKSHANDLER)GetHandler, MinProperty, MinData,\
2326 (PFNKSHANDLER)SetHandler,\
2327 (PKSPROPERTY_VALUES)Values, RelationsCount, (PKSPROPERTY)Relations,\
2328 (PFNKSHANDLER)SupportHandler, (ULONG)SerializedSize\
2329 }
2330
2331 typedef struct {
2332 ULONG PropertyId;
2333 union {
2334 PFNKSHANDLER GetPropertyHandler;
2335 BOOLEAN GetSupported;
2336 };
2337 ULONG MinProperty;
2338 ULONG MinData;
2339 union {
2340 PFNKSHANDLER SetPropertyHandler;
2341 BOOLEAN SetSupported;
2342 };
2343 const KSPROPERTY_VALUES*Values;
2344 ULONG RelationsCount;
2345 const KSPROPERTY* Relations;
2346 PFNKSHANDLER SupportHandler;
2347 ULONG SerializedSize;
2348 } KSPROPERTY_ITEM, *PKSPROPERTY_ITEM;
2349
2350 #define DEFINE_KSFASTPROPERTY_ITEM(PropertyId, GetHandler, SetHandler)\
2351 {\
2352 PropertyId, (PFNKSFASTHANDLER)GetHandler, (PFNKSFASTHANDLER)SetHandler, 0\
2353 }
2354
2355 typedef struct {
2356 ULONG PropertyId;
2357 union {
2358 PFNKSFASTHANDLER GetPropertyHandler;
2359 BOOLEAN GetSupported;
2360 };
2361 union {
2362 PFNKSFASTHANDLER SetPropertyHandler;
2363 BOOLEAN SetSupported;
2364 };
2365 ULONG Reserved;
2366 } KSFASTPROPERTY_ITEM, *PKSFASTPROPERTY_ITEM;
2367
2368 #define DEFINE_KSPROPERTY_SET(Set,\
2369 PropertiesCount,\
2370 PropertyItem,\
2371 FastIoCount,\
2372 FastIoTable)\
2373 {\
2374 Set,\
2375 PropertiesCount,\
2376 PropertyItem,\
2377 FastIoCount,\
2378 FastIoTable\
2379 }
2380
2381 #define DEFINE_KSPROPERTY_SET_TABLE(tablename)\
2382 const KSPROPERTY_SET tablename[] =
2383
2384 typedef struct {
2385 const GUID* Set;
2386 ULONG PropertiesCount;
2387 const KSPROPERTY_ITEM* PropertyItem;
2388 ULONG FastIoCount;
2389 const KSFASTPROPERTY_ITEM* FastIoTable;
2390 } KSPROPERTY_SET, *PKSPROPERTY_SET;
2391
2392 #define DEFINE_KSMETHOD_TABLE(tablename)\
2393 const KSMETHOD_ITEM tablename[] =
2394
2395 #define DEFINE_KSMETHOD_ITEM(MethodId, Flags,\
2396 MethodHandler,\
2397 MinMethod, MinData, SupportHandler)\
2398 {\
2399 MethodId, (PFNKSHANDLER)MethodHandler, MinMethod, MinData,\
2400 SupportHandler, Flags\
2401 }
2402
2403 typedef struct {
2404 ULONG MethodId;
2405 union {
2406 PFNKSHANDLER MethodHandler;
2407 BOOLEAN MethodSupported;
2408 };
2409 ULONG MinMethod;
2410 ULONG MinData;
2411 PFNKSHANDLER SupportHandler;
2412 ULONG Flags;
2413 } KSMETHOD_ITEM, *PKSMETHOD_ITEM;
2414
2415 #define DEFINE_KSFASTMETHOD_ITEM(MethodId, MethodHandler)\
2416 {\
2417 MethodId, (PFNKSFASTHANDLER)MethodHandler\
2418 }
2419
2420 typedef struct {
2421 ULONG MethodId;
2422 union {
2423 PFNKSFASTHANDLER MethodHandler;
2424 BOOLEAN MethodSupported;
2425 };
2426 } KSFASTMETHOD_ITEM, *PKSFASTMETHOD_ITEM;
2427
2428 #define DEFINE_KSMETHOD_SET(Set,\
2429 MethodsCount,\
2430 MethodItem,\
2431 FastIoCount,\
2432 FastIoTable)\
2433 {\
2434 Set,\
2435 MethodsCount,\
2436 MethodItem,\
2437 FastIoCount,\
2438 FastIoTable\
2439 }
2440
2441 #define DEFINE_KSMETHOD_SET_TABLE(tablename)\
2442 const KSMETHOD_SET tablename[] =
2443
2444 typedef struct {
2445 const GUID* Set;
2446 ULONG MethodsCount;
2447 const KSMETHOD_ITEM* MethodItem;
2448 ULONG FastIoCount;
2449 const KSFASTMETHOD_ITEM*FastIoTable;
2450 } KSMETHOD_SET, *PKSMETHOD_SET;
2451
2452 typedef struct _KSEVENT_ENTRY
2453 KSEVENT_ENTRY, *PKSEVENT_ENTRY;
2454
2455 typedef
2456 NTSTATUS
2457 (*PFNKSADDEVENT)(
2458 IN PIRP Irp,
2459 IN PKSEVENTDATA EventData,
2460 IN struct _KSEVENT_ENTRY* EventEntry
2461 );
2462
2463 typedef
2464 VOID
2465 (*PFNKSREMOVEEVENT)(
2466 IN PFILE_OBJECT FileObject,
2467 IN struct _KSEVENT_ENTRY* EventEntry
2468 );
2469
2470 #define DEFINE_KSEVENT_TABLE(tablename)\
2471 const KSEVENT_ITEM tablename[] =
2472
2473 #define DEFINE_KSEVENT_ITEM(EventId, DataInput, ExtraEntryData,\
2474 AddHandler, RemoveHandler, SupportHandler)\
2475 {\
2476 EventId,\
2477 DataInput,\
2478 ExtraEntryData,\
2479 AddHandler,\
2480 RemoveHandler,\
2481 SupportHandler\
2482 }
2483
2484 typedef struct {
2485 ULONG EventId;
2486 ULONG DataInput;
2487 ULONG ExtraEntryData;
2488 PFNKSADDEVENT AddHandler;
2489 PFNKSREMOVEEVENT RemoveHandler;
2490 PFNKSHANDLER SupportHandler;
2491 } KSEVENT_ITEM, *PKSEVENT_ITEM;
2492
2493 #define DEFINE_KSEVENT_SET(Set,\
2494 EventsCount,\
2495 EventItem)\
2496 {\
2497 Set, EventsCount, EventItem\
2498 }
2499
2500 #define DEFINE_KSEVENT_SET_TABLE(tablename)\
2501 const KSEVENT_SET tablename[] =
2502
2503 typedef struct {
2504 const GUID* Set;
2505 ULONG EventsCount;
2506 const KSEVENT_ITEM* EventItem;
2507 } KSEVENT_SET, *PKSEVENT_SET;
2508
2509 typedef struct {
2510 KDPC Dpc;
2511 ULONG ReferenceCount;
2512 KSPIN_LOCK AccessLock;
2513 } KSDPC_ITEM, *PKSDPC_ITEM;
2514
2515 typedef struct {
2516 KSDPC_ITEM DpcItem;
2517 LIST_ENTRY BufferList;
2518 } KSBUFFER_ITEM, *PKSBUFFER_ITEM;
2519
2520 #define KSEVENT_ENTRY_DELETED 1
2521 #define KSEVENT_ENTRY_ONESHOT 2
2522 #define KSEVENT_ENTRY_BUFFERED 4
2523
2524 struct _KSEVENT_ENTRY {
2525 LIST_ENTRY ListEntry;
2526 PVOID Object;
2527 union {
2528 PKSDPC_ITEM DpcItem;
2529 PKSBUFFER_ITEM BufferItem;
2530 };
2531 PKSEVENTDATA EventData;
2532 ULONG NotificationType;
2533 const KSEVENT_SET* EventSet;
2534 const KSEVENT_ITEM* EventItem;
2535 PFILE_OBJECT FileObject;
2536 ULONG SemaphoreAdjustment;
2537 ULONG Reserved;
2538 ULONG Flags;
2539 };
2540
2541 typedef enum {
2542 KSEVENTS_NONE,
2543 KSEVENTS_SPINLOCK,
2544 KSEVENTS_MUTEX,
2545 KSEVENTS_FMUTEX,
2546 KSEVENTS_FMUTEXUNSAFE,
2547 KSEVENTS_INTERRUPT,
2548 KSEVENTS_ERESOURCE
2549 } KSEVENTS_LOCKTYPE;
2550
2551 #define KSDISPATCH_FASTIO 0x80000000
2552
2553 typedef struct {
2554 PDRIVER_DISPATCH Create;
2555 PVOID Context;
2556 UNICODE_STRING ObjectClass;
2557 PSECURITY_DESCRIPTOR SecurityDescriptor;
2558 ULONG Flags;
2559 } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM;
2560
2561 typedef
2562 VOID
2563 (*PFNKSITEMFREECALLBACK)(
2564 IN PKSOBJECT_CREATE_ITEM CreateItem
2565 );
2566
2567 #define KSCREATE_ITEM_SECURITYCHANGED 0x00000001
2568 #define KSCREATE_ITEM_WILDCARD 0x00000002
2569 #define KSCREATE_ITEM_NOPARAMETERS 0x00000004
2570 #define KSCREATE_ITEM_FREEONSTOP 0x00000008
2571
2572 #define DEFINE_KSCREATE_DISPATCH_TABLE( tablename )\
2573 KSOBJECT_CREATE_ITEM tablename[] =
2574
2575 #define DEFINE_KSCREATE_ITEM(DispatchCreate, TypeName, Context)\
2576 {\
2577 (DispatchCreate),\
2578 (PVOID)(Context),\
2579 {\
2580 sizeof(TypeName) - sizeof(UNICODE_NULL),\
2581 sizeof(TypeName),\
2582 (PWCHAR)(TypeName)\
2583 },\
2584 NULL, 0\
2585 }
2586
2587 #define DEFINE_KSCREATE_ITEMEX(DispatchCreate, TypeName, Context, Flags)\
2588 {\
2589 (DispatchCreate),\
2590 (PVOID)(Context),\
2591 {\
2592 sizeof(TypeName) - sizeof(UNICODE_NULL),\
2593 sizeof(TypeName),\
2594 (PWCHAR)(TypeName)\
2595 },\
2596 NULL, (Flags)\
2597 }
2598
2599 #define DEFINE_KSCREATE_ITEMNULL( DispatchCreate, Context )\
2600 {\
2601 DispatchCreate,\
2602 Context,\
2603 {\
2604 0,\
2605 0,\
2606 NULL,\
2607 },\
2608 NULL, 0\
2609 }
2610
2611 typedef struct {
2612 ULONG CreateItemsCount;
2613 PKSOBJECT_CREATE_ITEM CreateItemsList;
2614 } KSOBJECT_CREATE, *PKSOBJECT_CREATE;
2615
2616 typedef struct {
2617 PDRIVER_DISPATCH DeviceIoControl;
2618 PDRIVER_DISPATCH Read;
2619 PDRIVER_DISPATCH Write;
2620 PDRIVER_DISPATCH Flush;
2621 PDRIVER_DISPATCH Close;
2622 PDRIVER_DISPATCH QuerySecurity;
2623 PDRIVER_DISPATCH SetSecurity;
2624 PFAST_IO_DEVICE_CONTROL FastDeviceIoControl;
2625 PFAST_IO_READ FastRead;
2626 PFAST_IO_WRITE FastWrite;
2627 } KSDISPATCH_TABLE, *PKSDISPATCH_TABLE;
2628
2629 #define DEFINE_KSDISPATCH_TABLE( tablename, DeviceIoControl, Read, Write,\
2630 Flush, Close, QuerySecurity, SetSecurity,\
2631 FastDeviceIoControl, FastRead, FastWrite )\
2632 const KSDISPATCH_TABLE tablename = \
2633 {\
2634 DeviceIoControl, \
2635 Read, \
2636 Write, \
2637 Flush, \
2638 Close, \
2639 QuerySecurity, \
2640 SetSecurity, \
2641 FastDeviceIoControl, \
2642 FastRead, \
2643 FastWrite, \
2644 }
2645
2646 #define KSCREATE_ITEM_IRP_STORAGE(Irp) ((PKSOBJECT_CREATE_ITEM)(Irp)->Tail.Overlay.DriverContext[0])
2647 #define KSEVENT_SET_IRP_STORAGE(Irp) ((const KSEVENT_SET*)(Irp)->Tail.Overlay.DriverContext[0])
2648 #define KSEVENT_ITEM_IRP_STORAGE(Irp) ((const KSEVENT_ITEM*)(Irp)->Tail.Overlay.DriverContext[3])
2649 #define KSEVENT_ENTRY_IRP_STORAGE(Irp) ((PKSEVENT_ENTRY)(Irp)->Tail.Overlay.DriverContext[0])
2650 #define KSMETHOD_SET_IRP_STORAGE(Irp) ((const KSMETHOD_SET*)(Irp)->Tail.Overlay.DriverContext[0])
2651 #define KSMETHOD_ITEM_IRP_STORAGE(Irp) ((const KSMETHOD_ITEM*)(Irp)->Tail.Overlay.DriverContext[3])
2652 #define KSMETHOD_TYPE_IRP_STORAGE(Irp) ((ULONG_PTR)((Irp)->Tail.Overlay.DriverContext[2]))
2653 #define KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) ((PKSPIN_LOCK)(Irp)->Tail.Overlay.DriverContext[1])
2654 #define KSPROPERTY_SET_IRP_STORAGE(Irp) ((const KSPROPERTY_SET*)(Irp)->Tail.Overlay.DriverContext[0])
2655 #define KSPROPERTY_ITEM_IRP_STORAGE(Irp) ((const KSPROPERTY_ITEM*)(Irp)->Tail.Overlay.DriverContext[3])
2656 #define KSPROPERTY_ATTRIBUTES_IRP_STORAGE(Irp) ((PKSATTRIBUTE_LIST)(Irp)->Tail.Overlay.DriverContext[2])
2657
2658 typedef PVOID KSDEVICE_HEADER, KSOBJECT_HEADER;
2659
2660 typedef enum {
2661 KsInvokeOnSuccess = 1,
2662 KsInvokeOnError = 2,
2663 KsInvokeOnCancel = 4
2664 } KSCOMPLETION_INVOCATION;
2665
2666 typedef enum {
2667 KsListEntryTail,
2668 KsListEntryHead
2669 } KSLIST_ENTRY_LOCATION;
2670
2671 typedef enum {
2672 KsAcquireOnly,
2673 KsAcquireAndRemove,
2674 KsAcquireOnlySingleItem,
2675 KsAcquireAndRemoveOnlySingleItem
2676 } KSIRP_REMOVAL_OPERATION;
2677
2678 typedef enum {
2679 KsStackCopyToNewLocation,
2680 KsStackReuseCurrentLocation,
2681 KsStackUseNewLocation
2682 } KSSTACK_USE;
2683
2684 typedef enum {
2685 KSTARGET_STATE_DISABLED,
2686 KSTARGET_STATE_ENABLED
2687 } KSTARGET_STATE;
2688
2689 typedef
2690 NTSTATUS
2691 (*PFNKSIRPLISTCALLBACK)(
2692 IN PIRP Irp,
2693 IN PVOID Context
2694 );
2695
2696 typedef
2697 VOID
2698 (*PFNREFERENCEDEVICEOBJECT)(
2699 IN PVOID Context
2700 );
2701
2702 typedef
2703 VOID
2704 (*PFNDEREFERENCEDEVICEOBJECT)(
2705 IN PVOID Context
2706 );
2707
2708 typedef
2709 NTSTATUS
2710 (*PFNQUERYREFERENCESTRING)(
2711 IN PVOID Context,
2712 IN OUT PWCHAR *String
2713 );
2714
2715 #define BUS_INTERFACE_REFERENCE_VERSION 0x100
2716
2717 typedef struct {
2718 //
2719 // Standard interface header
2720 //
2721
2722 INTERFACE Interface;
2723
2724 //
2725 // Standard bus interfaces
2726 //
2727
2728 PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject;
2729 PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject;
2730 PFNQUERYREFERENCESTRING QueryReferenceString;
2731
2732 } BUS_INTERFACE_REFERENCE, *PBUS_INTERFACE_REFERENCE;
2733
2734 #define STATIC_REFERENCE_BUS_INTERFACE STATIC_KSMEDIUMSETID_Standard
2735 #define REFERENCE_BUS_INTERFACE KSMEDIUMSETID_Standard
2736
2737 typedef
2738 NTSTATUS
2739 (*PFNQUERYMEDIUMSLIST)(
2740 IN PVOID Context,
2741 OUT ULONG* MediumsCount,
2742 OUT PKSPIN_MEDIUM* MediumList
2743 );
2744
2745 typedef struct {
2746 //
2747 // Standard interface header
2748 //
2749
2750 INTERFACE Interface;
2751
2752 //
2753 // Interface definition
2754 //
2755
2756 PFNQUERYMEDIUMSLIST QueryMediumsList;
2757
2758 } BUS_INTERFACE_MEDIUMS, *PBUS_INTERFACE_MEDIUMS;
2759
2760 #define STATIC_GUID_BUS_INTERFACE_MEDIUMS \
2761 0x4EC35C3EL, 0x201B, 0x11D2, 0x87, 0x45, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
2762 DEFINE_GUIDSTRUCT("4EC35C3E-201B-11D2-8745-00A0C9223196", GUID_BUS_INTERFACE_MEDIUMS);
2763 #define GUID_BUS_INTERFACE_MEDIUMS DEFINE_GUIDNAMED(GUID_BUS_INTERFACE_MEDIUMS)
2764
2765 #endif // defined(_NTDDK_)
2766
2767 #if !defined( PACK_PRAGMAS_NOT_SUPPORTED )
2768 #include <pshpack1.h>
2769 #endif
2770
2771 typedef struct {
2772 GUID PropertySet;
2773 ULONG Count;
2774 } KSPROPERTY_SERIALHDR, *PKSPROPERTY_SERIALHDR;
2775
2776 #if !defined( PACK_PRAGMAS_NOT_SUPPORTED )
2777 #include <poppack.h>
2778 #endif
2779
2780 typedef struct {
2781 KSIDENTIFIER PropTypeSet;
2782 ULONG Id;
2783 ULONG PropertyLength;
2784 } KSPROPERTY_SERIAL, *PKSPROPERTY_SERIAL;
2785
2786 #if defined(_NTDDK_)
2787
2788 #define IOCTL_KS_HANDSHAKE CTL_CODE(FILE_DEVICE_KS, 0x007, METHOD_NEITHER, FILE_ANY_ACCESS)
2789
2790 typedef struct {
2791 GUID ProtocolId;
2792 PVOID Argument1;
2793 PVOID Argument2;
2794 } KSHANDSHAKE, *PKSHANDSHAKE;
2795
2796 typedef struct _KSGATE
2797 KSGATE, *PKSGATE;
2798
2799 struct _KSGATE {
2800 LONG Count;
2801 PKSGATE NextGate;
2802 };
2803
2804 #ifndef _NTOS_
2805
2806 void __inline
2807 KsGateTurnInputOn(
2808 IN PKSGATE Gate OPTIONAL
2809 )
2810 {
2811 while (Gate && (InterlockedIncrement(&Gate->Count) == 1)) {
2812 Gate = Gate->NextGate;
2813 }
2814 }
2815
2816 void __inline
2817 KsGateTurnInputOff(
2818 IN PKSGATE Gate OPTIONAL
2819 )
2820 {
2821 while (Gate && (InterlockedDecrement(&Gate->Count) == 0)) {
2822 Gate = Gate->NextGate;
2823 }
2824 }
2825
2826 BOOLEAN __inline
2827 KsGateGetStateUnsafe(
2828 IN PKSGATE Gate
2829 )
2830 {
2831 ASSERT(Gate);
2832 return Gate->Count > 0;
2833 }
2834
2835 BOOLEAN __inline
2836 KsGateCaptureThreshold(
2837 IN PKSGATE Gate
2838 )
2839 {
2840 BOOLEAN captured;
2841
2842 ASSERT(Gate);
2843
2844 captured = (InterlockedCompareExchange(&Gate->Count,0,1) == 1);
2845
2846 //
2847 // If we made a transition, it must be propagated.
2848 //
2849 if (captured) {
2850 KsGateTurnInputOff(Gate->NextGate);
2851 }
2852
2853 //
2854 // We return whatever the state was prior to the compare/exchange. If
2855 // the state was on, the state is now off.
2856 //
2857 return captured;
2858 }
2859
2860 void __inline
2861 KsGateInitialize(
2862 IN PKSGATE Gate,
2863 IN LONG InitialCount,
2864 IN PKSGATE NextGate OPTIONAL,
2865 IN BOOLEAN StateToPropagate // IN BOOLEAN NextGateIsAnOrGate
2866 )
2867 {
2868 ASSERT(Gate);
2869 Gate->Count = InitialCount;
2870 Gate->NextGate = NextGate;
2871
2872 if (NextGate) {
2873 if (InitialCount > 0) {
2874 if (StateToPropagate) {
2875 KsGateTurnInputOn(NextGate);
2876 }
2877 } else {
2878 if (! StateToPropagate) {
2879 KsGateTurnInputOff(NextGate);
2880 }
2881 }
2882 }
2883 }
2884
2885 void __inline
2886 KsGateInitializeAnd(
2887 IN PKSGATE AndGate,
2888 IN PKSGATE NextOrGate OPTIONAL
2889 )
2890 {
2891 KsGateInitialize(AndGate,1,NextOrGate,TRUE);
2892 }
2893
2894 void __inline
2895 KsGateInitializeOr(
2896 IN PKSGATE OrGate,
2897 IN PKSGATE NextAndGate OPTIONAL
2898 )
2899 {
2900 KsGateInitialize(OrGate,0,NextAndGate,FALSE);
2901 }
2902
2903 void __inline KsGateAddOnInputToAnd(IN PKSGATE AndGate) {}
2904 void __inline KsGateAddOffInputToAnd(IN PKSGATE AndGate) { KsGateTurnInputOff(AndGate); }
2905 void __inline KsGateRemoveOnInputFromAnd(IN PKSGATE AndGate) {}
2906 void __inline KsGateRemoveOffInputFromAnd(IN PKSGATE AndGate) { KsGateTurnInputOn(AndGate); }
2907
2908 void __inline KsGateAddOnInputToOr(IN PKSGATE OrGate) { KsGateTurnInputOn(OrGate); }
2909 void __inline KsGateAddOffInputToOr(IN PKSGATE OrGate) {}
2910 void __inline KsGateRemoveOnInputFromOr(IN PKSGATE OrGate) { KsGateTurnInputOff(OrGate); }
2911 void __inline KsGateRemoveOffInputFromOr(IN PKSGATE OrGate) {}
2912
2913 void __inline
2914 KsGateTerminateAnd(
2915 IN PKSGATE AndGate
2916 )
2917 {
2918 ASSERT(AndGate);
2919 if (KsGateGetStateUnsafe(AndGate)) {
2920 KsGateRemoveOnInputFromOr(AndGate->NextGate);
2921 } else {
2922 KsGateRemoveOffInputFromOr(AndGate->NextGate);
2923 }
2924 }
2925
2926 void __inline
2927 KsGateTerminateOr(
2928 IN PKSGATE OrGate
2929 )
2930 {
2931 ASSERT(OrGate);
2932 if (KsGateGetStateUnsafe(OrGate)) {
2933 KsGateRemoveOnInputFromAnd(OrGate->NextGate);
2934 } else {
2935 KsGateRemoveOffInputFromAnd(OrGate->NextGate);
2936 }
2937 }
2938
2939 #endif // !_NTOS_
2940
2941 typedef PVOID KSOBJECT_BAG;
2942
2943 typedef
2944 BOOLEAN
2945 (*PFNKSGENERATEEVENTCALLBACK)(
2946 IN PVOID Context,
2947 IN PKSEVENT_ENTRY EventEntry
2948 );
2949
2950 typedef
2951 NTSTATUS
2952 (*PFNKSDEVICECREATE)(
2953 IN PKSDEVICE Device
2954 );
2955 typedef
2956 NTSTATUS
2957 (*PFNKSDEVICEPNPSTART)(
2958 IN PKSDEVICE Device,
2959 IN PIRP Irp,
2960 IN PCM_RESOURCE_LIST TranslatedResourceList OPTIONAL,
2961 IN PCM_RESOURCE_LIST UntranslatedResourceList OPTIONAL
2962 );
2963 typedef
2964 NTSTATUS
2965 (*PFNKSDEVICE)(
2966 IN PKSDEVICE Device
2967 );
2968 typedef
2969 NTSTATUS
2970 (*PFNKSDEVICEIRP)(
2971 IN PKSDEVICE Device,
2972 IN PIRP Irp
2973 );
2974 typedef
2975 void
2976 (*PFNKSDEVICEIRPVOID)(
2977 IN PKSDEVICE Device,
2978 IN PIRP Irp
2979 );
2980 typedef
2981 NTSTATUS
2982 (*PFNKSDEVICEQUERYCAPABILITIES)(
2983 IN PKSDEVICE Device,
2984 IN PIRP Irp,
2985 IN OUT PDEVICE_CAPABILITIES Capabilities
2986 );
2987 typedef
2988 NTSTATUS
2989 (*PFNKSDEVICEQUERYPOWER)(
2990 IN PKSDEVICE Device,
2991 IN PIRP Irp,
2992 IN DEVICE_POWER_STATE DeviceTo,
2993 IN DEVICE_POWER_STATE DeviceFrom,
2994 IN SYSTEM_POWER_STATE SystemTo,
2995 IN SYSTEM_POWER_STATE SystemFrom,
2996 IN POWER_ACTION Action
2997 );
2998 typedef
2999 void
3000 (*PFNKSDEVICESETPOWER)(
3001 IN PKSDEVICE Device,
3002 IN PIRP Irp,
3003 IN DEVICE_POWER_STATE To,
3004 IN DEVICE_POWER_STATE From
3005 );
3006 typedef
3007 NTSTATUS
3008 (*PFNKSFILTERFACTORYVOID)(
3009 IN PKSFILTERFACTORY FilterFactory
3010 );
3011 typedef
3012 void
3013 (*PFNKSFILTERFACTORYPOWER)(
3014 IN PKSFILTERFACTORY FilterFactory,
3015 IN DEVICE_POWER_STATE State
3016 );
3017 typedef
3018 NTSTATUS
3019 (*PFNKSFILTERIRP)(
3020 IN PKSFILTER Filter,
3021 IN PIRP Irp
3022 );
3023 typedef
3024 NTSTATUS
3025 (*PFNKSFILTERPROCESS)(
3026 IN PKSFILTER Filter,
3027 IN PKSPROCESSPIN_INDEXENTRY Index
3028 );
3029 typedef
3030 NTSTATUS
3031 (*PFNKSFILTERVOID)(
3032 IN PKSFILTER Filter
3033 );
3034 typedef
3035 void
3036 (*PFNKSFILTERPOWER)(
3037 IN PKSFILTER Filter,
3038 IN DEVICE_POWER_STATE State
3039 );
3040 typedef
3041 NTSTATUS
3042 (*PFNKSPINIRP)(
3043 IN PKSPIN Pin,
3044 IN PIRP Irp
3045 );
3046 typedef
3047 NTSTATUS
3048 (*PFNKSPINSETDEVICESTATE)(
3049 IN PKSPIN Pin,
3050 IN KSSTATE ToState,
3051 IN KSSTATE FromState
3052 );
3053 typedef
3054 NTSTATUS
3055 (*PFNKSPINSETDATAFORMAT)(
3056 IN PKSPIN Pin,
3057 IN PKSDATAFORMAT OldFormat OPTIONAL,
3058 IN PKSMULTIPLE_ITEM OldAttributeList OPTIONAL,
3059 IN const KSDATARANGE* DataRange,
3060 IN const KSATTRIBUTE_LIST* AttributeRange OPTIONAL
3061 );
3062 typedef
3063 NTSTATUS
3064 (*PFNKSPINHANDSHAKE)(
3065 IN PKSPIN Pin,
3066 IN PKSHANDSHAKE In,
3067 IN PKSHANDSHAKE Out
3068 );
3069 typedef
3070 NTSTATUS
3071 (*PFNKSPIN)(
3072 IN PKSPIN Pin
3073 );
3074 typedef
3075 void
3076 (*PFNKSPINVOID)(
3077 IN PKSPIN Pin
3078 );
3079 typedef
3080 void
3081 (*PFNKSPINPOWER)(
3082 IN PKSPIN Pin,
3083 IN DEVICE_POWER_STATE State
3084 );
3085 typedef
3086 BOOLEAN
3087 (*PFNKSPINSETTIMER)(
3088 IN PKSPIN Pin,
3089 IN PKTIMER Timer,
3090 IN LARGE_INTEGER DueTime,
3091 IN PKDPC Dpc
3092 );
3093 typedef
3094 BOOLEAN
3095 (*PFNKSPINCANCELTIMER)(
3096 IN PKSPIN Pin,
3097 IN PKTIMER Timer
3098 );
3099 typedef
3100 LONGLONG
3101 (FASTCALL *PFNKSPINCORRELATEDTIME)(
3102 IN PKSPIN Pin,
3103 OUT PLONGLONG SystemTime
3104 );
3105 typedef
3106 void
3107 (*PFNKSPINRESOLUTION)(
3108 IN PKSPIN Pin,
3109 OUT PKSRESOLUTION Resolution
3110 );
3111 typedef
3112 NTSTATUS
3113 (*PFNKSPININITIALIZEALLOCATOR)(
3114 IN PKSPIN Pin,
3115 IN PKSALLOCATOR_FRAMING AllocatorFraming,
3116 OUT PVOID* Context
3117 );
3118 typedef
3119 void
3120 (*PFNKSSTREAMPOINTER)(
3121 IN PKSSTREAM_POINTER StreamPointer
3122 );
3123
3124 typedef struct KSAUTOMATION_TABLE_
3125 KSAUTOMATION_TABLE, *PKSAUTOMATION_TABLE;
3126 struct KSAUTOMATION_TABLE_ {
3127 ULONG PropertySetsCount;
3128 ULONG PropertyItemSize;
3129 const KSPROPERTY_SET* PropertySets;
3130 ULONG MethodSetsCount;
3131 ULONG MethodItemSize;
3132 const KSMETHOD_SET* MethodSets;
3133 ULONG EventSetsCount;
3134 ULONG EventItemSize;
3135 const KSEVENT_SET* EventSets;
3136 #if !defined(_WIN64)
3137 PVOID Alignment;
3138 #endif // !defined(_WIN64)
3139 };
3140
3141 #define DEFINE_KSAUTOMATION_TABLE(table)\
3142 const KSAUTOMATION_TABLE table =
3143
3144 #define DEFINE_KSAUTOMATION_PROPERTIES(table)\
3145 SIZEOF_ARRAY(table),\
3146 sizeof(KSPROPERTY_ITEM),\
3147 table
3148
3149 #define DEFINE_KSAUTOMATION_METHODS(table)\
3150 SIZEOF_ARRAY(table),\
3151 sizeof(KSMETHOD_ITEM),\
3152 table
3153
3154 #define DEFINE_KSAUTOMATION_EVENTS(table)\
3155 SIZEOF_ARRAY(table),\
3156 sizeof(KSEVENT_ITEM),\
3157 table
3158
3159 #define DEFINE_KSAUTOMATION_PROPERTIES_NULL\
3160 0,\
3161 sizeof(KSPROPERTY_ITEM),\
3162 NULL
3163
3164 #define DEFINE_KSAUTOMATION_METHODS_NULL\
3165 0,\
3166 sizeof(KSMETHOD_ITEM),\
3167 NULL
3168
3169 #define DEFINE_KSAUTOMATION_EVENTS_NULL\
3170 0,\
3171 sizeof(KSEVENT_ITEM),\
3172 NULL
3173
3174 #define MIN_DEV_VER_FOR_QI (0x100)
3175
3176 struct _KSDEVICE_DISPATCH {
3177 PFNKSDEVICECREATE Add;
3178 PFNKSDEVICEPNPSTART Start;
3179 PFNKSDEVICE PostStart;
3180 PFNKSDEVICEIRP QueryStop;
3181 PFNKSDEVICEIRPVOID CancelStop;
3182 PFNKSDEVICEIRPVOID Stop;
3183 PFNKSDEVICEIRP QueryRemove;
3184 PFNKSDEVICEIRPVOID CancelRemove;
3185 PFNKSDEVICEIRPVOID Remove;
3186 PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities;
3187 PFNKSDEVICEIRPVOID SurpriseRemoval;
3188 PFNKSDEVICEQUERYPOWER QueryPower;
3189 PFNKSDEVICESETPOWER SetPower;
3190 PFNKSDEVICEIRP QueryInterface; // added in version 0x100
3191 };
3192
3193 struct _KSFILTER_DISPATCH {
3194 PFNKSFILTERIRP Create;
3195 PFNKSFILTERIRP Close;
3196 PFNKSFILTERPROCESS Process;
3197 PFNKSFILTERVOID Reset;
3198 };
3199
3200 struct _KSPIN_DISPATCH {
3201 PFNKSPINIRP Create;
3202 PFNKSPINIRP Close;
3203 PFNKSPIN Process;
3204 PFNKSPINVOID Reset;
3205 PFNKSPINSETDATAFORMAT SetDataFormat;
3206 PFNKSPINSETDEVICESTATE SetDeviceState;
3207 PFNKSPIN Connect;
3208 PFNKSPINVOID Disconnect;
3209 const KSCLOCK_DISPATCH* Clock;
3210 const KSALLOCATOR_DISPATCH* Allocator;
3211 };
3212
3213 struct _KSCLOCK_DISPATCH {
3214 PFNKSPINSETTIMER SetTimer;
3215 PFNKSPINCANCELTIMER CancelTimer;
3216 PFNKSPINCORRELATEDTIME CorrelatedTime;
3217 PFNKSPINRESOLUTION Resolution;
3218 };
3219
3220 struct _KSALLOCATOR_DISPATCH {
3221 PFNKSPININITIALIZEALLOCATOR InitializeAllocator;
3222 PFNKSDELETEALLOCATOR DeleteAllocator;
3223 PFNKSDEFAULTALLOCATE Allocate;
3224 PFNKSDEFAULTFREE Free;
3225 };
3226
3227 #define KSDEVICE_DESCRIPTOR_VERSION (0x100)
3228
3229 struct _KSDEVICE_DESCRIPTOR {
3230 const KSDEVICE_DISPATCH* Dispatch;
3231 ULONG FilterDescriptorsCount;
3232 const KSFILTER_DESCRIPTOR*const* FilterDescriptors;
3233 ULONG Version; // this is 0 for pre-version 100 driver
3234 //#if !defined(_WIN64)
3235 //PVOID Alignment;
3236 //#endif //!defined(_WIN64)
3237 };
3238
3239 struct _KSFILTER_DESCRIPTOR {
3240 const KSFILTER_DISPATCH* Dispatch;
3241 const KSAUTOMATION_TABLE* AutomationTable;
3242 ULONG Version;
3243 #define KSFILTER_DESCRIPTOR_VERSION ((ULONG)-1)
3244 ULONG Flags;
3245 #define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001
3246 #define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002
3247 #define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004
3248 const GUID* ReferenceGuid;
3249 ULONG PinDescriptorsCount;
3250 ULONG PinDescriptorSize;
3251 const KSPIN_DESCRIPTOR_EX* PinDescriptors;
3252 ULONG CategoriesCount;
3253 const GUID* Categories;
3254 ULONG NodeDescriptorsCount;
3255 ULONG NodeDescriptorSize;
3256 const KSNODE_DESCRIPTOR* NodeDescriptors;
3257 ULONG ConnectionsCount;
3258 const KSTOPOLOGY_CONNECTION* Connections;
3259 const KSCOMPONENTID* ComponentId;
3260 };
3261
3262 #define DEFINE_KSFILTER_DESCRIPTOR(descriptor)\
3263 const KSFILTER_DESCRIPTOR descriptor =
3264
3265 #define DEFINE_KSFILTER_PIN_DESCRIPTORS(table)\
3266 SIZEOF_ARRAY(table),\
3267 sizeof(table[0]),\
3268 table
3269
3270 #define DEFINE_KSFILTER_CATEGORIES(table)\
3271 SIZEOF_ARRAY(table),\
3272 table
3273
3274 #define DEFINE_KSFILTER_CATEGORY(category)\
3275 1,\
3276 &(category)
3277
3278 #define DEFINE_KSFILTER_CATEGORIES_NULL\
3279 0,\
3280 NULL
3281
3282 #define DEFINE_KSFILTER_NODE_DESCRIPTORS(table)\
3283 SIZEOF_ARRAY(table),\
3284 sizeof(table[0]),\
3285 table
3286
3287 #define DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL\
3288 0,\
3289 sizeof(KSNODE_DESCRIPTOR),\
3290 NULL
3291
3292 #define DEFINE_KSFILTER_CONNECTIONS(table)\
3293 SIZEOF_ARRAY(table),\
3294 table
3295
3296 #define DEFINE_KSFILTER_DEFAULT_CONNECTIONS\
3297 0,\
3298 NULL
3299
3300 #define DEFINE_KSFILTER_DESCRIPTOR_TABLE(table)\
3301 const KSFILTER_DESCRIPTOR*const table[] =
3302
3303 struct _KSPIN_DESCRIPTOR_EX {
3304 const KSPIN_DISPATCH* Dispatch;
3305 const KSAUTOMATION_TABLE* AutomationTable;
3306 KSPIN_DESCRIPTOR PinDescriptor;
3307 ULONG Flags;
3308 #define KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING
3309 #define KSPIN_FLAG_CRITICAL_PROCESSING KSFILTER_FLAG_CRITICAL_PROCESSING
3310 #define KSPIN_FLAG_HYPERCRITICAL_PROCESSING KSFILTER_FLAG_HYPERCRITICAL_PROCESSING
3311 #define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008
3312 #define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010
3313 #define KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL 0x00000020
3314 #define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040
3315 #define KSPIN_FLAG_ENFORCE_FIFO 0x00000080
3316
3317 #define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100
3318 #define KSPIN_FLAG_DISTINCT_TRAILING_EDGE 0x00000200
3319
3320 #define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000
3321 #define KSPIN_FLAG_SPLITTER 0x00020000
3322 #define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000
3323 #define KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT 0x00080000
3324 #define KSPIN_FLAG_FIXED_FORMAT 0x00100000
3325 #define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000
3326 #define KSPIN_FLAG_RENDERER (KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY|KSPIN_FLAG_GENERATE_EOS_EVENTS)
3327 #define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000
3328 ULONG InstancesPossible;
3329 ULONG InstancesNecessary;
3330 const KSALLOCATOR_FRAMING_EX* AllocatorFraming;
3331 PFNKSINTERSECTHANDLEREX IntersectHandler;
3332 };
3333
3334 #define DEFINE_KSPIN_DEFAULT_INTERFACES\
3335 0,\
3336 NULL
3337
3338 #define DEFINE_KSPIN_DEFAULT_MEDIUMS\
3339 0,\
3340 NULL
3341
3342 struct _KSNODE_DESCRIPTOR {
3343 const KSAUTOMATION_TABLE* AutomationTable;
3344 const GUID* Type;
3345 const GUID* Name;
3346 #if !defined(_WIN64)
3347 PVOID Alignment;
3348 #endif // !defined(_WIN64)
3349 };
3350
3351 #if !defined(_WIN64)
3352 #define DEFINE_NODE_DESCRIPTOR(automation,type,name) \
3353 { (automation), (type), (name), NULL }
3354 #else // !defined(_WIN64)
3355 #define DEFINE_NODE_DESCRIPTOR(automation,type,name) \
3356 { (automation), (type), (name) }
3357 #endif // !defined(_WIN64)
3358
3359 struct _KSDEVICE {
3360 const KSDEVICE_DESCRIPTOR* Descriptor;
3361 KSOBJECT_BAG Bag;
3362 PVOID Context;
3363 PDEVICE_OBJECT FunctionalDeviceObject;
3364 PDEVICE_OBJECT PhysicalDeviceObject;
3365 PDEVICE_OBJECT NextDeviceObject;
3366 BOOLEAN Started;
3367 SYSTEM_POWER_STATE SystemPowerState;
3368 DEVICE_POWER_STATE DevicePowerState;
3369 };
3370
3371 struct _KSFILTERFACTORY {
3372 const KSFILTER_DESCRIPTOR* FilterDescriptor;
3373 KSOBJECT_BAG Bag;
3374 PVOID Context;
3375 };
3376
3377 struct _KSFILTER {
3378 const KSFILTER_DESCRIPTOR* Descriptor;
3379 KSOBJECT_BAG Bag;
3380 PVOID Context;
3381 };
3382
3383 struct _KSPIN {
3384 const KSPIN_DESCRIPTOR_EX* Descriptor;
3385 KSOBJECT_BAG Bag;
3386 PVOID Context;
3387 ULONG Id;
3388 KSPIN_COMMUNICATION Communication;
3389 BOOLEAN ConnectionIsExternal;
3390 KSPIN_INTERFACE ConnectionInterface;
3391 KSPIN_MEDIUM ConnectionMedium;
3392 KSPRIORITY ConnectionPriority;
3393 PKSDATAFORMAT ConnectionFormat;
3394 PKSMULTIPLE_ITEM AttributeList;
3395 ULONG StreamHeaderSize;
3396 KSPIN_DATAFLOW DataFlow;
3397 KSSTATE DeviceState;
3398 KSRESET ResetState;
3399 };
3400
3401 struct _KSMAPPING {
3402 PHYSICAL_ADDRESS PhysicalAddress;
3403 ULONG ByteCount;
3404 ULONG Alignment;
3405 };
3406
3407 struct _KSSTREAM_POINTER_OFFSET
3408 {
3409 #if defined(_NTDDK_)
3410 union {
3411 PUCHAR Data;
3412 PKSMAPPING Mappings;
3413 };
3414 #else // !defined(_NTDDK_)
3415 PUCHAR Data;
3416 #endif // !defined(_NTDDK_)
3417 #if !defined(_WIN64)
3418 PVOID Alignment;
3419 #endif // !defined(_WIN64)
3420 ULONG Count;
3421 ULONG Remaining;
3422 };
3423
3424 struct _KSSTREAM_POINTER
3425 {
3426 PVOID Context;
3427 PKSPIN Pin;
3428 PKSSTREAM_HEADER StreamHeader;
3429 PKSSTREAM_POINTER_OFFSET Offset;
3430 KSSTREAM_POINTER_OFFSET OffsetIn;
3431 KSSTREAM_POINTER_OFFSET OffsetOut;
3432 };
3433
3434 struct _KSPROCESSPIN {
3435 PKSPIN Pin;
3436 PKSSTREAM_POINTER StreamPointer;
3437 PKSPROCESSPIN InPlaceCounterpart;
3438 PKSPROCESSPIN DelegateBranch;
3439 PKSPROCESSPIN CopySource;
3440 PVOID Data;
3441 ULONG BytesAvailable;
3442 ULONG BytesUsed;
3443 ULONG Flags;
3444 BOOLEAN Terminate;
3445 };
3446
3447 struct _KSPROCESSPIN_INDEXENTRY {
3448 PKSPROCESSPIN *Pins;
3449 ULONG Count;
3450 };
3451
3452 typedef enum {
3453 KsObjectTypeDevice,
3454 KsObjectTypeFilterFactory,
3455 KsObjectTypeFilter,
3456 KsObjectTypePin
3457 } KSOBJECTTYPE;
3458
3459 typedef
3460 void
3461 (*PFNKSFREE)(
3462 IN PVOID Data
3463 );
3464
3465 typedef
3466 void
3467 (*PFNKSPINFRAMERETURN)(
3468 IN PKSPIN Pin,
3469 IN PVOID Data OPTIONAL,
3470 IN ULONG Size OPTIONAL,
3471 IN PMDL Mdl OPTIONAL,
3472 IN PVOID Context OPTIONAL,
3473 IN NTSTATUS Status
3474 );
3475
3476 #if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
3477 #if !defined(_IKsControl_)
3478 #define _IKsControl_
3479
3480 typedef interface IKsControl* PIKSCONTROL;
3481
3482 #if !defined(DEFINE_ABSTRACT_UNKNOWN)
3483
3484 #define DEFINE_ABSTRACT_UNKNOWN() \
3485 STDMETHOD_(NTSTATUS, QueryInterface)(THIS_ \
3486 REFIID InterfaceId, \
3487 PVOID* Interface \
3488 ) PURE; \
3489 STDMETHOD_(ULONG,AddRef)(THIS) PURE; \
3490 STDMETHOD_(ULONG,Release)(THIS) PURE;
3491
3492 #endif //!defined(DEFINE_ABSTRACT_UNKNOWN)
3493
3494 #undef INTERFACE
3495 #define INTERFACE IKsControl
3496 DECLARE_INTERFACE_(IKsControl,IUnknown)
3497 {
3498 DEFINE_ABSTRACT_UNKNOWN() // For C
3499
3500 STDMETHOD_(NTSTATUS, KsProperty)(THIS_
3501 IN PKSPROPERTY Property,
3502 IN ULONG PropertyLength,
3503 IN OUT PVOID PropertyData,
3504 IN ULONG DataLength,
3505 OUT ULONG* BytesReturned
3506 ) PURE;
3507 STDMETHOD_(NTSTATUS, KsMethod)(THIS_
3508 IN PKSMETHOD Method,
3509 IN ULONG MethodLength,
3510 IN OUT PVOID MethodData,
3511 IN ULONG DataLength,
3512 OUT ULONG* BytesReturned
3513 ) PURE;
3514 STDMETHOD_(NTSTATUS, KsEvent)(THIS_
3515 IN PKSEVENT Event OPTIONAL,
3516 IN ULONG EventLength,
3517 IN OUT PVOID EventData,
3518 IN ULONG DataLength,
3519 OUT ULONG* BytesReturned
3520 ) PURE;
3521 };
3522
3523 typedef interface IKsReferenceClock* PIKSREFERENCECLOCK;
3524
3525 #undef INTERFACE
3526 #define INTERFACE IKsReferenceClock
3527 DECLARE_INTERFACE_(IKsReferenceClock,IUnknown)
3528 {
3529 DEFINE_ABSTRACT_UNKNOWN() // For C
3530
3531 STDMETHOD_(LONGLONG,GetTime)(THIS
3532 ) PURE;
3533 STDMETHOD_(LONGLONG,GetPhysicalTime)(THIS
3534 ) PURE;
3535 STDMETHOD_(LONGLONG,GetCorrelatedTime)(THIS_
3536 OUT PLONGLONG SystemTime
3537 ) PURE;
3538 STDMETHOD_(LONGLONG,GetCorrelatedPhysicalTime)(THIS_
3539 OUT PLONGLONG SystemTime
3540 ) PURE;
3541 STDMETHOD_(NTSTATUS, GetResolution)(THIS_
3542 OUT PKSRESOLUTION Resolution
3543 ) PURE;
3544 STDMETHOD_(NTSTATUS, GetState)(THIS_
3545 OUT PKSSTATE State
3546 ) PURE;
3547 };
3548 #undef INTERFACE
3549
3550 #define STATIC_IID_IKsControl \
3551 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
3552 DEFINE_GUID(IID_IKsControl,
3553 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96);
3554 #if defined(__cplusplus) && _MSC_VER >= 1100
3555 struct __declspec(uuid("28F54685-06FD-11D2-B27A-00A0C9223196")) IKsControl;
3556 #endif
3557
3558 #define STATIC_IID_IKsFastClock \
3559 0xc9902485, 0xc180, 0x11d2, 0x84, 0x73, 0xd4, 0x23, 0x94, 0x45, 0x9e, 0x5e
3560 DEFINE_GUID(IID_IKsFastClock,
3561 0xc9902485, 0xc180, 0x11d2, 0x84, 0x73, 0xd4, 0x23, 0x94, 0x45, 0x9e, 0x5e);
3562 #if defined(__cplusplus) && _MSC_VER >= 1100
3563 struct __declspec(uuid("C9902485-C180-11d2-8473-D42394459E5E")) IKsFastClock;
3564 #endif
3565
3566 #endif // !defined(_IKsControl_)
3567 #endif // defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
3568
3569 #endif // defined(_NTDDK_)
3570
3571 //===========================================================================
3572
3573 #if defined(__cplusplus)
3574 extern "C" {
3575 #endif // defined(__cplusplus)
3576
3577 //
3578 // exported prototypes
3579 //
3580
3581 #ifdef _KSDDK_
3582 #define KSDDKAPI
3583 #else // !_KSDDK_
3584 #define KSDDKAPI DECLSPEC_IMPORT
3585 #endif // _KSDDK_
3586
3587 #if defined(_NTDDK_)
3588
3589 KSDDKAPI
3590 NTSTATUS
3591 NTAPI
3592 KsEnableEvent(
3593 IN PIRP Irp,
3594 IN ULONG EventSetsCount,
3595 IN const KSEVENT_SET* EventSet,
3596 IN OUT PLIST_ENTRY EventsList OPTIONAL,
3597 IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL,
3598 IN PVOID EventsLock OPTIONAL
3599 );
3600
3601 KSDDKAPI
3602 NTSTATUS
3603 NTAPI
3604 KsEnableEventWithAllocator(
3605 IN PIRP Irp,
3606 IN ULONG EventSetsCount,
3607 IN const KSEVENT_SET* EventSet,
3608 IN OUT PLIST_ENTRY EventsList OPTIONAL,
3609 IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL,
3610 IN PVOID EventsLock OPTIONAL,
3611 IN PFNKSALLOCATOR Allocator OPTIONAL,
3612 IN ULONG EventItemSize OPTIONAL
3613 );
3614
3615 KSDDKAPI
3616 NTSTATUS
3617 NTAPI
3618 KsDisableEvent(
3619 IN PIRP Irp,
3620 IN OUT PLIST_ENTRY EventsList,
3621 IN KSEVENTS_LOCKTYPE EventsFlags,
3622 IN PVOID EventsLock
3623 );
3624
3625 KSDDKAPI
3626 VOID
3627 NTAPI
3628 KsDiscardEvent(
3629 IN PKSEVENT_ENTRY EventEntry
3630 );
3631
3632 KSDDKAPI
3633 VOID
3634 NTAPI
3635 KsFreeEventList(
3636 IN PFILE_OBJECT FileObject,
3637 IN OUT PLIST_ENTRY EventsList,
3638 IN KSEVENTS_LOCKTYPE EventsFlags,
3639 IN PVOID EventsLock
3640 );
3641
3642 KSDDKAPI
3643 NTSTATUS
3644 NTAPI
3645 KsGenerateEvent(
3646 IN PKSEVENT_ENTRY EventEntry
3647 );
3648
3649 KSDDKAPI
3650 NTSTATUS
3651 NTAPI
3652 KsGenerateDataEvent(
3653 IN PKSEVENT_ENTRY EventEntry,
3654 IN ULONG DataSize,
3655 IN PVOID Data
3656 );
3657
3658 KSDDKAPI
3659 VOID
3660 NTAPI
3661 KsGenerateEventList(
3662 IN GUID* Set OPTIONAL,
3663 IN ULONG EventId,
3664 IN PLIST_ENTRY EventsList,
3665 IN KSEVENTS_LOCKTYPE EventsFlags,
3666 IN PVOID EventsLock
3667 );
3668
3669 // property.c:
3670
3671 KSDDKAPI
3672 NTSTATUS
3673 NTAPI
3674 KsPropertyHandler(
3675 IN PIRP Irp,
3676 IN ULONG PropertySetsCount,
3677 IN const KSPROPERTY_SET* PropertySet
3678 );
3679
3680 KSDDKAPI
3681 NTSTATUS
3682 NTAPI
3683 KsPropertyHandlerWithAllocator(
3684 IN PIRP Irp,
3685 IN ULONG PropertySetsCount,
3686 IN const KSPROPERTY_SET* PropertySet,
3687 IN PFNKSALLOCATOR Allocator OPTIONAL,
3688 IN ULONG PropertyItemSize OPTIONAL
3689 );
3690
3691 KSDDKAPI
3692 BOOLEAN
3693 NTAPI
3694 KsFastPropertyHandler(
3695 IN PFILE_OBJECT FileObject,
3696 IN PKSPROPERTY UNALIGNED Property,
3697 IN ULONG PropertyLength,
3698 IN OUT PVOID UNALIGNED Data,
3699 IN ULONG DataLength,
3700 OUT PIO_STATUS_BLOCK IoStatus,
3701 IN ULONG PropertySetsCount,
3702 IN const KSPROPERTY_SET* PropertySet
3703 );
3704
3705 // method.c:
3706
3707 KSDDKAPI
3708 NTSTATUS
3709 NTAPI
3710 KsMethodHandler(
3711 IN PIRP Irp,
3712 IN ULONG MethodSetsCount,
3713 IN const KSMETHOD_SET* MethodSet
3714 );
3715
3716 KSDDKAPI
3717 NTSTATUS
3718 NTAPI
3719 KsMethodHandlerWithAllocator(
3720 IN PIRP Irp,
3721 IN ULONG MethodSetsCount,
3722 IN const KSMETHOD_SET* MethodSet,
3723 IN PFNKSALLOCATOR Allocator OPTIONAL,
3724 IN ULONG MethodItemSize OPTIONAL
3725 );
3726
3727 KSDDKAPI
3728 BOOLEAN
3729 NTAPI
3730 KsFastMethodHandler(
3731 IN PFILE_OBJECT FileObject,
3732 IN PKSMETHOD UNALIGNED Method,
3733 IN ULONG MethodLength,
3734 IN OUT PVOID UNALIGNED Data,
3735 IN ULONG DataLength,
3736 OUT PIO_STATUS_BLOCK IoStatus,
3737 IN ULONG MethodSetsCount,
3738 IN const KSMETHOD_SET* MethodSet
3739 );
3740
3741 // alloc.c:
3742
3743 KSDDKAPI
3744 NTSTATUS
3745 NTAPI
3746 KsCreateDefaultAllocator(
3747 IN PIRP Irp
3748 );
3749
3750 KSDDKAPI
3751 NTSTATUS
3752 NTAPI
3753 KsCreateDefaultAllocatorEx(
3754 IN PIRP Irp,
3755 IN PVOID InitializeContext OPTIONAL,
3756 IN PFNKSDEFAULTALLOCATE DefaultAllocate OPTIONAL,
3757 IN PFNKSDEFAULTFREE DefaultFree OPTIONAL,
3758 IN PFNKSINITIALIZEALLOCATOR InitializeAllocator OPTIONAL,
3759 IN PFNKSDELETEALLOCATOR DeleteAllocator OPTIONAL
3760 );
3761
3762 KSDDKAPI
3763 NTSTATUS
3764 NTAPI
3765 KsCreateAllocator(
3766 IN HANDLE ConnectionHandle,
3767 IN PKSALLOCATOR_FRAMING AllocatorFraming,
3768 OUT PHANDLE AllocatorHandle
3769 );
3770
3771 KSDDKAPI
3772 NTSTATUS
3773 NTAPI
3774 KsValidateAllocatorCreateRequest(
3775 IN PIRP Irp,
3776 OUT PKSALLOCATOR_FRAMING* AllocatorFraming
3777 );
3778
3779 KSDDKAPI
3780 NTSTATUS
3781 NTAPI
3782 KsValidateAllocatorFramingEx(
3783 IN PKSALLOCATOR_FRAMING_EX Framing,
3784 IN ULONG BufferSize,
3785 IN const KSALLOCATOR_FRAMING_EX *PinFraming
3786 );
3787
3788 // clock.c:
3789
3790 KSDDKAPI
3791 NTSTATUS
3792 NTAPI
3793 KsAllocateDefaultClock(
3794 OUT PKSDEFAULTCLOCK* DefaultClock
3795 );
3796
3797 KSDDKAPI
3798 NTSTATUS
3799 NTAPI
3800 KsAllocateDefaultClockEx(
3801 OUT PKSDEFAULTCLOCK* DefaultClock,
3802 IN PVOID Context OPTIONAL,
3803 IN PFNKSSETTIMER SetTimer OPTIONAL,
3804 IN PFNKSCANCELTIMER CancelTimer OPTIONAL,
3805 IN PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL,
3806 IN const KSRESOLUTION* Resolution OPTIONAL,
3807 IN ULONG Flags
3808 );
3809
3810 KSDDKAPI
3811 VOID
3812 NTAPI
3813 KsFreeDefaultClock(
3814 IN PKSDEFAULTCLOCK DefaultClock
3815 );
3816
3817 KSDDKAPI
3818 NTSTATUS
3819 NTAPI
3820 KsCreateDefaultClock(
3821 IN PIRP Irp,
3822 IN PKSDEFAULTCLOCK DefaultClock
3823 );
3824
3825 KSDDKAPI
3826 NTSTATUS
3827 NTAPI
3828 KsCreateClock(
3829 IN HANDLE ConnectionHandle,
3830 IN PKSCLOCK_CREATE ClockCreate,
3831 OUT PHANDLE ClockHandle
3832 );
3833
3834 KSDDKAPI
3835 NTSTATUS
3836 NTAPI
3837 KsValidateClockCreateRequest(
3838 IN PIRP Irp,
3839 OUT PKSCLOCK_CREATE* ClockCreate
3840 );
3841
3842 KSDDKAPI
3843 KSSTATE
3844 NTAPI
3845 KsGetDefaultClockState(
3846 IN PKSDEFAULTCLOCK DefaultClock
3847 );
3848
3849 KSDDKAPI
3850 VOID
3851 NTAPI
3852 KsSetDefaultClockState(
3853 IN PKSDEFAULTCLOCK DefaultClock,
3854 IN KSSTATE State
3855 );
3856
3857 KSDDKAPI
3858 LONGLONG
3859 NTAPI
3860 KsGetDefaultClockTime(
3861 IN PKSDEFAULTCLOCK DefaultClock
3862 );
3863
3864 KSDDKAPI
3865 VOID
3866 NTAPI
3867 KsSetDefaultClockTime(
3868 IN PKSDEFAULTCLOCK DefaultClock,
3869 IN LONGLONG Time
3870 );
3871
3872 // connect.c:
3873
3874 KSDDKAPI
3875 NTSTATUS
3876 NTAPI
3877 KsCreatePin(
3878 IN HANDLE FilterHandle,
3879 IN PKSPIN_CONNECT Connect,
3880 IN ACCESS_MASK DesiredAccess,
3881 OUT PHANDLE ConnectionHandle
3882 );
3883
3884 KSDDKAPI
3885 NTSTATUS
3886 NTAPI
3887 KsValidateConnectRequest(
3888 IN PIRP Irp,
3889 IN ULONG DescriptorsCount,
3890 IN const KSPIN_DESCRIPTOR* Descriptor,
3891 OUT PKSPIN_CONNECT* Connect
3892 );
3893
3894 KSDDKAPI
3895 NTSTATUS
3896 NTAPI
3897 KsPinPropertyHandler(
3898 IN PIRP Irp,
3899 IN PKSPROPERTY Property,
3900 IN OUT PVOID Data,
3901 IN ULONG DescriptorsCount,
3902 IN const KSPIN_DESCRIPTOR* Descriptor
3903 );
3904
3905 KSDDKAPI
3906 NTSTATUS
3907 NTAPI
3908 KsPinDataIntersection(
3909 IN PIRP Irp,
3910 IN PKSP_PIN Pin,
3911 OUT PVOID Data OPTIONAL,
3912 IN ULONG DescriptorsCount,
3913 IN const KSPIN_DESCRIPTOR* Descriptor,
3914 IN PFNKSINTERSECTHANDLER IntersectHandler
3915 );
3916
3917 KSDDKAPI
3918 NTSTATUS
3919 NTAPI
3920 KsPinDataIntersectionEx(
3921 IN PIRP Irp,
3922 IN PKSP_PIN Pin,
3923 OUT PVOID Data,
3924 IN ULONG DescriptorsCount,
3925 IN const KSPIN_DESCRIPTOR* Descriptor,
3926 IN ULONG DescriptorSize,
3927 IN PFNKSINTERSECTHANDLEREX IntersectHandler OPTIONAL,
3928 IN PVOID HandlerContext OPTIONAL
3929 );
3930
3931 KSDDKAPI
3932 NTSTATUS
3933 NTAPI
3934 KsHandleSizedListQuery(
3935 IN PIRP Irp,
3936 IN ULONG DataItemsCount,
3937 IN ULONG DataItemSize,
3938 IN const VOID* DataItems
3939 );
3940
3941 // image.c:
3942
3943 #if (!defined( MAKEINTRESOURCE ))
3944 #define MAKEINTRESOURCE( res ) ((ULONG_PTR) (USHORT) res)
3945 #endif
3946
3947 #if (!defined( RT_STRING ))
3948 #define RT_STRING MAKEINTRESOURCE( 6 )
3949 #define RT_RCDATA MAKEINTRESOURCE( 10 )
3950 #endif
3951
3952 KSDDKAPI
3953 NTSTATUS
3954 NTAPI
3955 KsLoadResource(
3956 IN PVOID ImageBase,
3957 IN POOL_TYPE PoolType,
3958 IN ULONG_PTR ResourceName,
3959 IN ULONG ResourceType,
3960 OUT PVOID *Resource,
3961 OUT PULONG ResourceSize
3962 );
3963
3964 KSDDKAPI
3965 NTSTATUS
3966 NTAPI
3967 KsGetImageNameAndResourceId(
3968 IN HANDLE RegKey,
3969 OUT PUNICODE_STRING ImageName,
3970 OUT PULONG_PTR ResourceId,
3971 OUT PULONG ValueType
3972 );
3973
3974 KSDDKAPI
3975 NTSTATUS
3976 NTAPI
3977 KsMapModuleName(
3978 IN PDEVICE_OBJECT PhysicalDeviceObject,
3979 IN PUNICODE_STRING ModuleName,
3980 OUT PUNICODE_STRING ImageName,
3981 OUT PULONG_PTR ResourceId,
3982 OUT PULONG ValueType
3983 );
3984
3985 // irp.c:
3986
3987 KSDDKAPI
3988 NTSTATUS
3989 NTAPI
3990 KsReferenceBusObject(
3991 IN KSDEVICE_HEADER Header
3992 );
3993
3994 KSDDKAPI
3995 VOID
3996 NTAPI
3997 KsDereferenceBusObject(
3998 IN KSDEVICE_HEADER Header
3999 );
4000
4001 KSDDKAPI
4002 NTSTATUS
4003 NTAPI
4004 KsDispatchQuerySecurity(
4005 IN PDEVICE_OBJECT DeviceObject,
4006 IN PIRP Irp
4007 );
4008
4009 KSDDKAPI
4010 NTSTATUS
4011 NTAPI
4012 KsDispatchSetSecurity(
4013 IN PDEVICE_OBJECT DeviceObject,
4014 IN PIRP Irp
4015 );
4016
4017 KSDDKAPI
4018 NTSTATUS
4019 NTAPI
4020 KsDispatchSpecificProperty(
4021 IN PIRP Irp,
4022 IN PFNKSHANDLER Handler
4023 );
4024
4025 KSDDKAPI
4026 NTSTATUS
4027 NTAPI
4028 KsDispatchSpecificMethod(
4029 IN PIRP Irp,
4030 IN PFNKSHANDLER Handler
4031 );
4032
4033 KSDDKAPI
4034 NTSTATUS
4035 NTAPI
4036 KsReadFile(
4037 IN PFILE_OBJECT FileObject,
4038 IN PKEVENT Event OPTIONAL,
4039 IN PVOID PortContext OPTIONAL,
4040 OUT PIO_STATUS_BLOCK IoStatusBlock,
4041 OUT PVOID Buffer,
4042 IN ULONG Length,
4043 IN ULONG Key OPTIONAL,
4044 IN KPROCESSOR_MODE RequestorMode
4045 );
4046
4047 KSDDKAPI
4048 NTSTATUS
4049 NTAPI
4050 KsWriteFile(
4051 IN PFILE_OBJECT FileObject,
4052 IN PKEVENT Event OPTIONAL,
4053 IN PVOID PortContext OPTIONAL,
4054 OUT PIO_STATUS_BLOCK IoStatusBlock,
4055 IN PVOID Buffer,
4056 IN ULONG Length,
4057 IN ULONG Key OPTIONAL,
4058 IN KPROCESSOR_MODE RequestorMode
4059 );
4060
4061 KSDDKAPI
4062 NTSTATUS
4063 NTAPI
4064 KsQueryInformationFile(
4065 IN PFILE_OBJECT FileObject,
4066 OUT PVOID FileInformation,
4067 IN ULONG Length,
4068 IN FILE_INFORMATION_CLASS FileInformationClass
4069 );
4070
4071 KSDDKAPI
4072 NTSTATUS
4073 NTAPI
4074 KsSetInformationFile(
4075 IN PFILE_OBJECT FileObject,
4076 IN PVOID FileInformation,
4077 IN ULONG Length,
4078 IN FILE_INFORMATION_CLASS FileInformationClass
4079 );
4080
4081 KSDDKAPI
4082 NTSTATUS
4083 NTAPI
4084 KsStreamIo(
4085 IN PFILE_OBJECT FileObject,
4086 IN PKEVENT Event OPTIONAL,
4087 IN PVOID PortContext OPTIONAL,
4088 IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
4089 IN PVOID CompletionContext OPTIONAL,
4090 IN KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL,
4091 OUT PIO_STATUS_BLOCK IoStatusBlock,
4092 IN OUT PVOID StreamHeaders,
4093 IN ULONG Length,
4094 IN ULONG Flags,
4095 IN KPROCESSOR_MODE RequestorMode
4096 );
4097
4098 KSDDKAPI
4099 NTSTATUS
4100 NTAPI
4101 KsProbeStreamIrp(
4102 IN OUT PIRP Irp,
4103 IN ULONG ProbeFlags,
4104 IN ULONG HeaderSize OPTIONAL
4105 );
4106
4107 KSDDKAPI
4108 NTSTATUS
4109 NTAPI
4110 KsAllocateExtraData(
4111 IN OUT PIRP Irp,
4112 IN ULONG ExtraSize,
4113 OUT PVOID* ExtraBuffer
4114 );
4115
4116 KSDDKAPI
4117 VOID
4118 NTAPI
4119 KsNullDriverUnload(
4120 IN PDRIVER_OBJECT DriverObject
4121 );
4122
4123 KSDDKAPI
4124 NTSTATUS
4125 NTAPI
4126 KsSetMajorFunctionHandler(
4127 IN PDRIVER_OBJECT DriverObject,
4128 IN ULONG MajorFunction
4129 );
4130
4131 KSDDKAPI
4132 NTSTATUS
4133 NTAPI
4134 KsDispatchInvalidDeviceRequest(
4135 IN PDEVICE_OBJECT DeviceObject,
4136 IN PIRP Irp
4137 );
4138
4139 KSDDKAPI
4140 NTSTATUS
4141 NTAPI
4142 KsDefaultDeviceIoCompletion(
4143 IN PDEVICE_OBJECT DeviceObject,
4144 IN PIRP Irp
4145 );
4146
4147 KSDDKAPI
4148 NTSTATUS
4149 NTAPI
4150 KsDispatchIrp(
4151 IN PDEVICE_OBJECT DeviceObject,
4152 IN PIRP Irp
4153 );
4154
4155 KSDDKAPI
4156 BOOLEAN
4157 NTAPI
4158 KsDispatchFastIoDeviceControlFailure(
4159 IN PFILE_OBJECT FileObject,
4160 IN BOOLEAN Wait,
4161 IN PVOID InputBuffer OPTIONAL,
4162 IN ULONG InputBufferLength,
4163 OUT PVOID OutputBuffer OPTIONAL,
4164 IN ULONG OutputBufferLength,
4165 IN ULONG IoControlCode,
4166 OUT PIO_STATUS_BLOCK IoStatus,
4167 IN PDEVICE_OBJECT DeviceObject
4168 );
4169
4170 KSDDKAPI
4171 BOOLEAN
4172 NTAPI
4173 KsDispatchFastReadFailure(
4174 IN PFILE_OBJECT FileObject,
4175 IN PLARGE_INTEGER FileOffset,
4176 IN ULONG Length,
4177 IN BOOLEAN Wait,
4178 IN ULONG LockKey,
4179 OUT PVOID Buffer,
4180 OUT PIO_STATUS_BLOCK IoStatus,
4181 IN PDEVICE_OBJECT DeviceObject
4182 );
4183
4184 #define KsDispatchFastWriteFailure KsDispatchFastReadFailure
4185
4186 KSDDKAPI
4187 VOID
4188 NTAPI
4189 KsCancelRoutine(
4190 IN PDEVICE_OBJECT DeviceObject,
4191 IN PIRP Irp
4192 );
4193
4194 KSDDKAPI
4195 VOID
4196 NTAPI
4197 KsCancelIo(
4198 IN OUT PLIST_ENTRY QueueHead,
4199 IN PKSPIN_LOCK SpinLock
4200 );
4201
4202 KSDDKAPI
4203 VOID
4204 NTAPI
4205 KsReleaseIrpOnCancelableQueue(
4206 IN PIRP Irp,
4207 IN PDRIVER_CANCEL DriverCancel OPTIONAL
4208 );
4209
4210 KSDDKAPI
4211 PIRP
4212 NTAPI
4213 KsRemoveIrpFromCancelableQueue(
4214 IN OUT PLIST_ENTRY QueueHead,
4215 IN PKSPIN_LOCK SpinLock,
4216 IN KSLIST_ENTRY_LOCATION ListLocation,
4217 IN KSIRP_REMOVAL_OPERATION RemovalOperation
4218 );
4219
4220 KSDDKAPI
4221 NTSTATUS
4222 NTAPI
4223 KsMoveIrpsOnCancelableQueue(
4224 IN OUT PLIST_ENTRY SourceList,
4225 IN PKSPIN_LOCK SourceLock,
4226 IN OUT PLIST_ENTRY DestinationList,
4227 IN PKSPIN_LOCK DestinationLock OPTIONAL,
4228 IN KSLIST_ENTRY_LOCATION ListLocation,
4229 IN PFNKSIRPLISTCALLBACK ListCallback,
4230 IN PVOID Context
4231 );
4232
4233 KSDDKAPI
4234 VOID
4235 NTAPI
4236 KsRemoveSpecificIrpFromCancelableQueue(
4237 IN PIRP Irp
4238 );
4239
4240 KSDDKAPI
4241 VOID
4242 NTAPI
4243 KsAddIrpToCancelableQueue(
4244 IN OUT PLIST_ENTRY QueueHead,
4245 IN PKSPIN_LOCK SpinLock,
4246 IN PIRP Irp,
4247 IN KSLIST_ENTRY_LOCATION ListLocation,
4248 IN PDRIVER_CANCEL DriverCancel OPTIONAL
4249 );
4250
4251 // api.c:
4252
4253 KSDDKAPI
4254 NTSTATUS
4255 NTAPI
4256 KsAcquireResetValue(
4257 IN PIRP Irp,
4258 OUT KSRESET* ResetValue
4259 );
4260
4261 KSDDKAPI
4262 NTSTATUS
4263 NTAPI
4264 KsTopologyPropertyHandler(
4265 IN PIRP Irp,
4266 IN PKSPROPERTY Property,
4267 IN OUT PVOID Data,
4268 IN const KSTOPOLOGY* Topology
4269 );
4270
4271 KSDDKAPI
4272 VOID
4273 NTAPI
4274 KsAcquireDeviceSecurityLock(
4275 IN KSDEVICE_HEADER Header,
4276 IN BOOLEAN Exclusive
4277 );
4278
4279 KSDDKAPI
4280 VOID
4281 NTAPI
4282 KsReleaseDeviceSecurityLock(
4283 IN KSDEVICE_HEADER Header
4284 );
4285
4286 KSDDKAPI
4287 NTSTATUS
4288 NTAPI
4289 KsDefaultDispatchPnp(
4290 IN PDEVICE_OBJECT DeviceObject,
4291 IN PIRP Irp
4292 );
4293
4294 KSDDKAPI
4295 NTSTATUS
4296 NTAPI
4297 KsDefaultDispatchPower(
4298 IN PDEVICE_OBJECT DeviceObject,
4299 IN PIRP Irp
4300 );
4301
4302 KSDDKAPI
4303 NTSTATUS
4304 NTAPI
4305 KsDefaultForwardIrp(
4306 IN PDEVICE_OBJECT DeviceObject,
4307 IN PIRP Irp
4308 );
4309
4310 KSDDKAPI
4311 VOID
4312 NTAPI
4313 KsSetDevicePnpAndBaseObject(
4314 IN KSDEVICE_HEADER Header,
4315 IN PDEVICE_OBJECT PnpDeviceObject,
4316 IN PDEVICE_OBJECT BaseObject
4317 );
4318
4319 KSDDKAPI
4320 PDEVICE_OBJECT
4321 NTAPI
4322 KsQueryDevicePnpObject(
4323 IN KSDEVICE_HEADER Header
4324 );
4325
4326 KSDDKAPI
4327 ACCESS_MASK
4328 NTAPI
4329 KsQueryObjectAccessMask(
4330 IN KSOBJECT_HEADER Header
4331 );
4332
4333 KSDDKAPI
4334 VOID
4335 NTAPI
4336 KsRecalculateStackDepth(
4337 IN KSDEVICE_HEADER Header,
4338 IN BOOLEAN ReuseStackLocation
4339 );
4340
4341 KSDDKAPI
4342 VOID
4343 NTAPI
4344 KsSetTargetState(
4345 IN KSOBJECT_HEADER Header,
4346 IN KSTARGET_STATE TargetState
4347 );
4348
4349 KSDDKAPI
4350 VOID
4351 NTAPI
4352 KsSetTargetDeviceObject(
4353 IN KSOBJECT_HEADER Header,
4354 IN PDEVICE_OBJECT TargetDevice OPTIONAL
4355 );
4356
4357 KSDDKAPI
4358 VOID
4359 NTAPI
4360 KsSetPowerDispatch(
4361 IN KSOBJECT_HEADER Header,
4362 IN PFNKSCONTEXT_DISPATCH PowerDispatch OPTIONAL,
4363 IN PVOID PowerContext OPTIONAL
4364 );
4365
4366 KSDDKAPI
4367 PKSOBJECT_CREATE_ITEM
4368 NTAPI
4369 KsQueryObjectCreateItem(
4370 IN KSOBJECT_HEADER Header
4371 );
4372
4373 KSDDKAPI
4374 NTSTATUS
4375 NTAPI
4376 KsAllocateDeviceHeader(
4377 OUT KSDEVICE_HEADER* Header,
4378 IN ULONG ItemsCount,
4379 IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL
4380 );
4381
4382 KSDDKAPI
4383 VOID
4384 NTAPI
4385 KsFreeDeviceHeader(
4386 IN KSDEVICE_HEADER Header
4387 );
4388
4389 KSDDKAPI
4390 NTSTATUS
4391 NTAPI
4392 KsAllocateObjectHeader(
4393 OUT KSOBJECT_HEADER* Header,
4394 IN ULONG ItemsCount,
4395 IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL,
4396 IN PIRP Irp,
4397 IN const KSDISPATCH_TABLE* Table
4398 );
4399
4400 KSDDKAPI
4401 VOID
4402 NTAPI
4403 KsFreeObjectHeader(
4404 IN KSOBJECT_HEADER Header
4405 );
4406
4407 KSDDKAPI
4408 NTSTATUS
4409 NTAPI
4410 KsAddObjectCreateItemToDeviceHeader(
4411 IN KSDEVICE_HEADER Header,
4412 IN PDRIVER_DISPATCH Create,
4413 IN PVOID Context,
4414 IN PWCHAR ObjectClass,
4415 IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL
4416 );
4417
4418 KSDDKAPI
4419 NTSTATUS
4420 NTAPI
4421 KsAddObjectCreateItemToObjectHeader(
4422 IN KSOBJECT_HEADER Header,
4423 IN PDRIVER_DISPATCH Create,
4424 IN PVOID Context,
4425 IN PWCHAR ObjectClass,
4426 IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL
4427 );
4428
4429 KSDDKAPI
4430 NTSTATUS
4431 NTAPI
4432 KsAllocateObjectCreateItem(
4433 IN KSDEVICE_HEADER Header,
4434 IN PKSOBJECT_CREATE_ITEM CreateItem,
4435 IN BOOLEAN AllocateEntry,
4436 IN PFNKSITEMFREECALLBACK ItemFreeCallback OPTIONAL
4437 );
4438
4439 KSDDKAPI
4440 NTSTATUS
4441 NTAPI
4442 KsFreeObjectCreateItem(
4443 IN KSDEVICE_HEADER Header,
4444 IN PUNICODE_STRING CreateItem
4445 );
4446
4447 KSDDKAPI
4448 NTSTATUS
4449 NTAPI
4450 KsFreeObjectCreateItemsByContext(
4451 IN KSDEVICE_HEADER Header,
4452 IN PVOID Context
4453 );
4454
4455 KSDDKAPI
4456 NTSTATUS
4457 NTAPI
4458 KsCreateDefaultSecurity(
4459 IN PSECURITY_DESCRIPTOR ParentSecurity OPTIONAL,
4460 OUT PSECURITY_DESCRIPTOR* DefaultSecurity
4461 );
4462
4463 KSDDKAPI
4464 NTSTATUS
4465 NTAPI
4466 KsForwardIrp(
4467 IN PIRP Irp,
4468 IN PFILE_OBJECT FileObject,
4469 IN BOOLEAN ReuseStackLocation
4470 );
4471
4472 KSDDKAPI
4473 NTSTATUS
4474 NTAPI
4475 KsForwardAndCatchIrp(
4476 IN PDEVICE_OBJECT DeviceObject,
4477 IN PIRP Irp,
4478 IN PFILE_OBJECT FileObject,
4479 IN KSSTACK_USE StackUse
4480 );
4481
4482 KSDDKAPI
4483 NTSTATUS
4484 NTAPI
4485 KsSynchronousIoControlDevice(
4486 IN PFILE_OBJECT FileObject,
4487 IN KPROCESSOR_MODE RequestorMode,
4488 IN ULONG IoControl,
4489 IN PVOID InBuffer,
4490 IN ULONG InSize,
4491 OUT PVOID OutBuffer,
4492 IN ULONG OutSize,
4493 OUT PULONG BytesReturned
4494 );
4495
4496 KSDDKAPI
4497 NTSTATUS
4498 NTAPI
4499 KsUnserializeObjectPropertiesFromRegistry(
4500 IN PFILE_OBJECT FileObject,
4501 IN HANDLE ParentKey OPTIONAL,
4502 IN PUNICODE_STRING RegistryPath OPTIONAL
4503 );
4504
4505 KSDDKAPI
4506 NTSTATUS
4507 NTAPI
4508 KsCacheMedium(
4509 IN PUNICODE_STRING SymbolicLink,
4510 IN PKSPIN_MEDIUM Medium,
4511 IN ULONG PinDirection
4512 );
4513
4514 // thread.c:
4515
4516 KSDDKAPI
4517 NTSTATUS
4518 NTAPI
4519 KsRegisterWorker(
4520 IN WORK_QUEUE_TYPE WorkQueueType,
4521 OUT PKSWORKER* Worker
4522 );
4523 KSDDKAPI
4524 NTSTATUS
4525 NTAPI
4526 KsRegisterCountedWorker(
4527 IN WORK_QUEUE_TYPE WorkQueueType,
4528 IN PWORK_QUEUE_ITEM CountedWorkItem,
4529 OUT PKSWORKER* Worker
4530 );
4531 KSDDKAPI
4532 VOID
4533 NTAPI
4534 KsUnregisterWorker(
4535 IN PKSWORKER Worker
4536 );
4537 KSDDKAPI
4538 NTSTATUS
4539 NTAPI
4540 KsQueueWorkItem(
4541 IN PKSWORKER Worker,
4542 IN PWORK_QUEUE_ITEM WorkItem
4543 );
4544 KSDDKAPI
4545 ULONG
4546 NTAPI
4547 KsIncrementCountedWorker(
4548 IN PKSWORKER Worker
4549 );
4550 KSDDKAPI
4551 ULONG
4552 NTAPI
4553 KsDecrementCountedWorker(
4554 IN PKSWORKER Worker
4555 );
4556
4557 // topology.c:
4558
4559 KSDDKAPI
4560 NTSTATUS
4561 NTAPI
4562 KsCreateTopologyNode(
4563 IN HANDLE ParentHandle,
4564 IN PKSNODE_CREATE NodeCreate,
4565 IN ACCESS_MASK DesiredAccess,
4566 OUT PHANDLE NodeHandle
4567 );
4568
4569 KSDDKAPI
4570 NTSTATUS
4571 NTAPI
4572 KsValidateTopologyNodeCreateRequest(
4573 IN PIRP Irp,
4574 IN PKSTOPOLOGY Topology,
4575 OUT PKSNODE_CREATE* NodeCreate
4576 );
4577
4578 KSDDKAPI
4579 NTSTATUS
4580 NTAPI
4581 KsMergeAutomationTables(
4582 OUT PKSAUTOMATION_TABLE* AutomationTableAB,
4583 IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL,
4584 IN PKSAUTOMATION_TABLE AutomationTableB OPTIONAL,
4585 IN KSOBJECT_BAG Bag OPTIONAL
4586 );
4587
4588 KSDDKAPI
4589 NTSTATUS
4590 NTAPI
4591 KsInitializeDriver(
4592 IN PDRIVER_OBJECT DriverObject,
4593 IN PUNICODE_STRING RegistryPathName,
4594 IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL
4595 );
4596
4597 KSDDKAPI
4598 NTSTATUS
4599 NTAPI
4600 KsAddDevice(
4601 IN PDRIVER_OBJECT DriverObject,
4602 IN PDEVICE_OBJECT PhysicalDeviceObject
4603 );
4604
4605 KSDDKAPI
4606 NTSTATUS
4607 NTAPI
4608 KsCreateDevice(
4609 IN PDRIVER_OBJECT DriverObject,
4610 IN PDEVICE_OBJECT PhysicalDeviceObject,
4611 IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL,
4612 IN ULONG ExtensionSize OPTIONAL,
4613 OUT PKSDEVICE* Device OPTIONAL
4614 );
4615
4616 KSDDKAPI
4617 NTSTATUS
4618 NTAPI
4619 KsInitializeDevice(
4620 IN PDEVICE_OBJECT FunctionalDeviceObject,
4621 IN PDEVICE_OBJECT PhysicalDeviceObject,
4622 IN PDEVICE_OBJECT NextDeviceObject,
4623 IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL
4624 );
4625
4626 KSDDKAPI
4627 void
4628 NTAPI
4629 KsTerminateDevice(
4630 IN PDEVICE_OBJECT DeviceObject
4631 );
4632
4633 KSDDKAPI
4634 PKSDEVICE
4635 NTAPI
4636 KsGetDeviceForDeviceObject(
4637 IN PDEVICE_OBJECT FunctionalDeviceObject
4638 );
4639
4640 KSDDKAPI
4641 void
4642 NTAPI
4643 KsAcquireDevice(
4644 IN PKSDEVICE Device
4645 );
4646
4647 KSDDKAPI
4648 void
4649 NTAPI
4650 KsReleaseDevice(
4651 IN PKSDEVICE Device
4652 );
4653
4654 KSDDKAPI
4655 void
4656 NTAPI
4657 KsDeviceRegisterAdapterObject(
4658 IN PKSDEVICE Device,
4659 IN PADAPTER_OBJECT AdapterObject,
4660 IN ULONG MaxMappingsByteCount,
4661 IN ULONG MappingTableStride
4662 );
4663
4664 KSDDKAPI
4665 ULONG
4666 NTAPI
4667 KsDeviceGetBusData(
4668 IN PKSDEVICE Device,
4669 IN ULONG DataType,
4670 IN PVOID Buffer,
4671 IN ULONG Offset,
4672 IN ULONG Length
4673 );
4674
4675 KSDDKAPI
4676 ULONG
4677 NTAPI
4678 KsDeviceSetBusData(
4679 IN PKSDEVICE Device,
4680 IN ULONG DataType,
4681 IN PVOID Buffer,
4682 IN ULONG Offset,
4683 IN ULONG Length
4684 );
4685
4686 KSDDKAPI
4687 NTSTATUS
4688 NTAPI
4689 KsCreateFilterFactory(
4690 IN PDEVICE_OBJECT DeviceObject,
4691 IN const KSFILTER_DESCRIPTOR* Descriptor,
4692 IN PWCHAR RefString OPTIONAL,
4693 IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL,
4694 IN ULONG CreateItemFlags,
4695 IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL,
4696 IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL,
4697 OUT PKSFILTERFACTORY* FilterFactory OPTIONAL
4698 );
4699
4700 #define KsDeleteFilterFactory(FilterFactory) \
4701 KsFreeObjectCreateItemsByContext(\
4702 *(KSDEVICE_HEADER *)(\
4703 KsFilterFactoryGetParentDevice(FilterFactory)->FunctionalDeviceObject->\
4704 DeviceExtension),\
4705 FilterFactory)
4706
4707 KSDDKAPI
4708 NTSTATUS
4709 NTAPI
4710 KsFilterFactoryAddCreateItem(
4711 IN PKSFILTERFACTORY FilterFactory,
4712 IN PWCHAR RefString,
4713 IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL,
4714 IN ULONG CreateItemFlags
4715 );
4716
4717 KSDDKAPI
4718 NTSTATUS
4719 NTAPI
4720 KsFilterFactorySetDeviceClassesState(
4721 IN PKSFILTERFACTORY FilterFactory,
4722 IN BOOLEAN NewState
4723 );
4724
4725 KSDDKAPI
4726 PUNICODE_STRING
4727 NTAPI
4728 KsFilterFactoryGetSymbolicLink(
4729 IN PKSFILTERFACTORY FilterFactory
4730 );
4731
4732 KSDDKAPI
4733 void
4734 NTAPI
4735 KsAddEvent(
4736 IN PVOID Object,
4737 IN PKSEVENT_ENTRY EventEntry
4738 );
4739
4740 void _inline
4741 KsFilterAddEvent(
4742 IN PKSFILTER Filter,
4743 IN PKSEVENT_ENTRY EventEntry
4744 )
4745 {
4746 KsAddEvent(Filter,EventEntry);
4747 }
4748
4749 void _inline
4750 KsPinAddEvent(
4751 IN PKSPIN Pin,
4752 IN PKSEVENT_ENTRY EventEntry
4753 )
4754 {
4755 KsAddEvent(Pin,EventEntry);
4756 }
4757
4758 KSDDKAPI
4759 NTSTATUS
4760 NTAPI
4761 KsDefaultAddEventHandler(
4762 IN PIRP Irp,
4763 IN PKSEVENTDATA EventData,
4764 IN OUT PKSEVENT_ENTRY EventEntry
4765 );
4766
4767 KSDDKAPI
4768 void
4769 NTAPI
4770 KsGenerateEvents(
4771 IN PVOID Object,
4772 IN const GUID* EventSet OPTIONAL,
4773 IN ULONG EventId,
4774 IN ULONG DataSize,
4775 IN PVOID Data OPTIONAL,
4776 IN PFNKSGENERATEEVENTCALLBACK CallBack OPTIONAL,
4777 IN PVOID CallBackContext OPTIONAL
4778 );
4779
4780 void _inline
4781 KsFilterGenerateEvents(
4782 IN PKSFILTER Filter,
4783 IN const GUID* EventSet OPTIONAL,
4784 IN ULONG EventId,
4785 IN ULONG DataSize,
4786 IN PVOID Data OPTIONAL,
4787 IN PFNKSGENERATEEVENTCALLBACK CallBack OPTIONAL,
4788 IN PVOID CallBackContext OPTIONAL
4789 )
4790 {
4791 KsGenerateEvents(
4792 Filter,
4793 EventSet,
4794 EventId,
4795 DataSize,
4796 Data,
4797 CallBack,
4798 CallBackContext);
4799 }
4800
4801 void _inline
4802 KsPinGenerateEvents(
4803 IN PKSPIN Pin,
4804 IN const GUID* EventSet OPTIONAL,
4805 IN ULONG EventId,
4806 IN ULONG DataSize,
4807 IN PVOID Data OPTIONAL,
4808 IN PFNKSGENERATEEVENTCALLBACK CallBack OPTIONAL,
4809 IN PVOID CallBackContext OPTIONAL
4810 )
4811 {
4812 KsGenerateEvents(
4813 Pin,
4814 EventSet,
4815 EventId,
4816 DataSize,
4817 Data,
4818 CallBack,
4819 CallBackContext);
4820 }
4821
4822 typedef enum {
4823 KSSTREAM_POINTER_STATE_UNLOCKED = 0,
4824 KSSTREAM_POINTER_STATE_LOCKED
4825 } KSSTREAM_POINTER_STATE;
4826
4827 KSDDKAPI
4828 NTSTATUS
4829 NTAPI
4830 KsPinGetAvailableByteCount(
4831 IN PKSPIN Pin,
4832 OUT PLONG InputDataBytes OPTIONAL,
4833 OUT PLONG OutputBufferBytes OPTIONAL
4834 );
4835
4836 KSDDKAPI
4837 PKSSTREAM_POINTER
4838 NTAPI
4839 KsPinGetLeadingEdgeStreamPointer(
4840 IN PKSPIN Pin,
4841 IN KSSTREAM_POINTER_STATE State
4842 );
4843
4844 KSDDKAPI
4845 PKSSTREAM_POINTER
4846 NTAPI
4847 KsPinGetTrailingEdgeStreamPointer(
4848 IN PKSPIN Pin,
4849 IN KSSTREAM_POINTER_STATE State
4850 );
4851
4852 KSDDKAPI
4853 NTSTATUS
4854 NTAPI
4855 KsStreamPointerLock(
4856 IN PKSSTREAM_POINTER StreamPointer
4857 );
4858
4859 KSDDKAPI
4860 void
4861 NTAPI
4862 KsStreamPointerUnlock(
4863 IN PKSSTREAM_POINTER StreamPointer,
4864 IN BOOLEAN Eject
4865 );
4866
4867 KSDDKAPI
4868 void
4869 NTAPI
4870 KsStreamPointerAdvanceOffsetsAndUnlock(
4871 IN PKSSTREAM_POINTER StreamPointer,
4872 IN ULONG InUsed,
4873 IN ULONG OutUsed,
4874 IN BOOLEAN Eject
4875 );
4876
4877 KSDDKAPI
4878 void
4879 NTAPI
4880 KsStreamPointerDelete(
4881 IN PKSSTREAM_POINTER StreamPointer
4882 );
4883
4884 KSDDKAPI
4885 NTSTATUS
4886 NTAPI
4887 KsStreamPointerClone(
4888 IN PKSSTREAM_POINTER StreamPointer,
4889 IN PFNKSSTREAMPOINTER CancelCallback OPTIONAL,
4890 IN ULONG ContextSize,
4891 OUT PKSSTREAM_POINTER* CloneStreamPointer
4892 );
4893
4894 KSDDKAPI
4895 NTSTATUS
4896 NTAPI
4897 KsStreamPointerAdvanceOffsets(
4898 IN PKSSTREAM_POINTER StreamPointer,
4899 IN ULONG InUsed,
4900 IN ULONG OutUsed,
4901 IN BOOLEAN Eject
4902 );
4903
4904 KSDDKAPI
4905 NTSTATUS
4906 NTAPI
4907 KsStreamPointerAdvance(
4908 IN PKSSTREAM_POINTER StreamPointer
4909 );
4910
4911 KSDDKAPI
4912 PMDL
4913 NTAPI
4914 KsStreamPointerGetMdl(
4915 IN PKSSTREAM_POINTER StreamPointer
4916 );
4917
4918 KSDDKAPI
4919 PIRP
4920 NTAPI
4921 KsStreamPointerGetIrp(
4922 IN PKSSTREAM_POINTER StreamPointer,
4923 OUT PBOOLEAN FirstFrameInIrp OPTIONAL,
4924 OUT PBOOLEAN LastFrameInIrp OPTIONAL
4925 );
4926
4927 KSDDKAPI
4928 void
4929 NTAPI
4930 KsStreamPointerScheduleTimeout(
4931 IN PKSSTREAM_POINTER StreamPointer,
4932 IN PFNKSSTREAMPOINTER Callback,
4933 IN ULONGLONG Interval
4934 );
4935
4936 KSDDKAPI
4937 void
4938 NTAPI
4939 KsStreamPointerCancelTimeout(
4940 IN PKSSTREAM_POINTER StreamPointer
4941 );
4942
4943 KSDDKAPI
4944 PKSSTREAM_POINTER
4945 NTAPI
4946 KsPinGetFirstCloneStreamPointer(
4947 IN PKSPIN Pin
4948 );
4949
4950 KSDDKAPI
4951 PKSSTREAM_POINTER
4952 NTAPI
4953 KsStreamPointerGetNextClone(
4954 IN PKSSTREAM_POINTER StreamPointer
4955 );
4956
4957 KSDDKAPI
4958 NTSTATUS
4959 NTAPI
4960 KsPinHandshake(
4961 IN PKSPIN Pin,
4962 IN PKSHANDSHAKE In,
4963 OUT PKSHANDSHAKE Out
4964 );
4965
4966 KSDDKAPI
4967 void
4968 NTAPI
4969 KsCompletePendingRequest(
4970 IN PIRP Irp
4971 );
4972
4973 KSDDKAPI
4974 KSOBJECTTYPE
4975 NTAPI
4976 KsGetObjectTypeFromIrp(
4977 IN PIRP Irp
4978 );
4979
4980 KSDDKAPI
4981 PVOID
4982 NTAPI
4983 KsGetObjectFromFileObject(
4984 IN PFILE_OBJECT FileObject
4985 );
4986
4987 KSDDKAPI
4988 KSOBJECTTYPE
4989 NTAPI
4990 KsGetObjectTypeFromFileObject(
4991 IN PFILE_OBJECT FileObject
4992 );
4993
4994 PKSFILTER __inline
4995 KsGetFilterFromFileObject(
4996 IN PFILE_OBJECT FileObject
4997 )
4998 {
4999 return (PKSFILTER) KsGetObjectFromFileObject(FileObject);
5000 }
5001
5002 PKSPIN __inline
5003 KsGetPinFromFileObject(
5004 IN PFILE_OBJECT FileObject
5005 )
5006 {
5007 return (PKSPIN) KsGetObjectFromFileObject(FileObject);
5008 }
5009
5010 KSDDKAPI
5011 PKSGATE
5012 NTAPI
5013 KsFilterGetAndGate(
5014 IN PKSFILTER Filter
5015 );
5016
5017 KSDDKAPI
5018 void
5019 NTAPI
5020 KsFilterAcquireProcessingMutex(
5021 IN PKSFILTER Filter
5022 );
5023
5024 KSDDKAPI
5025 void
5026 NTAPI
5027 KsFilterReleaseProcessingMutex(
5028 IN PKSFILTER Filter
5029 );
5030
5031 KSDDKAPI
5032 void
5033 NTAPI
5034 KsFilterAttemptProcessing(
5035 IN PKSFILTER Filter,
5036 IN BOOLEAN Asynchronous
5037 );
5038
5039 KSDDKAPI
5040 PKSGATE
5041 NTAPI
5042 KsPinGetAndGate(
5043 IN PKSPIN Pin
5044 );
5045
5046 KSDDKAPI
5047 void
5048 NTAPI
5049 KsPinAttachAndGate(
5050 IN PKSPIN Pin,
5051 IN PKSGATE AndGate OPTIONAL
5052 );
5053
5054 KSDDKAPI
5055 void
5056 NTAPI
5057 KsPinAttachOrGate(
5058 IN PKSPIN Pin,
5059 IN PKSGATE OrGate OPTIONAL
5060 );
5061
5062 KSDDKAPI
5063 void
5064 NTAPI
5065 KsPinAcquireProcessingMutex(
5066 IN PKSPIN Pin
5067 );
5068
5069 KSDDKAPI
5070 void
5071 NTAPI
5072 KsPinReleaseProcessingMutex(
5073 IN PKSPIN Pin
5074 );
5075
5076 KSDDKAPI
5077 BOOLEAN
5078 NTAPI
5079 KsProcessPinUpdate(
5080 IN PKSPROCESSPIN ProcessPin
5081 );
5082
5083 KSDDKAPI
5084 void
5085 NTAPI
5086 KsPinAttemptProcessing(
5087 IN PKSPIN Pin,
5088 IN BOOLEAN Asynchronous
5089 );
5090
5091 KSDDKAPI
5092 PVOID
5093 NTAPI
5094 KsGetParent(
5095 IN PVOID Object
5096 );
5097
5098 PKSDEVICE __inline
5099 KsFilterFactoryGetParentDevice(
5100 IN PKSFILTERFACTORY FilterFactory
5101 )
5102 {
5103 return (PKSDEVICE) KsGetParent((PVOID) FilterFactory);
5104 }
5105
5106 PKSFILTERFACTORY __inline
5107 KsFilterGetParentFilterFactory(
5108 IN PKSFILTER Filter
5109 )
5110 {
5111 return (PKSFILTERFACTORY) KsGetParent((PVOID) Filter);
5112 }
5113
5114 KSDDKAPI
5115 PKSFILTER
5116 NTAPI
5117 KsPinGetParentFilter(
5118 IN PKSPIN Pin
5119 );
5120
5121 KSDDKAPI
5122 PVOID
5123 NTAPI
5124 KsGetFirstChild(
5125 IN PVOID Object
5126 );
5127
5128 PKSFILTERFACTORY __inline
5129 KsDeviceGetFirstChildFilterFactory(
5130 IN PKSDEVICE Device
5131 )
5132 {
5133 return (PKSFILTERFACTORY) KsGetFirstChild((PVOID) Device);
5134 }
5135
5136 PKSFILTER __inline
5137 KsFilterFactoryGetFirstChildFilter(
5138 IN PKSFILTERFACTORY FilterFactory
5139 )
5140 {
5141 return (PKSFILTER) KsGetFirstChild((PVOID) FilterFactory);
5142 }
5143
5144 KSDDKAPI
5145 ULONG
5146 NTAPI
5147 KsFilterGetChildPinCount(
5148 IN PKSFILTER Filter,
5149 IN ULONG PinId
5150 );
5151
5152 KSDDKAPI
5153 PKSPIN
5154 NTAPI
5155 KsFilterGetFirstChildPin(
5156 IN PKSFILTER Filter,
5157 IN ULONG PinId
5158 );
5159
5160 KSDDKAPI
5161 PVOID
5162 NTAPI
5163 KsGetNextSibling(
5164 IN PVOID Object
5165 );
5166
5167 KSDDKAPI
5168 PKSPIN
5169 NTAPI
5170 KsPinGetNextSiblingPin(
5171 IN PKSPIN Pin
5172 );
5173
5174 PKSFILTERFACTORY __inline
5175 KsFilterFactoryGetNextSiblingFilterFactory(
5176 IN PKSFILTERFACTORY FilterFactory
5177 )
5178 {
5179 return (PKSFILTERFACTORY) KsGetNextSibling((PVOID) FilterFactory);
5180 }
5181
5182 PKSFILTER __inline
5183 KsFilterGetNextSiblingFilter(
5184 IN PKSFILTER Filter
5185 )
5186 {
5187 return (PKSFILTER) KsGetNextSibling((PVOID) Filter);
5188 }
5189
5190
5191 KSDDKAPI
5192 PKSDEVICE
5193 NTAPI
5194 KsGetDevice(
5195 IN PVOID Object
5196 );
5197
5198 PKSDEVICE __inline
5199 KsFilterFactoryGetDevice(
5200 IN PKSFILTERFACTORY FilterFactory
5201 )
5202 {
5203 return KsGetDevice((PVOID) FilterFactory);
5204 }
5205
5206 PKSDEVICE __inline
5207 KsFilterGetDevice(
5208 IN PKSFILTER Filter
5209 )
5210 {
5211 return KsGetDevice((PVOID) Filter);
5212 }
5213
5214 PKSDEVICE __inline
5215 KsPinGetDevice(
5216 IN PKSPIN Pin
5217 )
5218 {
5219 return KsGetDevice((PVOID) Pin);
5220 }
5221
5222 KSDDKAPI
5223 PKSFILTER
5224 NTAPI
5225 KsGetFilterFromIrp(
5226 IN PIRP Irp
5227 );
5228
5229 KSDDKAPI
5230 PKSPIN
5231 NTAPI
5232 KsGetPinFromIrp(
5233 IN PIRP Irp
5234 );
5235
5236 KSDDKAPI
5237 ULONG
5238 NTAPI
5239 KsGetNodeIdFromIrp(
5240 IN PIRP Irp
5241 );
5242
5243 KSDDKAPI
5244 void
5245 NTAPI
5246 KsAcquireControl(
5247 IN PVOID Object
5248 );
5249
5250 KSDDKAPI
5251 void
5252 NTAPI
5253 KsReleaseControl(
5254 IN PVOID Object
5255 );
5256
5257 void __inline
5258 KsFilterAcquireControl(
5259 IN PKSFILTER Filter
5260 )
5261 {
5262 KsAcquireControl((PVOID) Filter);
5263 }
5264
5265 void __inline
5266 KsFilterReleaseControl(
5267 IN PKSFILTER Filter
5268 )
5269 {
5270 KsReleaseControl((PVOID) Filter);
5271 }
5272
5273 void __inline
5274 KsPinAcquireControl(
5275 IN PKSPIN Pin
5276 )
5277 {
5278 KsAcquireControl((PVOID) Pin);
5279 }
5280
5281 void __inline
5282 KsPinReleaseControl(
5283 IN PKSPIN Pin
5284 )
5285 {
5286 KsReleaseControl((PVOID) Pin);
5287 }
5288
5289 KSDDKAPI
5290 NTSTATUS
5291 NTAPI
5292 KsAddItemToObjectBag(
5293 IN KSOBJECT_BAG ObjectBag,
5294 IN PVOID Item,
5295 IN PFNKSFREE Free OPTIONAL
5296 );
5297
5298 KSDDKAPI
5299 ULONG
5300 NTAPI
5301 KsRemoveItemFromObjectBag(
5302 IN KSOBJECT_BAG ObjectBag,
5303 IN PVOID Item,
5304 IN BOOLEAN Free
5305 );
5306
5307 #define KsDiscard(Object,Pointer)\
5308 KsRemoveItemFromObjectBag(\
5309 (Object)->Bag,\
5310 (PVOID)(Pointer),\
5311 TRUE)
5312
5313 KSDDKAPI
5314 NTSTATUS
5315 NTAPI
5316 KsAllocateObjectBag(
5317 IN PKSDEVICE Device,
5318 OUT KSOBJECT_BAG* ObjectBag
5319 );
5320
5321 KSDDKAPI
5322 void
5323 NTAPI
5324 KsFreeObjectBag(
5325 IN KSOBJECT_BAG ObjectBag
5326 );
5327
5328 KSDDKAPI
5329 NTSTATUS
5330 NTAPI
5331 KsCopyObjectBagItems(
5332 IN KSOBJECT_BAG ObjectBagDestination,
5333 IN KSOBJECT_BAG ObjectBagSource
5334 );
5335
5336 KSDDKAPI
5337 NTSTATUS
5338 NTAPI
5339 _KsEdit(
5340 IN KSOBJECT_BAG ObjectBag,
5341 IN OUT PVOID* PointerToPointerToItem,
5342 IN ULONG NewSize,
5343 IN ULONG OldSize,
5344 IN ULONG Tag
5345 );
5346
5347 #define KsEdit(Object,PointerToPointer,Tag)\
5348 _KsEdit(\
5349 (Object)->Bag,\
5350 (PVOID*)(PointerToPointer),\
5351 sizeof(**(PointerToPointer)),\
5352 sizeof(**(PointerToPointer)),\
5353 (Tag))
5354 #define KsEditSized(Object,PointerToPointer,NewSize,OldSize,Tag)\
5355 _KsEdit((Object)->Bag,(PVOID*)(PointerToPointer),(NewSize),(OldSize),(Tag))
5356
5357 KSDDKAPI
5358 NTSTATUS
5359 NTAPI
5360 KsRegisterFilterWithNoKSPins(
5361 IN PDEVICE_OBJECT DeviceObject,
5362 IN const GUID * InterfaceClassGUID,
5363 IN ULONG PinCount,
5364 IN BOOL * PinDirection,
5365 IN KSPIN_MEDIUM * MediumList,
5366 IN OPTIONAL GUID * CategoryList
5367 );
5368
5369 KSDDKAPI
5370 NTSTATUS
5371 NTAPI
5372 KsFilterCreatePinFactory (
5373 IN PKSFILTER Filter,
5374 IN const KSPIN_DESCRIPTOR_EX *const PinDescriptor,
5375 OUT PULONG PinID
5376 );
5377
5378 KSDDKAPI
5379 NTSTATUS
5380 NTAPI
5381 KsFilterCreateNode (
5382 IN PKSFILTER Filter,
5383 IN const KSNODE_DESCRIPTOR *const NodeDescriptor,
5384 OUT PULONG NodeID
5385 );
5386
5387 KSDDKAPI
5388 NTSTATUS
5389 NTAPI
5390 KsFilterAddTopologyConnections (
5391 IN PKSFILTER Filter,
5392 IN ULONG NewConnectionsCount,
5393 IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections
5394 );
5395
5396 KSDDKAPI
5397 NTSTATUS
5398 NTAPI
5399 KsPinGetConnectedPinInterface(
5400 IN PKSPIN Pin,
5401 IN const GUID* InterfaceId,
5402 OUT PVOID* Interface
5403 );
5404
5405 KSDDKAPI
5406 PFILE_OBJECT
5407 NTAPI
5408 KsPinGetConnectedPinFileObject(
5409 IN PKSPIN Pin
5410 );
5411
5412 KSDDKAPI
5413 NTSTATUS
5414 NTAPI
5415 KsPinGetConnectedFilterInterface(
5416 IN PKSPIN Pin,
5417 IN const GUID* InterfaceId,
5418 OUT PVOID* Interface
5419 );
5420
5421 #if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
5422
5423 KSDDKAPI
5424 NTSTATUS
5425 NTAPI
5426 KsPinGetReferenceClockInterface(
5427 IN PKSPIN Pin,
5428 OUT PIKSREFERENCECLOCK* Interface
5429 );
5430
5431 #endif //defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
5432
5433 KSDDKAPI
5434 VOID
5435 NTAPI
5436 KsPinSetPinClockTime(
5437 IN PKSPIN Pin,
5438 IN LONGLONG Time
5439 );
5440
5441 KSDDKAPI
5442 NTSTATUS
5443 NTAPI
5444 KsPinSubmitFrame(
5445 IN PKSPIN Pin,
5446 IN PVOID Data OPTIONAL,
5447 IN ULONG Size OPTIONAL,
5448 IN PKSSTREAM_HEADER StreamHeader OPTIONAL,
5449 IN PVOID Context OPTIONAL
5450 );
5451
5452 KSDDKAPI
5453 NTSTATUS
5454 NTAPI
5455 KsPinSubmitFrameMdl(
5456 IN PKSPIN Pin,
5457 IN PMDL Mdl OPTIONAL,
5458 IN PKSSTREAM_HEADER StreamHeader OPTIONAL,
5459 IN PVOID Context OPTIONAL
5460 );
5461
5462 KSDDKAPI
5463 void
5464 NTAPI
5465 KsPinRegisterFrameReturnCallback(
5466 IN PKSPIN Pin,
5467 IN PFNKSPINFRAMERETURN FrameReturn
5468 );
5469
5470 KSDDKAPI
5471 void
5472 NTAPI
5473 KsPinRegisterHandshakeCallback(
5474 IN PKSPIN Pin,
5475 IN PFNKSPINHANDSHAKE Handshake
5476 );
5477
5478 KSDDKAPI
5479 void
5480 NTAPI
5481 KsFilterRegisterPowerCallbacks(
5482 IN PKSFILTER Filter,
5483 IN PFNKSFILTERPOWER Sleep OPTIONAL,
5484 IN PFNKSFILTERPOWER Wake OPTIONAL
5485 );
5486
5487 KSDDKAPI
5488 void
5489 NTAPI
5490 KsPinRegisterPowerCallbacks(
5491 IN PKSPIN Pin,
5492 IN PFNKSPINPOWER Sleep OPTIONAL,
5493 IN PFNKSPINPOWER Wake OPTIONAL
5494 );
5495
5496 #if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
5497
5498 KSDDKAPI
5499 PUNKNOWN
5500 NTAPI
5501 KsRegisterAggregatedClientUnknown(
5502 IN PVOID Object,
5503 IN PUNKNOWN ClientUnknown
5504 );
5505
5506 KSDDKAPI
5507 PUNKNOWN
5508 NTAPI
5509 KsGetOuterUnknown(
5510 IN PVOID Object
5511 );
5512
5513 PUNKNOWN __inline
5514 KsDeviceRegisterAggregatedClientUnknown(
5515 IN PKSDEVICE Device,
5516 IN PUNKNOWN ClientUnknown
5517 )
5518 {
5519 return KsRegisterAggregatedClientUnknown((PVOID) Device,ClientUnknown);
5520 }
5521
5522 PUNKNOWN __inline
5523 KsDeviceGetOuterUnknown(
5524 IN PKSDEVICE Device
5525 )
5526 {
5527 return KsGetOuterUnknown((PVOID) Device);
5528 }
5529
5530 PUNKNOWN __inline
5531 KsFilterFactoryRegisterAggregatedClientUnknown(
5532 IN PKSFILTERFACTORY FilterFactory,
5533 IN PUNKNOWN ClientUnknown
5534 )
5535 {
5536 return KsRegisterAggregatedClientUnknown((PVOID) FilterFactory,ClientUnknown);
5537 }
5538
5539 PUNKNOWN __inline
5540 KsFilterFactoryGetOuterUnknown(
5541 IN PKSFILTERFACTORY FilterFactory
5542 )
5543 {
5544 return KsGetOuterUnknown((PVOID) FilterFactory);
5545 }
5546
5547 PUNKNOWN __inline
5548 KsFilterRegisterAggregatedClientUnknown(
5549 IN PKSFILTER Filter,
5550 IN PUNKNOWN ClientUnknown
5551 )
5552 {
5553 return KsRegisterAggregatedClientUnknown((PVOID) Filter,ClientUnknown);
5554 }
5555
5556 PUNKNOWN __inline
5557 KsFilterGetOuterUnknown(
5558 IN PKSFILTER Filter
5559 )
5560 {
5561 return KsGetOuterUnknown((PVOID) Filter);
5562 }
5563
5564 PUNKNOWN __inline
5565 KsPinRegisterAggregatedClientUnknown(
5566 IN PKSPIN Pin,
5567 IN PUNKNOWN ClientUnknown
5568 )
5569 {
5570 return KsRegisterAggregatedClientUnknown((PVOID) Pin,ClientUnknown);
5571 }
5572
5573 PUNKNOWN __inline
5574 KsPinGetOuterUnknown(
5575 IN PKSPIN Pin
5576 )
5577 {
5578 return KsGetOuterUnknown((PVOID) Pin);
5579 }
5580
5581 #endif // defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
5582
5583 #else // !defined(_NTDDK_)
5584
5585 #if !defined( KS_NO_CREATE_FUNCTIONS )
5586
5587 KSDDKAPI
5588 DWORD
5589 WINAPI
5590 KsCreateAllocator(
5591 IN HANDLE ConnectionHandle,
5592 IN PKSALLOCATOR_FRAMING AllocatorFraming,
5593 OUT PHANDLE AllocatorHandle
5594 );
5595
5596 KSDDKAPI
5597 DWORD
5598 NTAPI
5599 KsCreateClock(
5600 IN HANDLE ConnectionHandle,
5601 IN PKSCLOCK_CREATE ClockCreate,
5602 OUT PHANDLE ClockHandle
5603 );
5604
5605 KSDDKAPI
5606 DWORD
5607 WINAPI
5608 KsCreatePin(
5609 IN HANDLE FilterHandle,
5610 IN PKSPIN_CONNECT Connect,
5611 IN ACCESS_MASK DesiredAccess,
5612 OUT PHANDLE ConnectionHandle
5613 );
5614
5615 KSDDKAPI
5616 DWORD
5617 WINAPI
5618 KsCreateTopologyNode(
5619 IN HANDLE ParentHandle,
5620 IN PKSNODE_CREATE NodeCreate,
5621 IN ACCESS_MASK DesiredAccess,
5622 OUT PHANDLE NodeHandle
5623 );
5624
5625 #endif
5626
5627 #endif // !defined(_NTDDK_)
5628
5629 #if defined(__cplusplus)
5630 }
5631 #endif // defined(__cplusplus)
5632
5633 #endif // !_KS_

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26