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.

276 lines
9.3 KiB

  1. /**************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 2000
  4. *
  5. * TITLE: scanapi.h
  6. *
  7. * VERSION: 1.0
  8. *
  9. * DATE: 18 July, 2000
  10. *
  11. * DESCRIPTION:
  12. * Fake Scanner device library
  13. *
  14. ***************************************************************************/
  15. #ifndef _SCANAPI_H
  16. #define _SCANAPI_H
  17. #include "ioblockdefs.h"
  18. typedef GUID* PGUID;
  19. #define FLATBED_SCANNER_MODE 100
  20. #define SCROLLFED_SCANNER_MODE 200
  21. #define MULTIFUNCTION_DEVICE_MODE 300
  22. #define SCAN_START 0
  23. #define SCAN_CONTINUE 1
  24. #define SCAN_END 3
  25. typedef struct _DEVICE_BUTTON_INFO {
  26. BYTE ScanButton;
  27. BYTE FaxButton;
  28. BYTE EMailButton;
  29. BYTE DocumentButton;
  30. BYTE CancelButton;
  31. }DEVICE_BUTTON_INFO,*PDEVICE_BUTTON_INFO;
  32. typedef struct _INITINFO {
  33. HANDLE hDeviceDataHandle;
  34. TCHAR *szModuleFileName;
  35. CHAR *szCreateFileName;
  36. HKEY hKEY;
  37. }INITINFO,*PINITINFO;
  38. typedef struct _INTERRUPTEVENTINFO {
  39. CHAR *szDeviceName;
  40. HANDLE *phSignalEvent;
  41. HANDLE hShutdownEvent;
  42. GUID *pguidEvent;
  43. }INTERRUPTEVENTINFO,*PINTERRUPTEVENTINFO;
  44. typedef struct _WIAPROPERTIES {
  45. LONG NumItemProperties; // Number of item properties
  46. LPOLESTR *pszItemDefaults; // item property names
  47. PROPID *piItemDefaults; // item property ids
  48. PROPVARIANT *pvItemDefaults; // item property prop variants
  49. PROPSPEC *psItemDefaults; // item property propspecs
  50. WIA_PROPERTY_INFO *wpiItemDefaults; // item property attributes
  51. // valid values
  52. LONG NumSupportedFormats; // Number of supported formats
  53. LONG NumSupportedTYMED; // Number of supported TYMED
  54. LONG NumInitialFormats; // Number of Initial formats
  55. LONG NumSupportedDataTypes;// Number of supported data types
  56. LONG NumSupportedIntents; // Number of supported intents
  57. LONG NumSupportedCompressionTypes; // Number of supported compression types
  58. LONG NumSupportedResolutions;// Number of supported resolutions
  59. LONG NumSupportedPreviewModes;// Number of supported preview modes
  60. WIA_FORMAT_INFO *pSupportedFormats; // supported formats
  61. LONG *pSupportedTYMED; // supported TYMED
  62. GUID *pInitialFormats; // initial formats
  63. LONG *pSupportedDataTypes; // supported data types
  64. LONG *pSupportedIntents; // supported intents
  65. LONG *pSupportedCompressionTypes; // supported compression types
  66. LONG *pSupportedResolutions;// supproted resolutions
  67. LONG *pSupportedPreviewModes;// supported preview modes
  68. BOOL bLegacyBWRestrictions;// backward compatible with older system
  69. }WIAPROPERTIES,*PWIAPROPERTIES;
  70. typedef struct _WIACAPABILITIES {
  71. PLONG pNumSupportedEvents;
  72. PLONG pNumSupportedCommands;
  73. WIA_DEV_CAP_DRV *pCapabilities;
  74. }WIACAPABILITIES,*PWIACAPABILITIES;
  75. class CScanAPI {
  76. public:
  77. CScanAPI() :
  78. m_pIWiaLog(NULL) {
  79. }
  80. ~CScanAPI(){
  81. }
  82. IWiaLog *m_pIWiaLog; // WIA logging object
  83. virtual HRESULT SetLoggingInterface(IWiaLog *pLogInterface){
  84. if(pLogInterface){
  85. m_pIWiaLog = pLogInterface;
  86. } else {
  87. return E_INVALIDARG;
  88. }
  89. return S_OK;
  90. }
  91. // data acquisition functions
  92. virtual HRESULT Scan(LONG lState, PBYTE pData, DWORD dwBytesToRead, PDWORD pdwBytesWritten){
  93. return E_NOTIMPL;
  94. }
  95. virtual HRESULT SetDataType(LONG lDataType){
  96. return E_NOTIMPL;
  97. }
  98. virtual HRESULT SetXYResolution(LONG lXResolution, LONG lYResolution){
  99. return E_NOTIMPL;
  100. }
  101. virtual HRESULT SetSelectionArea(LONG lXPos, LONG lYPos, LONG lXExt, LONG lYExt){
  102. return E_NOTIMPL;
  103. }
  104. virtual HRESULT SetContrast(LONG lContrast){
  105. return E_NOTIMPL;
  106. }
  107. virtual HRESULT SetIntensity(LONG lIntensity){
  108. return E_NOTIMPL;
  109. }
  110. virtual HRESULT ResetDevice(){
  111. return E_NOTIMPL;
  112. }
  113. virtual HRESULT SetEmulationMode(LONG lDeviceMode){
  114. return E_NOTIMPL;
  115. }
  116. virtual HRESULT DisableDevice(){
  117. return E_NOTIMPL;
  118. }
  119. virtual HRESULT EnableDevice(){
  120. return E_NOTIMPL;
  121. }
  122. virtual HRESULT DeviceOnline(){
  123. return E_NOTIMPL;
  124. }
  125. virtual HRESULT GetDeviceEvent(GUID *pEvent){
  126. return E_NOTIMPL;
  127. }
  128. virtual HRESULT Diagnostic(){
  129. return E_NOTIMPL;
  130. }
  131. virtual HRESULT Initialize(PINITINFO pInitInfo){
  132. return E_NOTIMPL;
  133. }
  134. virtual HRESULT UnInitialize(){
  135. return E_NOTIMPL;
  136. }
  137. virtual HRESULT DoInterruptEventThread(PINTERRUPTEVENTINFO pEventInfo){
  138. return E_NOTIMPL;
  139. }
  140. virtual HRESULT ADFAttached(){
  141. return E_NOTIMPL;
  142. }
  143. virtual HRESULT ADFHasPaper(){
  144. return E_NOTIMPL;
  145. }
  146. virtual HRESULT ADFAvailable(){
  147. return E_NOTIMPL;
  148. }
  149. virtual HRESULT ADFFeedPage(){
  150. return E_NOTIMPL;
  151. }
  152. virtual HRESULT ADFUnFeedPage(){
  153. return E_NOTIMPL;
  154. }
  155. virtual HRESULT ADFStatus(){
  156. return E_NOTIMPL;
  157. }
  158. virtual HRESULT QueryButtonPanel(PDEVICE_BUTTON_INFO pButtonInformation){
  159. return E_NOTIMPL;
  160. }
  161. virtual HRESULT BuildRootItemProperties(PWIAPROPERTIES pProperties){
  162. return E_NOTIMPL;
  163. }
  164. virtual HRESULT BuildTopItemProperties(PWIAPROPERTIES pProperties){
  165. return E_NOTIMPL;
  166. }
  167. virtual HRESULT BuildCapabilities(PWIACAPABILITIES pCapabilities){
  168. return E_NOTIMPL;
  169. }
  170. virtual HRESULT GetBedWidthAndHeight(PLONG pWidth, PLONG pHeight){
  171. return E_NOTIMPL;
  172. }
  173. virtual HRESULT SetResolutionRestrictionString(TCHAR *szResolutions){
  174. return E_NOTIMPL;
  175. }
  176. virtual HRESULT SetScanMode(INT iScanMode){
  177. return E_NOTIMPL;
  178. }
  179. virtual HRESULT SetSTIDeviceHKEY(HKEY *pHKEY){
  180. return E_NOTIMPL;
  181. }
  182. virtual HRESULT GetSupportedFileFormats(GUID **ppguid, LONG *plNumSupportedFormats){
  183. return E_NOTIMPL;
  184. }
  185. virtual HRESULT GetSupportedMemoryFormats(GUID **ppguid, LONG *plNumSupportedFormats){
  186. return E_NOTIMPL;
  187. }
  188. virtual HRESULT IsColorDataBGR(BOOL *pbBGR){
  189. return E_NOTIMPL;
  190. }
  191. virtual HRESULT IsAlignmentNeeded(BOOL *pbALIGN){
  192. return E_NOTIMPL;
  193. }
  194. virtual HRESULT SetFormat(GUID *pguidFormat){
  195. return E_NOTIMPL;
  196. }
  197. };
  198. ///////////////////////////////////////////////////////////////////////////////////
  199. // MICRO DRIVER SYSTEM SUPPORT //
  200. ///////////////////////////////////////////////////////////////////////////////////
  201. class CMicroDriverAPI :public CScanAPI {
  202. public:
  203. CMicroDriverAPI();
  204. ~CMicroDriverAPI();
  205. CMICRO *m_pMicroDriver; // Micro driver communication
  206. SCANINFO m_ScanInfo; // ScanInfo structure
  207. TCHAR m_szResolutions[255]; // restricted resolutions string
  208. BOOL m_bDisconnected; // device disconnected during operation
  209. HRESULT Scan(LONG lState, PBYTE pData, DWORD dwBytesToRead, PDWORD pdwBytesWritten);
  210. HRESULT SetDataType(LONG lDataType);
  211. HRESULT SetXYResolution(LONG lXResolution, LONG lYResolution);
  212. HRESULT SetSelectionArea(LONG lXPos, LONG lYPos, LONG lXExt, LONG lYExt);
  213. HRESULT SetContrast(LONG lContrast);
  214. HRESULT SetIntensity(LONG lIntensity);
  215. HRESULT ResetDevice();
  216. HRESULT SetEmulationMode(LONG lDeviceMode);
  217. HRESULT DisableDevice();
  218. HRESULT EnableDevice();
  219. HRESULT DeviceOnline();
  220. HRESULT GetDeviceEvent(GUID *pEvent);
  221. HRESULT Diagnostic();
  222. HRESULT Initialize(PINITINFO pInitInfo);
  223. HRESULT UnInitialize();
  224. HRESULT DoInterruptEventThread(PINTERRUPTEVENTINFO pEventInfo);
  225. HRESULT ADFAttached();
  226. HRESULT ADFHasPaper();
  227. HRESULT ADFAvailable();
  228. HRESULT ADFFeedPage();
  229. HRESULT ADFUnFeedPage();
  230. HRESULT ADFStatus();
  231. HRESULT QueryButtonPanel(PDEVICE_BUTTON_INFO pButtonInformation);
  232. HRESULT BuildRootItemProperties(PWIAPROPERTIES pProperties);
  233. HRESULT BuildTopItemProperties(PWIAPROPERTIES pProperties);
  234. HRESULT BuildCapabilities(PWIACAPABILITIES pCapabilities);
  235. HRESULT GetBedWidthAndHeight(PLONG pWidth, PLONG pHeight);
  236. HRESULT SetResolutionRestrictionString(TCHAR *szResolutions);
  237. HRESULT SetScanMode(INT iScanMode);
  238. HRESULT SetSTIDeviceHKEY(HKEY *pHKEY);
  239. HRESULT GetSupportedFileFormats(GUID **ppguid, LONG *plNumSupportedFormats);
  240. HRESULT GetSupportedMemoryFormats(GUID **ppguid, LONG *plNumSupportedFormats);
  241. HRESULT IsColorDataBGR(BOOL *pbBGR);
  242. HRESULT IsAlignmentNeeded(BOOL *pbALIGN);
  243. HRESULT SetFormat(GUID *pguidFormat);
  244. // helpers
  245. HRESULT MicroDriverErrorToWIAError(LONG lMicroDriverError);
  246. BOOL IsValidRestriction(LONG **ppList, LONG *plNumItems, RANGEVALUEEX *pRangeValues);
  247. HRESULT DeleteAllProperties(PWIAPROPERTIES pProperties);
  248. HRESULT AllocateAllProperties(PWIAPROPERTIES pProperties);
  249. };
  250. #endif