Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5698 lines
140 KiB

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