Audio plugin host https://kx.studio/carla
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.

3578 lines
126KB

  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given.
  5. */
  6. #ifndef _KS_
  7. #define _KS_
  8. #include <winioctl.h>
  9. #if __GNUC__ >= 3
  10. # pragma GCC system_header
  11. #endif
  12. #ifndef __MINGW_EXTENSION
  13. # if defined(__GNUC__) || defined(__GNUG__)
  14. # define __MINGW_EXTENSION __extension__
  15. # else
  16. # define __MINGW_EXTENSION
  17. # endif
  18. #endif
  19. #ifdef __TCS__
  20. # define _KS_NO_ANONYMOUS_STRUCTURES_ 1
  21. #endif
  22. #ifdef _KS_NO_ANONYMOUS_STRUCTURES_
  23. # define _KS_ANON_STRUCT(X) struct X
  24. #else
  25. # define _KS_ANON_STRUCT(X) __MINGW_EXTENSION struct
  26. #endif
  27. #ifndef _NTRTL_
  28. # ifndef DEFINE_GUIDEX
  29. # define DEFINE_GUIDEX(name) EXTERN_C const GUID name
  30. # endif
  31. # ifndef STATICGUIDOF
  32. # define STATICGUIDOF(guid) STATIC_ ## guid
  33. # endif
  34. #endif /* _NTRTL_ */
  35. #ifndef SIZEOF_ARRAY
  36. # define SIZEOF_ARRAY(ar) (sizeof(ar) / sizeof((ar)[0]))
  37. #endif
  38. #define DEFINE_GUIDSTRUCT(g, n) DEFINE_GUIDEX(n)
  39. #define DEFINE_GUIDNAMED(n) n
  40. #define STATIC_GUID_NULL \
  41. 0x00000000L, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
  42. DEFINE_GUIDSTRUCT("00000000-0000-0000-0000-000000000000", GUID_NULL);
  43. #define GUID_NULL DEFINE_GUIDNAMED(GUID_NULL)
  44. #define IOCTL_KS_PROPERTY CTL_CODE(FILE_DEVICE_KS, 0x000, METHOD_NEITHER, FILE_ANY_ACCESS)
  45. #define IOCTL_KS_ENABLE_EVENT CTL_CODE(FILE_DEVICE_KS, 0x001, METHOD_NEITHER, FILE_ANY_ACCESS)
  46. #define IOCTL_KS_DISABLE_EVENT CTL_CODE(FILE_DEVICE_KS, 0x002, METHOD_NEITHER, FILE_ANY_ACCESS)
  47. #define IOCTL_KS_METHOD CTL_CODE(FILE_DEVICE_KS, 0x003, METHOD_NEITHER, FILE_ANY_ACCESS)
  48. #define IOCTL_KS_WRITE_STREAM CTL_CODE(FILE_DEVICE_KS, 0x004, METHOD_NEITHER, FILE_WRITE_ACCESS)
  49. #define IOCTL_KS_READ_STREAM CTL_CODE(FILE_DEVICE_KS, 0x005, METHOD_NEITHER, FILE_READ_ACCESS)
  50. #define IOCTL_KS_RESET_STATE CTL_CODE(FILE_DEVICE_KS, 0x006, METHOD_NEITHER, FILE_ANY_ACCESS)
  51. typedef enum
  52. {
  53. KSRESET_BEGIN,
  54. KSRESET_END
  55. }KSRESET;
  56. typedef enum
  57. {
  58. KSSTATE_STOP,
  59. KSSTATE_ACQUIRE,
  60. KSSTATE_PAUSE,
  61. KSSTATE_RUN
  62. }KSSTATE, * PKSSTATE;
  63. #define KSPRIORITY_LOW 0x00000001
  64. #define KSPRIORITY_NORMAL 0x40000000
  65. #define KSPRIORITY_HIGH 0x80000000
  66. #define KSPRIORITY_EXCLUSIVE 0xFFFFFFFF
  67. typedef struct
  68. {
  69. ULONG PriorityClass;
  70. ULONG PrioritySubClass;
  71. }KSPRIORITY, * PKSPRIORITY;
  72. typedef struct
  73. {
  74. __MINGW_EXTENSION union
  75. {
  76. _KS_ANON_STRUCT(_IDENTIFIER)
  77. {
  78. GUID Set;
  79. ULONG Id;
  80. ULONG Flags;
  81. };
  82. LONGLONG Alignment;
  83. };
  84. }KSIDENTIFIER, * PKSIDENTIFIER;
  85. typedef KSIDENTIFIER KSPROPERTY, * PKSPROPERTY, KSMETHOD, * PKSMETHOD, KSEVENT, * PKSEVENT;
  86. #define KSMETHOD_TYPE_NONE 0x00000000
  87. #define KSMETHOD_TYPE_READ 0x00000001
  88. #define KSMETHOD_TYPE_WRITE 0x00000002
  89. #define KSMETHOD_TYPE_MODIFY 0x00000003
  90. #define KSMETHOD_TYPE_SOURCE 0x00000004
  91. #define KSMETHOD_TYPE_SEND 0x00000001
  92. #define KSMETHOD_TYPE_SETSUPPORT 0x00000100
  93. #define KSMETHOD_TYPE_BASICSUPPORT 0x00000200
  94. #define KSMETHOD_TYPE_TOPOLOGY 0x10000000
  95. #define KSPROPERTY_TYPE_GET 0x00000001
  96. #define KSPROPERTY_TYPE_SET 0x00000002
  97. #define KSPROPERTY_TYPE_SETSUPPORT 0x00000100
  98. #define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200
  99. #define KSPROPERTY_TYPE_RELATIONS 0x00000400
  100. #define KSPROPERTY_TYPE_SERIALIZESET 0x00000800
  101. #define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000
  102. #define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000
  103. #define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000
  104. #define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000
  105. #define KSPROPERTY_TYPE_DEFAULTVALUES 0x00010000
  106. #define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
  107. typedef struct
  108. {
  109. KSPROPERTY Property;
  110. ULONG NodeId;
  111. ULONG Reserved;
  112. }KSP_NODE, * PKSP_NODE;
  113. typedef struct
  114. {
  115. KSMETHOD Method;
  116. ULONG NodeId;
  117. ULONG Reserved;
  118. }KSM_NODE, * PKSM_NODE;
  119. typedef struct
  120. {
  121. KSEVENT Event;
  122. ULONG NodeId;
  123. ULONG Reserved;
  124. }KSE_NODE, * PKSE_NODE;
  125. #define STATIC_KSPROPTYPESETID_General \
  126. 0x97E99BA0L, 0xBDEA, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  127. DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_General);
  128. #define KSPROPTYPESETID_General DEFINE_GUIDNAMED(KSPROPTYPESETID_General)
  129. typedef struct
  130. {
  131. ULONG Size;
  132. ULONG Count;
  133. }KSMULTIPLE_ITEM, * PKSMULTIPLE_ITEM;
  134. typedef struct
  135. {
  136. ULONG AccessFlags;
  137. ULONG DescriptionSize;
  138. KSIDENTIFIER PropTypeSet;
  139. ULONG MembersListCount;
  140. ULONG Reserved;
  141. }KSPROPERTY_DESCRIPTION, * PKSPROPERTY_DESCRIPTION;
  142. #define KSPROPERTY_MEMBER_RANGES 0x00000001
  143. #define KSPROPERTY_MEMBER_STEPPEDRANGES 0x00000002
  144. #define KSPROPERTY_MEMBER_VALUES 0x00000003
  145. #define KSPROPERTY_MEMBER_FLAG_DEFAULT 0x00000001
  146. #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_MULTICHANNEL 0x00000002
  147. #define KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM 0x00000004
  148. typedef struct
  149. {
  150. ULONG MembersFlags;
  151. ULONG MembersSize;
  152. ULONG MembersCount;
  153. ULONG Flags;
  154. }KSPROPERTY_MEMBERSHEADER, * PKSPROPERTY_MEMBERSHEADER;
  155. typedef union
  156. {
  157. _KS_ANON_STRUCT(_SIGNED)
  158. {
  159. LONG SignedMinimum;
  160. LONG SignedMaximum;
  161. };
  162. _KS_ANON_STRUCT(_UNSIGNED)
  163. {
  164. ULONG UnsignedMinimum;
  165. ULONG UnsignedMaximum;
  166. };
  167. }KSPROPERTY_BOUNDS_LONG, * PKSPROPERTY_BOUNDS_LONG;
  168. typedef union
  169. {
  170. _KS_ANON_STRUCT(_SIGNED64)
  171. {
  172. LONGLONG SignedMinimum;
  173. LONGLONG SignedMaximum;
  174. };
  175. _KS_ANON_STRUCT(_UNSIGNED64)
  176. {
  177. DWORDLONG UnsignedMinimum;
  178. DWORDLONG UnsignedMaximum;
  179. };
  180. }KSPROPERTY_BOUNDS_LONGLONG, * PKSPROPERTY_BOUNDS_LONGLONG;
  181. typedef struct
  182. {
  183. ULONG SteppingDelta;
  184. ULONG Reserved;
  185. KSPROPERTY_BOUNDS_LONG Bounds;
  186. }KSPROPERTY_STEPPING_LONG, * PKSPROPERTY_STEPPING_LONG;
  187. typedef struct
  188. {
  189. DWORDLONG SteppingDelta;
  190. KSPROPERTY_BOUNDS_LONGLONG Bounds;
  191. }KSPROPERTY_STEPPING_LONGLONG, * PKSPROPERTY_STEPPING_LONGLONG;
  192. #if defined(_NTDDK_)
  193. typedef struct _KSDEVICE_DESCRIPTOR KSDEVICE_DESCRIPTOR, * PKSDEVICE_DESCRIPTOR;
  194. typedef struct _KSDEVICE_DISPATCH KSDEVICE_DISPATCH, * PKSDEVICE_DISPATCH;
  195. typedef struct _KSDEVICE KSDEVICE, * PKSDEVICE;
  196. typedef struct _KSFILTERFACTORY KSFILTERFACTORY, * PKSFILTERFACTORY;
  197. typedef struct _KSFILTER_DESCRIPTOR KSFILTER_DESCRIPTOR, * PKSFILTER_DESCRIPTOR;
  198. typedef struct _KSFILTER_DISPATCH KSFILTER_DISPATCH, * PKSFILTER_DISPATCH;
  199. typedef struct _KSFILTER KSFILTER, * PKSFILTER;
  200. typedef struct _KSPIN_DESCRIPTOR_EX KSPIN_DESCRIPTOR_EX, * PKSPIN_DESCRIPTOR_EX;
  201. typedef struct _KSPIN_DISPATCH KSPIN_DISPATCH, * PKSPIN_DISPATCH;
  202. typedef struct _KSCLOCK_DISPATCH KSCLOCK_DISPATCH, * PKSCLOCK_DISPATCH;
  203. typedef struct _KSALLOCATOR_DISPATCH KSALLOCATOR_DISPATCH, * PKSALLOCATOR_DISPATCH;
  204. typedef struct _KSPIN KSPIN, * PKSPIN;
  205. typedef struct _KSNODE_DESCRIPTOR KSNODE_DESCRIPTOR, * PKSNODE_DESCRIPTOR;
  206. typedef struct _KSSTREAM_POINTER_OFFSET KSSTREAM_POINTER_OFFSET, * PKSSTREAM_POINTER_OFFSET;
  207. typedef struct _KSSTREAM_POINTER KSSTREAM_POINTER, * PKSSTREAM_POINTER;
  208. typedef struct _KSMAPPING KSMAPPING, * PKSMAPPING;
  209. typedef struct _KSPROCESSPIN KSPROCESSPIN, * PKSPROCESSPIN;
  210. typedef struct _KSPROCESSPIN_INDEXENTRY KSPROCESSPIN_INDEXENTRY, * PKSPROCESSPIN_INDEXENTRY;
  211. #endif /* _NTDDK_ */
  212. typedef PVOID PKSWORKER;
  213. typedef struct
  214. {
  215. ULONG NotificationType;
  216. __MINGW_EXTENSION union
  217. {
  218. struct
  219. {
  220. HANDLE Event;
  221. ULONG_PTR Reserved[2];
  222. }EventHandle;
  223. struct
  224. {
  225. HANDLE Semaphore;
  226. ULONG Reserved;
  227. LONG Adjustment;
  228. }SemaphoreHandle;
  229. #if defined(_NTDDK_)
  230. struct
  231. {
  232. PVOID Event;
  233. KPRIORITY Increment;
  234. ULONG_PTR Reserved;
  235. }EventObject;
  236. struct
  237. {
  238. PVOID Semaphore;
  239. KPRIORITY Increment;
  240. LONG Adjustment;
  241. }SemaphoreObject;
  242. struct
  243. {
  244. PKDPC Dpc;
  245. ULONG ReferenceCount;
  246. ULONG_PTR Reserved;
  247. }Dpc;
  248. struct
  249. {
  250. PWORK_QUEUE_ITEM WorkQueueItem;
  251. WORK_QUEUE_TYPE WorkQueueType;
  252. ULONG_PTR Reserved;
  253. }WorkItem;
  254. struct
  255. {
  256. PWORK_QUEUE_ITEM WorkQueueItem;
  257. PKSWORKER KsWorkerObject;
  258. ULONG_PTR Reserved;
  259. }KsWorkItem;
  260. #endif /* _NTDDK_ */
  261. struct
  262. {
  263. PVOID Unused;
  264. LONG_PTR Alignment[2];
  265. }Alignment;
  266. };
  267. }KSEVENTDATA, * PKSEVENTDATA;
  268. #define KSEVENTF_EVENT_HANDLE 0x00000001
  269. #define KSEVENTF_SEMAPHORE_HANDLE 0x00000002
  270. #if defined(_NTDDK_)
  271. # define KSEVENTF_EVENT_OBJECT 0x00000004
  272. # define KSEVENTF_SEMAPHORE_OBJECT 0x00000008
  273. # define KSEVENTF_DPC 0x00000010
  274. # define KSEVENTF_WORKITEM 0x00000020
  275. # define KSEVENTF_KSWORKITEM 0x00000080
  276. #endif /* _NTDDK_ */
  277. #define KSEVENT_TYPE_ENABLE 0x00000001
  278. #define KSEVENT_TYPE_ONESHOT 0x00000002
  279. #define KSEVENT_TYPE_ENABLEBUFFERED 0x00000004
  280. #define KSEVENT_TYPE_SETSUPPORT 0x00000100
  281. #define KSEVENT_TYPE_BASICSUPPORT 0x00000200
  282. #define KSEVENT_TYPE_QUERYBUFFER 0x00000400
  283. #define KSEVENT_TYPE_TOPOLOGY 0x10000000
  284. typedef struct
  285. {
  286. KSEVENT Event;
  287. PKSEVENTDATA EventData;
  288. PVOID Reserved;
  289. }KSQUERYBUFFER, * PKSQUERYBUFFER;
  290. typedef struct
  291. {
  292. ULONG Size;
  293. ULONG Flags;
  294. __MINGW_EXTENSION union
  295. {
  296. HANDLE ObjectHandle;
  297. PVOID ObjectPointer;
  298. };
  299. PVOID Reserved;
  300. KSEVENT Event;
  301. KSEVENTDATA EventData;
  302. }KSRELATIVEEVENT;
  303. #define KSRELATIVEEVENT_FLAG_HANDLE 0x00000001
  304. #define KSRELATIVEEVENT_FLAG_POINTER 0x00000002
  305. typedef struct
  306. {
  307. KSEVENTDATA EventData;
  308. LONGLONG MarkTime;
  309. }KSEVENT_TIME_MARK, * PKSEVENT_TIME_MARK;
  310. typedef struct
  311. {
  312. KSEVENTDATA EventData;
  313. LONGLONG TimeBase;
  314. LONGLONG Interval;
  315. }KSEVENT_TIME_INTERVAL, * PKSEVENT_TIME_INTERVAL;
  316. typedef struct
  317. {
  318. LONGLONG TimeBase;
  319. LONGLONG Interval;
  320. }KSINTERVAL, * PKSINTERVAL;
  321. #define STATIC_KSPROPSETID_General \
  322. 0x1464EDA5L, 0x6A8F, 0x11D1, 0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  323. DEFINE_GUIDSTRUCT("1464EDA5-6A8F-11D1-9AA7-00A0C9223196", KSPROPSETID_General);
  324. #define KSPROPSETID_General DEFINE_GUIDNAMED(KSPROPSETID_General)
  325. typedef enum
  326. {
  327. KSPROPERTY_GENERAL_COMPONENTID
  328. }KSPROPERTY_GENERAL;
  329. typedef struct
  330. {
  331. GUID Manufacturer;
  332. GUID Product;
  333. GUID Component;
  334. GUID Name;
  335. ULONG Version;
  336. ULONG Revision;
  337. }KSCOMPONENTID, * PKSCOMPONENTID;
  338. #define DEFINE_KSPROPERTY_ITEM_GENERAL_COMPONENTID(Handler) \
  339. DEFINE_KSPROPERTY_ITEM( \
  340. KSPROPERTY_GENERAL_COMPONENTID, \
  341. (Handler), \
  342. sizeof(KSPROPERTY), \
  343. sizeof(KSCOMPONENTID), \
  344. NULL, NULL, 0, NULL, NULL, 0)
  345. #define STATIC_KSMETHODSETID_StreamIo \
  346. 0x65D003CAL, 0x1523, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  347. DEFINE_GUIDSTRUCT("65D003CA-1523-11D2-B27A-00A0C9223196", KSMETHODSETID_StreamIo);
  348. #define KSMETHODSETID_StreamIo DEFINE_GUIDNAMED(KSMETHODSETID_StreamIo)
  349. typedef enum
  350. {
  351. KSMETHOD_STREAMIO_READ,
  352. KSMETHOD_STREAMIO_WRITE
  353. }KSMETHOD_STREAMIO;
  354. #define DEFINE_KSMETHOD_ITEM_STREAMIO_READ(Handler) \
  355. DEFINE_KSMETHOD_ITEM( \
  356. KSMETHOD_STREAMIO_READ, \
  357. KSMETHOD_TYPE_WRITE, \
  358. (Handler), \
  359. sizeof(KSMETHOD), \
  360. 0, \
  361. NULL)
  362. #define DEFINE_KSMETHOD_ITEM_STREAMIO_WRITE(Handler) \
  363. DEFINE_KSMETHOD_ITEM( \
  364. KSMETHOD_STREAMIO_WRITE, \
  365. KSMETHOD_TYPE_READ, \
  366. (Handler), \
  367. sizeof(KSMETHOD), \
  368. 0, \
  369. NULL)
  370. #define STATIC_KSPROPSETID_MediaSeeking \
  371. 0xEE904F0CL, 0xD09B, 0x11D0, 0xAB, 0xE9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  372. DEFINE_GUIDSTRUCT("EE904F0C-D09B-11D0-ABE9-00A0C9223196", KSPROPSETID_MediaSeeking);
  373. #define KSPROPSETID_MediaSeeking DEFINE_GUIDNAMED(KSPROPSETID_MediaSeeking)
  374. typedef enum
  375. {
  376. KSPROPERTY_MEDIASEEKING_CAPABILITIES,
  377. KSPROPERTY_MEDIASEEKING_FORMATS,
  378. KSPROPERTY_MEDIASEEKING_TIMEFORMAT,
  379. KSPROPERTY_MEDIASEEKING_POSITION,
  380. KSPROPERTY_MEDIASEEKING_STOPPOSITION,
  381. KSPROPERTY_MEDIASEEKING_POSITIONS,
  382. KSPROPERTY_MEDIASEEKING_DURATION,
  383. KSPROPERTY_MEDIASEEKING_AVAILABLE,
  384. KSPROPERTY_MEDIASEEKING_PREROLL,
  385. KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT
  386. }KSPROPERTY_MEDIASEEKING;
  387. typedef enum
  388. {
  389. KS_SEEKING_NoPositioning,
  390. KS_SEEKING_AbsolutePositioning,
  391. KS_SEEKING_RelativePositioning,
  392. KS_SEEKING_IncrementalPositioning,
  393. KS_SEEKING_PositioningBitsMask = 0x3,
  394. KS_SEEKING_SeekToKeyFrame,
  395. KS_SEEKING_ReturnTime = 0x8
  396. }KS_SEEKING_FLAGS;
  397. typedef enum
  398. {
  399. KS_SEEKING_CanSeekAbsolute = 0x1,
  400. KS_SEEKING_CanSeekForwards = 0x2,
  401. KS_SEEKING_CanSeekBackwards = 0x4,
  402. KS_SEEKING_CanGetCurrentPos = 0x8,
  403. KS_SEEKING_CanGetStopPos = 0x10,
  404. KS_SEEKING_CanGetDuration = 0x20,
  405. KS_SEEKING_CanPlayBackwards = 0x40
  406. }KS_SEEKING_CAPABILITIES;
  407. typedef struct
  408. {
  409. LONGLONG Current;
  410. LONGLONG Stop;
  411. KS_SEEKING_FLAGS CurrentFlags;
  412. KS_SEEKING_FLAGS StopFlags;
  413. }KSPROPERTY_POSITIONS, * PKSPROPERTY_POSITIONS;
  414. typedef struct
  415. {
  416. LONGLONG Earliest;
  417. LONGLONG Latest;
  418. }KSPROPERTY_MEDIAAVAILABLE, * PKSPROPERTY_MEDIAAVAILABLE;
  419. typedef struct
  420. {
  421. KSPROPERTY Property;
  422. GUID SourceFormat;
  423. GUID TargetFormat;
  424. LONGLONG Time;
  425. }KSP_TIMEFORMAT, * PKSP_TIMEFORMAT;
  426. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CAPABILITIES(Handler) \
  427. DEFINE_KSPROPERTY_ITEM( \
  428. KSPROPERTY_MEDIASEEKING_CAPABILITIES, \
  429. (Handler), \
  430. sizeof(KSPROPERTY), \
  431. sizeof(KS_SEEKING_CAPABILITIES), \
  432. NULL, NULL, 0, NULL, NULL, 0)
  433. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_FORMATS(Handler) \
  434. DEFINE_KSPROPERTY_ITEM( \
  435. KSPROPERTY_MEDIASEEKING_FORMATS, \
  436. (Handler), \
  437. sizeof(KSPROPERTY), \
  438. 0, \
  439. NULL, NULL, 0, NULL, NULL, 0)
  440. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_TIMEFORMAT(GetHandler, SetHandler) \
  441. DEFINE_KSPROPERTY_ITEM( \
  442. KSPROPERTY_MEDIASEEKING_TIMEFORMAT, \
  443. (GetHandler), \
  444. sizeof(KSPROPERTY), \
  445. sizeof(GUID), \
  446. (SetHandler), \
  447. NULL, 0, NULL, NULL, 0)
  448. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_POSITION(Handler) \
  449. DEFINE_KSPROPERTY_ITEM( \
  450. KSPROPERTY_MEDIASEEKING_POSITION, \
  451. (Handler), \
  452. sizeof(KSPROPERTY), \
  453. sizeof(LONGLONG), \
  454. NULL, NULL, 0, NULL, NULL, 0)
  455. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_STOPPOSITION(Handler) \
  456. DEFINE_KSPROPERTY_ITEM( \
  457. KSPROPERTY_MEDIASEEKING_STOPPOSITION, \
  458. (Handler), \
  459. sizeof(KSPROPERTY), \
  460. sizeof(LONGLONG), \
  461. NULL, NULL, 0, NULL, NULL, 0)
  462. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_POSITIONS(Handler) \
  463. DEFINE_KSPROPERTY_ITEM( \
  464. KSPROPERTY_MEDIASEEKING_POSITIONS, \
  465. NULL, \
  466. sizeof(KSPROPERTY), \
  467. sizeof(KSPROPERTY_POSITIONS), \
  468. (Handler), \
  469. NULL, 0, NULL, NULL, 0)
  470. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_DURATION(Handler) \
  471. DEFINE_KSPROPERTY_ITEM( \
  472. KSPROPERTY_MEDIASEEKING_DURATION, \
  473. (Handler), \
  474. sizeof(KSPROPERTY), \
  475. sizeof(LONGLONG), \
  476. NULL, NULL, 0, NULL, NULL, 0)
  477. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_AVAILABLE(Handler) \
  478. DEFINE_KSPROPERTY_ITEM( \
  479. KSPROPERTY_MEDIASEEKING_AVAILABLE, \
  480. (Handler), \
  481. sizeof(KSPROPERTY), \
  482. sizeof(KSPROPERTY_MEDIAAVAILABLE), \
  483. NULL, NULL, 0, NULL, NULL, 0)
  484. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_PREROLL(Handler) \
  485. DEFINE_KSPROPERTY_ITEM( \
  486. KSPROPERTY_MEDIASEEKING_PREROLL, \
  487. (Handler), \
  488. sizeof(KSPROPERTY), \
  489. sizeof(LONGLONG), \
  490. NULL, NULL, 0, NULL, NULL, 0)
  491. #define DEFINE_KSPROPERTY_ITEM_MEDIASEEKING_CONVERTTIMEFORMAT(Handler) \
  492. DEFINE_KSPROPERTY_ITEM( \
  493. KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT, \
  494. (Handler), \
  495. sizeof(KSP_TIMEFORMAT), \
  496. sizeof(LONGLONG), \
  497. NULL, NULL, 0, NULL, NULL, 0)
  498. #define STATIC_KSPROPSETID_Topology \
  499. 0x720D4AC0L, 0x7533, 0x11D0, { 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 }
  500. DEFINE_GUIDSTRUCT("720D4AC0-7533-11D0-A5D6-28DB04C10000", KSPROPSETID_Topology);
  501. #define KSPROPSETID_Topology DEFINE_GUIDNAMED(KSPROPSETID_Topology)
  502. typedef enum
  503. {
  504. KSPROPERTY_TOPOLOGY_CATEGORIES,
  505. KSPROPERTY_TOPOLOGY_NODES,
  506. KSPROPERTY_TOPOLOGY_CONNECTIONS,
  507. KSPROPERTY_TOPOLOGY_NAME
  508. }KSPROPERTY_TOPOLOGY;
  509. #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler) \
  510. DEFINE_KSPROPERTY_ITEM( \
  511. KSPROPERTY_TOPOLOGY_CATEGORIES, \
  512. (Handler), \
  513. sizeof(KSPROPERTY), \
  514. 0, \
  515. NULL, NULL, 0, NULL, NULL, 0)
  516. #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler) \
  517. DEFINE_KSPROPERTY_ITEM( \
  518. KSPROPERTY_TOPOLOGY_NODES, \
  519. (Handler), \
  520. sizeof(KSPROPERTY), \
  521. 0, \
  522. NULL, NULL, 0, NULL, NULL, 0)
  523. #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler) \
  524. DEFINE_KSPROPERTY_ITEM( \
  525. KSPROPERTY_TOPOLOGY_CONNECTIONS, \
  526. (Handler), \
  527. sizeof(KSPROPERTY), \
  528. 0, \
  529. NULL, NULL, 0, NULL, NULL, 0)
  530. #define DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler) \
  531. DEFINE_KSPROPERTY_ITEM( \
  532. KSPROPERTY_TOPOLOGY_NAME, \
  533. (Handler), \
  534. sizeof(KSP_NODE), \
  535. 0, \
  536. NULL, NULL, 0, NULL, NULL, 0)
  537. #define DEFINE_KSPROPERTY_TOPOLOGYSET(TopologySet, Handler) \
  538. DEFINE_KSPROPERTY_TABLE(TopologySet) { \
  539. DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CATEGORIES(Handler), \
  540. DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NODES(Handler), \
  541. DEFINE_KSPROPERTY_ITEM_TOPOLOGY_CONNECTIONS(Handler), \
  542. DEFINE_KSPROPERTY_ITEM_TOPOLOGY_NAME(Handler) \
  543. }
  544. #define STATIC_KSCATEGORY_BRIDGE \
  545. 0x085AFF00L, 0x62CE, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  546. DEFINE_GUIDSTRUCT("085AFF00-62CE-11CF-A5D6-28DB04C10000", KSCATEGORY_BRIDGE);
  547. #define KSCATEGORY_BRIDGE DEFINE_GUIDNAMED(KSCATEGORY_BRIDGE)
  548. #define STATIC_KSCATEGORY_CAPTURE \
  549. 0x65E8773DL, 0x8F56, 0x11D0, { 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 }
  550. DEFINE_GUIDSTRUCT("65E8773D-8F56-11D0-A3B9-00A0C9223196", KSCATEGORY_CAPTURE);
  551. #define KSCATEGORY_CAPTURE DEFINE_GUIDNAMED(KSCATEGORY_CAPTURE)
  552. #define STATIC_KSCATEGORY_RENDER \
  553. 0x65E8773EL, 0x8F56, 0x11D0, { 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 }
  554. DEFINE_GUIDSTRUCT("65E8773E-8F56-11D0-A3B9-00A0C9223196", KSCATEGORY_RENDER);
  555. #define KSCATEGORY_RENDER DEFINE_GUIDNAMED(KSCATEGORY_RENDER)
  556. #define STATIC_KSCATEGORY_MIXER \
  557. 0xAD809C00L, 0x7B88, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  558. DEFINE_GUIDSTRUCT("AD809C00-7B88-11D0-A5D6-28DB04C10000", KSCATEGORY_MIXER);
  559. #define KSCATEGORY_MIXER DEFINE_GUIDNAMED(KSCATEGORY_MIXER)
  560. #define STATIC_KSCATEGORY_SPLITTER \
  561. 0x0A4252A0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  562. DEFINE_GUIDSTRUCT("0A4252A0-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_SPLITTER);
  563. #define KSCATEGORY_SPLITTER DEFINE_GUIDNAMED(KSCATEGORY_SPLITTER)
  564. #define STATIC_KSCATEGORY_DATACOMPRESSOR \
  565. 0x1E84C900L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  566. DEFINE_GUIDSTRUCT("1E84C900-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATACOMPRESSOR);
  567. #define KSCATEGORY_DATACOMPRESSOR DEFINE_GUIDNAMED(KSCATEGORY_DATACOMPRESSOR)
  568. #define STATIC_KSCATEGORY_DATADECOMPRESSOR \
  569. 0x2721AE20L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  570. DEFINE_GUIDSTRUCT("2721AE20-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATADECOMPRESSOR);
  571. #define KSCATEGORY_DATADECOMPRESSOR DEFINE_GUIDNAMED(KSCATEGORY_DATADECOMPRESSOR)
  572. #define STATIC_KSCATEGORY_DATATRANSFORM \
  573. 0x2EB07EA0L, 0x7E70, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  574. DEFINE_GUIDSTRUCT("2EB07EA0-7E70-11D0-A5D6-28DB04C10000", KSCATEGORY_DATATRANSFORM);
  575. #define KSCATEGORY_DATATRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_DATATRANSFORM)
  576. #define STATIC_KSCATEGORY_COMMUNICATIONSTRANSFORM \
  577. 0xCF1DDA2CL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  578. DEFINE_GUIDSTRUCT("CF1DDA2C-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_COMMUNICATIONSTRANSFORM);
  579. #define KSCATEGORY_COMMUNICATIONSTRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_COMMUNICATIONSTRANSFORM)
  580. #define STATIC_KSCATEGORY_INTERFACETRANSFORM \
  581. 0xCF1DDA2DL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  582. DEFINE_GUIDSTRUCT("CF1DDA2D-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_INTERFACETRANSFORM);
  583. #define KSCATEGORY_INTERFACETRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_INTERFACETRANSFORM)
  584. #define STATIC_KSCATEGORY_MEDIUMTRANSFORM \
  585. 0xCF1DDA2EL, 0x9743, 0x11D0, 0xA3, 0xEE, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  586. DEFINE_GUIDSTRUCT("CF1DDA2E-9743-11D0-A3EE-00A0C9223196", KSCATEGORY_MEDIUMTRANSFORM);
  587. #define KSCATEGORY_MEDIUMTRANSFORM DEFINE_GUIDNAMED(KSCATEGORY_MEDIUMTRANSFORM)
  588. #define STATIC_KSCATEGORY_FILESYSTEM \
  589. 0x760FED5EL, 0x9357, 0x11D0, 0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  590. DEFINE_GUIDSTRUCT("760FED5E-9357-11D0-A3CC-00A0C9223196", KSCATEGORY_FILESYSTEM);
  591. #define KSCATEGORY_FILESYSTEM DEFINE_GUIDNAMED(KSCATEGORY_FILESYSTEM)
  592. #define STATIC_KSCATEGORY_CLOCK \
  593. 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  594. DEFINE_GUIDSTRUCT("53172480-4791-11D0-A5D6-28DB04C10000", KSCATEGORY_CLOCK);
  595. #define KSCATEGORY_CLOCK DEFINE_GUIDNAMED(KSCATEGORY_CLOCK)
  596. #define STATIC_KSCATEGORY_PROXY \
  597. 0x97EBAACAL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  598. DEFINE_GUIDSTRUCT("97EBAACA-95BD-11D0-A3EA-00A0C9223196", KSCATEGORY_PROXY);
  599. #define KSCATEGORY_PROXY DEFINE_GUIDNAMED(KSCATEGORY_PROXY)
  600. #define STATIC_KSCATEGORY_QUALITY \
  601. 0x97EBAACBL, 0x95BD, 0x11D0, 0xA3, 0xEA, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  602. DEFINE_GUIDSTRUCT("97EBAACB-95BD-11D0-A3EA-00A0C9223196", KSCATEGORY_QUALITY);
  603. #define KSCATEGORY_QUALITY DEFINE_GUIDNAMED(KSCATEGORY_QUALITY)
  604. typedef struct
  605. {
  606. ULONG FromNode;
  607. ULONG FromNodePin;
  608. ULONG ToNode;
  609. ULONG ToNodePin;
  610. }KSTOPOLOGY_CONNECTION, * PKSTOPOLOGY_CONNECTION;
  611. typedef struct
  612. {
  613. ULONG CategoriesCount;
  614. const GUID* Categories;
  615. ULONG TopologyNodesCount;
  616. const GUID* TopologyNodes;
  617. ULONG TopologyConnectionsCount;
  618. const KSTOPOLOGY_CONNECTION* TopologyConnections;
  619. const GUID* TopologyNodesNames;
  620. ULONG Reserved;
  621. }KSTOPOLOGY, * PKSTOPOLOGY;
  622. #define KSFILTER_NODE ((ULONG)-1)
  623. #define KSALL_NODES ((ULONG)-1)
  624. typedef struct
  625. {
  626. ULONG CreateFlags;
  627. ULONG Node;
  628. }KSNODE_CREATE, * PKSNODE_CREATE;
  629. #define STATIC_KSTIME_FORMAT_NONE STATIC_GUID_NULL
  630. #define KSTIME_FORMAT_NONE GUID_NULL
  631. #define STATIC_KSTIME_FORMAT_FRAME \
  632. 0x7b785570L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
  633. DEFINE_GUIDSTRUCT("7b785570-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_FRAME);
  634. #define KSTIME_FORMAT_FRAME DEFINE_GUIDNAMED(KSTIME_FORMAT_FRAME)
  635. #define STATIC_KSTIME_FORMAT_BYTE \
  636. 0x7b785571L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
  637. DEFINE_GUIDSTRUCT("7b785571-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_BYTE);
  638. #define KSTIME_FORMAT_BYTE DEFINE_GUIDNAMED(KSTIME_FORMAT_BYTE)
  639. #define STATIC_KSTIME_FORMAT_SAMPLE \
  640. 0x7b785572L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
  641. DEFINE_GUIDSTRUCT("7b785572-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_SAMPLE);
  642. #define KSTIME_FORMAT_SAMPLE DEFINE_GUIDNAMED(KSTIME_FORMAT_SAMPLE)
  643. #define STATIC_KSTIME_FORMAT_FIELD \
  644. 0x7b785573L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
  645. DEFINE_GUIDSTRUCT("7b785573-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_FIELD);
  646. #define KSTIME_FORMAT_FIELD DEFINE_GUIDNAMED(KSTIME_FORMAT_FIELD)
  647. #define STATIC_KSTIME_FORMAT_MEDIA_TIME \
  648. 0x7b785574L, 0x8c82, 0x11cf, 0xbc, 0x0c, 0x00, 0xaa, 0x00, 0xac, 0x74, 0xf6
  649. DEFINE_GUIDSTRUCT("7b785574-8c82-11cf-bc0c-00aa00ac74f6", KSTIME_FORMAT_MEDIA_TIME);
  650. #define KSTIME_FORMAT_MEDIA_TIME DEFINE_GUIDNAMED(KSTIME_FORMAT_MEDIA_TIME)
  651. typedef KSIDENTIFIER KSPIN_INTERFACE, * PKSPIN_INTERFACE;
  652. #define STATIC_KSINTERFACESETID_Standard \
  653. 0x1A8766A0L, 0x62CE, 0x11CF, { 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 }
  654. DEFINE_GUIDSTRUCT("1A8766A0-62CE-11CF-A5D6-28DB04C10000", KSINTERFACESETID_Standard);
  655. #define KSINTERFACESETID_Standard DEFINE_GUIDNAMED(KSINTERFACESETID_Standard)
  656. typedef enum
  657. {
  658. KSINTERFACE_STANDARD_STREAMING,
  659. KSINTERFACE_STANDARD_LOOPED_STREAMING,
  660. KSINTERFACE_STANDARD_CONTROL
  661. }KSINTERFACE_STANDARD;
  662. #define STATIC_KSINTERFACESETID_FileIo \
  663. 0x8C6F932CL, 0xE771, 0x11D0, 0xB8, 0xFF, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  664. DEFINE_GUIDSTRUCT("8C6F932C-E771-11D0-B8FF-00A0C9223196", KSINTERFACESETID_FileIo);
  665. #define KSINTERFACESETID_FileIo DEFINE_GUIDNAMED(KSINTERFACESETID_FileIo)
  666. typedef enum
  667. {
  668. KSINTERFACE_FILEIO_STREAMING
  669. }KSINTERFACE_FILEIO;
  670. #define KSMEDIUM_TYPE_ANYINSTANCE 0
  671. #define STATIC_KSMEDIUMSETID_Standard \
  672. 0x4747B320L, 0x62CE, 0x11CF, { 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 }
  673. DEFINE_GUIDSTRUCT("4747B320-62CE-11CF-A5D6-28DB04C10000", KSMEDIUMSETID_Standard);
  674. #define KSMEDIUMSETID_Standard DEFINE_GUIDNAMED(KSMEDIUMSETID_Standard)
  675. #define KSMEDIUM_STANDARD_DEVIO KSMEDIUM_TYPE_ANYINSTANCE
  676. #define STATIC_KSPROPSETID_Pin \
  677. 0x8C134960L, 0x51AD, 0x11CF, { 0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00 }
  678. DEFINE_GUIDSTRUCT("8C134960-51AD-11CF-878A-94F801C10000", KSPROPSETID_Pin);
  679. #define KSPROPSETID_Pin DEFINE_GUIDNAMED(KSPROPSETID_Pin)
  680. typedef enum
  681. {
  682. KSPROPERTY_PIN_CINSTANCES,
  683. KSPROPERTY_PIN_CTYPES,
  684. KSPROPERTY_PIN_DATAFLOW,
  685. KSPROPERTY_PIN_DATARANGES,
  686. KSPROPERTY_PIN_DATAINTERSECTION,
  687. KSPROPERTY_PIN_INTERFACES,
  688. KSPROPERTY_PIN_MEDIUMS,
  689. KSPROPERTY_PIN_COMMUNICATION,
  690. KSPROPERTY_PIN_GLOBALCINSTANCES,
  691. KSPROPERTY_PIN_NECESSARYINSTANCES,
  692. KSPROPERTY_PIN_PHYSICALCONNECTION,
  693. KSPROPERTY_PIN_CATEGORY,
  694. KSPROPERTY_PIN_NAME,
  695. KSPROPERTY_PIN_CONSTRAINEDDATARANGES,
  696. KSPROPERTY_PIN_PROPOSEDATAFORMAT
  697. }KSPROPERTY_PIN;
  698. typedef struct
  699. {
  700. KSPROPERTY Property;
  701. ULONG PinId;
  702. ULONG Reserved;
  703. }KSP_PIN, * PKSP_PIN;
  704. #define KSINSTANCE_INDETERMINATE ((ULONG)-1)
  705. typedef struct
  706. {
  707. ULONG PossibleCount;
  708. ULONG CurrentCount;
  709. }KSPIN_CINSTANCES, * PKSPIN_CINSTANCES;
  710. typedef enum
  711. {
  712. KSPIN_DATAFLOW_IN = 1,
  713. KSPIN_DATAFLOW_OUT
  714. }KSPIN_DATAFLOW, * PKSPIN_DATAFLOW;
  715. #define KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION 0
  716. #define KSDATAFORMAT_TEMPORAL_COMPRESSION (1 << KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION)
  717. #define KSDATAFORMAT_BIT_ATTRIBUTES 1
  718. #define KSDATAFORMAT_ATTRIBUTES (1 << KSDATAFORMAT_BIT_ATTRIBUTES)
  719. #define KSDATARANGE_BIT_ATTRIBUTES 1
  720. #define KSDATARANGE_ATTRIBUTES (1 << KSDATARANGE_BIT_ATTRIBUTES)
  721. #define KSDATARANGE_BIT_REQUIRED_ATTRIBUTES 2
  722. #define KSDATARANGE_REQUIRED_ATTRIBUTES (1 << KSDATARANGE_BIT_REQUIRED_ATTRIBUTES)
  723. typedef union
  724. {
  725. __MINGW_EXTENSION struct
  726. {
  727. ULONG FormatSize;
  728. ULONG Flags;
  729. ULONG SampleSize;
  730. ULONG Reserved;
  731. GUID MajorFormat;
  732. GUID SubFormat;
  733. GUID Specifier;
  734. };
  735. LONGLONG Alignment;
  736. }KSDATAFORMAT, * PKSDATAFORMAT, KSDATARANGE, * PKSDATARANGE;
  737. #define KSATTRIBUTE_REQUIRED 0x00000001
  738. typedef struct
  739. {
  740. ULONG Size;
  741. ULONG Flags;
  742. GUID Attribute;
  743. }KSATTRIBUTE, * PKSATTRIBUTE;
  744. #if defined(_NTDDK_)
  745. typedef struct
  746. {
  747. ULONG Count;
  748. PKSATTRIBUTE* Attributes;
  749. }KSATTRIBUTE_LIST, * PKSATTRIBUTE_LIST;
  750. #endif /* _NTDDK_ */
  751. typedef enum
  752. {
  753. KSPIN_COMMUNICATION_NONE,
  754. KSPIN_COMMUNICATION_SINK,
  755. KSPIN_COMMUNICATION_SOURCE,
  756. KSPIN_COMMUNICATION_BOTH,
  757. KSPIN_COMMUNICATION_BRIDGE
  758. }KSPIN_COMMUNICATION, * PKSPIN_COMMUNICATION;
  759. typedef KSIDENTIFIER KSPIN_MEDIUM, * PKSPIN_MEDIUM;
  760. typedef struct
  761. {
  762. KSPIN_INTERFACE Interface;
  763. KSPIN_MEDIUM Medium;
  764. ULONG PinId;
  765. HANDLE PinToHandle;
  766. KSPRIORITY Priority;
  767. }KSPIN_CONNECT, * PKSPIN_CONNECT;
  768. typedef struct
  769. {
  770. ULONG Size;
  771. ULONG Pin;
  772. WCHAR SymbolicLinkName[1];
  773. }KSPIN_PHYSICALCONNECTION, * PKSPIN_PHYSICALCONNECTION;
  774. #if defined(_NTDDK_)
  775. typedef NTSTATUS (*PFNKSINTERSECTHANDLER)(PIRP Irp, PKSP_PIN Pin,
  776. PKSDATARANGE DataRange,
  777. PVOID Data);
  778. typedef NTSTATUS (*PFNKSINTERSECTHANDLEREX)(PVOID Context, PIRP Irp,
  779. PKSP_PIN Pin,
  780. PKSDATARANGE DataRange,
  781. PKSDATARANGE MatchingDataRange,
  782. ULONG DataBufferSize,
  783. PVOID Data,
  784. PULONG DataSize);
  785. #endif /* _NTDDK_ */
  786. #define DEFINE_KSPIN_INTERFACE_TABLE(tablename) \
  787. const KSPIN_INTERFACE tablename[] =
  788. #define DEFINE_KSPIN_INTERFACE_ITEM(guid, _interFace) \
  789. { \
  790. STATICGUIDOF(guid), \
  791. (_interFace), \
  792. 0 \
  793. }
  794. #define DEFINE_KSPIN_MEDIUM_TABLE(tablename) \
  795. const KSPIN_MEDIUM tablename[] =
  796. #define DEFINE_KSPIN_MEDIUM_ITEM(guid, medium) \
  797. DEFINE_KSPIN_INTERFACE_ITEM(guid, medium)
  798. #define DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(Handler) \
  799. DEFINE_KSPROPERTY_ITEM( \
  800. KSPROPERTY_PIN_CINSTANCES, \
  801. (Handler), \
  802. sizeof(KSP_PIN), \
  803. sizeof(KSPIN_CINSTANCES), \
  804. NULL, NULL, 0, NULL, NULL, 0)
  805. #define DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(Handler) \
  806. DEFINE_KSPROPERTY_ITEM( \
  807. KSPROPERTY_PIN_CTYPES, \
  808. (Handler), \
  809. sizeof(KSPROPERTY), \
  810. sizeof(ULONG), \
  811. NULL, NULL, 0, NULL, NULL, 0)
  812. #define DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(Handler) \
  813. DEFINE_KSPROPERTY_ITEM( \
  814. KSPROPERTY_PIN_DATAFLOW, \
  815. (Handler), \
  816. sizeof(KSP_PIN), \
  817. sizeof(KSPIN_DATAFLOW), \
  818. NULL, NULL, 0, NULL, NULL, 0)
  819. #define DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(Handler) \
  820. DEFINE_KSPROPERTY_ITEM( \
  821. KSPROPERTY_PIN_DATARANGES, \
  822. (Handler), \
  823. sizeof(KSP_PIN), \
  824. 0, \
  825. NULL, NULL, 0, NULL, NULL, 0)
  826. #define DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(Handler) \
  827. DEFINE_KSPROPERTY_ITEM( \
  828. KSPROPERTY_PIN_DATAINTERSECTION, \
  829. (Handler), \
  830. sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM), \
  831. 0, \
  832. NULL, NULL, 0, NULL, NULL, 0)
  833. #define DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(Handler) \
  834. DEFINE_KSPROPERTY_ITEM( \
  835. KSPROPERTY_PIN_INTERFACES, \
  836. (Handler), \
  837. sizeof(KSP_PIN), \
  838. 0, \
  839. NULL, NULL, 0, NULL, NULL, 0)
  840. #define DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(Handler) \
  841. DEFINE_KSPROPERTY_ITEM( \
  842. KSPROPERTY_PIN_MEDIUMS, \
  843. (Handler), \
  844. sizeof(KSP_PIN), \
  845. 0, \
  846. NULL, NULL, 0, NULL, NULL, 0)
  847. #define DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(Handler) \
  848. DEFINE_KSPROPERTY_ITEM( \
  849. KSPROPERTY_PIN_COMMUNICATION, \
  850. (Handler), \
  851. sizeof(KSP_PIN), \
  852. sizeof(KSPIN_COMMUNICATION), \
  853. NULL, NULL, 0, NULL, NULL, 0)
  854. #define DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(Handler) \
  855. DEFINE_KSPROPERTY_ITEM( \
  856. KSPROPERTY_PIN_GLOBALCINSTANCES, \
  857. (Handler), \
  858. sizeof(KSP_PIN), \
  859. sizeof(KSPIN_CINSTANCES), \
  860. NULL, NULL, 0, NULL, NULL, 0)
  861. #define DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(Handler) \
  862. DEFINE_KSPROPERTY_ITEM( \
  863. KSPROPERTY_PIN_NECESSARYINSTANCES, \
  864. (Handler), \
  865. sizeof(KSP_PIN), \
  866. sizeof(ULONG), \
  867. NULL, NULL, 0, NULL, NULL, 0)
  868. #define DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(Handler) \
  869. DEFINE_KSPROPERTY_ITEM( \
  870. KSPROPERTY_PIN_PHYSICALCONNECTION, \
  871. (Handler), \
  872. sizeof(KSP_PIN), \
  873. 0, \
  874. NULL, NULL, 0, NULL, NULL, 0)
  875. #define DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(Handler) \
  876. DEFINE_KSPROPERTY_ITEM( \
  877. KSPROPERTY_PIN_CATEGORY, \
  878. (Handler), \
  879. sizeof(KSP_PIN), \
  880. sizeof(GUID), \
  881. NULL, NULL, 0, NULL, NULL, 0)
  882. #define DEFINE_KSPROPERTY_ITEM_PIN_NAME(Handler) \
  883. DEFINE_KSPROPERTY_ITEM( \
  884. KSPROPERTY_PIN_NAME, \
  885. (Handler), \
  886. sizeof(KSP_PIN), \
  887. 0, \
  888. NULL, NULL, 0, NULL, NULL, 0)
  889. #define DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(Handler) \
  890. DEFINE_KSPROPERTY_ITEM( \
  891. KSPROPERTY_PIN_CONSTRAINEDDATARANGES, \
  892. (Handler), \
  893. sizeof(KSP_PIN), \
  894. 0, \
  895. NULL, NULL, 0, NULL, NULL, 0)
  896. #define DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(Handler) \
  897. DEFINE_KSPROPERTY_ITEM( \
  898. KSPROPERTY_PIN_PROPOSEDATAFORMAT, \
  899. NULL, \
  900. sizeof(KSP_PIN), \
  901. sizeof(KSDATAFORMAT), \
  902. (Handler), NULL, 0, NULL, NULL, 0)
  903. #define DEFINE_KSPROPERTY_PINSET(PinSet, PropGeneral, PropInstances, PropIntersection) \
  904. DEFINE_KSPROPERTY_TABLE(PinSet) { \
  905. DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances), \
  906. DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral), \
  907. DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral), \
  908. DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral), \
  909. DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection), \
  910. DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral), \
  911. DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral), \
  912. DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral), \
  913. DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral), \
  914. DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral) \
  915. }
  916. #define DEFINE_KSPROPERTY_PINSETCONSTRAINED(PinSet, PropGeneral, PropInstances, PropIntersection) \
  917. DEFINE_KSPROPERTY_TABLE(PinSet) { \
  918. DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances), \
  919. DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral), \
  920. DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral), \
  921. DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral), \
  922. DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection), \
  923. DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral), \
  924. DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral), \
  925. DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral), \
  926. DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral), \
  927. DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral), \
  928. DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral) \
  929. }
  930. #define STATIC_KSNAME_Filter \
  931. 0x9b365890L, 0x165f, 0x11d0, 0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
  932. DEFINE_GUIDSTRUCT("9b365890-165f-11d0-a195-0020afd156e4", KSNAME_Filter);
  933. #define KSNAME_Filter DEFINE_GUIDNAMED(KSNAME_Filter)
  934. #define KSSTRING_Filter L"{9B365890-165F-11D0-A195-0020AFD156E4}"
  935. #define STATIC_KSNAME_Pin \
  936. 0x146F1A80L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  937. DEFINE_GUIDSTRUCT("146F1A80-4791-11D0-A5D6-28DB04C10000", KSNAME_Pin);
  938. #define KSNAME_Pin DEFINE_GUIDNAMED(KSNAME_Pin)
  939. #define KSSTRING_Pin L"{146F1A80-4791-11D0-A5D6-28DB04C10000}"
  940. #define STATIC_KSNAME_Clock \
  941. 0x53172480L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  942. DEFINE_GUIDSTRUCT("53172480-4791-11D0-A5D6-28DB04C10000", KSNAME_Clock);
  943. #define KSNAME_Clock DEFINE_GUIDNAMED(KSNAME_Clock)
  944. #define KSSTRING_Clock L"{53172480-4791-11D0-A5D6-28DB04C10000}"
  945. #define STATIC_KSNAME_Allocator \
  946. 0x642F5D00L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  947. DEFINE_GUIDSTRUCT("642F5D00-4791-11D0-A5D6-28DB04C10000", KSNAME_Allocator);
  948. #define KSNAME_Allocator DEFINE_GUIDNAMED(KSNAME_Allocator)
  949. #define KSSTRING_Allocator L"{642F5D00-4791-11D0-A5D6-28DB04C10000}"
  950. #define KSSTRING_AllocatorEx L"{091BB63B-603F-11D1-B067-00A0C9062802}"
  951. #define STATIC_KSNAME_TopologyNode \
  952. 0x0621061AL, 0xEE75, 0x11D0, 0xB9, 0x15, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  953. DEFINE_GUIDSTRUCT("0621061A-EE75-11D0-B915-00A0C9223196", KSNAME_TopologyNode);
  954. #define KSNAME_TopologyNode DEFINE_GUIDNAMED(KSNAME_TopologyNode)
  955. #define KSSTRING_TopologyNode L"{0621061A-EE75-11D0-B915-00A0C9223196}"
  956. #if defined(_NTDDK_)
  957. typedef struct
  958. {
  959. ULONG InterfacesCount;
  960. const KSPIN_INTERFACE* Interfaces;
  961. ULONG MediumsCount;
  962. const KSPIN_MEDIUM* Mediums;
  963. ULONG DataRangesCount;
  964. const PKSDATARANGE* DataRanges;
  965. KSPIN_DATAFLOW DataFlow;
  966. KSPIN_COMMUNICATION Communication;
  967. const GUID* Category;
  968. const GUID* Name;
  969. __MINGW_EXTENSION union
  970. {
  971. LONGLONG Reserved;
  972. __MINGW_EXTENSION struct
  973. {
  974. ULONG ConstrainedDataRangesCount;
  975. PKSDATARANGE* ConstrainedDataRanges;
  976. };
  977. };
  978. }KSPIN_DESCRIPTOR, * PKSPIN_DESCRIPTOR;
  979. typedef const KSPIN_DESCRIPTOR* PCKSPIN_DESCRIPTOR;
  980. # define DEFINE_KSPIN_DESCRIPTOR_TABLE(tablename) \
  981. const KSPIN_DESCRIPTOR tablename[] =
  982. # define DEFINE_KSPIN_DESCRIPTOR_ITEM(InterfacesCount, Interfaces, MediumsCount, Mediums, DataRangesCount, DataRanges, DataFlow, Communication) \
  983. { \
  984. InterfacesCount, Interfaces, MediumsCount, Mediums, \
  985. DataRangesCount, DataRanges, DataFlow, Communication, \
  986. NULL, NULL, 0 \
  987. }
  988. # define DEFINE_KSPIN_DESCRIPTOR_ITEMEX(InterfacesCount, Interfaces, MediumsCount, Mediums, DataRangesCount, DataRanges, DataFlow, Communication, Category, Name) \
  989. { \
  990. InterfacesCount, Interfaces, MediumsCount, Mediums, \
  991. DataRangesCount, DataRanges, DataFlow, Communication, \
  992. Category, Name, 0 \
  993. }
  994. #endif /* _NTDDK_ */
  995. #define STATIC_KSDATAFORMAT_TYPE_WILDCARD STATIC_GUID_NULL
  996. #define KSDATAFORMAT_TYPE_WILDCARD GUID_NULL
  997. #define STATIC_KSDATAFORMAT_SUBTYPE_WILDCARD STATIC_GUID_NULL
  998. #define KSDATAFORMAT_SUBTYPE_WILDCARD GUID_NULL
  999. #define STATIC_KSDATAFORMAT_TYPE_STREAM \
  1000. 0xE436EB83L, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70
  1001. DEFINE_GUIDSTRUCT("E436EB83-524F-11CE-9F53-0020AF0BA770", KSDATAFORMAT_TYPE_STREAM);
  1002. #define KSDATAFORMAT_TYPE_STREAM DEFINE_GUIDNAMED(KSDATAFORMAT_TYPE_STREAM)
  1003. #define STATIC_KSDATAFORMAT_SUBTYPE_NONE \
  1004. 0xE436EB8EL, 0x524F, 0x11CE, 0x9F, 0x53, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70
  1005. DEFINE_GUIDSTRUCT("E436EB8E-524F-11CE-9F53-0020AF0BA770", KSDATAFORMAT_SUBTYPE_NONE);
  1006. #define KSDATAFORMAT_SUBTYPE_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_NONE)
  1007. #define STATIC_KSDATAFORMAT_SPECIFIER_WILDCARD STATIC_GUID_NULL
  1008. #define KSDATAFORMAT_SPECIFIER_WILDCARD GUID_NULL
  1009. #define STATIC_KSDATAFORMAT_SPECIFIER_FILENAME \
  1010. 0xAA797B40L, 0xE974, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  1011. DEFINE_GUIDSTRUCT("AA797B40-E974-11CF-A5D6-28DB04C10000", KSDATAFORMAT_SPECIFIER_FILENAME);
  1012. #define KSDATAFORMAT_SPECIFIER_FILENAME DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_FILENAME)
  1013. #define STATIC_KSDATAFORMAT_SPECIFIER_FILEHANDLE \
  1014. 0x65E8773CL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  1015. DEFINE_GUIDSTRUCT("65E8773C-8F56-11D0-A3B9-00A0C9223196", KSDATAFORMAT_SPECIFIER_FILEHANDLE);
  1016. #define KSDATAFORMAT_SPECIFIER_FILEHANDLE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_FILEHANDLE)
  1017. #define STATIC_KSDATAFORMAT_SPECIFIER_NONE \
  1018. 0x0F6417D6L, 0xC318, 0x11D0, { 0xA4, 0x3F, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 }
  1019. DEFINE_GUIDSTRUCT("0F6417D6-C318-11D0-A43F-00A0C9223196", KSDATAFORMAT_SPECIFIER_NONE);
  1020. #define KSDATAFORMAT_SPECIFIER_NONE DEFINE_GUIDNAMED(KSDATAFORMAT_SPECIFIER_NONE)
  1021. #define STATIC_KSPROPSETID_Quality \
  1022. 0xD16AD380L, 0xAC1A, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  1023. DEFINE_GUIDSTRUCT("D16AD380-AC1A-11CF-A5D6-28DB04C10000", KSPROPSETID_Quality);
  1024. #define KSPROPSETID_Quality DEFINE_GUIDNAMED(KSPROPSETID_Quality)
  1025. typedef enum
  1026. {
  1027. KSPROPERTY_QUALITY_REPORT,
  1028. KSPROPERTY_QUALITY_ERROR
  1029. }KSPROPERTY_QUALITY;
  1030. #define DEFINE_KSPROPERTY_ITEM_QUALITY_REPORT(GetHandler, SetHandler) \
  1031. DEFINE_KSPROPERTY_ITEM( \
  1032. KSPROPERTY_QUALITY_REPORT, \
  1033. (GetHandler), \
  1034. sizeof(KSPROPERTY), \
  1035. sizeof(KSQUALITY), \
  1036. (SetHandler), \
  1037. NULL, 0, NULL, NULL, 0)
  1038. #define DEFINE_KSPROPERTY_ITEM_QUALITY_ERROR(GetHandler, SetHandler) \
  1039. DEFINE_KSPROPERTY_ITEM( \
  1040. KSPROPERTY_QUALITY_ERROR, \
  1041. (GetHandler), \
  1042. sizeof(KSPROPERTY), \
  1043. sizeof(KSERROR), \
  1044. (SetHandler), \
  1045. NULL, 0, NULL, NULL, 0)
  1046. #define STATIC_KSPROPSETID_Connection \
  1047. 0x1D58C920L, 0xAC9B, 0x11CF, { 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 }
  1048. DEFINE_GUIDSTRUCT("1D58C920-AC9B-11CF-A5D6-28DB04C10000", KSPROPSETID_Connection);
  1049. #define KSPROPSETID_Connection DEFINE_GUIDNAMED(KSPROPSETID_Connection)
  1050. typedef enum
  1051. {
  1052. KSPROPERTY_CONNECTION_STATE,
  1053. KSPROPERTY_CONNECTION_PRIORITY,
  1054. KSPROPERTY_CONNECTION_DATAFORMAT,
  1055. KSPROPERTY_CONNECTION_ALLOCATORFRAMING,
  1056. KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT,
  1057. KSPROPERTY_CONNECTION_ACQUIREORDERING,
  1058. KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX,
  1059. KSPROPERTY_CONNECTION_STARTAT
  1060. }KSPROPERTY_CONNECTION;
  1061. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(GetHandler, SetHandler) \
  1062. DEFINE_KSPROPERTY_ITEM( \
  1063. KSPROPERTY_CONNECTION_STATE, \
  1064. (GetHandler), \
  1065. sizeof(KSPROPERTY), \
  1066. sizeof(KSSTATE), \
  1067. (SetHandler), \
  1068. NULL, 0, NULL, NULL, 0)
  1069. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_PRIORITY(GetHandler, SetHandler) \
  1070. DEFINE_KSPROPERTY_ITEM( \
  1071. KSPROPERTY_CONNECTION_PRIORITY, \
  1072. (GetHandler), \
  1073. sizeof(KSPROPERTY), \
  1074. sizeof(KSPRIORITY), \
  1075. (SetHandler), \
  1076. NULL, 0, NULL, NULL, 0)
  1077. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_DATAFORMAT(GetHandler, SetHandler) \
  1078. DEFINE_KSPROPERTY_ITEM( \
  1079. KSPROPERTY_CONNECTION_DATAFORMAT, \
  1080. (GetHandler), \
  1081. sizeof(KSPROPERTY), \
  1082. 0, \
  1083. (SetHandler), \
  1084. NULL, 0, NULL, NULL, 0)
  1085. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING(Handler) \
  1086. DEFINE_KSPROPERTY_ITEM( \
  1087. KSPROPERTY_CONNECTION_ALLOCATORFRAMING, \
  1088. (Handler), \
  1089. sizeof(KSPROPERTY), \
  1090. sizeof(KSALLOCATOR_FRAMING), \
  1091. NULL, NULL, 0, NULL, NULL, 0)
  1092. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING_EX(Handler) \
  1093. DEFINE_KSPROPERTY_ITEM( \
  1094. KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX, \
  1095. (Handler), \
  1096. sizeof(KSPROPERTY), \
  1097. 0, \
  1098. NULL, NULL, 0, NULL, NULL, 0)
  1099. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_PROPOSEDATAFORMAT(Handler) \
  1100. DEFINE_KSPROPERTY_ITEM( \
  1101. KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT, \
  1102. NULL, \
  1103. sizeof(KSPROPERTY), \
  1104. sizeof(KSDATAFORMAT), \
  1105. (Handler), \
  1106. NULL, 0, NULL, NULL, 0)
  1107. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_ACQUIREORDERING(Handler) \
  1108. DEFINE_KSPROPERTY_ITEM( \
  1109. KSPROPERTY_CONNECTION_ACQUIREORDERING, \
  1110. (Handler), \
  1111. sizeof(KSPROPERTY), \
  1112. sizeof(int), \
  1113. NULL, NULL, 0, NULL, NULL, 0)
  1114. #define DEFINE_KSPROPERTY_ITEM_CONNECTION_STARTAT(Handler) \
  1115. DEFINE_KSPROPERTY_ITEM( \
  1116. KSPROPERTY_CONNECTION_STARTAT, \
  1117. NULL, \
  1118. sizeof(KSPROPERTY), \
  1119. sizeof(KSRELATIVEEVENT), \
  1120. (Handler), \
  1121. NULL, 0, NULL, NULL, 0)
  1122. #define KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER 0x00000001
  1123. #define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY 0x00000002
  1124. #define KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY 0x00000004
  1125. #define KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE 0x00000008
  1126. #define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY 0x80000000
  1127. #define KSALLOCATOR_OPTIONF_COMPATIBLE 0x00000001
  1128. #define KSALLOCATOR_OPTIONF_SYSTEM_MEMORY 0x00000002
  1129. #define KSALLOCATOR_OPTIONF_VALID 0x00000003
  1130. #define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010
  1131. #define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020
  1132. #define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040
  1133. #define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080
  1134. #define KSALLOCATOR_FLAG_NO_FRAME_INTEGRITY 0x00000100
  1135. #define KSALLOCATOR_FLAG_MULTIPLE_OUTPUT 0x00000200
  1136. #define KSALLOCATOR_FLAG_CYCLE 0x00000400
  1137. #define KSALLOCATOR_FLAG_ALLOCATOR_EXISTS 0x00000800
  1138. #define KSALLOCATOR_FLAG_INDEPENDENT_RANGES 0x00001000
  1139. #define KSALLOCATOR_FLAG_ATTENTION_STEPPING 0x00002000
  1140. typedef struct
  1141. {
  1142. __MINGW_EXTENSION union
  1143. {
  1144. ULONG OptionsFlags;
  1145. ULONG RequirementsFlags;
  1146. };
  1147. #if defined(_NTDDK_)
  1148. POOL_TYPE PoolType;
  1149. #else
  1150. ULONG PoolType;
  1151. #endif /* _NTDDK_ */
  1152. ULONG Frames;
  1153. ULONG FrameSize;
  1154. ULONG FileAlignment;
  1155. ULONG Reserved;
  1156. }KSALLOCATOR_FRAMING, * PKSALLOCATOR_FRAMING;
  1157. #if defined(_NTDDK_)
  1158. typedef PVOID (*PFNKSDEFAULTALLOCATE)(PVOID Context);
  1159. typedef VOID (*PFNKSDEFAULTFREE)(PVOID Context, PVOID Buffer);
  1160. typedef NTSTATUS (*PFNKSINITIALIZEALLOCATOR)(PVOID InitialContext,
  1161. PKSALLOCATOR_FRAMING AllocatorFraming,
  1162. PVOID* Context);
  1163. typedef VOID (*PFNKSDELETEALLOCATOR)(PVOID Context);
  1164. #endif /* _NTDDK_ */
  1165. typedef struct
  1166. {
  1167. ULONG MinFrameSize;
  1168. ULONG MaxFrameSize;
  1169. ULONG Stepping;
  1170. }KS_FRAMING_RANGE, * PKS_FRAMING_RANGE;
  1171. typedef struct
  1172. {
  1173. KS_FRAMING_RANGE Range;
  1174. ULONG InPlaceWeight;
  1175. ULONG NotInPlaceWeight;
  1176. }KS_FRAMING_RANGE_WEIGHTED, * PKS_FRAMING_RANGE_WEIGHTED;
  1177. typedef struct
  1178. {
  1179. ULONG RatioNumerator;
  1180. ULONG RatioDenominator;
  1181. ULONG RatioConstantMargin;
  1182. }KS_COMPRESSION, * PKS_COMPRESSION;
  1183. typedef struct
  1184. {
  1185. GUID MemoryType;
  1186. GUID BusType;
  1187. ULONG MemoryFlags;
  1188. ULONG BusFlags;
  1189. ULONG Flags;
  1190. ULONG Frames;
  1191. ULONG FileAlignment;
  1192. ULONG MemoryTypeWeight;
  1193. KS_FRAMING_RANGE PhysicalRange;
  1194. KS_FRAMING_RANGE_WEIGHTED FramingRange;
  1195. }KS_FRAMING_ITEM, * PKS_FRAMING_ITEM;
  1196. typedef struct
  1197. {
  1198. ULONG CountItems;
  1199. ULONG PinFlags;
  1200. KS_COMPRESSION OutputCompression;
  1201. ULONG PinWeight;
  1202. KS_FRAMING_ITEM FramingItem[1];
  1203. }KSALLOCATOR_FRAMING_EX, * PKSALLOCATOR_FRAMING_EX;
  1204. #define KSMEMORY_TYPE_WILDCARD GUID_NULL
  1205. #define STATIC_KSMEMORY_TYPE_WILDCARD STATIC_GUID_NULL
  1206. #define KSMEMORY_TYPE_DONT_CARE GUID_NULL
  1207. #define STATIC_KSMEMORY_TYPE_DONT_CARE STATIC_GUID_NULL
  1208. #define KS_TYPE_DONT_CARE GUID_NULL
  1209. #define STATIC_KS_TYPE_DONT_CARE STATIC_GUID_NULL
  1210. #define STATIC_KSMEMORY_TYPE_SYSTEM \
  1211. 0x091bb638L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
  1212. DEFINE_GUIDSTRUCT("091bb638-603f-11d1-b067-00a0c9062802", KSMEMORY_TYPE_SYSTEM);
  1213. #define KSMEMORY_TYPE_SYSTEM DEFINE_GUIDNAMED(KSMEMORY_TYPE_SYSTEM)
  1214. #define STATIC_KSMEMORY_TYPE_USER \
  1215. 0x8cb0fc28L, 0x7893, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
  1216. DEFINE_GUIDSTRUCT("8cb0fc28-7893-11d1-b069-00a0c9062802", KSMEMORY_TYPE_USER);
  1217. #define KSMEMORY_TYPE_USER DEFINE_GUIDNAMED(KSMEMORY_TYPE_USER)
  1218. #define STATIC_KSMEMORY_TYPE_KERNEL_PAGED \
  1219. 0xd833f8f8L, 0x7894, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
  1220. DEFINE_GUIDSTRUCT("d833f8f8-7894-11d1-b069-00a0c9062802", KSMEMORY_TYPE_KERNEL_PAGED);
  1221. #define KSMEMORY_TYPE_KERNEL_PAGED DEFINE_GUIDNAMED(KSMEMORY_TYPE_KERNEL_PAGED)
  1222. #define STATIC_KSMEMORY_TYPE_KERNEL_NONPAGED \
  1223. 0x4a6d5fc4L, 0x7895, 0x11d1, 0xb0, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
  1224. DEFINE_GUIDSTRUCT("4a6d5fc4-7895-11d1-b069-00a0c9062802", KSMEMORY_TYPE_KERNEL_NONPAGED);
  1225. #define KSMEMORY_TYPE_KERNEL_NONPAGED DEFINE_GUIDNAMED(KSMEMORY_TYPE_KERNEL_NONPAGED)
  1226. #define STATIC_KSMEMORY_TYPE_DEVICE_UNKNOWN \
  1227. 0x091bb639L, 0x603f, 0x11d1, 0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02
  1228. DEFINE_GUIDSTRUCT("091bb639-603f-11d1-b067-00a0c9062802", KSMEMORY_TYPE_DEVICE_UNKNOWN);
  1229. #define KSMEMORY_TYPE_DEVICE_UNKNOWN DEFINE_GUIDNAMED(KSMEMORY_TYPE_DEVICE_UNKNOWN)
  1230. #define DECLARE_SIMPLE_FRAMING_EX(FramingExName, MemoryType, Flags, Frames, Alignment, MinFrameSize, MaxFrameSize) \
  1231. const KSALLOCATOR_FRAMING_EX FramingExName = \
  1232. { \
  1233. 1, \
  1234. 0, \
  1235. { \
  1236. 1, \
  1237. 1, \
  1238. 0 \
  1239. }, \
  1240. 0, \
  1241. { \
  1242. { \
  1243. MemoryType, \
  1244. STATIC_KS_TYPE_DONT_CARE, \
  1245. 0, \
  1246. 0, \
  1247. Flags, \
  1248. Frames, \
  1249. Alignment, \
  1250. 0, \
  1251. { \
  1252. 0, \
  1253. (ULONG)-1, \
  1254. 1 \
  1255. }, \
  1256. { \
  1257. { \
  1258. MinFrameSize, \
  1259. MaxFrameSize, \
  1260. 1 \
  1261. }, \
  1262. 0, \
  1263. 0 \
  1264. } \
  1265. } \
  1266. } \
  1267. }
  1268. #define SetDefaultKsCompression(KsCompressionPointer) \
  1269. { \
  1270. KsCompressionPointer->RatioNumerator = 1; \
  1271. KsCompressionPointer->RatioDenominator = 1; \
  1272. KsCompressionPointer->RatioConstantMargin = 0; \
  1273. }
  1274. #define SetDontCareKsFramingRange(KsFramingRangePointer) \
  1275. { \
  1276. KsFramingRangePointer->MinFrameSize = 0; \
  1277. KsFramingRangePointer->MaxFrameSize = (ULONG)-1; \
  1278. KsFramingRangePointer->Stepping = 1; \
  1279. }
  1280. #define SetKsFramingRange(KsFramingRangePointer, P_MinFrameSize, P_MaxFrameSize) \
  1281. { \
  1282. KsFramingRangePointer->MinFrameSize = P_MinFrameSize; \
  1283. KsFramingRangePointer->MaxFrameSize = P_MaxFrameSize; \
  1284. KsFramingRangePointer->Stepping = 1; \
  1285. }
  1286. #define SetKsFramingRangeWeighted(KsFramingRangeWeightedPointer, P_MinFrameSize, P_MaxFrameSize) \
  1287. { \
  1288. KS_FRAMING_RANGE* KsFramingRange = \
  1289. &KsFramingRangeWeightedPointer->Range; \
  1290. SetKsFramingRange(KsFramingRange, P_MinFrameSize, P_MaxFrameSize); \
  1291. KsFramingRangeWeightedPointer->InPlaceWeight = 0; \
  1292. KsFramingRangeWeightedPointer->NotInPlaceWeight = 0; \
  1293. }
  1294. #define INITIALIZE_SIMPLE_FRAMING_EX(FramingExPointer, P_MemoryType, P_Flags, P_Frames, P_Alignment, P_MinFrameSize, P_MaxFrameSize) \
  1295. { \
  1296. KS_COMPRESSION* KsCompression = \
  1297. &FramingExPointer->OutputCompression; \
  1298. KS_FRAMING_RANGE* KsFramingRange = \
  1299. &FramingExPointer->FramingItem[0].PhysicalRange; \
  1300. KS_FRAMING_RANGE_WEIGHTED* KsFramingRangeWeighted = \
  1301. &FramingExPointer->FramingItem[0].FramingRange; \
  1302. FramingExPointer->CountItems = 1; \
  1303. FramingExPointer->PinFlags = 0; \
  1304. SetDefaultKsCompression(KsCompression); \
  1305. FramingExPointer->PinWeight = 0; \
  1306. FramingExPointer->FramingItem[0].MemoryType = P_MemoryType; \
  1307. FramingExPointer->FramingItem[0].BusType = KS_TYPE_DONT_CARE; \
  1308. FramingExPointer->FramingItem[0].MemoryFlags = 0; \
  1309. FramingExPointer->FramingItem[0].BusFlags = 0; \
  1310. FramingExPointer->FramingItem[0].Flags = P_Flags; \
  1311. FramingExPointer->FramingItem[0].Frames = P_Frames; \
  1312. FramingExPointer->FramingItem[0].FileAlignment = P_Alignment; \
  1313. FramingExPointer->FramingItem[0].MemoryTypeWeight = 0; \
  1314. SetDontCareKsFramingRange(KsFramingRange); \
  1315. SetKsFramingRangeWeighted(KsFramingRangeWeighted, \
  1316. P_MinFrameSize, P_MaxFrameSize); \
  1317. }
  1318. #define STATIC_KSEVENTSETID_StreamAllocator \
  1319. 0x75d95571L, 0x073c, 0x11d0, 0xa1, 0x61, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
  1320. DEFINE_GUIDSTRUCT("75d95571-073c-11d0-a161-0020afd156e4", KSEVENTSETID_StreamAllocator);
  1321. #define KSEVENTSETID_StreamAllocator DEFINE_GUIDNAMED(KSEVENTSETID_StreamAllocator)
  1322. typedef enum
  1323. {
  1324. KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME,
  1325. KSEVENT_STREAMALLOCATOR_FREEFRAME
  1326. }KSEVENT_STREAMALLOCATOR;
  1327. #define STATIC_KSMETHODSETID_StreamAllocator \
  1328. 0xcf6e4341L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
  1329. DEFINE_GUIDSTRUCT("cf6e4341-ec87-11cf-a130-0020afd156e4", KSMETHODSETID_StreamAllocator);
  1330. #define KSMETHODSETID_StreamAllocator DEFINE_GUIDNAMED(KSMETHODSETID_StreamAllocator)
  1331. typedef enum
  1332. {
  1333. KSMETHOD_STREAMALLOCATOR_ALLOC,
  1334. KSMETHOD_STREAMALLOCATOR_FREE
  1335. }KSMETHOD_STREAMALLOCATOR;
  1336. #define DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_ALLOC(Handler) \
  1337. DEFINE_KSMETHOD_ITEM( \
  1338. KSMETHOD_STREAMALLOCATOR_ALLOC, \
  1339. KSMETHOD_TYPE_WRITE, \
  1340. (Handler), \
  1341. sizeof(KSMETHOD), \
  1342. sizeof(PVOID), \
  1343. NULL)
  1344. #define DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_FREE(Handler) \
  1345. DEFINE_KSMETHOD_ITEM( \
  1346. KSMETHOD_STREAMALLOCATOR_FREE, \
  1347. KSMETHOD_TYPE_READ, \
  1348. (Handler), \
  1349. sizeof(KSMETHOD), \
  1350. sizeof(PVOID), \
  1351. NULL)
  1352. #define DEFINE_KSMETHOD_ALLOCATORSET(AllocatorSet, MethodAlloc, MethodFree) \
  1353. DEFINE_KSMETHOD_TABLE(AllocatorSet) { \
  1354. DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_ALLOC(MethodAlloc), \
  1355. DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_FREE(MethodFree) \
  1356. }
  1357. #define STATIC_KSPROPSETID_StreamAllocator \
  1358. 0xcf6e4342L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
  1359. DEFINE_GUIDSTRUCT("cf6e4342-ec87-11cf-a130-0020afd156e4", KSPROPSETID_StreamAllocator);
  1360. #define KSPROPSETID_StreamAllocator DEFINE_GUIDNAMED(KSPROPSETID_StreamAllocator)
  1361. #if defined(_NTDDK_)
  1362. typedef enum
  1363. {
  1364. KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE,
  1365. KSPROPERTY_STREAMALLOCATOR_STATUS
  1366. }KSPROPERTY_STREAMALLOCATOR;
  1367. # define DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_FUNCTIONTABLE(Handler) \
  1368. DEFINE_KSPROPERTY_ITEM( \
  1369. KSPROPERTY_STREAMALLOCATOR_FUNCTIONTABLE, \
  1370. (Handler), \
  1371. sizeof(KSPROPERTY), \
  1372. sizeof(KSSTREAMALLOCATOR_FUNCTIONTABLE), \
  1373. NULL, NULL, 0, NULL, NULL, 0)
  1374. # define DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_STATUS(Handler) \
  1375. DEFINE_KSPROPERTY_ITEM( \
  1376. KSPROPERTY_STREAMALLOCATOR_STATUS, \
  1377. (Handler), \
  1378. sizeof(KSPROPERTY), \
  1379. sizeof(KSSTREAMALLOCATOR_STATUS), \
  1380. NULL, NULL, 0, NULL, NULL, 0)
  1381. # define DEFINE_KSPROPERTY_ALLOCATORSET(AllocatorSet, PropFunctionTable, PropStatus) \
  1382. DEFINE_KSPROPERTY_TABLE(AllocatorSet) { \
  1383. DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_STATUS(PropStatus), \
  1384. DEFINE_KSPROPERTY_ITEM_STREAMALLOCATOR_FUNCTIONTABLE(PropFunctionTable) \
  1385. }
  1386. typedef NTSTATUS (*PFNALLOCATOR_ALLOCATEFRAME)(PFILE_OBJECT FileObject,
  1387. PVOID* Frame);
  1388. typedef VOID (*PFNALLOCATOR_FREEFRAME)(PFILE_OBJECT FileObject, PVOID Frame);
  1389. typedef struct
  1390. {
  1391. PFNALLOCATOR_ALLOCATEFRAME AllocateFrame;
  1392. PFNALLOCATOR_FREEFRAME FreeFrame;
  1393. }KSSTREAMALLOCATOR_FUNCTIONTABLE, * PKSSTREAMALLOCATOR_FUNCTIONTABLE;
  1394. #endif /* _NTDDK_ */
  1395. typedef struct
  1396. {
  1397. KSALLOCATOR_FRAMING Framing;
  1398. ULONG AllocatedFrames;
  1399. ULONG Reserved;
  1400. }KSSTREAMALLOCATOR_STATUS, * PKSSTREAMALLOCATOR_STATUS;
  1401. typedef struct
  1402. {
  1403. KSALLOCATOR_FRAMING_EX Framing;
  1404. ULONG AllocatedFrames;
  1405. ULONG Reserved;
  1406. }KSSTREAMALLOCATOR_STATUS_EX, * PKSSTREAMALLOCATOR_STATUS_EX;
  1407. #define KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT 0x00000001
  1408. #define KSSTREAM_HEADER_OPTIONSF_PREROLL 0x00000002
  1409. #define KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY 0x00000004
  1410. #define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED 0x00000008
  1411. #define KSSTREAM_HEADER_OPTIONSF_TIMEVALID 0x00000010
  1412. #define KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY 0x00000040
  1413. #define KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE 0x00000080
  1414. #define KSSTREAM_HEADER_OPTIONSF_DURATIONVALID 0x00000100
  1415. #define KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM 0x00000200
  1416. #define KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA 0x80000000
  1417. typedef struct
  1418. {
  1419. LONGLONG Time;
  1420. ULONG Numerator;
  1421. ULONG Denominator;
  1422. }KSTIME, * PKSTIME;
  1423. typedef struct
  1424. {
  1425. ULONG Size;
  1426. ULONG TypeSpecificFlags;
  1427. KSTIME PresentationTime;
  1428. LONGLONG Duration;
  1429. ULONG FrameExtent;
  1430. ULONG DataUsed;
  1431. PVOID Data;
  1432. ULONG OptionsFlags;
  1433. #ifdef _WIN64
  1434. ULONG Reserved;
  1435. #endif
  1436. }KSSTREAM_HEADER, * PKSSTREAM_HEADER;
  1437. #define STATIC_KSPROPSETID_StreamInterface \
  1438. 0x1fdd8ee1L, 0x9cd3, 0x11d0, 0x82, 0xaa, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a
  1439. DEFINE_GUIDSTRUCT("1fdd8ee1-9cd3-11d0-82aa-0000f822fe8a", KSPROPSETID_StreamInterface);
  1440. #define KSPROPSETID_StreamInterface DEFINE_GUIDNAMED(KSPROPSETID_StreamInterface)
  1441. typedef enum
  1442. {
  1443. KSPROPERTY_STREAMINTERFACE_HEADERSIZE
  1444. }KSPROPERTY_STREAMINTERFACE;
  1445. #define DEFINE_KSPROPERTY_ITEM_STREAMINTERFACE_HEADERSIZE(GetHandler) \
  1446. DEFINE_KSPROPERTY_ITEM( \
  1447. KSPROPERTY_STREAMINTERFACE_HEADERSIZE, \
  1448. (GetHandler), \
  1449. sizeof(KSPROPERTY), \
  1450. sizeof(ULONG), \
  1451. NULL, NULL, 0, NULL, NULL, 0)
  1452. #define DEFINE_KSPROPERTY_STREAMINTERFACESET(StreamInterfaceSet, HeaderSizeHandler) \
  1453. DEFINE_KSPROPERTY_TABLE(StreamInterfaceSet) { \
  1454. DEFINE_KSPROPERTY_ITEM_STREAMINTERFACE_HEADERSIZE(HeaderSizeHandler) \
  1455. }
  1456. #define STATIC_KSPROPSETID_Stream \
  1457. 0x65aaba60L, 0x98ae, 0x11cf, 0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
  1458. DEFINE_GUIDSTRUCT("65aaba60-98ae-11cf-a10d-0020afd156e4", KSPROPSETID_Stream);
  1459. #define KSPROPSETID_Stream DEFINE_GUIDNAMED(KSPROPSETID_Stream)
  1460. typedef enum
  1461. {
  1462. KSPROPERTY_STREAM_ALLOCATOR,
  1463. KSPROPERTY_STREAM_QUALITY,
  1464. KSPROPERTY_STREAM_DEGRADATION,
  1465. KSPROPERTY_STREAM_MASTERCLOCK,
  1466. KSPROPERTY_STREAM_TIMEFORMAT,
  1467. KSPROPERTY_STREAM_PRESENTATIONTIME,
  1468. KSPROPERTY_STREAM_PRESENTATIONEXTENT,
  1469. KSPROPERTY_STREAM_FRAMETIME,
  1470. KSPROPERTY_STREAM_RATECAPABILITY,
  1471. KSPROPERTY_STREAM_RATE,
  1472. KSPROPERTY_STREAM_PIPE_ID
  1473. }KSPROPERTY_STREAM;
  1474. #define DEFINE_KSPROPERTY_ITEM_STREAM_ALLOCATOR(GetHandler, SetHandler) \
  1475. DEFINE_KSPROPERTY_ITEM( \
  1476. KSPROPERTY_STREAM_ALLOCATOR, \
  1477. (GetHandler), \
  1478. sizeof(KSPROPERTY), \
  1479. sizeof(HANDLE), \
  1480. (SetHandler), \
  1481. NULL, 0, NULL, NULL, 0)
  1482. #define DEFINE_KSPROPERTY_ITEM_STREAM_QUALITY(Handler) \
  1483. DEFINE_KSPROPERTY_ITEM( \
  1484. KSPROPERTY_STREAM_QUALITY, \
  1485. (Handler), \
  1486. sizeof(KSPROPERTY), \
  1487. sizeof(KSQUALITY_MANAGER), \
  1488. NULL, NULL, 0, NULL, NULL, 0)
  1489. #define DEFINE_KSPROPERTY_ITEM_STREAM_DEGRADATION(GetHandler, SetHandler) \
  1490. DEFINE_KSPROPERTY_ITEM( \
  1491. KSPROPERTY_STREAM_DEGRADATION, \
  1492. (GetHandler), \
  1493. sizeof(KSPROPERTY), \
  1494. 0, \
  1495. (SetHandler), \
  1496. NULL, 0, NULL, NULL, 0)
  1497. #define DEFINE_KSPROPERTY_ITEM_STREAM_MASTERCLOCK(GetHandler, SetHandler) \
  1498. DEFINE_KSPROPERTY_ITEM( \
  1499. KSPROPERTY_STREAM_MASTERCLOCK, \
  1500. (GetHandler), \
  1501. sizeof(KSPROPERTY), \
  1502. sizeof(HANDLE), \
  1503. (SetHandler), \
  1504. NULL, 0, NULL, NULL, 0)
  1505. #define DEFINE_KSPROPERTY_ITEM_STREAM_TIMEFORMAT(Handler) \
  1506. DEFINE_KSPROPERTY_ITEM( \
  1507. KSPROPERTY_STREAM_TIMEFORMAT, \
  1508. (Handler), \
  1509. sizeof(KSPROPERTY), \
  1510. sizeof(GUID), \
  1511. NULL, NULL, 0, NULL, NULL, 0)
  1512. #define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONTIME(GetHandler, SetHandler) \
  1513. DEFINE_KSPROPERTY_ITEM( \
  1514. KSPROPERTY_STREAM_PRESENTATIONTIME, \
  1515. (GetHandler), \
  1516. sizeof(KSPROPERTY), \
  1517. sizeof(KSTIME), \
  1518. (SetHandler), \
  1519. NULL, 0, NULL, NULL, 0)
  1520. #define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONEXTENT(Handler) \
  1521. DEFINE_KSPROPERTY_ITEM( \
  1522. KSPROPERTY_STREAM_PRESENTATIONEXTENT, \
  1523. (Handler), \
  1524. sizeof(KSPROPERTY), \
  1525. sizeof(LONGLONG), \
  1526. NULL, NULL, 0, NULL, NULL, 0)
  1527. #define DEFINE_KSPROPERTY_ITEM_STREAM_FRAMETIME(Handler) \
  1528. DEFINE_KSPROPERTY_ITEM( \
  1529. KSPROPERTY_STREAM_FRAMETIME, \
  1530. (Handler), \
  1531. sizeof(KSPROPERTY), \
  1532. sizeof(KSFRAMETIME), \
  1533. NULL, NULL, 0, NULL, NULL, 0)
  1534. #define DEFINE_KSPROPERTY_ITEM_STREAM_RATECAPABILITY(Handler) \
  1535. DEFINE_KSPROPERTY_ITEM( \
  1536. KSPROPERTY_STREAM_RATECAPABILITY, \
  1537. (Handler), \
  1538. sizeof(KSRATE_CAPABILITY), \
  1539. sizeof(KSRATE), \
  1540. NULL, NULL, 0, NULL, NULL, 0)
  1541. #define DEFINE_KSPROPERTY_ITEM_STREAM_RATE(GetHandler, SetHandler) \
  1542. DEFINE_KSPROPERTY_ITEM( \
  1543. KSPROPERTY_STREAM_RATE, \
  1544. (GetHandler), \
  1545. sizeof(KSPROPERTY), \
  1546. sizeof(KSRATE), \
  1547. (SetHandler), \
  1548. NULL, 0, NULL, NULL, 0)
  1549. #define DEFINE_KSPROPERTY_ITEM_STREAM_PIPE_ID(GetHandler, SetHandler) \
  1550. DEFINE_KSPROPERTY_ITEM( \
  1551. KSPROPERTY_STREAM_PIPE_ID, \
  1552. (GetHandler), \
  1553. sizeof(KSPROPERTY), \
  1554. sizeof(HANDLE), \
  1555. (SetHandler), \
  1556. NULL, 0, NULL, NULL, 0)
  1557. typedef struct
  1558. {
  1559. HANDLE QualityManager;
  1560. PVOID Context;
  1561. }KSQUALITY_MANAGER, * PKSQUALITY_MANAGER;
  1562. typedef struct
  1563. {
  1564. LONGLONG Duration;
  1565. ULONG FrameFlags;
  1566. ULONG Reserved;
  1567. }KSFRAMETIME, * PKSFRAMETIME;
  1568. #define KSFRAMETIME_VARIABLESIZE 0x00000001
  1569. typedef struct
  1570. {
  1571. LONGLONG PresentationStart;
  1572. LONGLONG Duration;
  1573. KSPIN_INTERFACE Interface;
  1574. LONG Rate;
  1575. ULONG Flags;
  1576. }KSRATE, * PKSRATE;
  1577. #define KSRATE_NOPRESENTATIONSTART 0x00000001
  1578. #define KSRATE_NOPRESENTATIONDURATION 0x00000002
  1579. typedef struct
  1580. {
  1581. KSPROPERTY Property;
  1582. KSRATE Rate;
  1583. }KSRATE_CAPABILITY, * PKSRATE_CAPABILITY;
  1584. #define STATIC_KSPROPSETID_Clock \
  1585. 0xDF12A4C0L, 0xAC17, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  1586. DEFINE_GUIDSTRUCT("DF12A4C0-AC17-11CF-A5D6-28DB04C10000", KSPROPSETID_Clock);
  1587. #define KSPROPSETID_Clock DEFINE_GUIDNAMED(KSPROPSETID_Clock)
  1588. #define NANOSECONDS 10000000
  1589. #define KSCONVERT_PERFORMANCE_TIME(Frequency, PerformanceTime) \
  1590. ((((ULONGLONG)(ULONG)(PerformanceTime).HighPart * NANOSECONDS / (Frequency)) << 32) + \
  1591. ((((((ULONGLONG)(ULONG)(PerformanceTime).HighPart * NANOSECONDS) % (Frequency)) << 32) + \
  1592. ((ULONGLONG)(PerformanceTime).LowPart * NANOSECONDS)) / (Frequency)))
  1593. typedef struct
  1594. {
  1595. ULONG CreateFlags;
  1596. }KSCLOCK_CREATE, * PKSCLOCK_CREATE;
  1597. typedef struct
  1598. {
  1599. LONGLONG Time;
  1600. LONGLONG SystemTime;
  1601. }KSCORRELATED_TIME, * PKSCORRELATED_TIME;
  1602. typedef struct
  1603. {
  1604. LONGLONG Granularity;
  1605. LONGLONG Error;
  1606. }KSRESOLUTION, * PKSRESOLUTION;
  1607. typedef enum
  1608. {
  1609. KSPROPERTY_CLOCK_TIME,
  1610. KSPROPERTY_CLOCK_PHYSICALTIME,
  1611. KSPROPERTY_CLOCK_CORRELATEDTIME,
  1612. KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME,
  1613. KSPROPERTY_CLOCK_RESOLUTION,
  1614. KSPROPERTY_CLOCK_STATE,
  1615. #if defined(_NTDDK_)
  1616. KSPROPERTY_CLOCK_FUNCTIONTABLE
  1617. #endif /* _NTDDK_ */
  1618. }KSPROPERTY_CLOCK;
  1619. #if defined(_NTDDK_)
  1620. typedef LONGLONG (FASTCALL * PFNKSCLOCK_GETTIME)(PFILE_OBJECT FileObject);
  1621. typedef LONGLONG (FASTCALL * PFNKSCLOCK_CORRELATEDTIME)(PFILE_OBJECT FileObject,
  1622. PLONGLONG SystemTime);
  1623. typedef struct
  1624. {
  1625. PFNKSCLOCK_GETTIME GetTime;
  1626. PFNKSCLOCK_GETTIME GetPhysicalTime;
  1627. PFNKSCLOCK_CORRELATEDTIME GetCorrelatedTime;
  1628. PFNKSCLOCK_CORRELATEDTIME GetCorrelatedPhysicalTime;
  1629. }KSCLOCK_FUNCTIONTABLE, * PKSCLOCK_FUNCTIONTABLE;
  1630. typedef BOOLEAN (*PFNKSSETTIMER)(PVOID Context, PKTIMER Timer,
  1631. LARGE_INTEGER DueTime, PKDPC Dpc);
  1632. typedef BOOLEAN (*PFNKSCANCELTIMER)(PVOID Context, PKTIMER Timer);
  1633. typedef LONGLONG (FASTCALL * PFNKSCORRELATEDTIME)(PVOID Context,
  1634. PLONGLONG SystemTime);
  1635. typedef PVOID PKSDEFAULTCLOCK;
  1636. # define DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(Handler) \
  1637. DEFINE_KSPROPERTY_ITEM( \
  1638. KSPROPERTY_CLOCK_TIME, \
  1639. (Handler), \
  1640. sizeof(KSPROPERTY), sizeof(LONGLONG), \
  1641. NULL, NULL, 0, NULL, NULL, 0)
  1642. # define DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(Handler) \
  1643. DEFINE_KSPROPERTY_ITEM( \
  1644. KSPROPERTY_CLOCK_PHYSICALTIME, \
  1645. (Handler), \
  1646. sizeof(KSPROPERTY), sizeof(LONGLONG), \
  1647. NULL, NULL, 0, NULL, NULL, 0)
  1648. # define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(Handler) \
  1649. DEFINE_KSPROPERTY_ITEM( \
  1650. KSPROPERTY_CLOCK_CORRELATEDTIME, \
  1651. (Handler), \
  1652. sizeof(KSPROPERTY), \
  1653. sizeof(KSCORRELATED_TIME), \
  1654. NULL, NULL, 0, NULL, NULL, 0)
  1655. # define DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(Handler) \
  1656. DEFINE_KSPROPERTY_ITEM( \
  1657. KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME, \
  1658. (Handler), \
  1659. sizeof(KSPROPERTY), \
  1660. sizeof(KSCORRELATED_TIME), \
  1661. NULL, NULL, 0, NULL, NULL, 0)
  1662. # define DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(Handler) \
  1663. DEFINE_KSPROPERTY_ITEM( \
  1664. KSPROPERTY_CLOCK_RESOLUTION, \
  1665. (Handler), \
  1666. sizeof(KSPROPERTY), sizeof(KSRESOLUTION), \
  1667. NULL, NULL, 0, NULL, NULL, 0)
  1668. # define DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(Handler) \
  1669. DEFINE_KSPROPERTY_ITEM( \
  1670. KSPROPERTY_CLOCK_STATE, \
  1671. (Handler), \
  1672. sizeof(KSPROPERTY), sizeof(KSSTATE), \
  1673. NULL, NULL, 0, NULL, NULL, 0)
  1674. # define DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(Handler) \
  1675. DEFINE_KSPROPERTY_ITEM( \
  1676. KSPROPERTY_CLOCK_FUNCTIONTABLE, \
  1677. (Handler), \
  1678. sizeof(KSPROPERTY), \
  1679. sizeof(KSCLOCK_FUNCTIONTABLE), \
  1680. NULL, NULL, 0, NULL, NULL, 0)
  1681. # define DEFINE_KSPROPERTY_CLOCKSET(ClockSet, PropTime, PropPhysicalTime, PropCorrelatedTime, PropCorrelatedPhysicalTime, PropResolution, PropState, PropFunctionTable) \
  1682. DEFINE_KSPROPERTY_TABLE(ClockSet) { \
  1683. DEFINE_KSPROPERTY_ITEM_CLOCK_TIME(PropTime), \
  1684. DEFINE_KSPROPERTY_ITEM_CLOCK_PHYSICALTIME(PropPhysicalTime), \
  1685. DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDTIME(PropCorrelatedTime), \
  1686. DEFINE_KSPROPERTY_ITEM_CLOCK_CORRELATEDPHYSICALTIME(PropCorrelatedPhysicalTime), \
  1687. DEFINE_KSPROPERTY_ITEM_CLOCK_RESOLUTION(PropResolution), \
  1688. DEFINE_KSPROPERTY_ITEM_CLOCK_STATE(PropState), \
  1689. DEFINE_KSPROPERTY_ITEM_CLOCK_FUNCTIONTABLE(PropFunctionTable), \
  1690. }
  1691. #endif /* _NTDDK_ */
  1692. #define STATIC_KSEVENTSETID_Clock \
  1693. 0x364D8E20L, 0x62C7, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  1694. DEFINE_GUIDSTRUCT("364D8E20-62C7-11CF-A5D6-28DB04C10000", KSEVENTSETID_Clock);
  1695. #define KSEVENTSETID_Clock DEFINE_GUIDNAMED(KSEVENTSETID_Clock)
  1696. typedef enum
  1697. {
  1698. KSEVENT_CLOCK_INTERVAL_MARK,
  1699. KSEVENT_CLOCK_POSITION_MARK
  1700. }KSEVENT_CLOCK_POSITION;
  1701. #define STATIC_KSEVENTSETID_Connection \
  1702. 0x7f4bcbe0L, 0x9ea5, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00
  1703. DEFINE_GUIDSTRUCT("7f4bcbe0-9ea5-11cf-a5d6-28db04c10000", KSEVENTSETID_Connection);
  1704. #define KSEVENTSETID_Connection DEFINE_GUIDNAMED(KSEVENTSETID_Connection)
  1705. typedef enum
  1706. {
  1707. KSEVENT_CONNECTION_POSITIONUPDATE,
  1708. KSEVENT_CONNECTION_DATADISCONTINUITY,
  1709. KSEVENT_CONNECTION_TIMEDISCONTINUITY,
  1710. KSEVENT_CONNECTION_PRIORITY,
  1711. KSEVENT_CONNECTION_ENDOFSTREAM
  1712. }KSEVENT_CONNECTION;
  1713. typedef struct
  1714. {
  1715. PVOID Context;
  1716. ULONG Proportion;
  1717. LONGLONG DeltaTime;
  1718. }KSQUALITY, * PKSQUALITY;
  1719. typedef struct
  1720. {
  1721. PVOID Context;
  1722. ULONG Status;
  1723. }KSERROR, * PKSERROR;
  1724. typedef KSIDENTIFIER KSDEGRADE, * PKSDEGRADE;
  1725. #define STATIC_KSDEGRADESETID_Standard \
  1726. 0x9F564180L, 0x704C, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00
  1727. DEFINE_GUIDSTRUCT("9F564180-704C-11D0-A5D6-28DB04C10000", KSDEGRADESETID_Standard);
  1728. #define KSDEGRADESETID_Standard DEFINE_GUIDNAMED(KSDEGRADESETID_Standard)
  1729. typedef enum
  1730. {
  1731. KSDEGRADE_STANDARD_SAMPLE,
  1732. KSDEGRADE_STANDARD_QUALITY,
  1733. KSDEGRADE_STANDARD_COMPUTATION,
  1734. KSDEGRADE_STANDARD_SKIP
  1735. }KSDEGRADE_STANDARD;
  1736. #if defined(_NTDDK_)
  1737. # define KSPROBE_STREAMREAD 0x00000000
  1738. # define KSPROBE_STREAMWRITE 0x00000001
  1739. # define KSPROBE_ALLOCATEMDL 0x00000010
  1740. # define KSPROBE_PROBEANDLOCK 0x00000020
  1741. # define KSPROBE_SYSTEMADDRESS 0x00000040
  1742. # define KSPROBE_MODIFY 0x00000200
  1743. # define KSPROBE_STREAMWRITEMODIFY (KSPROBE_MODIFY | KSPROBE_STREAMWRITE)
  1744. # define KSPROBE_ALLOWFORMATCHANGE 0x00000080
  1745. # define KSSTREAM_READ KSPROBE_STREAMREAD
  1746. # define KSSTREAM_WRITE KSPROBE_STREAMWRITE
  1747. # define KSSTREAM_PAGED_DATA 0x00000000
  1748. # define KSSTREAM_NONPAGED_DATA 0x00000100
  1749. # define KSSTREAM_SYNCHRONOUS 0x00001000
  1750. # define KSSTREAM_FAILUREEXCEPTION 0x00002000
  1751. typedef NTSTATUS (*PFNKSCONTEXT_DISPATCH)(PVOID Context, PIRP Irp);
  1752. typedef NTSTATUS (*PFNKSHANDLER)(PIRP Irp, PKSIDENTIFIER Request, PVOID Data);
  1753. typedef BOOLEAN (*PFNKSFASTHANDLER)(PFILE_OBJECT FileObject,
  1754. PKSIDENTIFIER Request,
  1755. ULONG RequestLength, PVOID Data,
  1756. ULONG DataLength,
  1757. PIO_STATUS_BLOCK IoStatus);
  1758. typedef NTSTATUS (*PFNKSALLOCATOR)(PIRP Irp, ULONG BufferSize,
  1759. BOOLEAN InputOperation);
  1760. typedef struct
  1761. {
  1762. KSPROPERTY_MEMBERSHEADER MembersHeader;
  1763. const VOID* Members;
  1764. }KSPROPERTY_MEMBERSLIST, * PKSPROPERTY_MEMBERSLIST;
  1765. typedef struct
  1766. {
  1767. KSIDENTIFIER PropTypeSet;
  1768. ULONG MembersListCount;
  1769. const KSPROPERTY_MEMBERSLIST* MembersList;
  1770. }KSPROPERTY_VALUES, * PKSPROPERTY_VALUES;
  1771. # define DEFINE_KSPROPERTY_TABLE(tablename) \
  1772. const KSPROPERTY_ITEM tablename[] =
  1773. # define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler, MinProperty, MinData, SetHandler, Values, RelationsCount, Relations, SupportHandler, SerializedSize) \
  1774. { \
  1775. PropertyId, (PFNKSHANDLER)GetHandler, \
  1776. MinProperty, MinData, \
  1777. (PFNKSHANDLER)SetHandler, \
  1778. (PKSPROPERTY_VALUES)Values, RelationsCount, \
  1779. (PKSPROPERTY)Relations, \
  1780. (PFNKSHANDLER)SupportHandler, \
  1781. (ULONG)SerializedSize \
  1782. }
  1783. typedef struct
  1784. {
  1785. ULONG PropertyId;
  1786. __MINGW_EXTENSION union
  1787. {
  1788. PFNKSHANDLER GetPropertyHandler;
  1789. BOOLEAN GetSupported;
  1790. };
  1791. ULONG MinProperty;
  1792. ULONG MinData;
  1793. __MINGW_EXTENSION union
  1794. {
  1795. PFNKSHANDLER SetPropertyHandler;
  1796. BOOLEAN SetSupported;
  1797. };
  1798. const KSPROPERTY_VALUES* Values;
  1799. ULONG RelationsCount;
  1800. const KSPROPERTY* Relations;
  1801. PFNKSHANDLER SupportHandler;
  1802. ULONG SerializedSize;
  1803. }KSPROPERTY_ITEM, * PKSPROPERTY_ITEM;
  1804. # define DEFINE_KSFASTPROPERTY_ITEM(PropertyId, GetHandler, SetHandler) \
  1805. { \
  1806. PropertyId, (PFNKSFASTHANDLER)GetHandler, \
  1807. (PFNKSFASTHANDLER)SetHandler, 0 \
  1808. }
  1809. typedef struct
  1810. {
  1811. ULONG PropertyId;
  1812. __MINGW_EXTENSION union
  1813. {
  1814. PFNKSFASTHANDLER GetPropertyHandler;
  1815. BOOLEAN GetSupported;
  1816. };
  1817. __MINGW_EXTENSION union
  1818. {
  1819. PFNKSFASTHANDLER SetPropertyHandler;
  1820. BOOLEAN SetSupported;
  1821. };
  1822. ULONG Reserved;
  1823. }KSFASTPROPERTY_ITEM, * PKSFASTPROPERTY_ITEM;
  1824. # define DEFINE_KSPROPERTY_SET(Set, PropertiesCount, PropertyItem, FastIoCount, FastIoTable) \
  1825. { \
  1826. Set, \
  1827. PropertiesCount, PropertyItem, \
  1828. FastIoCount, FastIoTable \
  1829. }
  1830. # define DEFINE_KSPROPERTY_SET_TABLE(tablename) \
  1831. const KSPROPERTY_SET tablename[] =
  1832. typedef struct
  1833. {
  1834. const GUID* Set;
  1835. ULONG PropertiesCount;
  1836. const KSPROPERTY_ITEM* PropertyItem;
  1837. ULONG FastIoCount;
  1838. const KSFASTPROPERTY_ITEM* FastIoTable;
  1839. }KSPROPERTY_SET, * PKSPROPERTY_SET;
  1840. # define DEFINE_KSMETHOD_TABLE(tablename) \
  1841. const KSMETHOD_ITEM tablename[] =
  1842. # define DEFINE_KSMETHOD_ITEM(MethodId, Flags, MethodHandler, MinMethod, MinData, SupportHandler) \
  1843. { \
  1844. MethodId, (PFNKSHANDLER)MethodHandler, \
  1845. MinMethod, MinData, \
  1846. SupportHandler, Flags \
  1847. }
  1848. typedef struct
  1849. {
  1850. ULONG MethodId;
  1851. __MINGW_EXTENSION union
  1852. {
  1853. PFNKSHANDLER MethodHandler;
  1854. BOOLEAN MethodSupported;
  1855. };
  1856. ULONG MinMethod;
  1857. ULONG MinData;
  1858. PFNKSHANDLER SupportHandler;
  1859. ULONG Flags;
  1860. }KSMETHOD_ITEM, * PKSMETHOD_ITEM;
  1861. # define DEFINE_KSFASTMETHOD_ITEM(MethodId, MethodHandler) \
  1862. { \
  1863. MethodId, (PFNKSFASTHANDLER)MethodHandler \
  1864. }
  1865. typedef struct
  1866. {
  1867. ULONG MethodId;
  1868. __MINGW_EXTENSION union
  1869. {
  1870. PFNKSFASTHANDLER MethodHandler;
  1871. BOOLEAN MethodSupported;
  1872. };
  1873. }KSFASTMETHOD_ITEM, * PKSFASTMETHOD_ITEM;
  1874. # define DEFINE_KSMETHOD_SET(Set, MethodsCount, MethodItem, FastIoCount, FastIoTable) \
  1875. { \
  1876. Set, \
  1877. MethodsCount, MethodItem, \
  1878. FastIoCount, FastIoTable \
  1879. }
  1880. # define DEFINE_KSMETHOD_SET_TABLE(tablename) \
  1881. const KSMETHOD_SET tablename[] =
  1882. typedef struct
  1883. {
  1884. const GUID* Set;
  1885. ULONG MethodsCount;
  1886. const KSMETHOD_ITEM* MethodItem;
  1887. ULONG FastIoCount;
  1888. const KSFASTMETHOD_ITEM* FastIoTable;
  1889. }KSMETHOD_SET, * PKSMETHOD_SET;
  1890. typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, * PKSEVENT_ENTRY;
  1891. typedef NTSTATUS (*PFNKSADDEVENT)(PIRP Irp, PKSEVENTDATA EventData,
  1892. struct _KSEVENT_ENTRY* EventEntry);
  1893. typedef VOID (*PFNKSREMOVEEVENT)(PFILE_OBJECT FileObject,
  1894. struct _KSEVENT_ENTRY* EventEntry);
  1895. # define DEFINE_KSEVENT_TABLE(tablename) \
  1896. const KSEVENT_ITEM tablename[] =
  1897. # define DEFINE_KSEVENT_ITEM(EventId, DataInput, ExtraEntryData, AddHandler, RemoveHandler, SupportHandler) \
  1898. { \
  1899. EventId, DataInput, ExtraEntryData, \
  1900. AddHandler, RemoveHandler, SupportHandler \
  1901. }
  1902. typedef struct
  1903. {
  1904. ULONG EventId;
  1905. ULONG DataInput;
  1906. ULONG ExtraEntryData;
  1907. PFNKSADDEVENT AddHandler;
  1908. PFNKSREMOVEEVENT RemoveHandler;
  1909. PFNKSHANDLER SupportHandler;
  1910. }KSEVENT_ITEM, * PKSEVENT_ITEM;
  1911. # define DEFINE_KSEVENT_SET(Set, EventsCount, EventItem) \
  1912. { \
  1913. Set, EventsCount, EventItem \
  1914. }
  1915. # define DEFINE_KSEVENT_SET_TABLE(tablename) \
  1916. const KSEVENT_SET tablename[] =
  1917. typedef struct
  1918. {
  1919. const GUID* Set;
  1920. ULONG EventsCount;
  1921. const KSEVENT_ITEM* EventItem;
  1922. }KSEVENT_SET, * PKSEVENT_SET;
  1923. typedef struct
  1924. {
  1925. KDPC Dpc;
  1926. ULONG ReferenceCount;
  1927. KSPIN_LOCK AccessLock;
  1928. }KSDPC_ITEM, * PKSDPC_ITEM;
  1929. typedef struct
  1930. {
  1931. KSDPC_ITEM DpcItem;
  1932. LIST_ENTRY BufferList;
  1933. }KSBUFFER_ITEM, * PKSBUFFER_ITEM;
  1934. # define KSEVENT_ENTRY_DELETED 1
  1935. # define KSEVENT_ENTRY_ONESHOT 2
  1936. # define KSEVENT_ENTRY_BUFFERED 4
  1937. struct _KSEVENT_ENTRY
  1938. {
  1939. LIST_ENTRY ListEntry;
  1940. PVOID Object;
  1941. __MINGW_EXTENSION union
  1942. {
  1943. PKSDPC_ITEM DpcItem;
  1944. PKSBUFFER_ITEM BufferItem;
  1945. };
  1946. PKSEVENTDATA EventData;
  1947. ULONG NotificationType;
  1948. const KSEVENT_SET* EventSet;
  1949. const KSEVENT_ITEM* EventItem;
  1950. PFILE_OBJECT FileObject;
  1951. ULONG SemaphoreAdjustment;
  1952. ULONG Reserved;
  1953. ULONG Flags;
  1954. };
  1955. typedef enum
  1956. {
  1957. KSEVENTS_NONE,
  1958. KSEVENTS_SPINLOCK,
  1959. KSEVENTS_MUTEX,
  1960. KSEVENTS_FMUTEX,
  1961. KSEVENTS_FMUTEXUNSAFE,
  1962. KSEVENTS_INTERRUPT,
  1963. KSEVENTS_ERESOURCE
  1964. }KSEVENTS_LOCKTYPE;
  1965. # define KSDISPATCH_FASTIO 0x80000000
  1966. typedef struct
  1967. {
  1968. PDRIVER_DISPATCH Create;
  1969. PVOID Context;
  1970. UNICODE_STRING ObjectClass;
  1971. PSECURITY_DESCRIPTOR SecurityDescriptor;
  1972. ULONG Flags;
  1973. }KSOBJECT_CREATE_ITEM, * PKSOBJECT_CREATE_ITEM;
  1974. typedef VOID (*PFNKSITEMFREECALLBACK)(PKSOBJECT_CREATE_ITEM CreateItem);
  1975. # define KSCREATE_ITEM_SECURITYCHANGED 0x00000001
  1976. # define KSCREATE_ITEM_WILDCARD 0x00000002
  1977. # define KSCREATE_ITEM_NOPARAMETERS 0x00000004
  1978. # define KSCREATE_ITEM_FREEONSTOP 0x00000008
  1979. # define DEFINE_KSCREATE_DISPATCH_TABLE(tablename) \
  1980. KSOBJECT_CREATE_ITEM tablename[] =
  1981. # define DEFINE_KSCREATE_ITEM(DispatchCreate, TypeName, Context) \
  1982. { \
  1983. (DispatchCreate), (PVOID)(Context), \
  1984. { \
  1985. sizeof(TypeName) - sizeof(UNICODE_NULL), \
  1986. sizeof(TypeName), \
  1987. (PWCHAR)(TypeName) \
  1988. }, \
  1989. NULL, 0 \
  1990. }
  1991. # define DEFINE_KSCREATE_ITEMEX(DispatchCreate, TypeName, Context, Flags) \
  1992. { \
  1993. (DispatchCreate), \
  1994. (PVOID)(Context), \
  1995. { \
  1996. sizeof(TypeName) - sizeof(UNICODE_NULL), \
  1997. sizeof(TypeName), \
  1998. (PWCHAR)(TypeName) \
  1999. }, \
  2000. NULL, (Flags) \
  2001. }
  2002. # define DEFINE_KSCREATE_ITEMNULL(DispatchCreate, Context) \
  2003. { \
  2004. DispatchCreate, Context, \
  2005. { \
  2006. 0, 0, NULL, \
  2007. }, \
  2008. NULL, 0 \
  2009. }
  2010. typedef struct
  2011. {
  2012. ULONG CreateItemsCount;
  2013. PKSOBJECT_CREATE_ITEM CreateItemsList;
  2014. }KSOBJECT_CREATE, * PKSOBJECT_CREATE;
  2015. typedef struct
  2016. {
  2017. PDRIVER_DISPATCH DeviceIoControl;
  2018. PDRIVER_DISPATCH Read;
  2019. PDRIVER_DISPATCH Write;
  2020. PDRIVER_DISPATCH Flush;
  2021. PDRIVER_DISPATCH Close;
  2022. PDRIVER_DISPATCH QuerySecurity;
  2023. PDRIVER_DISPATCH SetSecurity;
  2024. PFAST_IO_DEVICE_CONTROL FastDeviceIoControl;
  2025. PFAST_IO_READ FastRead;
  2026. PFAST_IO_WRITE FastWrite;
  2027. }KSDISPATCH_TABLE, * PKSDISPATCH_TABLE;
  2028. # define DEFINE_KSDISPATCH_TABLE(tablename, DeviceIoControl, Read, Write, Flush, Close, QuerySecurity, SetSecurity, FastDeviceIoControl, FastRead, FastWrite) \
  2029. const KSDISPATCH_TABLE tablename = \
  2030. { \
  2031. DeviceIoControl, \
  2032. Read, \
  2033. Write, \
  2034. Flush, \
  2035. Close, \
  2036. QuerySecurity, \
  2037. SetSecurity, \
  2038. FastDeviceIoControl, \
  2039. FastRead, \
  2040. FastWrite, \
  2041. }
  2042. # define KSCREATE_ITEM_IRP_STORAGE(Irp) \
  2043. (*(PKSOBJECT_CREATE_ITEM*)&(Irp)->Tail.Overlay.DriverContext[0])
  2044. # define KSEVENT_SET_IRP_STORAGE(Irp) \
  2045. (*(const KSEVENT_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
  2046. # define KSEVENT_ITEM_IRP_STORAGE(Irp) \
  2047. (*(const KSEVENT_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
  2048. # define KSEVENT_ENTRY_IRP_STORAGE(Irp) \
  2049. (*(PKSEVENT_ENTRY*)&(Irp)->Tail.Overlay.DriverContext[0])
  2050. # define KSMETHOD_SET_IRP_STORAGE(Irp) \
  2051. (*(const KSMETHOD_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
  2052. # define KSMETHOD_ITEM_IRP_STORAGE(Irp) \
  2053. (*(const KSMETHOD_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
  2054. # define KSMETHOD_TYPE_IRP_STORAGE(Irp) \
  2055. (*(ULONG_PTR*)(&(Irp)->Tail.Overlay.DriverContext[2]))
  2056. # define KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) \
  2057. (*(PKSPIN_LOCK*)&(Irp)->Tail.Overlay.DriverContext[1])
  2058. # define KSPROPERTY_SET_IRP_STORAGE(Irp) \
  2059. (*(const KSPROPERTY_SET**)&(Irp)->Tail.Overlay.DriverContext[0])
  2060. # define KSPROPERTY_ITEM_IRP_STORAGE(Irp) \
  2061. (*(const KSPROPERTY_ITEM**)&(Irp)->Tail.Overlay.DriverContext[3])
  2062. # define KSPROPERTY_ATTRIBUTES_IRP_STORAGE(Irp) \
  2063. (*(PKSATTRIBUTE_LIST*)&(Irp)->Tail.Overlay.DriverContext[2])
  2064. typedef PVOID KSDEVICE_HEADER, KSOBJECT_HEADER;
  2065. typedef enum
  2066. {
  2067. KsInvokeOnSuccess = 1,
  2068. KsInvokeOnError = 2,
  2069. KsInvokeOnCancel = 4
  2070. }KSCOMPLETION_INVOCATION;
  2071. typedef enum
  2072. {
  2073. KsListEntryTail,
  2074. KsListEntryHead
  2075. }KSLIST_ENTRY_LOCATION;
  2076. typedef enum
  2077. {
  2078. KsAcquireOnly,
  2079. KsAcquireAndRemove,
  2080. KsAcquireOnlySingleItem,
  2081. KsAcquireAndRemoveOnlySingleItem
  2082. }KSIRP_REMOVAL_OPERATION;
  2083. typedef enum
  2084. {
  2085. KsStackCopyToNewLocation,
  2086. KsStackReuseCurrentLocation,
  2087. KsStackUseNewLocation
  2088. }KSSTACK_USE;
  2089. typedef enum
  2090. {
  2091. KSTARGET_STATE_DISABLED,
  2092. KSTARGET_STATE_ENABLED
  2093. }KSTARGET_STATE;
  2094. typedef NTSTATUS (*PFNKSIRPLISTCALLBACK)(PIRP Irp, PVOID Context);
  2095. typedef VOID (*PFNREFERENCEDEVICEOBJECT)(PVOID Context);
  2096. typedef VOID (*PFNDEREFERENCEDEVICEOBJECT)(PVOID Context);
  2097. typedef NTSTATUS (*PFNQUERYREFERENCESTRING)(PVOID Context, PWCHAR* String);
  2098. # define BUS_INTERFACE_REFERENCE_VERSION 0x100
  2099. typedef struct
  2100. {
  2101. INTERFACE Interface;
  2102. PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject;
  2103. PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject;
  2104. PFNQUERYREFERENCESTRING QueryReferenceString;
  2105. }BUS_INTERFACE_REFERENCE, * PBUS_INTERFACE_REFERENCE;
  2106. # define STATIC_REFERENCE_BUS_INTERFACE STATIC_KSMEDIUMSETID_Standard
  2107. # define REFERENCE_BUS_INTERFACE KSMEDIUMSETID_Standard
  2108. #endif /* _NTDDK_ */
  2109. #ifndef PACK_PRAGMAS_NOT_SUPPORTED
  2110. # include <pshpack1.h>
  2111. #endif
  2112. typedef struct
  2113. {
  2114. GUID PropertySet;
  2115. ULONG Count;
  2116. }KSPROPERTY_SERIALHDR, * PKSPROPERTY_SERIALHDR;
  2117. #ifndef PACK_PRAGMAS_NOT_SUPPORTED
  2118. # include <poppack.h>
  2119. #endif
  2120. typedef struct
  2121. {
  2122. KSIDENTIFIER PropTypeSet;
  2123. ULONG Id;
  2124. ULONG PropertyLength;
  2125. }KSPROPERTY_SERIAL, * PKSPROPERTY_SERIAL;
  2126. #if defined(_NTDDK_)
  2127. # define IOCTL_KS_HANDSHAKE \
  2128. CTL_CODE(FILE_DEVICE_KS, 0x007, METHOD_NEITHER, FILE_ANY_ACCESS)
  2129. typedef struct
  2130. {
  2131. GUID ProtocolId;
  2132. PVOID Argument1;
  2133. PVOID Argument2;
  2134. }KSHANDSHAKE, * PKSHANDSHAKE;
  2135. typedef struct _KSGATE KSGATE, * PKSGATE;
  2136. struct _KSGATE
  2137. {
  2138. LONG Count;
  2139. PKSGATE NextGate;
  2140. };
  2141. typedef PVOID KSOBJECT_BAG;
  2142. typedef BOOLEAN (*PFNKSGENERATEEVENTCALLBACK)(PVOID Context,
  2143. PKSEVENT_ENTRY EventEntry);
  2144. typedef NTSTATUS (*PFNKSDEVICECREATE)(PKSDEVICE Device);
  2145. typedef NTSTATUS (*PFNKSDEVICEPNPSTART)(PKSDEVICE Device, PIRP Irp,
  2146. PCM_RESOURCE_LIST TranslatedResourceList,
  2147. PCM_RESOURCE_LIST UntranslatedResourceList);
  2148. typedef NTSTATUS (*PFNKSDEVICE)(PKSDEVICE Device);
  2149. typedef NTSTATUS (*PFNKSDEVICEIRP)(PKSDEVICE Device, PIRP Irp);
  2150. typedef void (*PFNKSDEVICEIRPVOID)(PKSDEVICE Device, PIRP Irp);
  2151. typedef NTSTATUS (*PFNKSDEVICEQUERYCAPABILITIES)(PKSDEVICE Device, PIRP Irp,
  2152. PDEVICE_CAPABILITIES Capabilities);
  2153. typedef NTSTATUS (*PFNKSDEVICEQUERYPOWER)(PKSDEVICE Device, PIRP Irp,
  2154. DEVICE_POWER_STATE DeviceTo,
  2155. DEVICE_POWER_STATE DeviceFrom,
  2156. SYSTEM_POWER_STATE SystemTo,
  2157. SYSTEM_POWER_STATE SystemFrom,
  2158. POWER_ACTION Action);
  2159. typedef void (*PFNKSDEVICESETPOWER)(PKSDEVICE Device, PIRP Irp,
  2160. DEVICE_POWER_STATE To,
  2161. DEVICE_POWER_STATE From);
  2162. typedef NTSTATUS (*PFNKSFILTERFACTORYVOID)(PKSFILTERFACTORY FilterFactory);
  2163. typedef void (*PFNKSFILTERFACTORYPOWER)(PKSFILTERFACTORY FilterFactory,
  2164. DEVICE_POWER_STATE State);
  2165. typedef NTSTATUS (*PFNKSFILTERIRP)(PKSFILTER Filter, PIRP Irp);
  2166. typedef NTSTATUS (*PFNKSFILTERPROCESS)(PKSFILTER Filter,
  2167. PKSPROCESSPIN_INDEXENTRY Index);
  2168. typedef NTSTATUS (*PFNKSFILTERVOID)(PKSFILTER Filter);
  2169. typedef void (*PFNKSFILTERPOWER)(PKSFILTER Filter, DEVICE_POWER_STATE State);
  2170. typedef NTSTATUS (*PFNKSPINIRP)(PKSPIN Pin, PIRP Irp);
  2171. typedef NTSTATUS (*PFNKSPINSETDEVICESTATE)(PKSPIN Pin, KSSTATE ToState,
  2172. KSSTATE FromState);
  2173. typedef NTSTATUS (*PFNKSPINSETDATAFORMAT)(PKSPIN Pin, PKSDATAFORMAT OldFormat,
  2174. PKSMULTIPLE_ITEM OldAttributeList,
  2175. const KSDATARANGE* DataRange,
  2176. const KSATTRIBUTE_LIST* AttributeRange);
  2177. typedef NTSTATUS (*PFNKSPINHANDSHAKE)(PKSPIN Pin, PKSHANDSHAKE In,
  2178. PKSHANDSHAKE Out);
  2179. typedef NTSTATUS (*PFNKSPIN)(PKSPIN Pin);
  2180. typedef void (*PFNKSPINVOID)(PKSPIN Pin);
  2181. typedef void (*PFNKSPINPOWER)(PKSPIN Pin, DEVICE_POWER_STATE State);
  2182. typedef BOOLEAN (*PFNKSPINSETTIMER)(PKSPIN Pin, PKTIMER Timer,
  2183. LARGE_INTEGER DueTime, PKDPC Dpc);
  2184. typedef BOOLEAN (*PFNKSPINCANCELTIMER)(PKSPIN Pin, PKTIMER Timer);
  2185. typedef LONGLONG (FASTCALL * PFNKSPINCORRELATEDTIME)(PKSPIN Pin,
  2186. PLONGLONG SystemTime);
  2187. typedef void (*PFNKSPINRESOLUTION)(PKSPIN Pin, PKSRESOLUTION Resolution);
  2188. typedef NTSTATUS (*PFNKSPININITIALIZEALLOCATOR)(PKSPIN Pin,
  2189. PKSALLOCATOR_FRAMING AllocatorFraming,
  2190. PVOID* Context);
  2191. typedef void (*PFNKSSTREAMPOINTER)(PKSSTREAM_POINTER StreamPointer);
  2192. typedef struct KSAUTOMATION_TABLE_ KSAUTOMATION_TABLE, * PKSAUTOMATION_TABLE;
  2193. struct KSAUTOMATION_TABLE_
  2194. {
  2195. ULONG PropertySetsCount;
  2196. ULONG PropertyItemSize;
  2197. const KSPROPERTY_SET* PropertySets;
  2198. ULONG MethodSetsCount;
  2199. ULONG MethodItemSize;
  2200. const KSMETHOD_SET* MethodSets;
  2201. ULONG EventSetsCount;
  2202. ULONG EventItemSize;
  2203. const KSEVENT_SET* EventSets;
  2204. # ifndef _WIN64
  2205. PVOID Alignment;
  2206. # endif
  2207. };
  2208. # define DEFINE_KSAUTOMATION_TABLE(table) \
  2209. const KSAUTOMATION_TABLE table =
  2210. # define DEFINE_KSAUTOMATION_PROPERTIES(table) \
  2211. SIZEOF_ARRAY(table), \
  2212. sizeof(KSPROPERTY_ITEM), \
  2213. table
  2214. # define DEFINE_KSAUTOMATION_METHODS(table) \
  2215. SIZEOF_ARRAY(table), \
  2216. sizeof(KSMETHOD_ITEM), \
  2217. table
  2218. # define DEFINE_KSAUTOMATION_EVENTS(table) \
  2219. SIZEOF_ARRAY(table), \
  2220. sizeof(KSEVENT_ITEM), \
  2221. table
  2222. # define DEFINE_KSAUTOMATION_PROPERTIES_NULL \
  2223. 0, \
  2224. sizeof(KSPROPERTY_ITEM), \
  2225. NULL
  2226. # define DEFINE_KSAUTOMATION_METHODS_NULL \
  2227. 0, \
  2228. sizeof(KSMETHOD_ITEM), \
  2229. NULL
  2230. # define DEFINE_KSAUTOMATION_EVENTS_NULL \
  2231. 0, \
  2232. sizeof(KSEVENT_ITEM), \
  2233. NULL
  2234. # define MIN_DEV_VER_FOR_QI (0x100)
  2235. struct _KSDEVICE_DISPATCH
  2236. {
  2237. PFNKSDEVICECREATE Add;
  2238. PFNKSDEVICEPNPSTART Start;
  2239. PFNKSDEVICE PostStart;
  2240. PFNKSDEVICEIRP QueryStop;
  2241. PFNKSDEVICEIRPVOID CancelStop;
  2242. PFNKSDEVICEIRPVOID Stop;
  2243. PFNKSDEVICEIRP QueryRemove;
  2244. PFNKSDEVICEIRPVOID CancelRemove;
  2245. PFNKSDEVICEIRPVOID Remove;
  2246. PFNKSDEVICEQUERYCAPABILITIES QueryCapabilities;
  2247. PFNKSDEVICEIRPVOID SurpriseRemoval;
  2248. PFNKSDEVICEQUERYPOWER QueryPower;
  2249. PFNKSDEVICESETPOWER SetPower;
  2250. PFNKSDEVICEIRP QueryInterface;
  2251. };
  2252. struct _KSFILTER_DISPATCH
  2253. {
  2254. PFNKSFILTERIRP Create;
  2255. PFNKSFILTERIRP Close;
  2256. PFNKSFILTERPROCESS Process;
  2257. PFNKSFILTERVOID Reset;
  2258. };
  2259. struct _KSPIN_DISPATCH
  2260. {
  2261. PFNKSPINIRP Create;
  2262. PFNKSPINIRP Close;
  2263. PFNKSPIN Process;
  2264. PFNKSPINVOID Reset;
  2265. PFNKSPINSETDATAFORMAT SetDataFormat;
  2266. PFNKSPINSETDEVICESTATE SetDeviceState;
  2267. PFNKSPIN Connect;
  2268. PFNKSPINVOID Disconnect;
  2269. const KSCLOCK_DISPATCH* Clock;
  2270. const KSALLOCATOR_DISPATCH* Allocator;
  2271. };
  2272. struct _KSCLOCK_DISPATCH
  2273. {
  2274. PFNKSPINSETTIMER SetTimer;
  2275. PFNKSPINCANCELTIMER CancelTimer;
  2276. PFNKSPINCORRELATEDTIME CorrelatedTime;
  2277. PFNKSPINRESOLUTION Resolution;
  2278. };
  2279. struct _KSALLOCATOR_DISPATCH
  2280. {
  2281. PFNKSPININITIALIZEALLOCATOR InitializeAllocator;
  2282. PFNKSDELETEALLOCATOR DeleteAllocator;
  2283. PFNKSDEFAULTALLOCATE Allocate;
  2284. PFNKSDEFAULTFREE Free;
  2285. };
  2286. # define KSDEVICE_DESCRIPTOR_VERSION (0x100)
  2287. struct _KSDEVICE_DESCRIPTOR
  2288. {
  2289. const KSDEVICE_DISPATCH* Dispatch;
  2290. ULONG FilterDescriptorsCount;
  2291. const KSFILTER_DESCRIPTOR* const* FilterDescriptors;
  2292. ULONG Version;
  2293. };
  2294. struct _KSFILTER_DESCRIPTOR
  2295. {
  2296. const KSFILTER_DISPATCH* Dispatch;
  2297. const KSAUTOMATION_TABLE* AutomationTable;
  2298. ULONG Version;
  2299. # define KSFILTER_DESCRIPTOR_VERSION ((ULONG)-1)
  2300. ULONG Flags;
  2301. # define KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING 0x00000001
  2302. # define KSFILTER_FLAG_CRITICAL_PROCESSING 0x00000002
  2303. # define KSFILTER_FLAG_HYPERCRITICAL_PROCESSING 0x00000004
  2304. # define KSFILTER_FLAG_RECEIVE_ZERO_LENGTH_SAMPLES 0x00000008
  2305. # define KSFILTER_FLAG_DENY_USERMODE_ACCESS 0x80000000
  2306. const GUID* ReferenceGuid;
  2307. ULONG PinDescriptorsCount;
  2308. ULONG PinDescriptorSize;
  2309. const KSPIN_DESCRIPTOR_EX* PinDescriptors;
  2310. ULONG CategoriesCount;
  2311. const GUID* Categories;
  2312. ULONG NodeDescriptorsCount;
  2313. ULONG NodeDescriptorSize;
  2314. const KSNODE_DESCRIPTOR* NodeDescriptors;
  2315. ULONG ConnectionsCount;
  2316. const KSTOPOLOGY_CONNECTION* Connections;
  2317. const KSCOMPONENTID* ComponentId;
  2318. };
  2319. # define DEFINE_KSFILTER_DESCRIPTOR(descriptor) \
  2320. const KSFILTER_DESCRIPTOR descriptor =
  2321. # define DEFINE_KSFILTER_PIN_DESCRIPTORS(table) \
  2322. SIZEOF_ARRAY(table), \
  2323. sizeof(table[0]), \
  2324. table
  2325. # define DEFINE_KSFILTER_CATEGORIES(table) \
  2326. SIZEOF_ARRAY(table), \
  2327. table
  2328. # define DEFINE_KSFILTER_CATEGORY(category) \
  2329. 1, \
  2330. &(category)
  2331. # define DEFINE_KSFILTER_CATEGORIES_NULL \
  2332. 0, \
  2333. NULL
  2334. # define DEFINE_KSFILTER_NODE_DESCRIPTORS(table) \
  2335. SIZEOF_ARRAY(table), \
  2336. sizeof(table[0]), \
  2337. table
  2338. # define DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL \
  2339. 0, \
  2340. sizeof(KSNODE_DESCRIPTOR), \
  2341. NULL
  2342. # define DEFINE_KSFILTER_CONNECTIONS(table) \
  2343. SIZEOF_ARRAY(table), \
  2344. table
  2345. # define DEFINE_KSFILTER_DEFAULT_CONNECTIONS \
  2346. 0, \
  2347. NULL
  2348. # define DEFINE_KSFILTER_DESCRIPTOR_TABLE(table) \
  2349. const KSFILTER_DESCRIPTOR * const table[] =
  2350. struct _KSPIN_DESCRIPTOR_EX
  2351. {
  2352. const KSPIN_DISPATCH* Dispatch;
  2353. const KSAUTOMATION_TABLE* AutomationTable;
  2354. KSPIN_DESCRIPTOR PinDescriptor;
  2355. ULONG Flags;
  2356. # define KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING
  2357. # define KSPIN_FLAG_CRITICAL_PROCESSING KSFILTER_FLAG_CRITICAL_PROCESSING
  2358. # define KSPIN_FLAG_HYPERCRITICAL_PROCESSING KSFILTER_FLAG_HYPERCRITICAL_PROCESSING
  2359. # define KSPIN_FLAG_ASYNCHRONOUS_PROCESSING 0x00000008
  2360. # define KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING 0x00000010
  2361. # define KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL 0x00000020
  2362. # define KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING 0x00000040
  2363. # define KSPIN_FLAG_ENFORCE_FIFO 0x00000080
  2364. # define KSPIN_FLAG_GENERATE_MAPPINGS 0x00000100
  2365. # define KSPIN_FLAG_DISTINCT_TRAILING_EDGE 0x00000200
  2366. # define KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY 0x00010000
  2367. # define KSPIN_FLAG_SPLITTER 0x00020000
  2368. # define KSPIN_FLAG_USE_STANDARD_TRANSPORT 0x00040000
  2369. # define KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT 0x00080000
  2370. # define KSPIN_FLAG_FIXED_FORMAT 0x00100000
  2371. # define KSPIN_FLAG_GENERATE_EOS_EVENTS 0x00200000
  2372. # define KSPIN_FLAG_RENDERER (KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY | KSPIN_FLAG_GENERATE_EOS_EVENTS)
  2373. # define KSPIN_FLAG_IMPLEMENT_CLOCK 0x00400000
  2374. # define KSPIN_FLAG_SOME_FRAMES_REQUIRED_FOR_PROCESSING 0x00800000
  2375. # define KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE 0x01000000
  2376. # define KSPIN_FLAG_DENY_USERMODE_ACCESS 0x80000000
  2377. ULONG InstancesPossible;
  2378. ULONG InstancesNecessary;
  2379. const KSALLOCATOR_FRAMING_EX* AllocatorFraming;
  2380. PFNKSINTERSECTHANDLEREX IntersectHandler;
  2381. };
  2382. # define DEFINE_KSPIN_DEFAULT_INTERFACES \
  2383. 0, \
  2384. NULL
  2385. # define DEFINE_KSPIN_DEFAULT_MEDIUMS \
  2386. 0, \
  2387. NULL
  2388. struct _KSNODE_DESCRIPTOR
  2389. {
  2390. const KSAUTOMATION_TABLE* AutomationTable;
  2391. const GUID* Type;
  2392. const GUID* Name;
  2393. # ifndef _WIN64
  2394. PVOID Alignment;
  2395. # endif
  2396. };
  2397. # ifndef _WIN64
  2398. # define DEFINE_NODE_DESCRIPTOR(automation, type, name) \
  2399. { (automation), (type), (name), NULL }
  2400. # else
  2401. # define DEFINE_NODE_DESCRIPTOR(automation, type, name) \
  2402. { (automation), (type), (name) }
  2403. # endif
  2404. struct _KSDEVICE
  2405. {
  2406. const KSDEVICE_DESCRIPTOR* Descriptor;
  2407. KSOBJECT_BAG Bag;
  2408. PVOID Context;
  2409. PDEVICE_OBJECT FunctionalDeviceObject;
  2410. PDEVICE_OBJECT PhysicalDeviceObject;
  2411. PDEVICE_OBJECT NextDeviceObject;
  2412. BOOLEAN Started;
  2413. SYSTEM_POWER_STATE SystemPowerState;
  2414. DEVICE_POWER_STATE DevicePowerState;
  2415. };
  2416. struct _KSFILTERFACTORY
  2417. {
  2418. const KSFILTER_DESCRIPTOR* FilterDescriptor;
  2419. KSOBJECT_BAG Bag;
  2420. PVOID Context;
  2421. };
  2422. struct _KSFILTER
  2423. {
  2424. const KSFILTER_DESCRIPTOR* Descriptor;
  2425. KSOBJECT_BAG Bag;
  2426. PVOID Context;
  2427. };
  2428. struct _KSPIN
  2429. {
  2430. const KSPIN_DESCRIPTOR_EX* Descriptor;
  2431. KSOBJECT_BAG Bag;
  2432. PVOID Context;
  2433. ULONG Id;
  2434. KSPIN_COMMUNICATION Communication;
  2435. BOOLEAN ConnectionIsExternal;
  2436. KSPIN_INTERFACE ConnectionInterface;
  2437. KSPIN_MEDIUM ConnectionMedium;
  2438. KSPRIORITY ConnectionPriority;
  2439. PKSDATAFORMAT ConnectionFormat;
  2440. PKSMULTIPLE_ITEM AttributeList;
  2441. ULONG StreamHeaderSize;
  2442. KSPIN_DATAFLOW DataFlow;
  2443. KSSTATE DeviceState;
  2444. KSRESET ResetState;
  2445. KSSTATE ClientState;
  2446. };
  2447. struct _KSMAPPING
  2448. {
  2449. PHYSICAL_ADDRESS PhysicalAddress;
  2450. ULONG ByteCount;
  2451. ULONG Alignment;
  2452. };
  2453. struct _KSSTREAM_POINTER_OFFSET
  2454. {
  2455. # if defined(_NTDDK_)
  2456. __MINGW_EXTENSION union
  2457. {
  2458. PUCHAR Data;
  2459. PKSMAPPING Mappings;
  2460. };
  2461. # else
  2462. PUCHAR Data;
  2463. # endif /* _NTDDK_ */
  2464. # ifndef _WIN64
  2465. PVOID Alignment;
  2466. # endif
  2467. ULONG Count;
  2468. ULONG Remaining;
  2469. };
  2470. struct _KSSTREAM_POINTER
  2471. {
  2472. PVOID Context;
  2473. PKSPIN Pin;
  2474. PKSSTREAM_HEADER StreamHeader;
  2475. PKSSTREAM_POINTER_OFFSET Offset;
  2476. KSSTREAM_POINTER_OFFSET OffsetIn;
  2477. KSSTREAM_POINTER_OFFSET OffsetOut;
  2478. };
  2479. struct _KSPROCESSPIN
  2480. {
  2481. PKSPIN Pin;
  2482. PKSSTREAM_POINTER StreamPointer;
  2483. PKSPROCESSPIN InPlaceCounterpart;
  2484. PKSPROCESSPIN DelegateBranch;
  2485. PKSPROCESSPIN CopySource;
  2486. PVOID Data;
  2487. ULONG BytesAvailable;
  2488. ULONG BytesUsed;
  2489. ULONG Flags;
  2490. BOOLEAN Terminate;
  2491. };
  2492. struct _KSPROCESSPIN_INDEXENTRY
  2493. {
  2494. PKSPROCESSPIN* Pins;
  2495. ULONG Count;
  2496. };
  2497. typedef enum
  2498. {
  2499. KsObjectTypeDevice,
  2500. KsObjectTypeFilterFactory,
  2501. KsObjectTypeFilter,
  2502. KsObjectTypePin
  2503. }KSOBJECTTYPE;
  2504. typedef void (*PFNKSFREE)(PVOID Data);
  2505. typedef void (*PFNKSPINFRAMERETURN)(PKSPIN Pin, PVOID Data, ULONG Size, PMDL Mdl,
  2506. PVOID Context, NTSTATUS Status);
  2507. typedef void (*PFNKSPINIRPCOMPLETION)(PKSPIN Pin, PIRP Irp);
  2508. # if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
  2509. # ifndef _IKsControl_
  2510. # define _IKsControl_
  2511. typedef struct IKsControl* PIKSCONTROL;
  2512. # ifndef DEFINE_ABSTRACT_UNKNOWN
  2513. # define DEFINE_ABSTRACT_UNKNOWN() \
  2514. STDMETHOD_(NTSTATUS, QueryInterface) (THIS_ \
  2515. REFIID InterfaceId, \
  2516. PVOID * Interface \
  2517. )PURE; \
  2518. STDMETHOD_(ULONG, AddRef) (THIS)PURE; \
  2519. STDMETHOD_(ULONG, Release) (THIS)PURE;
  2520. # endif
  2521. # undef INTERFACE
  2522. # define INTERFACE IKsControl
  2523. DECLARE_INTERFACE_(IKsControl, IUnknown)
  2524. {
  2525. DEFINE_ABSTRACT_UNKNOWN()
  2526. STDMETHOD_(NTSTATUS, KsProperty) (THIS_
  2527. PKSPROPERTY Property,
  2528. ULONG PropertyLength,
  2529. PVOID PropertyData,
  2530. ULONG DataLength,
  2531. ULONG * BytesReturned
  2532. ) PURE;
  2533. STDMETHOD_(NTSTATUS, KsMethod) (THIS_
  2534. PKSMETHOD Method,
  2535. ULONG MethodLength,
  2536. PVOID MethodData,
  2537. ULONG DataLength,
  2538. ULONG * BytesReturned
  2539. ) PURE;
  2540. STDMETHOD_(NTSTATUS, KsEvent) (THIS_
  2541. PKSEVENT Event,
  2542. ULONG EventLength,
  2543. PVOID EventData,
  2544. ULONG DataLength,
  2545. ULONG * BytesReturned
  2546. ) PURE;
  2547. };
  2548. typedef struct IKsReferenceClock* PIKSREFERENCECLOCK;
  2549. # undef INTERFACE
  2550. # define INTERFACE IKsReferenceClock
  2551. DECLARE_INTERFACE_(IKsReferenceClock, IUnknown)
  2552. {
  2553. DEFINE_ABSTRACT_UNKNOWN()
  2554. STDMETHOD_(LONGLONG, GetTime) (THIS) PURE;
  2555. STDMETHOD_(LONGLONG, GetPhysicalTime) (THIS) PURE;
  2556. STDMETHOD_(LONGLONG, GetCorrelatedTime) (THIS_
  2557. PLONGLONG SystemTime
  2558. ) PURE;
  2559. STDMETHOD_(LONGLONG, GetCorrelatedPhysicalTime) (THIS_
  2560. PLONGLONG SystemTime
  2561. ) PURE;
  2562. STDMETHOD_(NTSTATUS, GetResolution) (THIS_
  2563. PKSRESOLUTION Resolution
  2564. ) PURE;
  2565. STDMETHOD_(NTSTATUS, GetState) (THIS_
  2566. PKSSTATE State
  2567. ) PURE;
  2568. };
  2569. # undef INTERFACE
  2570. # define INTERFACE IKsDeviceFunctions
  2571. DECLARE_INTERFACE_(IKsDeviceFunctions, IUnknown)
  2572. {
  2573. DEFINE_ABSTRACT_UNKNOWN()
  2574. STDMETHOD_(NTSTATUS, RegisterAdapterObjectEx) (THIS_
  2575. PADAPTER_OBJECT AdapterObject,
  2576. PDEVICE_DESCRIPTION DeviceDescription,
  2577. ULONG NumberOfMapRegisters,
  2578. ULONG MaxMappingsByteCount,
  2579. ULONG MappingTableStride
  2580. ) PURE;
  2581. };
  2582. # undef INTERFACE
  2583. # define STATIC_IID_IKsControl \
  2584. 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96
  2585. DEFINE_GUID(IID_IKsControl,
  2586. 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96);
  2587. # define STATIC_IID_IKsFastClock \
  2588. 0xc9902485, 0xc180, 0x11d2, 0x84, 0x73, 0xd4, 0x23, 0x94, 0x45, 0x9e, 0x5e
  2589. DEFINE_GUID(IID_IKsFastClock,
  2590. 0xc9902485, 0xc180, 0x11d2, 0x84, 0x73, 0xd4, 0x23, 0x94, 0x45, 0x9e, 0x5e);
  2591. # define STATIC_IID_IKsDeviceFunctions \
  2592. 0xe234f2e2, 0xbd69, 0x4f8c, 0xb3, 0xf2, 0x7c, 0xd7, 0x9e, 0xd4, 0x66, 0xbd
  2593. DEFINE_GUID(IID_IKsDeviceFunctions,
  2594. 0xe234f2e2, 0xbd69, 0x4f8c, 0xb3, 0xf2, 0x7c, 0xd7, 0x9e, 0xd4, 0x66, 0xbd);
  2595. # endif /* _IKsControl_ */
  2596. # endif /* defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__) */
  2597. #endif /* _NTDDK_ */
  2598. #ifdef __cplusplus
  2599. extern "C" {
  2600. #endif
  2601. #ifdef _KSDDK_
  2602. # define KSDDKAPI
  2603. #else
  2604. # define KSDDKAPI DECLSPEC_IMPORT
  2605. #endif
  2606. #if defined(_NTDDK_)
  2607. KSDDKAPI NTSTATUS NTAPI KsEnableEvent(PIRP Irp, ULONG EventSetsCount, const KSEVENT_SET* EventSet, PLIST_ENTRY EventsList, KSEVENTS_LOCKTYPE EventsFlags, PVOID EventsLock);
  2608. KSDDKAPI NTSTATUS NTAPI KsEnableEventWithAllocator(PIRP Irp, ULONG EventSetsCount, const KSEVENT_SET* EventSet, PLIST_ENTRY EventsList, KSEVENTS_LOCKTYPE EventsFlags, PVOID EventsLock, PFNKSALLOCATOR Allocator, ULONG EventItemSize);
  2609. KSDDKAPI NTSTATUS NTAPI KsDisableEvent(PIRP Irp, PLIST_ENTRY EventsList, KSEVENTS_LOCKTYPE EventsFlags, PVOID EventsLock);
  2610. KSDDKAPI VOID NTAPI KsDiscardEvent(PKSEVENT_ENTRY EventEntry);
  2611. KSDDKAPI VOID NTAPI KsFreeEventList(PFILE_OBJECT FileObject, PLIST_ENTRY EventsList, KSEVENTS_LOCKTYPE EventsFlags, PVOID EventsLock);
  2612. KSDDKAPI NTSTATUS NTAPI KsGenerateEvent(PKSEVENT_ENTRY EventEntry);
  2613. KSDDKAPI NTSTATUS NTAPI KsGenerateDataEvent(PKSEVENT_ENTRY EventEntry, ULONG DataSize, PVOID Data);
  2614. KSDDKAPI VOID NTAPI KsGenerateEventList(GUID* Set, ULONG EventId, PLIST_ENTRY EventsList, KSEVENTS_LOCKTYPE EventsFlags, PVOID EventsLock);
  2615. KSDDKAPI NTSTATUS NTAPI KsPropertyHandler(PIRP Irp, ULONG PropertySetsCount, const KSPROPERTY_SET* PropertySet);
  2616. KSDDKAPI NTSTATUS NTAPI KsPropertyHandlerWithAllocator(PIRP Irp, ULONG PropertySetsCount, const KSPROPERTY_SET* PropertySet, PFNKSALLOCATOR Allocator, ULONG PropertyItemSize);
  2617. KSDDKAPI BOOLEAN NTAPI KsFastPropertyHandler(PFILE_OBJECT FileObject, PKSPROPERTY Property, ULONG PropertyLength, PVOID Data, ULONG DataLength, PIO_STATUS_BLOCK IoStatus, ULONG PropertySetsCount, const KSPROPERTY_SET* PropertySet);
  2618. KSDDKAPI NTSTATUS NTAPI KsMethodHandler(PIRP Irp, ULONG MethodSetsCount, const KSMETHOD_SET* MethodSet);
  2619. KSDDKAPI NTSTATUS NTAPI KsMethodHandlerWithAllocator(PIRP Irp, ULONG MethodSetsCount, const KSMETHOD_SET* MethodSet, PFNKSALLOCATOR Allocator, ULONG MethodItemSize);
  2620. KSDDKAPI BOOLEAN NTAPI KsFastMethodHandler(PFILE_OBJECT FileObject, PKSMETHOD Method, ULONG MethodLength, PVOID Data, ULONG DataLength, PIO_STATUS_BLOCK IoStatus, ULONG MethodSetsCount, const KSMETHOD_SET* MethodSet);
  2621. KSDDKAPI NTSTATUS NTAPI KsCreateDefaultAllocator(PIRP Irp);
  2622. KSDDKAPI NTSTATUS NTAPI KsCreateDefaultAllocatorEx(PIRP Irp, PVOID InitializeContext, PFNKSDEFAULTALLOCATE DefaultAllocate, PFNKSDEFAULTFREE DefaultFree, PFNKSINITIALIZEALLOCATOR InitializeAllocator, PFNKSDELETEALLOCATOR DeleteAllocator);
  2623. KSDDKAPI NTSTATUS NTAPI KsCreateAllocator(HANDLE ConnectionHandle, PKSALLOCATOR_FRAMING AllocatorFraming, PHANDLE AllocatorHandle);
  2624. KSDDKAPI NTSTATUS NTAPI KsValidateAllocatorCreateRequest(PIRP Irp, PKSALLOCATOR_FRAMING* AllocatorFraming);
  2625. KSDDKAPI NTSTATUS NTAPI KsValidateAllocatorFramingEx(PKSALLOCATOR_FRAMING_EX Framing, ULONG BufferSize, const KSALLOCATOR_FRAMING_EX* PinFraming);
  2626. KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClock(PKSDEFAULTCLOCK* DefaultClock);
  2627. KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClockEx(PKSDEFAULTCLOCK* DefaultClock, PVOID Context, PFNKSSETTIMER SetTimer, PFNKSCANCELTIMER CancelTimer, PFNKSCORRELATEDTIME CorrelatedTime, const KSRESOLUTION* Resolution, ULONG Flags);
  2628. KSDDKAPI VOID NTAPI KsFreeDefaultClock(PKSDEFAULTCLOCK DefaultClock);
  2629. KSDDKAPI NTSTATUS NTAPI KsCreateDefaultClock(PIRP Irp, PKSDEFAULTCLOCK DefaultClock);
  2630. KSDDKAPI NTSTATUS NTAPI KsCreateClock(HANDLE ConnectionHandle, PKSCLOCK_CREATE ClockCreate, PHANDLE ClockHandle);
  2631. KSDDKAPI NTSTATUS NTAPI KsValidateClockCreateRequest(PIRP Irp, PKSCLOCK_CREATE* ClockCreate);
  2632. KSDDKAPI KSSTATE NTAPI KsGetDefaultClockState(PKSDEFAULTCLOCK DefaultClock);
  2633. KSDDKAPI VOID NTAPI KsSetDefaultClockState(PKSDEFAULTCLOCK DefaultClock, KSSTATE State);
  2634. KSDDKAPI LONGLONG NTAPI KsGetDefaultClockTime(PKSDEFAULTCLOCK DefaultClock);
  2635. KSDDKAPI VOID NTAPI KsSetDefaultClockTime(PKSDEFAULTCLOCK DefaultClock, LONGLONG Time);
  2636. KSDDKAPI NTSTATUS NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle);
  2637. KSDDKAPI NTSTATUS NTAPI KsValidateConnectRequest(PIRP Irp, ULONG DescriptorsCount, const KSPIN_DESCRIPTOR* Descriptor, PKSPIN_CONNECT* Connect);
  2638. KSDDKAPI NTSTATUS NTAPI KsPinPropertyHandler(PIRP Irp, PKSPROPERTY Property, PVOID Data, ULONG DescriptorsCount, const KSPIN_DESCRIPTOR* Descriptor);
  2639. KSDDKAPI NTSTATUS NTAPI KsPinDataIntersection(PIRP Irp, PKSP_PIN Pin, PVOID Data, ULONG DescriptorsCount, const KSPIN_DESCRIPTOR* Descriptor, PFNKSINTERSECTHANDLER IntersectHandler);
  2640. KSDDKAPI NTSTATUS NTAPI KsPinDataIntersectionEx(PIRP Irp, PKSP_PIN Pin, PVOID Data, ULONG DescriptorsCount, const KSPIN_DESCRIPTOR* Descriptor, ULONG DescriptorSize, PFNKSINTERSECTHANDLEREX IntersectHandler, PVOID HandlerContext);
  2641. KSDDKAPI NTSTATUS NTAPI KsHandleSizedListQuery(PIRP Irp, ULONG DataItemsCount, ULONG DataItemSize, const VOID* DataItems);
  2642. # ifndef MAKEINTRESOURCE
  2643. # define MAKEINTRESOURCE(r) ((ULONG_PTR)(USHORT)r)
  2644. # endif
  2645. # ifndef RT_STRING
  2646. # define RT_STRING MAKEINTRESOURCE(6)
  2647. # define RT_RCDATA MAKEINTRESOURCE(10)
  2648. # endif
  2649. KSDDKAPI NTSTATUS NTAPI KsLoadResource(PVOID ImageBase, POOL_TYPE PoolType, ULONG_PTR ResourceName, ULONG ResourceType, PVOID* Resource, PULONG ResourceSize);
  2650. KSDDKAPI NTSTATUS NTAPI KsGetImageNameAndResourceId(HANDLE RegKey, PUNICODE_STRING ImageName, PULONG_PTR ResourceId, PULONG ValueType);
  2651. KSDDKAPI NTSTATUS NTAPI KsMapModuleName(PDEVICE_OBJECT PhysicalDeviceObject, PUNICODE_STRING ModuleName, PUNICODE_STRING ImageName, PULONG_PTR ResourceId, PULONG ValueType);
  2652. KSDDKAPI NTSTATUS NTAPI KsReferenceBusObject(KSDEVICE_HEADER Header);
  2653. KSDDKAPI VOID NTAPI KsDereferenceBusObject(KSDEVICE_HEADER Header);
  2654. KSDDKAPI NTSTATUS NTAPI KsDispatchQuerySecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2655. KSDDKAPI NTSTATUS NTAPI KsDispatchSetSecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2656. KSDDKAPI NTSTATUS NTAPI KsDispatchSpecificProperty(PIRP Irp, PFNKSHANDLER Handler);
  2657. KSDDKAPI NTSTATUS NTAPI KsDispatchSpecificMethod(PIRP Irp, PFNKSHANDLER Handler);
  2658. KSDDKAPI NTSTATUS NTAPI KsReadFile(PFILE_OBJECT FileObject, PKEVENT Event, PVOID PortContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, ULONG Key, KPROCESSOR_MODE RequestorMode);
  2659. KSDDKAPI NTSTATUS NTAPI KsWriteFile(PFILE_OBJECT FileObject, PKEVENT Event, PVOID PortContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, ULONG Key, KPROCESSOR_MODE RequestorMode);
  2660. KSDDKAPI NTSTATUS NTAPI KsQueryInformationFile(PFILE_OBJECT FileObject, PVOID FileInformation, ULONG Length, FILE_INFORMATION_CLASS FileInformationClass);
  2661. KSDDKAPI NTSTATUS NTAPI KsSetInformationFile(PFILE_OBJECT FileObject, PVOID FileInformation, ULONG Length, FILE_INFORMATION_CLASS FileInformationClass);
  2662. KSDDKAPI NTSTATUS NTAPI KsStreamIo(PFILE_OBJECT FileObject, PKEVENT Event, PVOID PortContext, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext, KSCOMPLETION_INVOCATION CompletionInvocationFlags, PIO_STATUS_BLOCK IoStatusBlock, PVOID StreamHeaders, ULONG Length, ULONG Flags, KPROCESSOR_MODE RequestorMode);
  2663. KSDDKAPI NTSTATUS NTAPI KsProbeStreamIrp(PIRP Irp, ULONG ProbeFlags, ULONG HeaderSize);
  2664. KSDDKAPI NTSTATUS NTAPI KsAllocateExtraData(PIRP Irp, ULONG ExtraSize, PVOID* ExtraBuffer);
  2665. KSDDKAPI VOID NTAPI KsNullDriverUnload(PDRIVER_OBJECT DriverObject);
  2666. KSDDKAPI NTSTATUS NTAPI KsSetMajorFunctionHandler(PDRIVER_OBJECT DriverObject, ULONG MajorFunction);
  2667. KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2668. KSDDKAPI NTSTATUS NTAPI KsDefaultDeviceIoCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2669. KSDDKAPI NTSTATUS NTAPI KsDispatchIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2670. KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(PFILE_OBJECT FileObject, BOOLEAN Wait, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, ULONG IoControlCode, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject);
  2671. KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, ULONG Length, BOOLEAN Wait, ULONG LockKey, PVOID Buffer, PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject);
  2672. # define KsDispatchFastWriteFailure KsDispatchFastReadFailure
  2673. KSDDKAPI VOID NTAPI KsCancelRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2674. KSDDKAPI VOID NTAPI KsCancelIo(PLIST_ENTRY QueueHead, PKSPIN_LOCK SpinLock);
  2675. KSDDKAPI VOID NTAPI KsReleaseIrpOnCancelableQueue(PIRP Irp, PDRIVER_CANCEL DriverCancel);
  2676. KSDDKAPI PIRP NTAPI KsRemoveIrpFromCancelableQueue(PLIST_ENTRY QueueHead, PKSPIN_LOCK SpinLock, KSLIST_ENTRY_LOCATION ListLocation, KSIRP_REMOVAL_OPERATION RemovalOperation);
  2677. KSDDKAPI NTSTATUS NTAPI KsMoveIrpsOnCancelableQueue(PLIST_ENTRY SourceList, PKSPIN_LOCK SourceLock, PLIST_ENTRY DestinationList, PKSPIN_LOCK DestinationLock, KSLIST_ENTRY_LOCATION ListLocation, PFNKSIRPLISTCALLBACK ListCallback, PVOID Context);
  2678. KSDDKAPI VOID NTAPI KsRemoveSpecificIrpFromCancelableQueue(PIRP Irp);
  2679. KSDDKAPI VOID NTAPI KsAddIrpToCancelableQueue(PLIST_ENTRY QueueHead, PKSPIN_LOCK SpinLock, PIRP Irp, KSLIST_ENTRY_LOCATION ListLocation, PDRIVER_CANCEL DriverCancel);
  2680. KSDDKAPI NTSTATUS NTAPI KsAcquireResetValue(PIRP Irp, KSRESET* ResetValue);
  2681. KSDDKAPI NTSTATUS NTAPI KsTopologyPropertyHandler(PIRP Irp, PKSPROPERTY Property, PVOID Data, const KSTOPOLOGY* Topology);
  2682. KSDDKAPI VOID NTAPI KsAcquireDeviceSecurityLock(KSDEVICE_HEADER Header, BOOLEAN Exclusive);
  2683. KSDDKAPI VOID NTAPI KsReleaseDeviceSecurityLock(KSDEVICE_HEADER Header);
  2684. KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2685. KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPower(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2686. KSDDKAPI NTSTATUS NTAPI KsDefaultForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
  2687. KSDDKAPI VOID NTAPI KsSetDevicePnpAndBaseObject(KSDEVICE_HEADER Header, PDEVICE_OBJECT PnpDeviceObject, PDEVICE_OBJECT BaseObject);
  2688. KSDDKAPI PDEVICE_OBJECT NTAPI KsQueryDevicePnpObject(KSDEVICE_HEADER Header);
  2689. KSDDKAPI ACCESS_MASK NTAPI KsQueryObjectAccessMask(KSOBJECT_HEADER Header);
  2690. KSDDKAPI VOID NTAPI KsRecalculateStackDepth(KSDEVICE_HEADER Header, BOOLEAN ReuseStackLocation);
  2691. KSDDKAPI VOID NTAPI KsSetTargetState(KSOBJECT_HEADER Header, KSTARGET_STATE TargetState);
  2692. KSDDKAPI VOID NTAPI KsSetTargetDeviceObject(KSOBJECT_HEADER Header, PDEVICE_OBJECT TargetDevice);
  2693. KSDDKAPI VOID NTAPI KsSetPowerDispatch(KSOBJECT_HEADER Header, PFNKSCONTEXT_DISPATCH PowerDispatch, PVOID PowerContext);
  2694. KSDDKAPI PKSOBJECT_CREATE_ITEM NTAPI KsQueryObjectCreateItem(KSOBJECT_HEADER Header);
  2695. KSDDKAPI NTSTATUS NTAPI KsAllocateDeviceHeader(KSDEVICE_HEADER* Header, ULONG ItemsCount, PKSOBJECT_CREATE_ITEM ItemsList);
  2696. KSDDKAPI VOID NTAPI KsFreeDeviceHeader(KSDEVICE_HEADER Header);
  2697. KSDDKAPI NTSTATUS NTAPI KsAllocateObjectHeader(KSOBJECT_HEADER* Header, ULONG ItemsCount, PKSOBJECT_CREATE_ITEM ItemsList, PIRP Irp, const KSDISPATCH_TABLE* Table);
  2698. KSDDKAPI VOID NTAPI KsFreeObjectHeader(KSOBJECT_HEADER Header);
  2699. KSDDKAPI NTSTATUS NTAPI KsAddObjectCreateItemToDeviceHeader(KSDEVICE_HEADER Header, PDRIVER_DISPATCH Create, PVOID Context, PWSTR ObjectClass, PSECURITY_DESCRIPTOR SecurityDescriptor);
  2700. KSDDKAPI NTSTATUS NTAPI KsAddObjectCreateItemToObjectHeader(KSOBJECT_HEADER Header, PDRIVER_DISPATCH Create, PVOID Context, PWSTR ObjectClass, PSECURITY_DESCRIPTOR SecurityDescriptor);
  2701. KSDDKAPI NTSTATUS NTAPI KsAllocateObjectCreateItem(KSDEVICE_HEADER Header, PKSOBJECT_CREATE_ITEM CreateItem, BOOLEAN AllocateEntry, PFNKSITEMFREECALLBACK ItemFreeCallback);
  2702. KSDDKAPI NTSTATUS NTAPI KsFreeObjectCreateItem(KSDEVICE_HEADER Header, PUNICODE_STRING CreateItem);
  2703. KSDDKAPI NTSTATUS NTAPI KsFreeObjectCreateItemsByContext(KSDEVICE_HEADER Header, PVOID Context);
  2704. KSDDKAPI NTSTATUS NTAPI KsCreateDefaultSecurity(PSECURITY_DESCRIPTOR ParentSecurity, PSECURITY_DESCRIPTOR* DefaultSecurity);
  2705. KSDDKAPI NTSTATUS NTAPI KsForwardIrp(PIRP Irp, PFILE_OBJECT FileObject, BOOLEAN ReuseStackLocation);
  2706. KSDDKAPI NTSTATUS NTAPI KsForwardAndCatchIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp, PFILE_OBJECT FileObject, KSSTACK_USE StackUse);
  2707. KSDDKAPI NTSTATUS NTAPI KsSynchronousIoControlDevice(PFILE_OBJECT FileObject, KPROCESSOR_MODE RequestorMode, ULONG IoControl, PVOID InBuffer, ULONG InSize, PVOID OutBuffer, ULONG OutSize, PULONG BytesReturned);
  2708. KSDDKAPI NTSTATUS NTAPI KsUnserializeObjectPropertiesFromRegistry(PFILE_OBJECT FileObject, HANDLE ParentKey, PUNICODE_STRING RegistryPath);
  2709. KSDDKAPI NTSTATUS NTAPI KsCacheMedium(PUNICODE_STRING SymbolicLink, PKSPIN_MEDIUM Medium, ULONG PinDirection);
  2710. KSDDKAPI NTSTATUS NTAPI KsRegisterWorker(WORK_QUEUE_TYPE WorkQueueType, PKSWORKER* Worker);
  2711. KSDDKAPI NTSTATUS NTAPI KsRegisterCountedWorker(WORK_QUEUE_TYPE WorkQueueType, PWORK_QUEUE_ITEM CountedWorkItem, PKSWORKER* Worker);
  2712. KSDDKAPI VOID NTAPI KsUnregisterWorker(PKSWORKER Worker);
  2713. KSDDKAPI NTSTATUS NTAPI KsQueueWorkItem(PKSWORKER Worker, PWORK_QUEUE_ITEM WorkItem);
  2714. KSDDKAPI ULONG NTAPI KsIncrementCountedWorker(PKSWORKER Worker);
  2715. KSDDKAPI ULONG NTAPI KsDecrementCountedWorker(PKSWORKER Worker);
  2716. KSDDKAPI NTSTATUS NTAPI KsCreateTopologyNode(HANDLE ParentHandle, PKSNODE_CREATE NodeCreate, ACCESS_MASK DesiredAccess, PHANDLE NodeHandle);
  2717. KSDDKAPI NTSTATUS NTAPI KsValidateTopologyNodeCreateRequest(PIRP Irp, PKSTOPOLOGY Topology, PKSNODE_CREATE* NodeCreate);
  2718. KSDDKAPI NTSTATUS NTAPI KsMergeAutomationTables(PKSAUTOMATION_TABLE* AutomationTableAB, PKSAUTOMATION_TABLE AutomationTableA, PKSAUTOMATION_TABLE AutomationTableB, KSOBJECT_BAG Bag);
  2719. KSDDKAPI NTSTATUS NTAPI KsInitializeDriver(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPathName, const KSDEVICE_DESCRIPTOR* Descriptor);
  2720. KSDDKAPI NTSTATUS NTAPI KsAddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject);
  2721. KSDDKAPI NTSTATUS NTAPI KsCreateDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject, const KSDEVICE_DESCRIPTOR* Descriptor, ULONG ExtensionSize, PKSDEVICE* Device);
  2722. KSDDKAPI NTSTATUS NTAPI KsInitializeDevice(PDEVICE_OBJECT FunctionalDeviceObject, PDEVICE_OBJECT PhysicalDeviceObject, PDEVICE_OBJECT NextDeviceObject, const KSDEVICE_DESCRIPTOR* Descriptor);
  2723. KSDDKAPI void NTAPI KsTerminateDevice(PDEVICE_OBJECT DeviceObject);
  2724. KSDDKAPI PKSDEVICE NTAPI KsGetDeviceForDeviceObject(PDEVICE_OBJECT FunctionalDeviceObject);
  2725. KSDDKAPI void NTAPI KsAcquireDevice(PKSDEVICE Device);
  2726. KSDDKAPI void NTAPI KsReleaseDevice(PKSDEVICE Device);
  2727. KSDDKAPI void NTAPI KsDeviceRegisterAdapterObject(PKSDEVICE Device, PADAPTER_OBJECT AdapterObject, ULONG MaxMappingsByteCount, ULONG MappingTableStride);
  2728. KSDDKAPI ULONG NTAPI KsDeviceGetBusData(PKSDEVICE Device, ULONG DataType, PVOID Buffer, ULONG Offset, ULONG Length);
  2729. KSDDKAPI ULONG NTAPI KsDeviceSetBusData(PKSDEVICE Device, ULONG DataType, PVOID Buffer, ULONG Offset, ULONG Length);
  2730. KSDDKAPI NTSTATUS NTAPI KsCreateFilterFactory(PDEVICE_OBJECT DeviceObject, const KSFILTER_DESCRIPTOR* Descriptor, PWSTR RefString, PSECURITY_DESCRIPTOR SecurityDescriptor, ULONG CreateItemFlags, PFNKSFILTERFACTORYPOWER SleepCallback, PFNKSFILTERFACTORYPOWER WakeCallback, PKSFILTERFACTORY* FilterFactory);
  2731. # define KsDeleteFilterFactory(FilterFactory) \
  2732. KsFreeObjectCreateItemsByContext(*(KSDEVICE_HEADER*)( \
  2733. KsFilterFactoryGetParentDevice(FilterFactory)->FunctionalDeviceObject->DeviceExtension), \
  2734. FilterFactory)
  2735. KSDDKAPI NTSTATUS NTAPI KsFilterFactoryUpdateCacheData(PKSFILTERFACTORY FilterFactory, const KSFILTER_DESCRIPTOR* FilterDescriptor);
  2736. KSDDKAPI NTSTATUS NTAPI KsFilterFactoryAddCreateItem(PKSFILTERFACTORY FilterFactory, PWSTR RefString, PSECURITY_DESCRIPTOR SecurityDescriptor, ULONG CreateItemFlags);
  2737. KSDDKAPI NTSTATUS NTAPI KsFilterFactorySetDeviceClassesState(PKSFILTERFACTORY FilterFactory, BOOLEAN NewState);
  2738. KSDDKAPI PUNICODE_STRING NTAPI KsFilterFactoryGetSymbolicLink(PKSFILTERFACTORY FilterFactory);
  2739. KSDDKAPI void NTAPI KsAddEvent(PVOID Object, PKSEVENT_ENTRY EventEntry);
  2740. void __forceinline KsFilterAddEvent(PKSFILTER Filter, PKSEVENT_ENTRY EventEntry)
  2741. {
  2742. KsAddEvent(Filter, EventEntry);
  2743. }
  2744. void __forceinline KsPinAddEvent(PKSPIN Pin, PKSEVENT_ENTRY EventEntry)
  2745. {
  2746. KsAddEvent(Pin, EventEntry);
  2747. }
  2748. KSDDKAPI NTSTATUS NTAPI KsDefaultAddEventHandler(PIRP Irp, PKSEVENTDATA EventData, PKSEVENT_ENTRY EventEntry);
  2749. KSDDKAPI void NTAPI KsGenerateEvents(PVOID Object, const GUID* EventSet, ULONG EventId, ULONG DataSize, PVOID Data, PFNKSGENERATEEVENTCALLBACK CallBack, PVOID CallBackContext);
  2750. void __forceinline KsFilterGenerateEvents(PKSFILTER Filter, const GUID* EventSet, ULONG EventId, ULONG DataSize, PVOID Data, PFNKSGENERATEEVENTCALLBACK CallBack, PVOID CallBackContext)
  2751. {
  2752. KsGenerateEvents(Filter, EventSet, EventId, DataSize, Data, CallBack,
  2753. CallBackContext);
  2754. }
  2755. void __forceinline KsPinGenerateEvents(PKSPIN Pin, const GUID* EventSet, ULONG EventId, ULONG DataSize, PVOID Data, PFNKSGENERATEEVENTCALLBACK CallBack, PVOID CallBackContext)
  2756. {
  2757. KsGenerateEvents(Pin, EventSet, EventId, DataSize, Data, CallBack,
  2758. CallBackContext);
  2759. }
  2760. typedef enum
  2761. {
  2762. KSSTREAM_POINTER_STATE_UNLOCKED = 0,
  2763. KSSTREAM_POINTER_STATE_LOCKED
  2764. }KSSTREAM_POINTER_STATE;
  2765. KSDDKAPI NTSTATUS NTAPI KsPinGetAvailableByteCount(PKSPIN Pin, PLONG InputDataBytes, PLONG OutputBufferBytes);
  2766. KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetLeadingEdgeStreamPointer(PKSPIN Pin, KSSTREAM_POINTER_STATE State);
  2767. KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetTrailingEdgeStreamPointer(PKSPIN Pin, KSSTREAM_POINTER_STATE State);
  2768. KSDDKAPI NTSTATUS NTAPI KsStreamPointerSetStatusCode(PKSSTREAM_POINTER StreamPointer, NTSTATUS Status);
  2769. KSDDKAPI NTSTATUS NTAPI KsStreamPointerLock(PKSSTREAM_POINTER StreamPointer);
  2770. KSDDKAPI void NTAPI KsStreamPointerUnlock(PKSSTREAM_POINTER StreamPointer, BOOLEAN Eject);
  2771. KSDDKAPI void NTAPI KsStreamPointerAdvanceOffsetsAndUnlock(PKSSTREAM_POINTER StreamPointer, ULONG InUsed, ULONG OutUsed, BOOLEAN Eject);
  2772. KSDDKAPI void NTAPI KsStreamPointerDelete(PKSSTREAM_POINTER StreamPointer);
  2773. KSDDKAPI NTSTATUS NTAPI KsStreamPointerClone(PKSSTREAM_POINTER StreamPointer, PFNKSSTREAMPOINTER CancelCallback, ULONG ContextSize, PKSSTREAM_POINTER* CloneStreamPointer);
  2774. KSDDKAPI NTSTATUS NTAPI KsStreamPointerAdvanceOffsets(PKSSTREAM_POINTER StreamPointer, ULONG InUsed, ULONG OutUsed, BOOLEAN Eject);
  2775. KSDDKAPI NTSTATUS NTAPI KsStreamPointerAdvance(PKSSTREAM_POINTER StreamPointer);
  2776. KSDDKAPI PMDL NTAPI KsStreamPointerGetMdl(PKSSTREAM_POINTER StreamPointer);
  2777. KSDDKAPI PIRP NTAPI KsStreamPointerGetIrp(PKSSTREAM_POINTER StreamPointer, PBOOLEAN FirstFrameInIrp, PBOOLEAN LastFrameInIrp);
  2778. KSDDKAPI void NTAPI KsStreamPointerScheduleTimeout(PKSSTREAM_POINTER StreamPointer, PFNKSSTREAMPOINTER Callback, ULONGLONG Interval);
  2779. KSDDKAPI void NTAPI KsStreamPointerCancelTimeout(PKSSTREAM_POINTER StreamPointer);
  2780. KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetFirstCloneStreamPointer(PKSPIN Pin);
  2781. KSDDKAPI PKSSTREAM_POINTER NTAPI KsStreamPointerGetNextClone(PKSSTREAM_POINTER StreamPointer);
  2782. KSDDKAPI NTSTATUS NTAPI KsPinHandshake(PKSPIN Pin, PKSHANDSHAKE In, PKSHANDSHAKE Out);
  2783. KSDDKAPI void NTAPI KsCompletePendingRequest(PIRP Irp);
  2784. KSDDKAPI KSOBJECTTYPE NTAPI KsGetObjectTypeFromIrp(PIRP Irp);
  2785. KSDDKAPI PVOID NTAPI KsGetObjectFromFileObject(PFILE_OBJECT FileObject);
  2786. KSDDKAPI KSOBJECTTYPE NTAPI KsGetObjectTypeFromFileObject(PFILE_OBJECT FileObject);
  2787. PKSFILTER __forceinline KsGetFilterFromFileObject(PFILE_OBJECT FileObject)
  2788. {
  2789. return (PKSFILTER)KsGetObjectFromFileObject(FileObject);
  2790. }
  2791. PKSPIN __forceinline KsGetPinFromFileObject(PFILE_OBJECT FileObject)
  2792. {
  2793. return (PKSPIN)KsGetObjectFromFileObject(FileObject);
  2794. }
  2795. KSDDKAPI PKSGATE NTAPI KsFilterGetAndGate(PKSFILTER Filter);
  2796. KSDDKAPI void NTAPI KsFilterAcquireProcessingMutex(PKSFILTER Filter);
  2797. KSDDKAPI void NTAPI KsFilterReleaseProcessingMutex(PKSFILTER Filter);
  2798. KSDDKAPI void NTAPI KsFilterAttemptProcessing(PKSFILTER Filter, BOOLEAN Asynchronous);
  2799. KSDDKAPI PKSGATE NTAPI KsPinGetAndGate(PKSPIN Pin);
  2800. KSDDKAPI void NTAPI KsPinAttachAndGate(PKSPIN Pin, PKSGATE AndGate);
  2801. KSDDKAPI void NTAPI KsPinAttachOrGate(PKSPIN Pin, PKSGATE OrGate);
  2802. KSDDKAPI void NTAPI KsPinAcquireProcessingMutex(PKSPIN Pin);
  2803. KSDDKAPI void NTAPI KsPinReleaseProcessingMutex(PKSPIN Pin);
  2804. KSDDKAPI BOOLEAN NTAPI KsProcessPinUpdate(PKSPROCESSPIN ProcessPin);
  2805. KSDDKAPI void NTAPI KsPinGetCopyRelationships(PKSPIN Pin, PKSPIN* CopySource, PKSPIN* DelegateBranch);
  2806. KSDDKAPI void NTAPI KsPinAttemptProcessing(PKSPIN Pin, BOOLEAN Asynchronous);
  2807. KSDDKAPI PVOID NTAPI KsGetParent(PVOID Object);
  2808. PKSDEVICE __forceinline KsFilterFactoryGetParentDevice(PKSFILTERFACTORY FilterFactory)
  2809. {
  2810. return (PKSDEVICE)KsGetParent((PVOID)FilterFactory);
  2811. }
  2812. PKSFILTERFACTORY __forceinline KsFilterGetParentFilterFactory(PKSFILTER Filter)
  2813. {
  2814. return (PKSFILTERFACTORY)KsGetParent((PVOID)Filter);
  2815. }
  2816. KSDDKAPI PKSFILTER NTAPI KsPinGetParentFilter(PKSPIN Pin);
  2817. KSDDKAPI PVOID NTAPI KsGetFirstChild(PVOID Object);
  2818. PKSFILTERFACTORY __forceinline KsDeviceGetFirstChildFilterFactory(PKSDEVICE Device)
  2819. {
  2820. return (PKSFILTERFACTORY)KsGetFirstChild((PVOID)Device);
  2821. }
  2822. PKSFILTER __forceinline KsFilterFactoryGetFirstChildFilter(PKSFILTERFACTORY FilterFactory)
  2823. {
  2824. return (PKSFILTER)KsGetFirstChild((PVOID)FilterFactory);
  2825. }
  2826. KSDDKAPI ULONG NTAPI KsFilterGetChildPinCount(PKSFILTER Filter, ULONG PinId);
  2827. KSDDKAPI PKSPIN NTAPI KsFilterGetFirstChildPin(PKSFILTER Filter, ULONG PinId);
  2828. KSDDKAPI PVOID NTAPI KsGetNextSibling(PVOID Object);
  2829. KSDDKAPI PKSPIN NTAPI KsPinGetNextSiblingPin(PKSPIN Pin);
  2830. PKSFILTERFACTORY __forceinline KsFilterFactoryGetNextSiblingFilterFactory(PKSFILTERFACTORY FilterFactory)
  2831. {
  2832. return (PKSFILTERFACTORY)KsGetNextSibling((PVOID)FilterFactory);
  2833. }
  2834. PKSFILTER __forceinline KsFilterGetNextSiblingFilter(PKSFILTER Filter)
  2835. {
  2836. return (PKSFILTER)KsGetNextSibling((PVOID)Filter);
  2837. }
  2838. KSDDKAPI PKSDEVICE NTAPI KsGetDevice(PVOID Object);
  2839. PKSDEVICE __forceinline KsFilterFactoryGetDevice(PKSFILTERFACTORY FilterFactory)
  2840. {
  2841. return KsGetDevice((PVOID)FilterFactory);
  2842. }
  2843. PKSDEVICE __forceinline KsFilterGetDevice(PKSFILTER Filter)
  2844. {
  2845. return KsGetDevice((PVOID)Filter);
  2846. }
  2847. PKSDEVICE __forceinline KsPinGetDevice(PKSPIN Pin)
  2848. {
  2849. return KsGetDevice((PVOID)Pin);
  2850. }
  2851. KSDDKAPI PKSFILTER NTAPI KsGetFilterFromIrp(PIRP Irp);
  2852. KSDDKAPI PKSPIN NTAPI KsGetPinFromIrp(PIRP Irp);
  2853. KSDDKAPI ULONG NTAPI KsGetNodeIdFromIrp(PIRP Irp);
  2854. KSDDKAPI void NTAPI KsAcquireControl(PVOID Object);
  2855. KSDDKAPI void NTAPI KsReleaseControl(PVOID Object);
  2856. void __forceinline KsFilterAcquireControl(PKSFILTER Filter)
  2857. {
  2858. KsAcquireControl((PVOID)Filter);
  2859. }
  2860. void __forceinline KsFilterReleaseControl(PKSFILTER Filter)
  2861. {
  2862. KsReleaseControl((PVOID)Filter);
  2863. }
  2864. void __forceinline KsPinAcquireControl(PKSPIN Pin)
  2865. {
  2866. KsAcquireControl((PVOID)Pin);
  2867. }
  2868. void __forceinline KsPinReleaseControl(PKSPIN Pin)
  2869. {
  2870. KsReleaseControl((PVOID)Pin);
  2871. }
  2872. KSDDKAPI NTSTATUS NTAPI KsAddItemToObjectBag(KSOBJECT_BAG ObjectBag, PVOID Item, PFNKSFREE Free);
  2873. KSDDKAPI ULONG NTAPI KsRemoveItemFromObjectBag(KSOBJECT_BAG ObjectBag, PVOID Item, BOOLEAN Free);
  2874. # define KsDiscard(Object, Pointer) \
  2875. KsRemoveItemFromObjectBag((Object)->Bag, (PVOID)(Pointer), TRUE)
  2876. KSDDKAPI NTSTATUS NTAPI KsAllocateObjectBag(PKSDEVICE Device, KSOBJECT_BAG* ObjectBag);
  2877. KSDDKAPI void NTAPI KsFreeObjectBag(KSOBJECT_BAG ObjectBag);
  2878. KSDDKAPI NTSTATUS NTAPI KsCopyObjectBagItems(KSOBJECT_BAG ObjectBagDestination, KSOBJECT_BAG ObjectBagSource);
  2879. KSDDKAPI NTSTATUS NTAPI _KsEdit(KSOBJECT_BAG ObjectBag, PVOID* PointerToPointerToItem, ULONG NewSize, ULONG OldSize, ULONG Tag);
  2880. # define KsEdit(Object, PointerToPointer, Tag) \
  2881. _KsEdit((Object)->Bag, (PVOID*)(PointerToPointer), \
  2882. sizeof(**(PointerToPointer)), sizeof(**(PointerToPointer)), (Tag))
  2883. # define KsEditSized(Object, PointerToPointer, NewSize, OldSize, Tag) \
  2884. _KsEdit((Object)->Bag, (PVOID*)(PointerToPointer), (NewSize), (OldSize), (Tag))
  2885. KSDDKAPI NTSTATUS NTAPI KsRegisterFilterWithNoKSPins(PDEVICE_OBJECT DeviceObject, const GUID* InterfaceClassGUID, ULONG PinCount, WINBOOL* PinDirection, KSPIN_MEDIUM* MediumList, GUID* CategoryList);
  2886. KSDDKAPI NTSTATUS NTAPI KsFilterCreatePinFactory(PKSFILTER Filter, const KSPIN_DESCRIPTOR_EX* const PinDescriptor, PULONG PinID);
  2887. KSDDKAPI NTSTATUS NTAPI KsFilterCreateNode(PKSFILTER Filter, const KSNODE_DESCRIPTOR* const NodeDescriptor, PULONG NodeID);
  2888. KSDDKAPI NTSTATUS NTAPI KsFilterAddTopologyConnections(PKSFILTER Filter, ULONG NewConnectionsCount, const KSTOPOLOGY_CONNECTION* const NewTopologyConnections);
  2889. KSDDKAPI NTSTATUS NTAPI KsPinGetConnectedPinInterface(PKSPIN Pin, const GUID* InterfaceId, PVOID* Interface);
  2890. KSDDKAPI PFILE_OBJECT NTAPI KsPinGetConnectedPinFileObject(PKSPIN Pin);
  2891. KSDDKAPI PDEVICE_OBJECT NTAPI KsPinGetConnectedPinDeviceObject(PKSPIN Pin);
  2892. KSDDKAPI NTSTATUS NTAPI KsPinGetConnectedFilterInterface(PKSPIN Pin, const GUID* InterfaceId, PVOID* Interface);
  2893. # if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
  2894. KSDDKAPI NTSTATUS NTAPI KsPinGetReferenceClockInterface(PKSPIN Pin, PIKSREFERENCECLOCK* Interface);
  2895. # endif /* defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__) */
  2896. KSDDKAPI VOID NTAPI KsPinSetPinClockTime(PKSPIN Pin, LONGLONG Time);
  2897. KSDDKAPI NTSTATUS NTAPI KsPinSubmitFrame(PKSPIN Pin, PVOID Data, ULONG Size, PKSSTREAM_HEADER StreamHeader, PVOID Context);
  2898. KSDDKAPI NTSTATUS NTAPI KsPinSubmitFrameMdl(PKSPIN Pin, PMDL Mdl, PKSSTREAM_HEADER StreamHeader, PVOID Context);
  2899. KSDDKAPI void NTAPI KsPinRegisterFrameReturnCallback(PKSPIN Pin, PFNKSPINFRAMERETURN FrameReturn);
  2900. KSDDKAPI void NTAPI KsPinRegisterIrpCompletionCallback(PKSPIN Pin, PFNKSPINIRPCOMPLETION IrpCompletion);
  2901. KSDDKAPI void NTAPI KsPinRegisterHandshakeCallback(PKSPIN Pin, PFNKSPINHANDSHAKE Handshake);
  2902. KSDDKAPI void NTAPI KsFilterRegisterPowerCallbacks(PKSFILTER Filter, PFNKSFILTERPOWER Sleep, PFNKSFILTERPOWER Wake);
  2903. KSDDKAPI void NTAPI KsPinRegisterPowerCallbacks(PKSPIN Pin, PFNKSPINPOWER Sleep, PFNKSPINPOWER Wake);
  2904. # if defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__)
  2905. KSDDKAPI PUNKNOWN NTAPI KsRegisterAggregatedClientUnknown(PVOID Object, PUNKNOWN ClientUnknown);
  2906. KSDDKAPI PUNKNOWN NTAPI KsGetOuterUnknown(PVOID Object);
  2907. PUNKNOWN __forceinline KsDeviceRegisterAggregatedClientUnknown(PKSDEVICE Device, PUNKNOWN ClientUnknown)
  2908. {
  2909. return KsRegisterAggregatedClientUnknown((PVOID)Device, ClientUnknown);
  2910. }
  2911. PUNKNOWN __forceinline KsDeviceGetOuterUnknown(PKSDEVICE Device)
  2912. {
  2913. return KsGetOuterUnknown((PVOID)Device);
  2914. }
  2915. PUNKNOWN __forceinline KsFilterFactoryRegisterAggregatedClientUnknown(PKSFILTERFACTORY FilterFactory, PUNKNOWN ClientUnknown)
  2916. {
  2917. return KsRegisterAggregatedClientUnknown((PVOID)FilterFactory, ClientUnknown);
  2918. }
  2919. PUNKNOWN __forceinline KsFilterFactoryGetOuterUnknown(PKSFILTERFACTORY FilterFactory)
  2920. {
  2921. return KsGetOuterUnknown((PVOID)FilterFactory);
  2922. }
  2923. PUNKNOWN __forceinline KsFilterRegisterAggregatedClientUnknown(PKSFILTER Filter, PUNKNOWN ClientUnknown)
  2924. {
  2925. return KsRegisterAggregatedClientUnknown((PVOID)Filter, ClientUnknown);
  2926. }
  2927. PUNKNOWN __forceinline KsFilterGetOuterUnknown(PKSFILTER Filter)
  2928. {
  2929. return KsGetOuterUnknown((PVOID)Filter);
  2930. }
  2931. PUNKNOWN __forceinline KsPinRegisterAggregatedClientUnknown(PKSPIN Pin, PUNKNOWN ClientUnknown)
  2932. {
  2933. return KsRegisterAggregatedClientUnknown((PVOID)Pin, ClientUnknown);
  2934. }
  2935. PUNKNOWN __forceinline KsPinGetOuterUnknown(PKSPIN Pin)
  2936. {
  2937. return KsGetOuterUnknown((PVOID)Pin);
  2938. }
  2939. # endif /* defined(_UNKNOWN_H_) || defined(__IUnknown_INTERFACE_DEFINED__) */
  2940. #else /* _NTDDK_ */
  2941. # ifndef KS_NO_CREATE_FUNCTIONS
  2942. KSDDKAPI DWORD WINAPI KsCreateAllocator(HANDLE ConnectionHandle, PKSALLOCATOR_FRAMING AllocatorFraming, PHANDLE AllocatorHandle);
  2943. KSDDKAPI DWORD NTAPI KsCreateClock(HANDLE ConnectionHandle, PKSCLOCK_CREATE ClockCreate, PHANDLE ClockHandle);
  2944. KSDDKAPI DWORD WINAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle);
  2945. KSDDKAPI DWORD WINAPI KsCreateTopologyNode(HANDLE ParentHandle, PKSNODE_CREATE NodeCreate, ACCESS_MASK DesiredAccess, PHANDLE NodeHandle);
  2946. # endif
  2947. #endif /* _NTDDK_ */
  2948. #ifdef __cplusplus
  2949. }
  2950. #endif
  2951. #define DENY_USERMODE_ACCESS(pIrp, CompleteRequest) \
  2952. if(pIrp->RequestorMode != KernelMode){ \
  2953. pIrp->IoStatus.Information = 0; \
  2954. pIrp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; \
  2955. if(CompleteRequest){ \
  2956. IoCompleteRequest(pIrp, IO_NO_INCREMENT); } \
  2957. return STATUS_INVALID_DEVICE_REQUEST; \
  2958. }
  2959. #endif /* _KS_ */