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.

619 lines
12 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: funcdecl.h
  8. //
  9. //--------------------------------------------------------------------------
  10. //
  11. // Function declarations for the ParClass (parallel.sys) driver
  12. //
  13. VOID
  14. ParDumpDevExtTable();
  15. NTSTATUS
  16. ParWMIRegistrationControl(
  17. IN PDEVICE_OBJECT DeviceObject,
  18. IN ULONG Action
  19. );
  20. BOOLEAN
  21. ParIsPodo(
  22. IN PDEVICE_OBJECT DevObj
  23. );
  24. NTSTATUS
  25. ParWmiPdoInitWmi(
  26. IN PDEVICE_OBJECT DeviceObject
  27. );
  28. NTSTATUS
  29. ParWmiPdoSystemControlDispatch(
  30. IN PDEVICE_OBJECT DeviceObject,
  31. IN PIRP Irp
  32. );
  33. PCHAR
  34. Par3QueryDeviceId(
  35. IN PDEVICE_EXTENSION Extension,
  36. OUT PCHAR DeviceIdBuffer,
  37. IN ULONG BufferSize,
  38. OUT PULONG DeviceIdSize,
  39. IN BOOLEAN bReturnRawString, // TRUE == include the 2 size bytes in the returned string
  40. IN BOOLEAN bBuildStlDeviceId
  41. );
  42. PDEVICE_OBJECT
  43. ParDetectCreatePdo(PDEVICE_OBJECT legacyPodo, UCHAR Dot3Id, BOOLEAN bStlDot3Id);
  44. NTSTATUS
  45. ParBuildSendInternalIoctl(
  46. IN ULONG IoControlCode,
  47. IN PDEVICE_OBJECT TargetDeviceObject,
  48. IN PVOID InputBuffer OPTIONAL,
  49. IN ULONG InputBufferLength,
  50. OUT PVOID OutputBuffer OPTIONAL,
  51. IN ULONG OutputBufferLength,
  52. IN PLARGE_INTEGER Timeout OPTIONAL
  53. );
  54. //
  55. // initunld.c - driver initialization and unload
  56. //
  57. NTSTATUS
  58. DriverEntry(
  59. IN PDRIVER_OBJECT DriverObject,
  60. IN PUNICODE_STRING RegistryPath
  61. );
  62. VOID
  63. ParUnload(
  64. IN PDRIVER_OBJECT DriverObject
  65. );
  66. NTSTATUS
  67. ParPower(
  68. IN PDEVICE_OBJECT pDeviceObject,
  69. IN PIRP pIrp
  70. );
  71. NTSTATUS
  72. ParPdoPower(
  73. IN PDEVICE_EXTENSION Extension,
  74. IN PIRP pIrp
  75. );
  76. NTSTATUS
  77. ParFdoPower(
  78. IN PDEVICE_EXTENSION Extension,
  79. IN PIRP pIrp
  80. );
  81. // parclass.c ?
  82. VOID
  83. ParLogError(
  84. IN PDRIVER_OBJECT DriverObject,
  85. IN PDEVICE_OBJECT DeviceObject OPTIONAL,
  86. IN PHYSICAL_ADDRESS P1,
  87. IN PHYSICAL_ADDRESS P2,
  88. IN ULONG SequenceNumber,
  89. IN UCHAR MajorFunctionCode,
  90. IN UCHAR RetryCount,
  91. IN ULONG UniqueErrorValue,
  92. IN NTSTATUS FinalStatus,
  93. IN NTSTATUS SpecificIOStatus
  94. );
  95. UCHAR
  96. ParInitializeDevice(
  97. IN PDEVICE_EXTENSION Extension
  98. );
  99. VOID
  100. ParNotInitError(
  101. IN PDEVICE_EXTENSION Extension,
  102. IN UCHAR DeviceStatus
  103. );
  104. VOID
  105. ParStartIo(
  106. IN PDEVICE_EXTENSION Extension
  107. );
  108. VOID
  109. ParallelThread(
  110. IN PVOID Context
  111. );
  112. NTSTATUS
  113. ParCreateSystemThread(
  114. PDEVICE_EXTENSION Extension
  115. );
  116. VOID
  117. ParCancelRequest(
  118. PDEVICE_OBJECT DeviceObject,
  119. PIRP Irp
  120. );
  121. // exports.c
  122. USHORT
  123. ParExportedDetermineIeeeModes(
  124. IN PDEVICE_EXTENSION Extension
  125. );
  126. NTSTATUS
  127. ParExportedIeeeFwdToRevMode(
  128. IN PDEVICE_EXTENSION Extension
  129. );
  130. NTSTATUS
  131. ParExportedIeeeRevToFwdMode(
  132. IN PDEVICE_EXTENSION Extension
  133. );
  134. NTSTATUS
  135. ParExportedNegotiateIeeeMode(
  136. IN PDEVICE_EXTENSION Extension,
  137. IN USHORT ModeMaskFwd,
  138. IN USHORT ModeMaskRev,
  139. IN PARALLEL_SAFETY ModeSafety,
  140. IN BOOLEAN IsForward
  141. );
  142. NTSTATUS
  143. ParExportedTerminateIeeeMode(
  144. IN PDEVICE_EXTENSION Extension
  145. );
  146. NTSTATUS
  147. ParExportedParallelRead(
  148. IN PDEVICE_EXTENSION Extension,
  149. IN PVOID Buffer,
  150. IN ULONG NumBytesToRead,
  151. OUT PULONG NumBytesRead,
  152. IN UCHAR Channel
  153. );
  154. NTSTATUS
  155. ParExportedParallelWrite(
  156. IN PDEVICE_EXTENSION Extension,
  157. OUT PVOID Buffer,
  158. IN ULONG NumBytesToWrite,
  159. OUT PULONG NumBytesWritten,
  160. IN UCHAR Channel
  161. );
  162. NTSTATUS
  163. ParTerminateParclassMode(
  164. IN PDEVICE_EXTENSION Extension
  165. );
  166. VOID
  167. ParWriteIo(
  168. IN PDEVICE_EXTENSION Extension
  169. );
  170. VOID
  171. ParReadIo(
  172. IN PDEVICE_EXTENSION Extension
  173. );
  174. VOID
  175. ParDeviceIo(
  176. IN PDEVICE_EXTENSION Extension
  177. );
  178. // pnp?
  179. NTSTATUS
  180. DriverEntry(
  181. IN PDRIVER_OBJECT DriverObject,
  182. IN PUNICODE_STRING RegistryPath
  183. );
  184. NTSTATUS
  185. ParPnpAddDevice(
  186. IN PDRIVER_OBJECT pDriverObject,
  187. IN PDEVICE_OBJECT pPhysicalDeviceObject
  188. );
  189. NTSTATUS
  190. ParParallelPnp(
  191. IN PDEVICE_OBJECT pDeviceObject,
  192. IN PIRP pIrp
  193. );
  194. NTSTATUS
  195. ParPdoParallelPnp(
  196. IN PDEVICE_OBJECT pDeviceObject,
  197. IN PIRP pIrp
  198. );
  199. NTSTATUS
  200. ParFdoParallelPnp(
  201. IN PDEVICE_OBJECT pDeviceObject,
  202. IN PIRP pIrp
  203. );
  204. NTSTATUS
  205. ParSynchCompletionRoutine(
  206. IN PDEVICE_OBJECT DeviceObject,
  207. IN PIRP Irp,
  208. IN PKEVENT Event
  209. );
  210. PDEVICE_OBJECT
  211. ParPnpCreateDevice(
  212. IN PDRIVER_OBJECT pDriverObject
  213. );
  214. BOOLEAN
  215. ParMakeNames(
  216. IN ULONG ParallelPortNumber,
  217. OUT PUNICODE_STRING ClassName,
  218. OUT PUNICODE_STRING LinkName
  219. );
  220. VOID
  221. ParCheckParameters(
  222. IN OUT PDEVICE_EXTENSION Extension
  223. );
  224. VOID
  225. ParPnpFindDeviceIdKeys(
  226. OUT PUCHAR *lppMFG,
  227. OUT PUCHAR *lppMDL,
  228. OUT PUCHAR *lppCLS,
  229. OUT PUCHAR *lppDES,
  230. OUT PUCHAR *lppAID,
  231. OUT PUCHAR *lppCID,
  232. IN PUCHAR lpDeviceID
  233. );
  234. VOID
  235. ParDot3ParseDevId(
  236. PUCHAR *lpp_DL,
  237. PUCHAR *lpp_C,
  238. PUCHAR *lpp_CMD,
  239. PUCHAR *lpp_4DL,
  240. PUCHAR *lpp_M,
  241. PUCHAR lpDeviceID
  242. );
  243. VOID
  244. GetCheckSum(
  245. IN PUCHAR Block,
  246. IN USHORT Len,
  247. OUT PUSHORT CheckSum
  248. );
  249. BOOLEAN
  250. String2Num(
  251. IN OUT PUCHAR *lpp_Str,
  252. IN CHAR c,
  253. OUT ULONG *num
  254. );
  255. UCHAR
  256. StringCountValues(
  257. IN PCHAR string,
  258. IN CHAR delimeter
  259. );
  260. PUCHAR
  261. StringChr(
  262. IN PCHAR string,
  263. IN CHAR c
  264. );
  265. ULONG
  266. StringLen(
  267. IN PUCHAR string
  268. );
  269. VOID
  270. StringSubst(
  271. IN OUT PUCHAR lpS,
  272. IN UCHAR chTargetChar,
  273. IN UCHAR chReplacementChar,
  274. IN USHORT cbS
  275. );
  276. BOOLEAN
  277. ParSelectDevice(
  278. IN PDEVICE_EXTENSION Extension,
  279. IN BOOLEAN HavePort
  280. );
  281. BOOLEAN
  282. ParDeselectDevice(
  283. IN PDEVICE_EXTENSION Extension,
  284. IN BOOLEAN KeepPort
  285. );
  286. #if DBG
  287. VOID
  288. ParDumpDeviceObjectList(
  289. PDEVICE_OBJECT ParClassFdo
  290. );
  291. #endif
  292. NTSTATUS
  293. ParAcquireRemoveLock(
  294. IN PIO_REMOVE_LOCK RemoveLock,
  295. IN PVOID Tag OPTIONAL
  296. );
  297. VOID
  298. ParReleaseRemoveLock(
  299. IN PIO_REMOVE_LOCK RemoveLock,
  300. IN PVOID Tag OPTIONAL
  301. );
  302. VOID
  303. ParReleaseRemoveLockAndWait(
  304. IN PIO_REMOVE_LOCK RemoveLock,
  305. IN PVOID Tag
  306. );
  307. NTSTATUS
  308. ParPnpInterfaceChangeNotify(
  309. IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION pDeviceInterfaceChangeNotification,
  310. IN PVOID pContext
  311. );
  312. VOID
  313. ParMakeClassNameFromNumber(
  314. IN ULONG Number,
  315. OUT PUNICODE_STRING ClassName
  316. );
  317. VOID
  318. ParMakeDotClassNameFromBaseClassName(
  319. IN PUNICODE_STRING BaseClassName,
  320. IN ULONG Number,
  321. OUT PUNICODE_STRING DotClassName
  322. );
  323. VOID
  324. ParInitCommonDOPre(PDEVICE_OBJECT DevObj, PDEVICE_OBJECT Fdo, PUNICODE_STRING ClassName);
  325. VOID
  326. ParInitCommonDOPost(PDEVICE_OBJECT DevObj);
  327. NTSTATUS
  328. ParInitPdo(
  329. IN PDEVICE_OBJECT NewPdo,
  330. IN PUCHAR DeviceIdString,
  331. IN ULONG DeviceIdLength,
  332. IN PDEVICE_OBJECT LegacyPodo,
  333. IN UCHAR Dot3Id
  334. );
  335. NTSTATUS
  336. ParInitLegacyPodo(PDEVICE_OBJECT LegacyPodo, PUNICODE_STRING PortSymbolicLinkName);
  337. VOID
  338. ParAddDevObjToFdoList(PDEVICE_OBJECT DevObj);
  339. PDEVICE_OBJECT
  340. ParCreateLegacyPodo(PDEVICE_OBJECT Fdo, PUNICODE_STRING PortSymbolicLinkName);
  341. VOID
  342. ParAcquireListMutexAndKillDeviceObject(PDEVICE_OBJECT Fdo, PDEVICE_OBJECT DevObj);
  343. VOID
  344. ParKillDeviceObject(
  345. PDEVICE_OBJECT DeviceObject
  346. );
  347. PWSTR
  348. ParCreateWideStringFromUnicodeString(
  349. PUNICODE_STRING UnicodeString
  350. );
  351. PDEVICE_OBJECT
  352. ParDetectCreateEndOfChainPdo(PDEVICE_OBJECT LegacyPodo);
  353. VOID
  354. ParEnumerate1284_3Devices(
  355. IN PDEVICE_OBJECT pFdoDeviceObject,
  356. IN PDEVICE_OBJECT pPortDeviceObject,
  357. IN PDEVICE_OBJECT EndOfChainDeviceObject
  358. );
  359. NTSTATUS
  360. ParPnpNotifyTargetDeviceChange(
  361. IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION pDeviceInterfaceChangeNotification,
  362. IN PDEVICE_OBJECT pFdoDeviceObject
  363. );
  364. NTSTATUS
  365. ParPnpNotifyInterfaceChange(
  366. IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION NotificationStruct,
  367. IN PDEVICE_OBJECT Fdo
  368. );
  369. NTSTATUS
  370. ParPnpGetId(
  371. IN PUCHAR DeviceIdString,
  372. IN ULONG Type,
  373. OUT PUCHAR resultString,
  374. OUT PUCHAR descriptionString
  375. );
  376. NTSTATUS
  377. ParPnpFdoQueryDeviceRelationsBusRelations(
  378. IN PDEVICE_OBJECT Fdo,
  379. IN PIRP Irp
  380. );
  381. VOID ParAddPodoToDevObjStruct(PPAR_DEVOBJ_STRUCT DevObjStructHead, PDEVICE_OBJECT CurrentDo);
  382. VOID ParAddEndOfChainPdoToDevObjStruct(PPAR_DEVOBJ_STRUCT DevObjStructHead, PDEVICE_OBJECT CurrentDo);
  383. VOID ParAddDot3PdoToDevObjStruct(PPAR_DEVOBJ_STRUCT DevObjStructHead, PDEVICE_OBJECT CurrentDo);
  384. VOID ParAddLegacyZipPdoToDevObjStruct(IN PPAR_DEVOBJ_STRUCT DevObjStructHead, IN PDEVICE_OBJECT CurrentDo);
  385. PPAR_DEVOBJ_STRUCT ParFindCreateDevObjStruct(PPAR_DEVOBJ_STRUCT DevObjStructHead, PUCHAR Controller);
  386. VOID ParDumpDevObjStructList(PPAR_DEVOBJ_STRUCT DevObjStructHead);
  387. PPAR_DEVOBJ_STRUCT ParBuildDevObjStructList(PDEVICE_OBJECT Fdo);
  388. VOID ParDoParallelBusRescan(PPAR_DEVOBJ_STRUCT DevObjStructHead);
  389. BOOLEAN
  390. ParDeviceExists(
  391. PDEVICE_EXTENSION Extension,
  392. IN BOOLEAN HavePortKeepPort
  393. );
  394. NTSTATUS
  395. ParAllocatePortDevice(
  396. IN PDEVICE_OBJECT PortDeviceObject
  397. );
  398. NTSTATUS
  399. ParAllocatePortDevice(
  400. IN PDEVICE_OBJECT PortDeviceObject
  401. );
  402. NTSTATUS
  403. ParAcquirePort(
  404. IN PDEVICE_OBJECT PortDeviceObject,
  405. IN PLARGE_INTEGER Timeout OPTIONAL
  406. );
  407. NTSTATUS
  408. ParReleasePort(
  409. IN PDEVICE_OBJECT PortDeviceObject
  410. );
  411. VOID
  412. ParDetectDot3DataLink(
  413. IN PDEVICE_EXTENSION Extension,
  414. IN PUCHAR DeviceId
  415. );
  416. VOID
  417. ParMarkPdoHardwareGone(
  418. IN PDEVICE_EXTENSION Extension
  419. );
  420. VOID
  421. ParDestroyDevObjStructList(
  422. IN PPAR_DEVOBJ_STRUCT DevObjStructHead
  423. );
  424. VOID
  425. ParRescan1284_3DaisyChain(
  426. IN PPAR_DEVOBJ_STRUCT CurrentNode
  427. );
  428. VOID
  429. ParRescanEndOfChain(
  430. IN PPAR_DEVOBJ_STRUCT CurrentNode
  431. );
  432. NTSTATUS
  433. ParInit1284_3Bus(
  434. IN PDEVICE_OBJECT PortDeviceObject
  435. );
  436. UCHAR
  437. ParGet1284_3DeviceCount(
  438. IN PDEVICE_OBJECT PortDeviceObject
  439. );
  440. NTSTATUS
  441. ParSelect1284_3Device(
  442. IN PDEVICE_OBJECT PortDeviceObject,
  443. IN UCHAR Dot3DeviceId
  444. );
  445. NTSTATUS
  446. ParDeselect1284_3Device(
  447. IN PDEVICE_OBJECT PortDeviceObject,
  448. IN UCHAR Dot3DeviceId
  449. );
  450. VOID
  451. ParRescanLegacyZip(
  452. IN PPAR_DEVOBJ_STRUCT CurrentNode
  453. );
  454. PCHAR
  455. Par3QueryLegacyZipDeviceId(
  456. IN PDEVICE_EXTENSION Extension,
  457. OUT PCHAR CallerDeviceIdBuffer, OPTIONAL
  458. IN ULONG CallerBufferSize,
  459. OUT PULONG DeviceIdSize,
  460. IN BOOLEAN bReturnRawString // TRUE == include the 2 size bytes in the returned string
  461. // FALSE == discard the 2 size bytes
  462. );
  463. PCHAR
  464. ParStlQueryStlDeviceId(
  465. IN PDEVICE_EXTENSION Extension,
  466. OUT PCHAR CallerDeviceIdBuffer,
  467. IN ULONG CallerBufferSize,
  468. OUT PULONG DeviceIdSize,
  469. IN BOOLEAN bReturnRawString
  470. ) ;
  471. BOOLEAN
  472. ParStlCheckIfStl(
  473. IN PDEVICE_EXTENSION Extension,
  474. IN ULONG ulDaisyIndex
  475. ) ;
  476. NTSTATUS
  477. ParRegisterForParportRemovalRelations(
  478. IN PDEVICE_EXTENSION Extension
  479. );
  480. NTSTATUS
  481. ParUnregisterForParportRemovalRelations(
  482. IN PDEVICE_EXTENSION Extension
  483. );
  484. VOID
  485. ParCheckEnableLegacyZipFlag();
  486. PWSTR
  487. ParGetPortLptName(
  488. IN PDEVICE_OBJECT PortDeviceObject
  489. );
  490. NTSTATUS
  491. ParCreateDevice(
  492. IN PDRIVER_OBJECT DriverObject,
  493. IN ULONG DeviceExtensionSize,
  494. IN PUNICODE_STRING DeviceName OPTIONAL,
  495. IN DEVICE_TYPE DeviceType,
  496. IN ULONG DeviceCharacteristics,
  497. IN BOOLEAN Exclusive,
  498. OUT PDEVICE_OBJECT *DeviceObject
  499. );
  500. VOID
  501. ParInitializeExtension1284Info(
  502. IN PDEVICE_EXTENSION Extension
  503. );
  504. VOID
  505. ParGetDriverParameterDword(
  506. IN PUNICODE_STRING ServicePath,
  507. IN PWSTR ParameterName,
  508. IN OUT PULONG ParameterValue
  509. );
  510. VOID
  511. ParFixupDeviceId(
  512. IN OUT PUCHAR DeviceId
  513. );