Leaked source code of windows server 2003
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.

2399 lines
58 KiB

  1. #define ENABLE_STREAM_CLASS_AS_ALLOCATOR
  2. #define ENABLE_KS_METHODS
  3. #define ENABLE_MULTIPLE_FILTER_TYPES 1 // enable/disable support for multiple
  4. // filters on a single hardware/driver.
  5. //
  6. // when the code for the method support is finally done, STRMINI.H will have
  7. // to be checked into the tree also, in the include directory.
  8. //
  9. /*++
  10. Copyright (c) 1996 Microsoft Corporation
  11. Module Name:
  12. codcls.h
  13. Abstract:
  14. This file defines the necessary structures, defines, and functions for
  15. the common CODEC class driver.
  16. Author:
  17. Bill Parry (billpa)
  18. Environment:
  19. Kernel mode only
  20. Revision History:
  21. --*/
  22. #ifndef _STREAMCLASS_H
  23. #define _STREAMCLASS_H
  24. #include "messages.h"
  25. #include "strmini.h"
  26. #include <stdarg.h>
  27. //
  28. // I don't want to try to include cfgmgr32 just for this.
  29. //
  30. #ifndef MAX_DEVICE_ID_LEN
  31. #define MAX_DEVICE_ID_LEN 200
  32. #endif // MAX_DEVICE_ID_LEN
  33. #ifndef _WIN64
  34. // 4 byte alignment causes Alignment Fault for spinlock.
  35. #pragma pack(4)
  36. #endif
  37. #if ENABLE_MULTIPLE_FILTER_TYPES
  38. #define IF_MF( s ) s
  39. #define IF_MFS( s ) { s }
  40. #define IFN_MF( s )
  41. #define IFN_MFS( s )
  42. #define MFTRACE( s ) StreamClassDebugPrint s
  43. #else
  44. #define IF_MF( s )
  45. #define IF_MFS( s )
  46. #define IFN_MF( s ) s
  47. #define IFN_MFS( s ) { s }
  48. #define MFTRACE( s )
  49. #endif
  50. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  51. //
  52. // this is a debug string header
  53. //
  54. #define STR_MODULENAME "STREAM.SYS:"
  55. //
  56. // define some data allocation tags
  57. //
  58. #define STREAMCLASS_TAG_STREAMHEADER 'pdCS'
  59. #define STREAMCLASS_TAG_FILTERCONNECTION '10CS'
  60. #define STREAMCLASS_TAG_DATAFORMAT '20CS'
  61. #define ID_DATA_DESTINATION_PIN 0
  62. #define ID_DATA_SOURCE_PIN 1
  63. #endif //ENABLE_STREAM_CLASS_AS_ALLOCATOR
  64. #define MAX_STRING_LENGTH 256
  65. #define TRAP DEBUG_BREAKPOINT()
  66. //
  67. // the following macros are used to correctly synchronize class driver entry
  68. // points called by the minidriver.
  69. //
  70. #define BEGIN_MINIDRIVER_STREAM_CALLIN(DeviceExtension, Irql) { \
  71. DeviceExtension->BeginMinidriverCallin(DeviceExtension, \
  72. Irql); \
  73. ASSERT(++DeviceExtension->LowerApiThreads == 1);\
  74. }
  75. #define END_MINIDRIVER_STREAM_CALLIN(StreamObject, Irql) { \
  76. ASSERT(--DeviceExtension->LowerApiThreads == 0);\
  77. DeviceExtension->EndMinidriverStreamCallin(StreamObject, \
  78. Irql); \
  79. }
  80. #define BEGIN_MINIDRIVER_DEVICE_CALLIN(DeviceExtension, Irql) { \
  81. DeviceExtension->BeginMinidriverCallin(DeviceExtension, \
  82. Irql); \
  83. ASSERT(++DeviceExtension->LowerApiThreads == 1);\
  84. }
  85. #define END_MINIDRIVER_DEVICE_CALLIN(DeviceExtension, Irql) { \
  86. ASSERT(--DeviceExtension->LowerApiThreads == 0);\
  87. DeviceExtension->EndMinidriverDeviceCallin(DeviceExtension, \
  88. Irql); \
  89. }
  90. //
  91. // The following flags should not be cleared from the interrupt data structure
  92. // by SCGetInterruptState.
  93. //
  94. #define STREAM_FLAGS_INTERRUPT_FLAG_MASK 0
  95. //
  96. // Device Extension flags follow - PASSIVE LEVEL ACCESS ONLY!!!!!!
  97. //
  98. //
  99. // Indicates that the PNP start function has been received for the device.
  100. //
  101. #define DEVICE_FLAGS_PNP_STARTED 0x00001
  102. //
  103. // Indicates that this device is a child device (PDO)
  104. //
  105. #define DEVICE_FLAGS_CHILD 0x0002
  106. //
  107. // indicates that the device has been removed
  108. //
  109. #define DEVICE_FLAGS_DEVICE_INACCESSIBLE 0x00100
  110. //
  111. // debug flag indicates that we've warned of too many low pri calls
  112. //
  113. #define DEVICE_FLAGS_PRI_WARN_GIVEN 0x00200
  114. //
  115. // flag indicates that we've received an NT style surprise remove call
  116. //
  117. #define DEVICE_FLAGS_SURPRISE_REMOVE_RECEIVED 0x00400
  118. //
  119. // flag indicated that a Child device ( PDO ) has received a remove
  120. //
  121. #define DEVICE_FLAGS_CHILD_MARK_DELETE 0x00800
  122. //
  123. // flag indicates (FDO) has enum children from registry
  124. //
  125. #define DEVICE_FLAGS_CHILDREN_ENUMED 0x01000
  126. //
  127. // device registry flags follow
  128. //
  129. //
  130. // page out the driver when not opened
  131. //
  132. #define DEVICE_REG_FL_PAGE_CLOSED 0x00000001
  133. //
  134. // page out the driver when opened but idle
  135. //
  136. #define DEVICE_REG_FL_PAGE_IDLE 0x00000002
  137. //
  138. // power down the device when not opened
  139. //
  140. #define DEVICE_REG_FL_POWER_DOWN_CLOSED 0x00000004
  141. //
  142. // don't suspend if any pins are running
  143. //
  144. #define DEVICE_REG_FL_NO_SUSPEND_IF_RUNNING 0x00000008
  145. //
  146. // This driver uses SWEnum to load, which means it is a kernel mode
  147. // streaming driver that has no hardware associated with it. We need to
  148. // AddRef/DeRef this driver special.
  149. //
  150. #define DRIVER_USES_SWENUM_TO_LOAD 0x00000010
  151. //
  152. // This flag indicates that the dirver is OK for system power to go to
  153. // hibernation, even the driver does not process/support the irp_mn_query_power
  154. // for system power hinbernation.
  155. //
  156. #define DEVICE_REG_FL_OK_TO_HIBERNATE 0x00000020
  157. //
  158. // The following flags should not be cleared from the interrupt data structure
  159. // by SCGetInterruptState.
  160. //
  161. #define DEVICE_FLAGS_INTERRUPT_FLAG_MASK 0
  162. //
  163. // Interrupt flags follow.
  164. //
  165. //
  166. // Indicates that StreamClassCompletionDpc needs to be run. This is set when
  167. // A minidriver makes a request which must be done at DPC and is cleared when
  168. // when the request information is gotten by MpGetInterruptState.
  169. //
  170. #define INTERRUPT_FLAGS_NOTIFICATION_REQUIRED 0x00001
  171. //
  172. // Indicates the minidriver is wants a timer request. Set by
  173. // StreamClassNotification and cleared by MpGetInterruptState. This flag is
  174. // stored in the interrupt data structure. The timer request parameters are
  175. // stored in the interrupt data structure.
  176. //
  177. #define INTERRUPT_FLAGS_TIMER_CALL_REQUEST 0x00002
  178. //
  179. // Indicates the minidriver is wants a priority change. Set by
  180. // StreamClassRequestNewPriority and cleared by SCGetInterruptState. This flag
  181. // is stored in the interrupt data structure. The timer request parameters are
  182. // stored in the interrupt data structure.
  183. //
  184. #define INTERRUPT_FLAGS_PRIORITY_CHANGE_REQUEST 0x00004
  185. //
  186. // Indicates that the PNP stop function has been received for the device.
  187. //
  188. #define INTERRUPT_FLAGS_LOG_ERROR 0x00008
  189. //
  190. // Indicates that the clock is beinq queried.
  191. //
  192. #define INTERRUPT_FLAGS_CLOCK_QUERY_REQUEST 0x00010
  193. //
  194. // Indicates that the streams need to be rescanned.
  195. //
  196. #define INTERRUPT_FLAGS_NEED_STREAM_RESCAN 0x00020
  197. //
  198. // Pointer to the synchronize execution routine.
  199. //
  200. typedef
  201. BOOLEAN
  202. (__stdcall * PSYNCHRONIZE_ROUTINE) (
  203. IN PKINTERRUPT Interrupt,
  204. IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
  205. IN PVOID SynchronizeContext);
  206. //
  207. // Pointer to the begin minidriver callin routine.
  208. //
  209. typedef VOID
  210. (__stdcall * PBEGIN_CALLIN_ROUTINE) (
  211. IN struct _DEVICE_EXTENSION * DeviceExtension,
  212. IN PKIRQL Irql
  213. );
  214. //
  215. // Pointer to the end minidriver callin routine.
  216. //
  217. typedef
  218. VOID
  219. (__stdcall * PEND_DEVICE_CALLIN_ROUTINE) (
  220. IN struct _DEVICE_EXTENSION * DeviceExtension,
  221. IN PKIRQL Irql
  222. );
  223. typedef
  224. VOID
  225. (__stdcall * PEND_STREAM_CALLIN_ROUTINE) (
  226. IN struct _STREAM_OBJECT * StreamObject,
  227. IN PKIRQL Irql
  228. );
  229. //
  230. // Queue link for mapped addresses stored for unmapping.
  231. //
  232. typedef struct _MAPPED_ADDRESS {
  233. struct _MAPPED_ADDRESS *NextMappedAddress;
  234. PVOID MappedAddress;
  235. ULONG NumberOfBytes;
  236. LARGE_INTEGER IoAddress;
  237. ULONG BusNumber;
  238. } MAPPED_ADDRESS, *PMAPPED_ADDRESS;
  239. //
  240. // error log entry definition
  241. //
  242. typedef struct _ERROR_LOG_ENTRY {
  243. NTSTATUS ErrorCode; // error code
  244. ULONG SequenceNumber; // request sequence number
  245. ULONG UniqueId; // uniqe ID for the error
  246. } ERROR_LOG_ENTRY, *PERROR_LOG_ENTRY;
  247. //
  248. // callback procedure definition
  249. //
  250. typedef NTSTATUS
  251. (*PSTREAM_CALLBACK_PROCEDURE) (
  252. IN PVOID SRB
  253. );
  254. typedef VOID
  255. (*PSTREAM_ASYNC_CALLBACK_PROCEDURE) (
  256. IN struct _STREAM_REQUEST_BLOCK *SRB
  257. );
  258. //
  259. // STREAM request block
  260. //
  261. typedef struct _STREAM_REQUEST_BLOCK {
  262. HW_STREAM_REQUEST_BLOCK HwSRB;
  263. ULONG Flags;
  264. ULONG SequenceNumber;
  265. ULONG ExtensionLength;
  266. PMDL Mdl;
  267. PVOID MapRegisterBase;
  268. PHYSICAL_ADDRESS PhysicalAddress;
  269. ULONG Length;
  270. PSTREAM_ASYNC_CALLBACK_PROCEDURE Callback;
  271. LIST_ENTRY SRBListEntry;
  272. KEVENT Event;
  273. ULONG StreamHeaderSize;
  274. BOOLEAN DoNotCallBack;
  275. KEVENT DmaEvent;
  276. BOOLEAN bMemPtrValid;
  277. PVOID *pMemPtrArray;
  278. } STREAM_REQUEST_BLOCK, *PSTREAM_REQUEST_BLOCK;
  279. //
  280. // SRB flags (not to be confused with the HW SRB flags)
  281. //
  282. #define SRB_FLAGS_IS_ACTIVE 0x00000001
  283. //
  284. // define the minidriver information structure
  285. //
  286. typedef struct _MINIDRIVER_INFORMATION {
  287. HW_INITIALIZATION_DATA HwInitData;
  288. ULONG Flags;
  289. KEVENT ControlEvent;
  290. ULONG UseCount;
  291. ULONG OpenCount;
  292. } MINIDRIVER_INFORMATION, *PMINIDRIVER_INFORMATION;
  293. //
  294. // flags for minidriver information Flags field above
  295. //
  296. //
  297. // indicates that the driver may not be paged out
  298. //
  299. #define DRIVER_FLAGS_NO_PAGEOUT 0x01
  300. //
  301. // indicates that the driver has been paged out
  302. //
  303. #define DRIVER_FLAGS_PAGED_OUT 0x02
  304. //
  305. // pin info not contained in the pin description
  306. //
  307. typedef struct _ADDITIONAL_PIN_INFO {
  308. ULONG CurrentInstances;
  309. ULONG MaxInstances;
  310. // NextFileObject must be per instance, i.e. can't be here.
  311. // Move to streamobject
  312. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  313. //PFILE_OBJECT NextFileObject; // The chained file object
  314. #endif
  315. ULONG Reserved;
  316. } ADDITIONAL_PIN_INFO, *PADDITIONAL_PIN_INFO;
  317. //
  318. // Define data storage for access at interrupt Irql.
  319. //
  320. typedef struct _INTERRUPT_DATA {
  321. //
  322. // interrupt flags
  323. //
  324. ULONG Flags;
  325. ERROR_LOG_ENTRY LogEntry;
  326. //
  327. // List head for singlely linked list of complete IRPs.
  328. //
  329. PHW_STREAM_REQUEST_BLOCK CompletedSRB;
  330. //
  331. // Minidriver timer request routine.
  332. //
  333. PHW_TIMER_ROUTINE HwTimerRoutine;
  334. //
  335. // Mindriver timer request time in micro seconds.
  336. //
  337. ULONG HwTimerValue;
  338. PVOID HwTimerContext;
  339. //
  340. // Mindriver priority change routine.
  341. //
  342. PHW_PRIORITY_ROUTINE HwPriorityRoutine;
  343. //
  344. // Mindriver priority change level.
  345. //
  346. STREAM_PRIORITY HwPriorityLevel;
  347. PVOID HwPriorityContext;
  348. PHW_QUERY_CLOCK_ROUTINE HwQueryClockRoutine;
  349. TIME_FUNCTION HwQueryClockFunction;
  350. } INTERRUPT_DATA, *PINTERRUPT_DATA;
  351. //
  352. // object common to both stream and filter instances
  353. //
  354. typedef struct _COMMON_OBJECT {
  355. PVOID DeviceHeader;
  356. ULONG Cookie;
  357. #ifdef _WIN64
  358. ULONG Alignment;
  359. #endif // _WIN64
  360. INTERRUPT_DATA InterruptData;
  361. PHW_TIMER_ROUTINE HwTimerRoutine; // Timer request routine
  362. PVOID HwTimerContext;
  363. KTIMER MiniDriverTimer; // Miniclass timer object.
  364. KDPC MiniDriverTimerDpc; // Miniclass DPC for timer object.
  365. WORK_QUEUE_ITEM WorkItem;
  366. #if DBG
  367. BOOLEAN PriorityWorkItemScheduled;
  368. #endif
  369. } COMMON_OBJECT, *PCOMMON_OBJECT;
  370. //
  371. // stream name info
  372. //
  373. typedef struct _STREAM_OPEN_INFORMATION {
  374. WCHAR Guid[11];
  375. ULONG Instance;
  376. } STREAM_OPEN_INFORMATION, *PSTREAM_OPEN_INFORMATION;
  377. //
  378. // clock instance structure
  379. //
  380. typedef struct _CLOCK_INSTANCE {
  381. PVOID DeviceHeader;
  382. PFILE_OBJECT ParentFileObject;
  383. //PFILE_OBJECT ClockFileObject; johnlee
  384. struct _STREAM_OBJECT *StreamObject;
  385. } CLOCK_INSTANCE, *PCLOCK_INSTANCE;
  386. //
  387. // master clock info structure
  388. //
  389. typedef struct _MASTER_CLOCK_INFO {
  390. PFILE_OBJECT ClockFileObject;
  391. KSCLOCK_FUNCTIONTABLE FunctionTable;
  392. } MASTER_CLOCK_INFO, *PMASTER_CLOCK_INFO;
  393. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  394. typedef enum {
  395. PinStopped,
  396. PinStopPending,
  397. PinPrepared,
  398. PinRunning
  399. } PIN_STATE;
  400. typedef enum {
  401. IrpSource,
  402. IrpSink,
  403. } PIN_TYPE;
  404. #define READ 0
  405. #define WRITE 1
  406. typedef struct _QUEUE {
  407. KSPIN_LOCK QueueLock;
  408. LIST_ENTRY ActiveQueue;
  409. WORK_QUEUE_ITEM WorkItem;
  410. BOOL WorkItemQueued;
  411. } QUEUE, PQUEUE;
  412. #endif //ENABLE_STREAM_CLASS_AS_ALLOCATOR
  413. //
  414. // TODO: WORKITEM: remove this once KS can multiplex cleanup calls.
  415. //
  416. #define STREAM_OBJECT_COOKIE 0xd73afe3f
  417. typedef struct _COOKIE_CHECK {
  418. PVOID Header;
  419. ULONG PossibleCookie;
  420. } COOKIE_CHECK, *PCOOKIE_CHECK;
  421. //
  422. // stream object definition
  423. //
  424. typedef struct _STREAM_OBJECT {
  425. COMMON_OBJECT ComObj;
  426. PFILE_OBJECT FilterFileObject;
  427. PFILE_OBJECT FileObject;
  428. struct _FILTER_INSTANCE *FilterInstance;
  429. HW_STREAM_OBJECT HwStreamObject;
  430. LIST_ENTRY DataPendingQueue;
  431. LIST_ENTRY ControlPendingQueue;
  432. LIST_ENTRY OutstandingQueue;
  433. LIST_ENTRY NextStream;
  434. LIST_ENTRY NotifyList;
  435. struct _DEVICE_EXTENSION *DeviceExtension;
  436. struct _STREAM_OBJECT *NextNeedyStream;
  437. PKSPROPERTY_SET PropertyInfo;
  438. ULONG PropInfoSize;
  439. PKSEVENT_SET EventInfo;
  440. ULONG EventInfoCount;
  441. KEVENT ControlSetMasterClock; // to serialize SetMasterClock
  442. KSPIN_LOCK LockUseMasterClock; // control use of MasterClockInfo
  443. PMASTER_CLOCK_INFO MasterClockInfo;
  444. PCLOCK_INSTANCE ClockInstance;
  445. PKSPROPERTY_SET ConstructedPropertyInfo;
  446. ULONG ConstructedPropInfoSize;
  447. KSSTATE CurrentState;
  448. BOOLEAN ReadyForNextControlReq;
  449. BOOLEAN ReadyForNextDataReq;
  450. BOOLEAN OnNeedyQueue;
  451. BOOLEAN InFlush;
  452. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  453. PIN_STATE PinState;
  454. PIN_TYPE PinType; // IrpSource or IrpSink
  455. PFILE_OBJECT AllocatorFileObject;
  456. PFILE_OBJECT NextFileObject;
  457. LIST_ENTRY FreeQueue;
  458. KSPIN_LOCK FreeQueueLock;
  459. KEVENT StopEvent;
  460. PKSDATAFORMAT DataFormat;
  461. ULONG PinId;
  462. HANDLE PinToHandle;
  463. KSALLOCATOR_FRAMING Framing;
  464. BOOL EndOfStream;
  465. QUEUE Queues[2];
  466. #endif //ENABLE_STREAM_CLASS_AS_ALLOCATOR
  467. #ifdef ENABLE_KS_METHODS
  468. PKSMETHOD_SET MethodInfo;
  469. ULONG MethodInfoSize;
  470. #endif
  471. BOOLEAN StandardTransport;
  472. //
  473. // This keeps track of the number of frames in circulation between the
  474. // output and the downstream input. It is a total count of those frames
  475. // queued to EITHER pin or in a pending list OTHER THAN THE FREE LIST
  476. // on the output pin.
  477. //
  478. LONG QueuedFramesPlusOne;
  479. } STREAM_OBJECT, *PSTREAM_OBJECT;
  480. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  481. //
  482. // NOTE! This is the minimal structure size for STREAM_HEADER_EX.
  483. // The connected pins are queried for the actual header size (including
  484. // whatever extended header size is required).
  485. //
  486. typedef struct _STREAM_HEADER_EX *PSTREAM_HEADER_EX;
  487. typedef struct _STREAM_HEADER_EX {
  488. ULONG WhichQueue;
  489. ULONG Id;
  490. IO_STATUS_BLOCK IoStatus;
  491. KEVENT CompletionEvent;
  492. LIST_ENTRY ListEntry;
  493. ULONG ReferenceCount;
  494. PFILE_OBJECT OwnerFileObject;
  495. PFILE_OBJECT NextFileObject; // next one to stream to.
  496. #if (DBG)
  497. PVOID Data;
  498. ULONG OnFreeList;
  499. ULONG OnActiveList;
  500. #else
  501. ULONG Reserved;
  502. #endif
  503. KSSTREAM_HEADER Header;
  504. } STREAM_HEADER_EX, *PSTREAM_HEADER_EX;
  505. #endif //ENABLE_STREAM_CLASS_AS_ALLOCATOR
  506. //
  507. // struct for retrieving the interrupt data
  508. //
  509. typedef struct _INTERRUPT_CONTEXT {
  510. PSTREAM_OBJECT NeedyStream;
  511. struct _DEVICE_EXTENSION *DeviceExtension;
  512. PINTERRUPT_DATA SavedStreamInterruptData;
  513. PINTERRUPT_DATA SavedDeviceInterruptData;
  514. } INTERRUPT_CONTEXT, *PINTERRUPT_CONTEXT;
  515. //
  516. // Performance improvement chance - array for stream prop & event pointers
  517. //
  518. typedef struct _STREAM_ADDITIONAL_INFO {
  519. PKSPROPERTY_SET StreamPropertiesArray;
  520. PKSEVENT_SET StreamEventsArray;
  521. } STREAM_ADDITIONAL_INFO, *PSTREAM_ADDITIONAL_INFO;
  522. //
  523. // filter instance structure
  524. // (right now, this is global across all same filter creates!)
  525. //
  526. #if ENABLE_MULTIPLE_FILTER_TYPES
  527. //
  528. // for forward reference in FILTER_INSTANCE
  529. //
  530. typedef struct _DEVICE_EXTENSION;
  531. //
  532. // I claim that as it currently stands, 5/17/99 "No multiple instance
  533. // mini driver works" because the bug in stream.sys. Therefore, backward
  534. // compatibility is only a concern for single instance mini drivers.
  535. //
  536. // The reason is the implemention following:
  537. // FilterDispatchGlobalCreate()
  538. // {
  539. // ...
  540. // if (!DeviceExtension->GlobalFilterInstance) {
  541. //
  542. //
  543. // Status = SCOpenMinidriverInstance(DeviceExtension,
  544. // &FilterInstance,
  545. // SCGlobalInstanceCallback,
  546. // Irp);
  547. // ...
  548. // if (NT_SUCCESS(Status)) {
  549. // ...
  550. // DeviceExtension->GlobalFilterInstance = FilterInstance;
  551. // ...
  552. // }
  553. // }
  554. // else { // will not call mini drivers
  555. // }
  556. // }
  557. //
  558. // At the 2nd call, the FilterInstance will point to the same 1st one.
  559. //
  560. // We are braching out code here to support Multiple Filters without
  561. // disturbing the exisitng support to max the backward compatibilty.
  562. // The multiple filter support include 1 type n instances,
  563. // and m types p instances.
  564. //
  565. // MinidriverData->HwInitData.
  566. // 1 x 1 FilterInstanceExtensionSize =0 NumNameExtension =0
  567. // 1 x n FilterInstanceExtensionSize!=0 NumNameExtension =0
  568. // m x p FilterInstanceExtensionSize!=0 NumNameExtension!=0
  569. //
  570. typedef struct _FILTER_TYPE_INFORMATION {
  571. UNICODE_STRING *SymbolicLinks;
  572. ULONG LinkNameCount;
  573. PHW_STREAM_DESCRIPTOR StreamDescriptor;
  574. ULONG Reserved;
  575. } FILTER_TYPE_INFO;
  576. typedef FILTER_TYPE_INFO *PFILTER_TYPE_INFO;
  577. #endif
  578. typedef struct _DEVICE_EXTENSION;
  579. typedef struct _FILTER_INSTANCE {
  580. PVOID DeviceHeader;
  581. PDEVICE_OBJECT DeviceObject;
  582. LIST_ENTRY NextFilterInstance; // internal linked list of filter I's.
  583. LIST_ENTRY FirstStream;
  584. PVOID HwInstanceExtension;
  585. PADDITIONAL_PIN_INFO PinInstanceInfo; // pointer to array of pins
  586. // allocated directly below this
  587. // structure.
  588. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  589. //
  590. // Feature work: add per filter filter type when data splitting is enabled!
  591. //
  592. PKSWORKER WorkerRead;
  593. PKSWORKER WorkerWrite;
  594. #endif //ENABLE_STREAM_CLASS_AS_ALLOCATOR
  595. #ifdef ENABLE_KS_METHODS
  596. IF_MF(
  597. PKSMETHOD_SET DeviceMethodsArray; // from pDevExt
  598. )
  599. #endif
  600. #define SIGN_FILTER_INSTANCE 'FrtS' //StrF
  601. #if ENABLE_MULTIPLE_FILTER_TYPES
  602. #define ASSERT_FILTER_INSTANCE(FI) ASSERT((FI)->Signature==SIGN_FILTER_INSTANCE)
  603. #else
  604. #define ASSERT_FILTER_INSTANCE(FI)
  605. #endif
  606. IF_MF(
  607. ULONG Signature;
  608. PKSPIN_DESCRIPTOR PinInformation; // moved from pDevExt
  609. //ULONG PinInformationSize; // from pDevExt,not used
  610. ULONG NumberOfPins; // from pDevExt
  611. PKSEVENT_SET EventInfo; // from pDevExt
  612. ULONG EventInfoCount; // from pDevExt
  613. LIST_ENTRY NotifyList; // from pDevExt
  614. PHW_EVENT_ROUTINE HwEventRoutine; // from pDevExt
  615. PKSPROPERTY_SET DevicePropertiesArray; // from pDevExt
  616. PSTREAM_ADDITIONAL_INFO StreamPropEventArray; // ditto
  617. ULONG Reenumerated; // if 1, StreamDescriptor is newly alloc
  618. // need to be freed. Else, it points into
  619. // the global one which belong to DevExt.
  620. ULONG NeedReenumeration; // requesting reenumeration
  621. ULONG StreamDescriptorSize; // the new size for streamdescriptor;
  622. struct _DEVICE_EXTENSION *DeviceExtension;
  623. PHW_STREAM_DESCRIPTOR StreamDescriptor;
  624. ULONG FilterTypeIndex;
  625. //
  626. // Performance improvement chance. Per filterinstance ControlEvent etc might be
  627. // better.For now, let them share ones in DeviceExtension
  628. //
  629. //KEVENT ControlEvent
  630. //PHW_TIMER_ROUTINE HwTimerRoutine; // Timer request routine
  631. //PVOID HwTimerContext;
  632. //KTIMER MiniDriverTimer; // Miniclass timer object.
  633. //KDPC MiniDriverTimerDpc; // Miniclass DPC for timer object.
  634. //WORK_QUEUE_ITEM WorkItem;
  635. ) // IF_MF
  636. } FILTER_INSTANCE, *PFILTER_INSTANCE;
  637. //
  638. // Per Device data
  639. //
  640. typedef struct _DEVICE_EXTENSION {
  641. COMMON_OBJECT ComObj;
  642. ULONG Flags; // per device flags (PD_xx)
  643. PDEVICE_OBJECT DeviceObject; // device object
  644. PDEVICE_OBJECT AttachedPdo; // device object returned from the attach
  645. ULONG RegistryFlags; // registry flags
  646. // callback routine on DMA allocate
  647. // callback function for
  648. // KeSynch execution
  649. PKINTERRUPT InterruptObject; // Interrupt object and routine
  650. PKSERVICE_ROUTINE InterruptRoutine;
  651. PADAPTER_OBJECT DmaAdapterObject; // Dma Adapter information.
  652. ULONG NumberOfMapRegisters; // max. number of map registers
  653. // for
  654. // device
  655. PVOID MapRegisterBase;
  656. PMINIDRIVER_INFORMATION MinidriverData; // pointer to minidriver data
  657. PDEVICE_OBJECT PhysicalDeviceObject; // pointer to PDO for adapter
  658. PVOID HwDeviceExtension; // minidriver's device extension
  659. PPORT_CONFIGURATION_INFORMATION ConfigurationInformation;
  660. // configuration info for adapter
  661. PMAPPED_ADDRESS MappedAddressList; // address map list head
  662. //
  663. // Routine to call to synchronize execution for the minidriver.
  664. //
  665. PSYNCHRONIZE_ROUTINE SynchronizeExecution;
  666. KSPIN_LOCK SpinLock;
  667. ULONG SequenceNumber; // offset 0x30
  668. ULONG DmaBufferLength;
  669. PHYSICAL_ADDRESS DmaBufferPhysical;
  670. PVOID DmaBuffer;
  671. LIST_ENTRY PendingQueue;
  672. LIST_ENTRY OutstandingQueue;
  673. KDPC WorkDpc;
  674. IFN_MF(
  675. //
  676. // Move to FilterInstance for IF_MF
  677. //
  678. PKSPIN_DESCRIPTOR PinInformation;
  679. ULONG PinInformationSize;
  680. ULONG NumberOfPins;
  681. )
  682. #define SIGN_DEVICE_EXTENSION 'DrtS' //StrD
  683. #if ENABLE_MULTIPLE_FILTER_TYPES
  684. #define ASSERT_DEVICE_EXTENSION(DE) ASSERT((DE)->Signature==SIGN_DEVICE_EXTENSION)
  685. #else
  686. #define ASSERT_DEVICE_EXTENSION(DE)
  687. #endif
  688. ULONG Signature2;
  689. LIST_ENTRY FilterInstanceList;
  690. ULONG NumberOfOpenInstances;
  691. IFN_MF(
  692. //
  693. // Don't need for IF_MF
  694. //
  695. PFILTER_INSTANCE GlobalFilterInstance;
  696. ULONG NumberOfGlobalInstances;
  697. )
  698. struct _STREAM_OBJECT *NeedyStream;
  699. PHW_STREAM_DESCRIPTOR StreamDescriptor;
  700. KEVENT ControlEvent;
  701. KEVENT RemoveEvent;
  702. BOOLEAN NoSync;
  703. PMINIDRIVER_INFORMATION DriverInfo;
  704. PBEGIN_CALLIN_ROUTINE BeginMinidriverCallin;
  705. PEND_STREAM_CALLIN_ROUTINE EndMinidriverStreamCallin;
  706. PEND_DEVICE_CALLIN_ROUTINE EndMinidriverDeviceCallin;
  707. LONG OneBasedIoCount;
  708. UNICODE_STRING *SymbolicLinks;
  709. DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
  710. DEVICE_POWER_STATE CurrentPowerState;
  711. LIST_ENTRY Children;
  712. LIST_ENTRY DeadEventList;
  713. WORK_QUEUE_ITEM EventWorkItem;
  714. WORK_QUEUE_ITEM RescanWorkItem;
  715. WORK_QUEUE_ITEM PowerCompletionWorkItem; // this is used for S Irp, S and D Irps dont exclude between.
  716. WORK_QUEUE_ITEM DevIrpCompletionWorkItem; // this is for D Irp as opposed to S Irp which uses above
  717. BOOLEAN ReadyForNextReq;
  718. BOOLEAN DeadEventItemQueued;
  719. IFN_MF(
  720. //
  721. // move to FilterInstace for MF
  722. //
  723. PKSEVENT_SET EventInfo;
  724. ULONG EventInfoCount;
  725. LIST_ENTRY NotifyList;
  726. PHW_EVENT_ROUTINE HwEventRoutine;
  727. PKSPROPERTY_SET DevicePropertiesArray;
  728. PSTREAM_ADDITIONAL_INFO StreamPropEventArray;
  729. )
  730. #ifdef ENABLE_KS_METHODS
  731. IFN_MF(
  732. //
  733. // move to FilterInstance for MF
  734. PKSMETHOD_SET DeviceMethodsArray;
  735. )
  736. #endif
  737. IF_MF(
  738. ULONG NumberOfNameExtensions;
  739. ULONG NumberOfFilterTypes;
  740. PKSOBJECT_CREATE_ITEM CreateItems;
  741. PFILTER_TYPE_INFO FilterTypeInfos;
  742. ULONG Signature;
  743. ULONG FilterExtensionSize;
  744. )
  745. #if DBG
  746. ULONG LowerApiThreads;
  747. ULONG NumberOfRequests;
  748. ULONG NumberOfLowPriCalls;
  749. #endif
  750. LIST_ENTRY PendedIrps;
  751. KSPIN_LOCK PendedIrpsLock;
  752. KSPIN_LOCK PowerLock;
  753. SYSTEM_POWER_STATE CurrentSystemState;
  754. KEVENT BlockPoweredDownEvent;
  755. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  756. //
  757. // debug work item trap structure
  758. //
  759. #if DBG
  760. typedef struct _DEBUG_WORK_ITEM {
  761. PCOMMON_OBJECT Object;
  762. PHW_PRIORITY_ROUTINE HwPriorityRoutine;
  763. PVOID HwPriorityContext;
  764. } DEBUG_WORK_ITEM, *PDEBUG_WORK_ITEM;
  765. #endif
  766. //
  767. // registry entry structure
  768. //
  769. typedef struct _STREAM_REGISTRY_ENTRY {
  770. PWCHAR String;
  771. ULONG StringLength;
  772. ULONG Flags;
  773. } STREAM_REGISTRY_ENTRY, *PSTREAM_REGISTRY_ENTRY;
  774. //
  775. // power context structure
  776. //
  777. typedef struct _POWER_CONTEXT {
  778. KEVENT Event;
  779. NTSTATUS Status;
  780. } POWER_CONTEXT, *PPOWER_CONTEXT;
  781. //
  782. // child device extension
  783. //
  784. typedef struct _CHILD_DEVICE_EXTENSION {
  785. COMMON_OBJECT ComObj;
  786. ULONG Flags; // per device flags (PD_xx)
  787. PDEVICE_OBJECT ChildDeviceObject;
  788. PDEVICE_OBJECT ParentDeviceObject;
  789. LIST_ENTRY ChildExtensionList;
  790. PWCHAR DeviceName;
  791. ULONG DeviceIndex;
  792. } CHILD_DEVICE_EXTENSION, *PCHILD_DEVICE_EXTENSION;
  793. //
  794. // Function declarations
  795. //
  796. NTSTATUS
  797. StreamClassOpen(
  798. IN PDEVICE_OBJECT DeviceObject,
  799. IN PIRP Irp
  800. );
  801. NTSTATUS
  802. StreamClassClose(
  803. IN PDEVICE_OBJECT DeviceObject,
  804. IN PIRP Irp
  805. );
  806. NTSTATUS
  807. StreamClassDeviceControl(
  808. IN PDEVICE_OBJECT DeviceObject,
  809. IN PIRP Irp
  810. );
  811. NTSTATUS
  812. StreamClassNull(
  813. IN PDEVICE_OBJECT DeviceObject,
  814. IN PIRP Irp
  815. );
  816. VOID
  817. StreamClassDpc(
  818. IN PKDPC Dpc,
  819. IN PDEVICE_OBJECT DeviceObject,
  820. IN PIRP Irp,
  821. IN PVOID Context
  822. );
  823. BOOLEAN
  824. StreamClassInterrupt(
  825. IN PKINTERRUPT InterruptObject,
  826. IN PDEVICE_OBJECT DeviceObject
  827. );
  828. NTSTATUS
  829. StreamClassShutDown(
  830. IN PDEVICE_OBJECT DeviceObject,
  831. IN PIRP Irp
  832. );
  833. BOOLEAN
  834. SCGetInterruptState(
  835. IN PVOID ServiceContext
  836. );
  837. VOID
  838. SCMinidriverDeviceTimerDpc(
  839. IN struct _KDPC * Dpc,
  840. IN PVOID DeviceObject,
  841. IN PVOID SystemArgument1,
  842. IN PVOID SystemArgument2
  843. );
  844. VOID
  845. SCMinidriverStreamTimerDpc(
  846. IN struct _KDPC * Dpc,
  847. IN PVOID Context,
  848. IN PVOID SystemArgument1,
  849. IN PVOID SystemArgument2
  850. );
  851. PSTREAM_REQUEST_BLOCK
  852. SCBuildRequestPacket(
  853. IN PDEVICE_EXTENSION DeviceExtension,
  854. IN PIRP Irp,
  855. IN ULONG AdditionalSize1,
  856. IN ULONG AdditionalSize2
  857. );
  858. BOOLEAN
  859. SCSynchronizeExecution(
  860. IN PKINTERRUPT Interrupt,
  861. IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
  862. IN PVOID SynchronizeContext
  863. );
  864. VOID
  865. SCLogError(
  866. IN PDEVICE_OBJECT DeviceObject,
  867. IN ULONG SequenceNumber,
  868. IN NTSTATUS ErrorCode,
  869. IN ULONG UniqueId
  870. );
  871. VOID
  872. SCLogErrorWithString(
  873. IN PDEVICE_OBJECT DeviceObject,
  874. IN OPTIONAL PDEVICE_EXTENSION DeviceExtension,
  875. IN NTSTATUS ErrorCode,
  876. IN ULONG UniqueId,
  877. IN PUNICODE_STRING String1
  878. );
  879. VOID
  880. SCMinidriverTimerDpc(
  881. IN struct _KDPC * Dpc,
  882. IN PVOID Context,
  883. IN PVOID SystemArgument1,
  884. IN PVOID SystemArgument2
  885. );
  886. BOOLEAN
  887. SCSetUpForDMA(
  888. IN PDEVICE_OBJECT DeviceObject,
  889. IN PSTREAM_REQUEST_BLOCK Request
  890. );
  891. IO_ALLOCATION_ACTION
  892. StreamClassDmaCallback(
  893. IN PDEVICE_OBJECT DeviceObject,
  894. IN PIRP Irp,
  895. IN PVOID MapRegisterBase,
  896. IN PVOID Context
  897. );
  898. VOID
  899. SCStartMinidriverRequest(
  900. IN PSTREAM_OBJECT StreamObject,
  901. IN PSTREAM_REQUEST_BLOCK Request,
  902. IN PVOID EntryPoint
  903. );
  904. NTSTATUS
  905. SCProcessCompletedRequest(
  906. IN PSTREAM_REQUEST_BLOCK SRB
  907. );
  908. NTSTATUS
  909. StreamClassUninitializeMinidriver(
  910. IN PDEVICE_OBJECT DeviceObject,
  911. IN PIRP Irp);
  912. NTSTATUS
  913. StreamClassVideoRegister(
  914. IN PVOID Argument1,
  915. IN PVOID Argument2,
  916. IN PHW_INITIALIZATION_DATA HwInitializationData
  917. );
  918. NTSTATUS
  919. StreamClassCleanup (
  920. IN PDEVICE_OBJECT DeviceObject,
  921. IN PIRP Irp
  922. );
  923. void
  924. SCSetCurrentDPowerState (
  925. IN PDEVICE_EXTENSION DeviceExtension,
  926. IN DEVICE_POWER_STATE PowerState
  927. );
  928. void
  929. SCSetCurrentSPowerState (
  930. IN PDEVICE_EXTENSION DeviceExtension,
  931. IN SYSTEM_POWER_STATE PowerState
  932. );
  933. void
  934. SCRedispatchPendedIrps (
  935. IN PDEVICE_EXTENSION DeviceExtension,
  936. IN BOOLEAN FailRequests
  937. );
  938. NTSTATUS
  939. StreamClassPassThroughIrp (
  940. IN PDEVICE_OBJECT DeviceObject,
  941. IN PIRP Irp
  942. );
  943. NTSTATUS
  944. StreamClassPnP(
  945. IN PDEVICE_OBJECT DeviceObject,
  946. IN PIRP Irp
  947. );
  948. NTSTATUS
  949. StreamClassPower(
  950. IN PDEVICE_OBJECT DeviceObject,
  951. IN PIRP Irp
  952. );
  953. NTSTATUS
  954. StreamClassPnPAddDevice(
  955. IN PDRIVER_OBJECT DriverObject,
  956. IN PDEVICE_OBJECT PhysicalDeviceObject
  957. );
  958. VOID
  959. SCFreeAllResources(
  960. IN PDEVICE_EXTENSION DeviceExtension
  961. );
  962. VOID
  963. StreamClassUnload(
  964. IN PDRIVER_OBJECT DriverObject
  965. );
  966. BOOLEAN
  967. StreamClassSynchronizeExecution(
  968. IN PKINTERRUPT Interrupt,
  969. IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
  970. IN PVOID SynchronizeContext
  971. );
  972. VOID
  973. StreamClassDebugPrint(
  974. STREAM_DEBUG_LEVEL DebugPrintLevel,
  975. PSCHAR DebugMessage,
  976. ...
  977. );
  978. NTSTATUS
  979. SCCompleteIrp(
  980. IN PIRP Irp,
  981. IN NTSTATUS Status,
  982. IN PDEVICE_EXTENSION DeviceExtension
  983. );
  984. NTSTATUS
  985. SCUninitializeMinidriver(
  986. IN PDEVICE_OBJECT DeviceObject,
  987. IN PIRP Irp);
  988. BOOLEAN
  989. SCDummyMinidriverRoutine(
  990. IN PVOID Context
  991. );
  992. NTSTATUS
  993. SCStreamInfoCallback(
  994. IN PSTREAM_REQUEST_BLOCK SRB
  995. );
  996. NTSTATUS
  997. FilterDispatchGlobalCreate(
  998. IN PDEVICE_OBJECT DeviceObject,
  999. IN PIRP Irp
  1000. );
  1001. NTSTATUS
  1002. StreamDispatchCreate(
  1003. IN PDEVICE_OBJECT DeviceObject,
  1004. IN PIRP Irp
  1005. );
  1006. NTSTATUS
  1007. FilterDispatchIoControl(
  1008. IN PDEVICE_OBJECT DeviceObject,
  1009. IN PIRP Irp
  1010. );
  1011. NTSTATUS
  1012. FilterDispatchClose
  1013. (
  1014. IN PDEVICE_OBJECT pdo,
  1015. IN PIRP pIrp
  1016. );
  1017. NTSTATUS
  1018. SCStreamDeviceState
  1019. (
  1020. IN PIRP Irp,
  1021. IN PKSPROPERTY Property,
  1022. IN OUT PKSSTATE DeviceState
  1023. );
  1024. NTSTATUS
  1025. StreamDispatchIoControl
  1026. (
  1027. IN PDEVICE_OBJECT DeviceObject,
  1028. IN PIRP Irp
  1029. );
  1030. NTSTATUS StreamDispatchRead
  1031. (
  1032. IN PDEVICE_OBJECT DeviceObject,
  1033. IN PIRP Irp
  1034. );
  1035. NTSTATUS StreamDispatchWrite
  1036. (
  1037. IN PDEVICE_OBJECT DeviceObject,
  1038. IN PIRP Irp
  1039. );
  1040. NTSTATUS
  1041. SCLocalInstanceCallback(
  1042. IN PSTREAM_REQUEST_BLOCK SRB
  1043. );
  1044. IFN_MF(
  1045. NTSTATUS
  1046. SCGlobalInstanceCallback(
  1047. IN PSTREAM_REQUEST_BLOCK SRB
  1048. );
  1049. )
  1050. NTSTATUS
  1051. SCOpenStreamCallback(
  1052. IN PSTREAM_REQUEST_BLOCK SRB
  1053. );
  1054. VOID
  1055. SCRequestDpcForStream(
  1056. IN PSTREAM_OBJECT StreamObject
  1057. );
  1058. NTSTATUS
  1059. SCSubmitRequest(
  1060. IN SRB_COMMAND Command,
  1061. IN PVOID Buffer,
  1062. IN ULONG BufferLength,
  1063. IN PSTREAM_CALLBACK_PROCEDURE Callback,
  1064. IN PDEVICE_EXTENSION DeviceExtension,
  1065. IN PVOID InstanceExtension,
  1066. IN PHW_STREAM_OBJECT HwStreamObject,
  1067. IN PIRP Irp,
  1068. OUT PBOOLEAN RequestIssued,
  1069. IN PLIST_ENTRY Queue,
  1070. IN PVOID MinidriverRoutine
  1071. );
  1072. NTSTATUS
  1073. SCCloseInstanceCallback(
  1074. IN PSTREAM_REQUEST_BLOCK SRB
  1075. );
  1076. NTSTATUS
  1077. SCFilterPinInstances(
  1078. IN PIRP Irp,
  1079. IN PKSPROPERTY Property,
  1080. IN OUT PVOID Data);
  1081. NTSTATUS
  1082. SCFilterPinDataRouting(
  1083. IN PIRP Irp,
  1084. IN PKSPROPERTY Property,
  1085. IN OUT PVOID Data);
  1086. NTSTATUS
  1087. SCFilterPinDataIntersection(
  1088. IN PIRP Irp,
  1089. IN PKSPROPERTY Property,
  1090. IN OUT PVOID Data);
  1091. NTSTATUS
  1092. SCFilterPinPropertyHandler(
  1093. IN PIRP Irp,
  1094. IN PKSPROPERTY Property,
  1095. IN OUT PVOID Data);
  1096. NTSTATUS
  1097. SCFilterProvider(
  1098. IN PIRP Irp,
  1099. IN PKSPROPERTY Property,
  1100. IN OUT PVOID Data);
  1101. NTSTATUS
  1102. StreamDispatchClose
  1103. (
  1104. IN PDEVICE_OBJECT DeviceObject,
  1105. IN PIRP Irp
  1106. );
  1107. NTSTATUS
  1108. StreamDispatchCleanup
  1109. (
  1110. IN PDEVICE_OBJECT DeviceObject,
  1111. IN PIRP Irp
  1112. );
  1113. NTSTATUS
  1114. SCCloseStreamCallback(
  1115. IN PSTREAM_REQUEST_BLOCK SRB
  1116. );
  1117. BOOLEAN
  1118. SCProcessPioDataBuffers(
  1119. IN PKSSTREAM_HEADER FirstHeader,
  1120. IN ULONG NumberOfHeaders,
  1121. IN PSTREAM_OBJECT StreamObject,
  1122. IN PMDL FirstMdl,
  1123. IN ULONG StreamHeaderSize,
  1124. IN PVOID *pMemPtrArray,
  1125. IN BOOLEAN Write
  1126. );
  1127. VOID
  1128. SCProcessDmaDataBuffers(
  1129. IN PKSSTREAM_HEADER FirstHeader,
  1130. IN ULONG NumberOfHeaders,
  1131. IN PSTREAM_OBJECT StreamObject,
  1132. IN PMDL FirstMdl,
  1133. OUT PULONG NumberOfPages,
  1134. IN ULONG StreamHeaderSize,
  1135. IN BOOLEAN Write
  1136. );
  1137. VOID
  1138. SCErrorDataSRB(
  1139. IN PHW_STREAM_REQUEST_BLOCK SRB
  1140. );
  1141. VOID
  1142. SCCheckOutstandingRequestsForTimeouts(
  1143. IN PLIST_ENTRY ListEntry
  1144. );
  1145. VOID
  1146. SCCheckFilterInstanceStreamsForTimeouts(
  1147. IN PFILTER_INSTANCE FilterInstance
  1148. );
  1149. VOID
  1150. StreamClassTickHandler(
  1151. IN PDEVICE_OBJECT DeviceObject,
  1152. IN PVOID Context
  1153. );
  1154. VOID
  1155. StreamClassCancelOutstandingIrp(
  1156. IN PDEVICE_OBJECT DeviceObject,
  1157. IN PIRP Irp
  1158. );
  1159. VOID
  1160. StreamClassCancelPendingIrp(
  1161. IN PDEVICE_OBJECT DeviceObject,
  1162. IN PIRP Irp
  1163. );
  1164. VOID
  1165. SCCancelOutstandingIrp(
  1166. IN PDEVICE_EXTENSION DeviceExtension,
  1167. IN PIRP Irp
  1168. );
  1169. BOOLEAN
  1170. SCCheckFilterInstanceStreamsForIrp(
  1171. IN PFILTER_INSTANCE FilterInstance,
  1172. IN PIRP Irp
  1173. );
  1174. BOOLEAN
  1175. SCCheckRequestsForIrp(
  1176. IN PLIST_ENTRY ListEntry,
  1177. IN PIRP Irp,
  1178. IN BOOLEAN IsIrpQueue,
  1179. IN PDEVICE_EXTENSION DeviceExtension
  1180. );
  1181. VOID
  1182. SCNotifyMinidriverCancel(
  1183. IN PSTREAM_REQUEST_BLOCK SRB
  1184. );
  1185. NTSTATUS
  1186. SCProcessCompletedPropertyRequest(
  1187. IN PSTREAM_REQUEST_BLOCK SRB
  1188. );
  1189. NTSTATUS
  1190. StreamClassMinidriverDeviceGetProperty
  1191. (
  1192. IN PIRP Irp,
  1193. IN PKSPROPERTY Property,
  1194. IN OUT PVOID PropertyInfo
  1195. );
  1196. NTSTATUS
  1197. StreamClassMinidriverDeviceSetProperty
  1198. (
  1199. IN PIRP Irp,
  1200. IN PKSPROPERTY Property,
  1201. IN OUT PVOID PropertyInfo
  1202. );
  1203. NTSTATUS
  1204. StreamClassMinidriverStreamGetProperty
  1205. (
  1206. IN PIRP Irp,
  1207. IN PKSPROPERTY Property,
  1208. IN OUT PVOID PropertyInfo
  1209. );
  1210. NTSTATUS
  1211. StreamClassMinidriverStreamSetProperty
  1212. (
  1213. IN PIRP Irp,
  1214. IN PKSPROPERTY Property,
  1215. IN OUT PVOID PropertyInfo
  1216. );
  1217. NTSTATUS
  1218. DriverEntry(
  1219. IN PDRIVER_OBJECT DriverObject,
  1220. IN PUNICODE_STRING RegistryPath
  1221. );
  1222. NTSTATUS
  1223. SCOpenMinidriverInstance(
  1224. IN PDEVICE_EXTENSION DeviceExtension,
  1225. OUT PFILTER_INSTANCE * ReturnedFilterInstance,
  1226. IN PSTREAM_CALLBACK_PROCEDURE Callback,
  1227. IN PIRP Irp
  1228. );
  1229. NTSTATUS
  1230. SCMinidriverDevicePropertyHandler
  1231. (
  1232. IN SRB_COMMAND Command,
  1233. IN PIRP Irp,
  1234. IN PKSPROPERTY Property,
  1235. IN OUT PVOID PropertyInfo
  1236. );
  1237. NTSTATUS
  1238. SCMinidriverStreamPropertyHandler
  1239. (
  1240. IN SRB_COMMAND Command,
  1241. IN PIRP Irp,
  1242. IN PKSPROPERTY Property,
  1243. IN OUT PVOID PropertyInfo
  1244. );
  1245. VOID
  1246. SCStartRequestOnStream(
  1247. IN PSTREAM_OBJECT StreamObject,
  1248. IN PDEVICE_EXTENSION DeviceExtension
  1249. );
  1250. NTSTATUS
  1251. StreamClassPnPAddDeviceWorker(
  1252. IN PDRIVER_OBJECT DriverObject,
  1253. IN PDEVICE_OBJECT PhysicalDeviceObject,
  1254. IN OUT PDEVICE_EXTENSION * ReturnedDeviceExtension
  1255. );
  1256. NTSTATUS
  1257. SCProcessDataTransfer(
  1258. IN PDEVICE_EXTENSION DeviceExtension,
  1259. IN PIRP Irp,
  1260. IN SRB_COMMAND Command
  1261. );
  1262. VOID
  1263. SCUpdateMinidriverProperties(
  1264. IN ULONG NumProps,
  1265. IN PKSPROPERTY_SET MinidriverProps,
  1266. IN BOOLEAN Stream
  1267. );
  1268. VOID
  1269. SCInitializeWorkItem(
  1270. IN PSTREAM_REQUEST_BLOCK SRB
  1271. );
  1272. NTSTATUS
  1273. SCInitializeCallback(
  1274. IN PSTREAM_REQUEST_BLOCK SRB
  1275. );
  1276. VOID
  1277. SCStreamInfoWorkItem(
  1278. IN PSTREAM_REQUEST_BLOCK SRB
  1279. );
  1280. NTSTATUS
  1281. SCDequeueAndDeleteSrb(
  1282. IN PSTREAM_REQUEST_BLOCK SRB
  1283. );
  1284. VOID
  1285. SCReadRegistryValues(IN PDEVICE_EXTENSION DeviceExtension,
  1286. IN PDEVICE_OBJECT PhysicalDeviceObject
  1287. );
  1288. NTSTATUS
  1289. SCGetRegistryValue(
  1290. IN HANDLE Handle,
  1291. IN PWCHAR KeyNameString,
  1292. IN ULONG KeyNameStringLength,
  1293. IN PVOID Data,
  1294. IN ULONG DataLength
  1295. );
  1296. VOID
  1297. SCInsertStreamInFilter(
  1298. IN PSTREAM_OBJECT StreamObject,
  1299. IN PDEVICE_EXTENSION DeviceExtension
  1300. );
  1301. VOID
  1302. SCReferenceDriver(
  1303. IN PDEVICE_EXTENSION DeviceExtension
  1304. );
  1305. VOID
  1306. SCDereferenceDriver(
  1307. IN PDEVICE_EXTENSION DeviceExtension
  1308. );
  1309. VOID
  1310. SCQueueSrbWorkItem(
  1311. IN PSTREAM_REQUEST_BLOCK Srb
  1312. );
  1313. VOID
  1314. SCProcessPriorityChangeRequest(
  1315. IN PCOMMON_OBJECT CommonObject,
  1316. IN PINTERRUPT_DATA SavedInterruptData,
  1317. IN PDEVICE_EXTENSION DeviceExtension
  1318. );
  1319. VOID
  1320. SCProcessTimerRequest(
  1321. IN PCOMMON_OBJECT CommonObject,
  1322. IN PINTERRUPT_DATA SavedInterruptData
  1323. );
  1324. NTSTATUS
  1325. SCPowerCallback(
  1326. IN PSTREAM_REQUEST_BLOCK SRB
  1327. );
  1328. BOOLEAN
  1329. SCCheckIfOkToPowerDown(
  1330. IN PDEVICE_EXTENSION DeviceExtension
  1331. );
  1332. NTSTATUS
  1333. SCIssueRequestToDevice(
  1334. IN PDEVICE_EXTENSION DeviceExtension,
  1335. IN PSTREAM_OBJECT StreamObject,
  1336. PSTREAM_REQUEST_BLOCK Request,
  1337. IN PVOID MinidriverRoutine,
  1338. IN PLIST_ENTRY Queue,
  1339. IN PIRP Irp
  1340. );
  1341. VOID
  1342. SCBeginSynchronizedMinidriverCallin(
  1343. IN PDEVICE_EXTENSION DeviceExtension,
  1344. IN PKIRQL Irql
  1345. );
  1346. VOID
  1347. SCBeginUnsynchronizedMinidriverCallin(
  1348. IN PDEVICE_EXTENSION DeviceExtension,
  1349. IN PKIRQL Irql
  1350. );
  1351. VOID
  1352. SCEndUnsynchronizedMinidriverDeviceCallin(
  1353. IN PDEVICE_EXTENSION DeviceExtension,
  1354. IN PKIRQL Irql
  1355. );
  1356. VOID
  1357. SCEndUnsynchronizedMinidriverStreamCallin(
  1358. IN PSTREAM_OBJECT StreamObject,
  1359. IN PKIRQL Irql
  1360. );
  1361. VOID
  1362. SCEndSynchronizedMinidriverStreamCallin(
  1363. IN PSTREAM_OBJECT StreamObject,
  1364. IN PKIRQL Irql
  1365. );
  1366. VOID
  1367. SCEndSynchronizedMinidriverDeviceCallin(
  1368. IN PDEVICE_EXTENSION DeviceExtension,
  1369. IN PKIRQL Irql
  1370. );
  1371. NTSTATUS
  1372. SCStartWorker(
  1373. IN PIRP Irp
  1374. );
  1375. NTSTATUS
  1376. SCShowIoPending(
  1377. IN PDEVICE_EXTENSION DeviceExtension,
  1378. IN PIRP Irp
  1379. );
  1380. VOID
  1381. SCWaitForOutstandingIo(
  1382. IN PDEVICE_EXTENSION DeviceExtension
  1383. );
  1384. VOID
  1385. SCCheckPoweredUp(
  1386. IN PDEVICE_EXTENSION DeviceExtension
  1387. );
  1388. VOID
  1389. SCCheckPowerDown(
  1390. IN PDEVICE_EXTENSION DeviceExtension
  1391. );
  1392. NTSTATUS
  1393. SCUninitializeCallback(
  1394. IN PSTREAM_REQUEST_BLOCK SRB
  1395. );
  1396. NTSTATUS
  1397. SCRemoveComplete(
  1398. IN PDEVICE_OBJECT DeviceObject,
  1399. IN PIRP Irp,
  1400. IN PVOID Context
  1401. );
  1402. VOID
  1403. SCRemoveCompleteWorkItem(
  1404. IN PDEVICE_EXTENSION DeviceExtension
  1405. );
  1406. VOID
  1407. SCDetachDevice(
  1408. IN PDEVICE_OBJECT Fdo,
  1409. IN PDEVICE_OBJECT Pdo
  1410. );
  1411. NTSTATUS
  1412. SCQueryWorker(
  1413. IN PDEVICE_OBJECT DeviceObject,
  1414. IN PIRP Irp
  1415. );
  1416. NTSTATUS
  1417. SCCallNextDriver(
  1418. IN PDEVICE_EXTENSION DeviceExtension,
  1419. IN PIRP Irp
  1420. );
  1421. VOID
  1422. StreamFlushIo(
  1423. IN PDEVICE_EXTENSION DeviceExtension,
  1424. IN PSTREAM_OBJECT StreamObject
  1425. );
  1426. NTSTATUS
  1427. ClockDispatchCreate(
  1428. IN PDEVICE_OBJECT DeviceObject,
  1429. IN PIRP Irp
  1430. );
  1431. NTSTATUS
  1432. SCOpenMasterCallback(
  1433. IN PSTREAM_REQUEST_BLOCK SRB
  1434. );
  1435. NTSTATUS
  1436. SCSetMasterClock(
  1437. IN PIRP Irp,
  1438. IN PKSPROPERTY Property,
  1439. IN OUT PHANDLE ClockHandle
  1440. );
  1441. NTSTATUS
  1442. SCClockGetTime(
  1443. IN PIRP Irp,
  1444. IN PKSPROPERTY Property,
  1445. IN OUT PULONGLONG StreamTime
  1446. );
  1447. NTSTATUS
  1448. SCClockGetPhysicalTime(
  1449. IN PIRP Irp,
  1450. IN PKSPROPERTY Property,
  1451. IN OUT PULONGLONG PhysicalTime
  1452. );
  1453. NTSTATUS
  1454. SCClockGetSynchronizedTime(
  1455. IN PIRP Irp,
  1456. IN PKSPROPERTY Property,
  1457. IN OUT PKSCORRELATED_TIME SyncTime
  1458. );
  1459. NTSTATUS
  1460. SCClockGetFunctionTable(
  1461. IN PIRP Irp,
  1462. IN PKSPROPERTY Property,
  1463. IN OUT PKSCLOCK_FUNCTIONTABLE FunctionTable
  1464. );
  1465. NTSTATUS
  1466. ClockDispatchClose(
  1467. IN PDEVICE_OBJECT DeviceObject,
  1468. IN PIRP Irp
  1469. );
  1470. ULONGLONG FASTCALL
  1471. SCGetSynchronizedTime(
  1472. IN PFILE_OBJECT FileObject,
  1473. IN PULONGLONG SystemTime
  1474. );
  1475. ULONGLONG FASTCALL
  1476. SCGetPhysicalTime(
  1477. IN PFILE_OBJECT FileObject
  1478. );
  1479. ULONGLONG
  1480. SCGetStreamTime(
  1481. IN PFILE_OBJECT FileObject
  1482. );
  1483. VOID
  1484. SCMinidriverTimeFunction(
  1485. IN PHW_TIME_CONTEXT TimeContext
  1486. );
  1487. NTSTATUS
  1488. ClockDispatchIoControl(
  1489. IN PDEVICE_OBJECT DeviceObject,
  1490. IN PIRP Irp
  1491. );
  1492. VOID
  1493. StreamClassQueryMasterClock(
  1494. IN PHW_STREAM_OBJECT HwStreamObject,
  1495. IN HANDLE MasterClockHandle,
  1496. IN TIME_FUNCTION TimeFunction,
  1497. IN PHW_QUERY_CLOCK_ROUTINE ClockCallbackRoutine
  1498. );
  1499. NTSTATUS
  1500. SCSendUnknownCommand(
  1501. IN PIRP Irp,
  1502. IN PDEVICE_EXTENSION DeviceExtension,
  1503. IN PVOID Callback,
  1504. OUT PBOOLEAN RequestIssued
  1505. );
  1506. NTSTATUS
  1507. SCPNPQueryCallback(
  1508. IN PSTREAM_REQUEST_BLOCK SRB
  1509. );
  1510. NTSTATUS
  1511. SCUnknownPNPCallback(
  1512. IN PSTREAM_REQUEST_BLOCK SRB
  1513. );
  1514. NTSTATUS
  1515. SCUnknownPowerCallback(
  1516. IN PSTREAM_REQUEST_BLOCK SRB
  1517. );
  1518. BOOLEAN
  1519. SCMapMemoryAddress(PACCESS_RANGE AccessRanges,
  1520. PHYSICAL_ADDRESS TranslatedAddress,
  1521. PPORT_CONFIGURATION_INFORMATION ConfigInfo,
  1522. PDEVICE_EXTENSION DeviceExtension,
  1523. PCM_RESOURCE_LIST ResourceList,
  1524. PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialResourceDescriptor
  1525. );
  1526. VOID
  1527. SCUpdatePersistedProperties(IN PSTREAM_OBJECT StreamObject,
  1528. IN PDEVICE_EXTENSION DeviceExtension,
  1529. IN PFILE_OBJECT FileObject
  1530. );
  1531. VOID
  1532. SCCreateSymbolicLinks(
  1533. IN PDEVICE_EXTENSION DeviceExtension
  1534. );
  1535. VOID
  1536. SCDestroySymbolicLinks(
  1537. IN PDEVICE_EXTENSION DeviceExtension
  1538. );
  1539. NTSTATUS
  1540. SCSynchCompletionRoutine(
  1541. IN PDEVICE_OBJECT DeviceObject,
  1542. IN PIRP Irp,
  1543. IN PKEVENT Event
  1544. );
  1545. VOID
  1546. SCSignalSRBEvent(
  1547. IN PSTREAM_REQUEST_BLOCK Srb
  1548. );
  1549. NTSTATUS
  1550. SCFilterTopologyHandler(
  1551. IN PIRP Irp,
  1552. IN PKSPROPERTY Property,
  1553. IN OUT PVOID Data);
  1554. NTSTATUS
  1555. SCStreamProposeNewFormat
  1556. (
  1557. IN PIRP Irp,
  1558. IN PKSPROPERTY Property,
  1559. IN OUT PKSDATAFORMAT Format
  1560. );
  1561. NTSTATUS
  1562. SCGetMasterClock(
  1563. IN PIRP Irp,
  1564. IN PKSPROPERTY Property,
  1565. IN OUT PHANDLE ClockHandle
  1566. );
  1567. NTSTATUS
  1568. SCCloseClockCallback(
  1569. IN PSTREAM_REQUEST_BLOCK SRB
  1570. );
  1571. NTSTATUS
  1572. SCStreamDeviceRate
  1573. (
  1574. IN PIRP Irp,
  1575. IN PKSPROPERTY Property,
  1576. IN OUT PKSRATE DeviceRate
  1577. );
  1578. NTSTATUS
  1579. SCStreamDeviceRateCapability
  1580. (
  1581. IN PIRP Irp,
  1582. IN PKSRATE_CAPABILITY RateCap,
  1583. IN OUT PKSRATE DeviceRate
  1584. );
  1585. NTSTATUS
  1586. SCFilterPinIntersectionHandler(
  1587. IN PIRP Irp,
  1588. IN PKSP_PIN Pin,
  1589. OUT PVOID Data
  1590. );
  1591. NTSTATUS
  1592. SCIntersectHandler(
  1593. IN PIRP Irp,
  1594. IN PKSP_PIN Pin,
  1595. IN PKSDATARANGE DataRange,
  1596. OUT PVOID Data
  1597. );
  1598. NTSTATUS
  1599. SCDataIntersectionCallback(
  1600. IN PSTREAM_REQUEST_BLOCK SRB
  1601. );
  1602. NTSTATUS
  1603. SCQueryCapabilities(
  1604. IN PDEVICE_OBJECT PdoDeviceObject,
  1605. IN PDEVICE_CAPABILITIES DeviceCapabilities
  1606. );
  1607. NTSTATUS
  1608. SCSynchPowerCompletionRoutine(
  1609. IN PDEVICE_OBJECT DeviceObject,
  1610. IN UCHAR MinorFunction,
  1611. IN POWER_STATE DeviceState,
  1612. IN PVOID Context,
  1613. IN PIO_STATUS_BLOCK IoStatus
  1614. );
  1615. NTSTATUS
  1616. SCGetStreamDeviceState
  1617. (
  1618. IN PIRP Irp,
  1619. IN PKSPROPERTY Property,
  1620. IN OUT PKSSTATE DeviceState
  1621. );
  1622. NTSTATUS
  1623. SCCreateChildPdo(
  1624. IN PVOID PnpId,
  1625. IN PDEVICE_OBJECT DeviceObject,
  1626. IN ULONG InstanceNumber
  1627. );
  1628. NTSTATUS
  1629. SCEnumerateChildren(
  1630. IN PDEVICE_OBJECT DeviceObject,
  1631. IN PIRP Irp
  1632. );
  1633. NTSTATUS
  1634. StreamClassEnumPnp(
  1635. IN PDEVICE_OBJECT DeviceObject,
  1636. IN PIRP Irp
  1637. );
  1638. NTSTATUS
  1639. StreamClassEnumPower(
  1640. IN PDEVICE_OBJECT DeviceObject,
  1641. IN PIRP Irp
  1642. );
  1643. NTSTATUS
  1644. SCEnumGetCaps(
  1645. IN PCHILD_DEVICE_EXTENSION DeviceExtension,
  1646. OUT PDEVICE_CAPABILITIES Capabilities
  1647. );
  1648. NTSTATUS
  1649. SCQueryEnumId(
  1650. IN PDEVICE_OBJECT DeviceObject,
  1651. IN BUS_QUERY_ID_TYPE BusQueryIdType,
  1652. IN OUT PWSTR * BusQueryId
  1653. );
  1654. NTSTATUS
  1655. AllocatorDispatchCreate(
  1656. IN PDEVICE_OBJECT DeviceObject,
  1657. IN PIRP Irp
  1658. );
  1659. NTSTATUS
  1660. StreamClassEnableEventHandler(
  1661. IN PIRP Irp,
  1662. IN PKSEVENTDATA EventData,
  1663. IN PKSEVENT_ENTRY EventEntry
  1664. );
  1665. VOID
  1666. StreamClassDisableEventHandler(
  1667. IN PFILE_OBJECT FileObject,
  1668. IN PKSEVENT_ENTRY EventEntry
  1669. );
  1670. VOID
  1671. SCUpdateMinidriverEvents(
  1672. IN ULONG NumEvents,
  1673. IN PKSEVENT_SET MinidriverEvents,
  1674. IN BOOLEAN Stream
  1675. );
  1676. NTSTATUS
  1677. SCEnableEventSynchronized(
  1678. IN PVOID ServiceContext
  1679. );
  1680. VOID
  1681. SCGetDeadListSynchronized(
  1682. IN PLIST_ENTRY NewListEntry
  1683. );
  1684. VOID
  1685. SCFreeDeadEvents(
  1686. IN PDEVICE_EXTENSION DeviceExtension
  1687. );
  1688. NTSTATUS
  1689. StreamClassForwardUnsupported(
  1690. IN PDEVICE_OBJECT DeviceObject,
  1691. IN PIRP Irp
  1692. );
  1693. NTSTATUS
  1694. SCStreamSetFormat
  1695. (
  1696. IN PIRP Irp,
  1697. IN PKSPROPERTY Property,
  1698. IN OUT PKSDATAFORMAT Format
  1699. );
  1700. VOID
  1701. SCInsertStreamInfo(
  1702. IN PDEVICE_EXTENSION DeviceExtension,
  1703. IN PKSPIN_DESCRIPTOR PinDescs,
  1704. IN PHW_STREAM_DESCRIPTOR StreamDescriptor,
  1705. IN ULONG NumberOfPins
  1706. );
  1707. VOID
  1708. SCRescanStreams(
  1709. IN PDEVICE_EXTENSION DeviceExtension
  1710. );
  1711. NTSTATUS
  1712. SCGetStreamHeaderSize(
  1713. IN PIRP Irp,
  1714. IN PKSPROPERTY Property,
  1715. IN OUT PULONG StreamHeaderSize
  1716. );
  1717. VOID
  1718. SCInterlockedRemoveEntryList(
  1719. PDEVICE_EXTENSION DeviceExtension,
  1720. PLIST_ENTRY List
  1721. );
  1722. VOID
  1723. SCInsertFiltersInDevice(
  1724. IN PFILTER_INSTANCE FilterInstance,
  1725. IN PDEVICE_EXTENSION DeviceExtension
  1726. );
  1727. NTSTATUS
  1728. SCBustedSynchPowerCompletionRoutine(
  1729. IN PDEVICE_OBJECT DeviceObject,
  1730. IN UCHAR MinorFunction,
  1731. IN POWER_STATE DeviceState,
  1732. IN PVOID Context,
  1733. IN PIO_STATUS_BLOCK IoStatus
  1734. );
  1735. BOOLEAN
  1736. SCCheckIfStreamsRunning(
  1737. IN PFILTER_INSTANCE FilterInstance
  1738. );
  1739. #if DBG
  1740. BOOLEAN
  1741. SCDebugKeSynchronizeExecution(
  1742. IN PKINTERRUPT Interrupt,
  1743. IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
  1744. IN PVOID SynchronizeContext
  1745. );
  1746. #endif // DEBUG
  1747. NTSTATUS
  1748. SCEnableDeviceEventSynchronized(
  1749. IN PVOID ServiceContext
  1750. );
  1751. NTSTATUS
  1752. StreamClassEnableDeviceEventHandler(
  1753. IN PIRP Irp,
  1754. IN PKSEVENTDATA EventData,
  1755. IN PKSEVENT_ENTRY EventEntry
  1756. );
  1757. VOID
  1758. StreamClassDisableDeviceEventHandler(
  1759. IN PFILE_OBJECT FileObject,
  1760. IN PKSEVENT_ENTRY EventEntry
  1761. );
  1762. VOID
  1763. SCCallBackSrb(
  1764. IN PSTREAM_REQUEST_BLOCK Srb,
  1765. IN PDEVICE_EXTENSION DeviceExtension
  1766. );
  1767. NTSTATUS
  1768. DllUnload(
  1769. VOID
  1770. );
  1771. VOID
  1772. SCPowerCompletionWorker(
  1773. IN PIRP SystemIrp
  1774. );
  1775. VOID
  1776. SCSendSurpriseNotification(
  1777. IN PDEVICE_EXTENSION DeviceExtension,
  1778. IN PIRP Irp
  1779. );
  1780. #if DBG
  1781. VOID
  1782. SCDebugPriorityWorkItem(
  1783. IN PDEBUG_WORK_ITEM WorkItemStruct
  1784. );
  1785. #endif
  1786. PKSPROPERTY_SET
  1787. SCCopyMinidriverProperties(
  1788. IN ULONG NumProps,
  1789. IN PKSPROPERTY_SET MinidriverProps
  1790. );
  1791. PKSEVENT_SET
  1792. SCCopyMinidriverEvents(
  1793. IN ULONG NumEvents,
  1794. IN PKSEVENT_SET MinidriverEvents
  1795. );
  1796. #ifdef ENABLE_STREAM_CLASS_AS_ALLOCATOR
  1797. NTSTATUS
  1798. SCStreamAllocatorFraming(
  1799. IN PIRP Irp,
  1800. IN PKSPROPERTY Property,
  1801. IN OUT PKSALLOCATOR_FRAMING Framing
  1802. );
  1803. NTSTATUS
  1804. SCStreamAllocator(
  1805. IN PIRP Irp,
  1806. IN PKSPROPERTY Property,
  1807. IN OUT PHANDLE AllocatorHandle
  1808. );
  1809. NTSTATUS
  1810. IoCompletionRoutine(
  1811. PDEVICE_OBJECT DeviceObject,
  1812. PIRP Irp,
  1813. PVOID Context
  1814. );
  1815. NTSTATUS
  1816. CleanupTransfer(
  1817. IN PFILTER_INSTANCE FilterInstance,
  1818. IN PSTREAM_OBJECT StreamObject
  1819. );
  1820. NTSTATUS
  1821. EndTransfer(
  1822. IN PFILTER_INSTANCE FilterInstance,
  1823. IN PSTREAM_OBJECT StreamObject
  1824. );
  1825. NTSTATUS
  1826. BeginTransfer(
  1827. IN PFILTER_INSTANCE FilterInstance,
  1828. IN PSTREAM_OBJECT StreamObject
  1829. );
  1830. NTSTATUS
  1831. PrepareTransfer(
  1832. IN PFILTER_INSTANCE FilterInstance,
  1833. IN PSTREAM_OBJECT StreamObject
  1834. );
  1835. NTSTATUS
  1836. PinCreateHandler(
  1837. IN PIRP Irp,
  1838. IN PSTREAM_OBJECT StreamObject
  1839. );
  1840. NTSTATUS
  1841. AllocateFrame(
  1842. PFILE_OBJECT Allocator,
  1843. PVOID *Frame
  1844. );
  1845. NTSTATUS
  1846. FreeFrame(
  1847. PFILE_OBJECT Allocator,
  1848. PVOID Frame
  1849. );
  1850. #endif //ENABLE_STREAM_CLASS_AS_ALLOCATOR
  1851. #ifdef ENABLE_KS_METHODS
  1852. NTSTATUS
  1853. SCProcessCompletedMethodRequest(
  1854. IN PSTREAM_REQUEST_BLOCK SRB
  1855. );
  1856. NTSTATUS
  1857. StreamClassMinidriverStreamMethod
  1858. (
  1859. IN PIRP Irp,
  1860. IN PKSMETHOD Method,
  1861. IN OUT PVOID MethodInfo
  1862. );
  1863. NTSTATUS
  1864. StreamClassMinidriverDeviceMethod
  1865. (
  1866. IN PIRP Irp,
  1867. IN PKSMETHOD Method,
  1868. IN OUT PVOID MethodInfo
  1869. );
  1870. NTSTATUS
  1871. SCMinidriverStreamMethodHandler(
  1872. IN SRB_COMMAND Command,
  1873. IN PIRP Irp,
  1874. IN PKSMETHOD Method,
  1875. IN OUT PVOID MethodInfo
  1876. );
  1877. NTSTATUS
  1878. SCMinidriverDeviceMethodHandler(
  1879. IN SRB_COMMAND Command,
  1880. IN PIRP Irp,
  1881. IN PKSMETHOD Method,
  1882. IN OUT PVOID MethodInfo
  1883. );
  1884. VOID
  1885. SCUpdateMinidriverMethods(
  1886. IN ULONG NumMethods,
  1887. IN PKSMETHOD_SET MinidriverMethods,
  1888. IN BOOLEAN Stream
  1889. );
  1890. PKSMETHOD_SET
  1891. SCCopyMinidriverMethods(
  1892. IN ULONG NumMethods,
  1893. IN PKSMETHOD_SET MinidriverMethods
  1894. );
  1895. NTSTATUS
  1896. SCStreamMethodHandler(
  1897. IN PIRP Irp,
  1898. IN PKSMETHOD Method,
  1899. IN OUT PVOID MethodInfo
  1900. );
  1901. NTSTATUS
  1902. SCStreamAllocatorMethodHandler(
  1903. IN PIRP Irp,
  1904. IN PKSMETHOD Method,
  1905. IN OUT PVOID MethodInfo
  1906. );
  1907. #endif
  1908. #if ENABLE_MULTIPLE_FILTER_TYPES
  1909. NTSTATUS
  1910. SciOnFilterStreamDescriptor(
  1911. PFILTER_INSTANCE FilterInstance,
  1912. PHW_STREAM_DESCRIPTOR StreamDescriptor);
  1913. VOID
  1914. SciInsertFilterStreamInfo(
  1915. IN PFILTER_INSTANCE FilterInstance,
  1916. IN PKSPIN_DESCRIPTOR PinDescs,
  1917. IN ULONG NumberOfPins);
  1918. NTSTATUS
  1919. SciFreeFilterInstance(
  1920. PFILTER_INSTANCE pFilterInstance
  1921. );
  1922. NTSTATUS
  1923. SciQuerySystemPowerHiberCallback(
  1924. IN PSTREAM_REQUEST_BLOCK SRB
  1925. );
  1926. #endif // ENABLE_MULTIPLE_FILTER_TYPES
  1927. #define SCLOG_FLAGS_CLOCK 0x00000001
  1928. #define SCLOG_FLAGS_PNP 0x00000002
  1929. #define SCLOG_FLAGS_PRINT 0x80000000
  1930. #if (DBG) && !defined(_WIN64)
  1931. NTSTATUS SCLog( ULONG ulTag, ULONG ulArg1, ULONG ulArg2, ULONG ulArg3 );
  1932. NTSTATUS SCLogWithTime( ULONG ulTag, ULONG ulArg1, ULONG ulArg2 );
  1933. #define SCLOG( ulTag, Arg1, Arg2, Arg3 ) SCLog( ulTag, (ULONG)Arg1, (ULONG)Arg2, (ULONG)Arg3 )
  1934. #define SCLOGWITHTIME( ulTag, Arg1, Arg2 ) SCLogWithTime( ulTag, Arg1, Arg2 )
  1935. #else
  1936. #define SCLOG( ulTag, Arg1, Arg2, Arg3 )
  1937. #define SCLOGWITHTIME( ulTag, Arg1, Arg2 )
  1938. #endif
  1939. #endif // #ifndef _STREAMCLASS_H