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

513 lines
9.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: proto.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef ___REDBOOK_PROTOTYPES_H
  11. #define ___REDBOOK_PROTOTYPES_H
  12. //////////////////////////////////////////////////////////////////////
  13. //
  14. // From redbook\pnp.c
  15. //
  16. NTSTATUS
  17. DriverEntry(
  18. IN PDRIVER_OBJECT DriverObject,
  19. IN PUNICODE_STRING RegistryPath
  20. );
  21. NTSTATUS
  22. RedBookAddDevice(
  23. IN PDRIVER_OBJECT DriverObject,
  24. IN PDEVICE_OBJECT PhysicalDeviceObject
  25. );
  26. NTSTATUS
  27. RedBookPnp(
  28. IN PDEVICE_OBJECT DeviceObject,
  29. IN PIRP Irp
  30. );
  31. NTSTATUS
  32. RedBookPnpRemoveDevice(
  33. IN PDEVICE_OBJECT DeviceObject,
  34. IN PIRP Irp
  35. );
  36. NTSTATUS
  37. RedBookPnpStopDevice(
  38. IN PDEVICE_OBJECT DeviceObject,
  39. IN PIRP Irp
  40. );
  41. NTSTATUS
  42. RedBookPnpStartDevice(
  43. IN PDEVICE_OBJECT DeviceObject
  44. );
  45. VOID
  46. RedBookUnload(
  47. IN PDRIVER_OBJECT DriverObject
  48. );
  49. //////////////////////////////////////////////////////////
  50. #if DBG
  51. #define VerifyCalledByThread(D) \
  52. ASSERT(PsGetCurrentThread() == (D)->Thread.SelfPointer)
  53. #else // !DBG
  54. #define VerifyCalledByThread(D) // Nop
  55. #endif // !DBG
  56. //////////////////////////////////////////////////////////////////////
  57. //
  58. // From redbook\errlog.c
  59. //
  60. VOID
  61. RedBookLogError(
  62. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  63. IN NTSTATUS IoErrorCode,
  64. IN NTSTATUS FinalStatus
  65. );
  66. //////////////////////////////////////////////////////////////////////
  67. //
  68. // From redbook\wmi.c
  69. //
  70. NTSTATUS
  71. RedBookWmiUninit(
  72. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  73. );
  74. NTSTATUS
  75. RedBookWmiInit(
  76. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  77. );
  78. NTSTATUS
  79. RedBookWmiQueryDataBlock (
  80. IN PDEVICE_OBJECT DeviceObject,
  81. IN PIRP Irp,
  82. IN ULONG GuidIndex,
  83. IN ULONG InstanceIndex,
  84. IN ULONG InstanceCount,
  85. IN OUT PULONG InstanceLengthArray,
  86. IN ULONG OutBufferSize,
  87. OUT PUCHAR Buffer
  88. );
  89. NTSTATUS
  90. RedBookWmiSetDataBlock(
  91. IN PDEVICE_OBJECT DeviceObject,
  92. IN PIRP Irp,
  93. IN ULONG GuidIndex,
  94. IN ULONG InstanceIndex,
  95. IN ULONG BufferSize,
  96. IN PUCHAR Buffer
  97. );
  98. NTSTATUS
  99. RedBookWmiSetDataItem(
  100. IN PDEVICE_OBJECT DeviceObject,
  101. IN PIRP Irp,
  102. IN ULONG GuidIndex,
  103. IN ULONG InstanceIndex,
  104. IN ULONG DataItemId,
  105. IN ULONG BufferSize,
  106. IN PUCHAR Buffer
  107. );
  108. NTSTATUS
  109. RedBookWmiSystemControl(
  110. IN PDEVICE_OBJECT DeviceObject,
  111. IN PIRP Irp
  112. );
  113. VOID
  114. RedBookThreadWmiHandler(
  115. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  116. PLIST_ENTRY ListEntry
  117. );
  118. NTSTATUS
  119. RedBookWmiQueryRegInfo(
  120. IN PDEVICE_OBJECT DeviceObject,
  121. OUT PULONG RegFlags,
  122. OUT PUNICODE_STRING InstanceName,
  123. OUT PUNICODE_STRING *RegistryPath,
  124. OUT PUNICODE_STRING MofResourceName,
  125. OUT PDEVICE_OBJECT *PhysicalDeviceObject
  126. );
  127. VOID
  128. RedBookWmiCopyPerfInfo(
  129. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  130. OUT PREDBOOK_WMI_PERF_DATA Out
  131. );
  132. //////////////////////////////////////////////////////////////////////
  133. //
  134. // From redbook\sysaudio.c
  135. //
  136. NTSTATUS
  137. OpenSysAudio(
  138. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  139. );
  140. NTSTATUS
  141. CloseSysAudio(
  142. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  143. );
  144. NTSTATUS
  145. GetPinProperty(
  146. IN PFILE_OBJECT FileObject,
  147. IN ULONG PropertyId,
  148. IN ULONG PinId,
  149. IN ULONG PropertySize,
  150. OUT PVOID Property
  151. );
  152. NTSTATUS
  153. GetVolumeNodeId(
  154. IN PFILE_OBJECT FileObject,
  155. OUT PULONG VolumeNodeId
  156. );
  157. NTSTATUS
  158. UninitializeVirtualSource(
  159. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  160. );
  161. NTSTATUS
  162. InitializeVirtualSource(
  163. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  164. );
  165. NTSTATUS
  166. AttachVirtualSource(
  167. IN PFILE_OBJECT FileObject,
  168. IN ULONG MixerPinId
  169. );
  170. VOID
  171. SetNextDeviceState(
  172. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  173. KSSTATE State
  174. );
  175. VOID
  176. RedBookKsSetVolume(
  177. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  178. );
  179. NTSTATUS
  180. OpenInterfaceByGuid(
  181. IN CONST GUID * InterfaceClassGuid,
  182. OUT HANDLE * Handle,
  183. OUT PFILE_OBJECT * FileObject
  184. );
  185. //////////////////////////////////////////////////////////////////////
  186. //
  187. // From redbook\redbook.c
  188. //
  189. NTSTATUS
  190. RedBookRegistryRead(
  191. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  192. );
  193. NTSTATUS
  194. RedBookRegistryWrite(
  195. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  196. );
  197. NTSTATUS
  198. RedBookReadWrite(
  199. PDEVICE_OBJECT DeviceObject,
  200. PIRP Irp
  201. );
  202. NTSTATUS
  203. RedBookSignalCompletion(
  204. IN PDEVICE_OBJECT DeviceObject,
  205. IN PIRP Irp,
  206. IN PKEVENT Event
  207. );
  208. NTSTATUS
  209. RedBookSetTransferLength(
  210. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension
  211. );
  212. NTSTATUS
  213. RedBookPower(
  214. IN PDEVICE_OBJECT DeviceObject,
  215. IN PIRP Irp
  216. );
  217. NTSTATUS
  218. RedBookDeviceControl(
  219. PDEVICE_OBJECT DeviceObject,
  220. PIRP Irp
  221. );
  222. NTSTATUS
  223. RedBookForwardIrpSynchronous(
  224. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  225. IN PIRP Irp
  226. );
  227. NTSTATUS
  228. RedBookGetDescriptor(
  229. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  230. IN PSTORAGE_PROPERTY_ID PropertyId,
  231. OUT PSTORAGE_DESCRIPTOR_HEADER *Descriptor
  232. );
  233. //////////////////////////////////////////////////////////
  234. //
  235. // from redbook\ioctl.c
  236. //
  237. VOID
  238. RedBookDCPause(
  239. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  240. PREDBOOK_THREAD_IOCTL_DATA Context
  241. );
  242. VOID
  243. RedBookDCStop(
  244. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  245. PREDBOOK_THREAD_IOCTL_DATA Context
  246. );
  247. VOID
  248. RedBookDCResume(
  249. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  250. PREDBOOK_THREAD_IOCTL_DATA Context
  251. );
  252. VOID
  253. RedBookDCPlay(
  254. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  255. PREDBOOK_THREAD_IOCTL_DATA Context
  256. );
  257. VOID
  258. RedBookDCSeek(
  259. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  260. PREDBOOK_THREAD_IOCTL_DATA Context
  261. );
  262. VOID
  263. RedBookDCReadQ(
  264. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  265. PREDBOOK_THREAD_IOCTL_DATA Context
  266. );
  267. VOID
  268. RedBookDCCheckVerify(
  269. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  270. PREDBOOK_THREAD_IOCTL_DATA Context
  271. );
  272. VOID
  273. RedBookDCSetVolume(
  274. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  275. PREDBOOK_THREAD_IOCTL_DATA Context
  276. );
  277. VOID
  278. RedBookDCGetVolume(
  279. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  280. PREDBOOK_THREAD_IOCTL_DATA Context
  281. );
  282. VOID
  283. RedBookDCDefault(
  284. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  285. PREDBOOK_THREAD_IOCTL_DATA Context
  286. );
  287. VOID
  288. RedBookThreadIoctlHandler(
  289. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  290. PLIST_ENTRY ListEntry
  291. );
  292. NTSTATUS
  293. RedBookCompleteIoctl(
  294. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  295. IN PREDBOOK_THREAD_IOCTL_DATA Context,
  296. IN BOOLEAN SendToLowerDriver
  297. );
  298. VOID
  299. RedBookThreadIoctlCompletionHandler(
  300. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  301. );
  302. //////////////////////////////////////////////////////////////////////
  303. //
  304. // From redbook\thread.c
  305. //
  306. VOID
  307. RedBookSystemThread(
  308. PVOID Context
  309. );
  310. VOID
  311. RedBookReadRaw(
  312. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  313. PREDBOOK_COMPLETION_CONTEXT Context
  314. );
  315. NTSTATUS
  316. RedBookReadRawCompletion(
  317. PVOID UnusableParameter,
  318. PIRP Irp,
  319. PREDBOOK_COMPLETION_CONTEXT Context
  320. );
  321. VOID
  322. RedBookStream(
  323. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  324. PREDBOOK_COMPLETION_CONTEXT Context
  325. );
  326. NTSTATUS
  327. RedBookStreamCompletion(
  328. PVOID UnusableParameter,
  329. PIRP Irp,
  330. PREDBOOK_COMPLETION_CONTEXT Context
  331. );
  332. ULONG
  333. GetCdromState(
  334. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  335. );
  336. LONG
  337. SetCdromState(
  338. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  339. IN LONG ExpectedOldState,
  340. IN LONG NewState
  341. );
  342. VOID
  343. RedBookDeallocatePlayResources(
  344. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  345. );
  346. NTSTATUS
  347. RedBookAllocatePlayResources(
  348. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  349. );
  350. BOOLEAN
  351. RedBookArePlayResourcesAllocated(
  352. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  353. );
  354. NTSTATUS
  355. RedBookCacheToc(
  356. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  357. );
  358. ULONG
  359. WhichTrackContainsThisLBA(
  360. PCDROM_TOC Toc,
  361. ULONG Lba
  362. );
  363. VOID
  364. RedBookThreadDigitalHandler(
  365. IN PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  366. PLIST_ENTRY ListEntry
  367. );
  368. VOID
  369. AddWmiStats(
  370. PREDBOOK_DEVICE_EXTENSION DeviceExtension,
  371. PREDBOOK_COMPLETION_CONTEXT Context
  372. );
  373. VOID
  374. RedBookCheckForDiscChangeAndFreeResources(
  375. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  376. );
  377. NTSTATUS
  378. SysAudioPnpNotification(
  379. PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification,
  380. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  381. );
  382. VOID
  383. RedBookCheckForAudioDeviceRemoval(
  384. PREDBOOK_DEVICE_EXTENSION DeviceExtension
  385. );
  386. //////////////////////////////////////////////////////////////////////
  387. __inline
  388. ULONG
  389. SafeMod(
  390. IN ULONG Value,
  391. IN ULONG ModBy
  392. )
  393. {
  394. return ((Value+ModBy)%ModBy);
  395. }
  396. __inline
  397. NTSTATUS
  398. RedBookSendToNextDriver(
  399. PDEVICE_OBJECT DeviceObject,
  400. PIRP Irp
  401. )
  402. /*++
  403. Routine Description:
  404. This routine is sends the Irp to the next driver in line
  405. when the Irp is not processed by this driver.
  406. This happens quite often, so should not have any debug statements.
  407. Request this as an inline operation for speed.
  408. Arguments:
  409. DeviceObject
  410. Irp
  411. Return Value:
  412. NTSTATUS
  413. --*/
  414. {
  415. IoSkipCurrentIrpStackLocation(Irp);
  416. return IoCallDriver(((PREDBOOK_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->TargetDeviceObject,Irp);
  417. }
  418. //////////////////////////////////////////////////////////////////////
  419. #endif // ___REDBOOK_PROTOTYPES_H