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.

331 lines
8.6 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. private.h
  5. Abstract:
  6. Prototypes and definitions for the scsi scanner device driver.
  7. Author:
  8. Ray Patrick (raypat)
  9. Environment:
  10. kernel mode only
  11. Notes:
  12. Revision History:
  13. --*/
  14. #ifndef _SCSISCAN_PRIAVATE_
  15. #define _SCSISCAN_PRIAVATE_
  16. // Includes
  17. #include "debug.h"
  18. #include "scsiscan.h"
  19. // Defines
  20. #define MAXIMUM_RETRIES 4
  21. #define SCSISCAN_TIMEOUT 600
  22. #define SRB SCSI_REQUEST_BLOCK
  23. #define PSRB PSCSI_REQUEST_BLOCK
  24. #ifndef ARRAYSIZE
  25. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  26. #endif
  27. // Typedefs
  28. typedef struct _SCSISCAN_DEVICE_EXTENSION {
  29. ULONG Signature;
  30. PDEVICE_OBJECT pStackDeviceObject;
  31. PDEVICE_OBJECT pPhysicalDeviceObject;
  32. ULONG SrbFlags;
  33. UCHAR PortNumber;
  34. ULONG TimeOutValue;
  35. ULONG ErrorCount;
  36. ULONG SelecTimeoutCount;
  37. ULONG LastSrbError;
  38. ULONG DeviceInstance;
  39. ULONG PnpDeviceNumber;
  40. USHORT DeviceFlags;
  41. PSTORAGE_ADAPTER_DESCRIPTOR pAdapterDescriptor;
  42. UNICODE_STRING DeviceName;
  43. //UNICODE_STRING SymbolicLinkName;
  44. KEVENT PendingIoEvent;
  45. ULONG PendingIoCount;
  46. BOOLEAN AcceptingRequests;
  47. PVOID DeviceLock;
  48. ULONG OpenInstanceCount;
  49. PIRP pPowerIrp;
  50. DEVICE_POWER_STATE CurrentDevicePowerState;
  51. //
  52. // Records whether we actually created the symbolic link name
  53. // at driver load time. If we didn't create it, we won't try
  54. // to distroy it when we unload.
  55. //
  56. BOOLEAN CreatedSymbolicLink;
  57. //
  58. // This points to the symbolic link name that was
  59. // linked to the actual nt device name.
  60. //
  61. UNICODE_STRING SymbolicLinkName;
  62. //
  63. // This points to the class name used to create the
  64. // device and the symbolic link. We carry this
  65. // around for a short while...
  66. UNICODE_STRING ClassName;
  67. //
  68. // Name of the device interface
  69. //
  70. UNICODE_STRING InterfaceNameString;
  71. } SCSISCAN_DEVICE_EXTENSION, *PSCSISCAN_DEVICE_EXTENSION;
  72. typedef struct _TRANSFER_CONTEXT {
  73. ULONG Signature;
  74. PSCSISCAN_CMD pCmd;
  75. SRB Srb;
  76. PUCHAR pTransferBuffer;
  77. ULONG TransferLength;
  78. LONG RemainingTransferLength;
  79. LONG NBytesTransferred;
  80. ULONG RetryCount;
  81. PUCHAR pSenseBuffer;
  82. PMDL pSenseMdl;
  83. PMDL pSrbStatusMdl;
  84. } TRANSFER_CONTEXT, *PTRANSFER_CONTEXT;
  85. typedef struct _COMPLETION_CONTEXT {
  86. ULONG Signature;
  87. PDEVICE_OBJECT pDeviceObject;
  88. SRB Srb;
  89. }COMPLETION_CONTEXT, *PCOMPLETION_CONTEXT;
  90. #ifdef _WIN64
  91. // For 32bit client on 64bit OS.
  92. typedef struct _SCSISCAN_CMD_32 {
  93. ULONG Reserved1;
  94. ULONG Size;
  95. ULONG SrbFlags;
  96. UCHAR CdbLength;
  97. UCHAR SenseLength;
  98. UCHAR Reserved2;
  99. UCHAR Reserved3;
  100. ULONG TransferLength;
  101. UCHAR Cdb[16];
  102. UCHAR * POINTER_32 pSrbStatus;
  103. UCHAR * POINTER_32 pSenseBuffer;
  104. } SCSISCAN_CMD_32, *PSCSISCAN_CMD_32;
  105. #endif // _WIN64
  106. //
  107. // Prototypes
  108. //
  109. NTSTATUS
  110. DriverEntry( // in scsiscan.c
  111. IN PDRIVER_OBJECT DriverObject,
  112. IN PUNICODE_STRING RegistryPath
  113. );
  114. NTSTATUS SSPnp ( // in scsiscan.c
  115. IN PDEVICE_OBJECT pDeviceObject,
  116. IN PIRP pIrp
  117. );
  118. NTSTATUS
  119. SSPnpAddDevice( // in scsiscan.c
  120. IN PDRIVER_OBJECT DriverObject,
  121. IN PDEVICE_OBJECT PhysicalDevice
  122. );
  123. NTSTATUS
  124. SSOpen( // in scsiscan.c
  125. IN PDEVICE_OBJECT pDeviceObject,
  126. IN PIRP pIrp
  127. );
  128. NTSTATUS
  129. SSClose( // in scsiscan.c
  130. IN PDEVICE_OBJECT pDeviceObject,
  131. IN PIRP pIrp
  132. );
  133. NTSTATUS
  134. SSReadWrite( // in scsiscan.c
  135. IN PDEVICE_OBJECT pDeviceObject,
  136. IN PIRP pIrp
  137. );
  138. NTSTATUS
  139. SSDeviceControl( // in scsiscan.c
  140. IN PDEVICE_OBJECT pDeviceObject,
  141. IN PIRP pIrp
  142. );
  143. NTSTATUS
  144. SSGetInfo( // in scsiscan.c
  145. IN PDEVICE_OBJECT pDeviceObject,
  146. IN ULONG ControlCode,
  147. OUT PVOID *ppv
  148. );
  149. VOID
  150. SSSendScannerRequest( // in scsiscan.c
  151. PDEVICE_OBJECT pDeviceObject,
  152. PIRP pIrp,
  153. PTRANSFER_CONTEXT pTransferContext,
  154. BOOLEAN Retry
  155. );
  156. NTSTATUS
  157. SSReadWriteIoComplete( // in scsiscan.c
  158. IN PDEVICE_OBJECT pDeviceObject,
  159. IN PIRP pIrp,
  160. IN PVOID Context
  161. );
  162. NTSTATUS
  163. SSIoctlIoComplete( // in scsiscan.c
  164. IN PDEVICE_OBJECT pDeviceObject,
  165. IN PIRP pIrp,
  166. IN PVOID Context
  167. );
  168. NTSTATUS
  169. SSDeviceControl( // in scsiscan.c
  170. IN PDEVICE_OBJECT pDeviceObject,
  171. IN PIRP pIrp
  172. );
  173. VOID
  174. SSAdjustTransferSize( // in scsiscan.c
  175. PSCSISCAN_DEVICE_EXTENSION pde,
  176. PTRANSFER_CONTEXT pTransferContext
  177. );
  178. PTRANSFER_CONTEXT // in scsiscan.c
  179. SSBuildTransferContext(
  180. PSCSISCAN_DEVICE_EXTENSION pde,
  181. PIRP pIrp,
  182. PSCSISCAN_CMD pCmd,
  183. ULONG CmdLength,
  184. PMDL pTransferMdl,
  185. BOOLEAN AllowMultipleTransfer
  186. );
  187. NTSTATUS // in scsiscan.c
  188. SSCreateSymbolicLink(
  189. PSCSISCAN_DEVICE_EXTENSION pde
  190. );
  191. NTSTATUS // in scsiscan.c
  192. SSDestroySymbolicLink(
  193. PSCSISCAN_DEVICE_EXTENSION pde
  194. );
  195. VOID // in scsiscan.c
  196. SSIncrementIoCount(
  197. IN PDEVICE_OBJECT pDeviceObject
  198. );
  199. LONG // in scsiscan.c
  200. SSDecrementIoCount(
  201. IN PDEVICE_OBJECT DeviceObject
  202. );
  203. NTSTATUS // in scsiscan.c
  204. SSDeferIrpCompletion(
  205. IN PDEVICE_OBJECT pDeviceObject,
  206. IN PIRP pIrp,
  207. IN PVOID Context
  208. );
  209. NTSTATUS // in scsiscan.c
  210. SSPower(
  211. IN PDEVICE_OBJECT pDeviceObject,
  212. IN PIRP pIrp
  213. );
  214. VOID // in scsiscan.c
  215. SSUnload(
  216. IN PDRIVER_OBJECT pDriverObject
  217. );
  218. VOID
  219. SSSetTransferLengthToCdb(
  220. PCDB pCdb,
  221. ULONG TransferLength
  222. ); // in scsiscan.c
  223. NTSTATUS
  224. SSCallNextDriverSynch(
  225. IN PSCSISCAN_DEVICE_EXTENSION pde,
  226. IN PIRP pIrp
  227. );
  228. NTSTATUS
  229. ClassGetDescriptor( // in class.c
  230. IN PDEVICE_OBJECT DeviceObject,
  231. IN PSTORAGE_PROPERTY_ID PropertyId,
  232. OUT PVOID *pDescriptor
  233. );
  234. BOOLEAN
  235. ClassInterpretSenseInfo( // in class.c
  236. IN PDEVICE_OBJECT pDeviceObject,
  237. IN PSRB pSrb,
  238. IN UCHAR MajorFunctionCode,
  239. IN ULONG IoDeviceCode,
  240. IN ULONG RetryCount,
  241. OUT NTSTATUS *Status
  242. );
  243. VOID // in class.c
  244. ClassReleaseQueue(
  245. IN PDEVICE_OBJECT pDeviceObject
  246. );
  247. NTSTATUS
  248. ClassAsynchronousCompletion( // in class.c
  249. PDEVICE_OBJECT pDeviceObject,
  250. PIRP pIrp,
  251. PCOMPLETION_CONTEXT pContext
  252. );
  253. NTSTATUS
  254. ClassGetInfo( // in class.c
  255. IN PDEVICE_OBJECT pDeviceObject,
  256. OUT PSCSISCAN_INFO pTargetInfo
  257. );
  258. NTSTATUS
  259. ScsiScanHandleInterface(
  260. PDEVICE_OBJECT DeviceObject,
  261. PUNICODE_STRING InterfaceName,
  262. BOOLEAN Create
  263. );
  264. #endif // _SCSISCAN_PRIAVATE_