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.

258 lines
9.0 KiB

  1. /******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1998-1999
  4. *
  5. * TITLE: wiamdef.h
  6. *
  7. * VERSION: 2.0
  8. *
  9. * DATE: 28 July, 1999
  10. *
  11. * DESCRIPTION:
  12. * Header file used to define WIA constants and globals.
  13. *
  14. ******************************************************************************/
  15. #pragma once
  16. //
  17. // The following array of PROPIDs identifies properties that are ALWAYS
  18. // present in a WIA_PROPERTY_CONTEXT. Drivers can specify additional
  19. // properties when creating a property context with wiasCreatePropContext.
  20. //
  21. #ifdef STD_PROPS_IN_CONTEXT
  22. #define NUM_STD_PROPS_IN_CONTEXT 13
  23. PROPID WIA_StdPropsInContext[NUM_STD_PROPS_IN_CONTEXT] = {
  24. WIA_IPA_DATATYPE,
  25. WIA_IPA_DEPTH,
  26. WIA_IPS_XRES,
  27. WIA_IPS_XPOS,
  28. WIA_IPS_XEXTENT,
  29. WIA_IPA_PIXELS_PER_LINE,
  30. WIA_IPS_YRES,
  31. WIA_IPS_YPOS,
  32. WIA_IPS_YEXTENT,
  33. WIA_IPA_NUMBER_OF_LINES,
  34. WIA_IPS_CUR_INTENT,
  35. WIA_IPA_TYMED,
  36. WIA_IPA_FORMAT,
  37. };
  38. #endif
  39. //**************************************************************************
  40. //
  41. // WIA Service prototypes
  42. //
  43. //
  44. // History:
  45. //
  46. // 4/27/1999 - Initial Version
  47. //
  48. //**************************************************************************
  49. // Flag used by wiasGetImageInformation.
  50. #define WIAS_INIT_CONTEXT 1
  51. // Flag used by wiasDownSampleBuffer
  52. #define WIAS_GET_DOWNSAMPLED_SIZE_ONLY 0x1
  53. //
  54. // IWiaMiniDrvService methods
  55. //
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59. HRESULT _stdcall wiasCreateDrvItem(LONG, BSTR, BSTR, IWiaMiniDrv*, LONG, BYTE**, IWiaDrvItem**);
  60. HRESULT _stdcall wiasGetImageInformation(BYTE*, LONG, PMINIDRV_TRANSFER_CONTEXT);
  61. HRESULT _stdcall wiasWritePageBufToFile(PMINIDRV_TRANSFER_CONTEXT);
  62. HRESULT _stdcall wiasWriteBufToFile(LONG, PMINIDRV_TRANSFER_CONTEXT);
  63. HRESULT _stdcall wiasReadMultiple(BYTE*, ULONG, const PROPSPEC*, PROPVARIANT*, PROPVARIANT*);
  64. HRESULT _stdcall wiasReadPropStr(BYTE*, PROPID, BSTR*, BSTR*, BOOL);
  65. HRESULT _stdcall wiasReadPropLong(BYTE*, PROPID, LONG*, LONG*, BOOL);
  66. HRESULT _stdcall wiasReadPropFloat(BYTE*, PROPID, FLOAT*, FLOAT*, BOOL);
  67. HRESULT _stdcall wiasReadPropGuid(BYTE*, PROPID, GUID*, GUID*, BOOL);
  68. HRESULT _stdcall wiasReadPropBin(BYTE*, PROPID, BYTE**, BYTE**, BOOL);
  69. HRESULT _stdcall wiasWriteMultiple(BYTE*, ULONG, const PROPSPEC*, const PROPVARIANT*);
  70. HRESULT _stdcall wiasWritePropStr(BYTE*, PROPID, BSTR);
  71. HRESULT _stdcall wiasWritePropLong(BYTE*, PROPID, LONG);
  72. HRESULT _stdcall wiasWritePropFloat(BYTE*, PROPID, FLOAT);
  73. HRESULT _stdcall wiasWritePropGuid(BYTE*, PROPID, GUID);
  74. HRESULT _stdcall wiasWritePropBin(BYTE*, PROPID, LONG, BYTE*);
  75. HRESULT _stdcall wiasGetPropertyAttributes(BYTE*, LONG, PROPSPEC*, ULONG*, PROPVARIANT*);
  76. HRESULT _stdcall wiasSetPropertyAttributes(BYTE*, LONG, PROPSPEC*, ULONG*, PROPVARIANT*);
  77. HRESULT _stdcall wiasSetItemPropNames(BYTE*, LONG, PROPID*, LPOLESTR*);
  78. HRESULT _stdcall wiasSetItemPropAttribs(BYTE*, LONG, PROPSPEC*, PWIA_PROPERTY_INFO);
  79. HRESULT _stdcall wiasValidateItemProperties(BYTE*, ULONG, const PROPSPEC*);
  80. HRESULT _stdcall wiasSendEndOfPage(BYTE*, LONG, PMINIDRV_TRANSFER_CONTEXT);
  81. HRESULT _stdcall wiasGetItemType(BYTE*, LONG*);
  82. HRESULT _stdcall wiasGetDrvItem(BYTE*, IWiaDrvItem**);
  83. HRESULT _stdcall wiasGetRootItem(BYTE*, BYTE**);
  84. HRESULT _stdcall wiasSetValidFlag(BYTE*, PROPID, ULONG, ULONG);
  85. HRESULT _stdcall wiasSetValidRangeLong(BYTE*, PROPID, LONG, LONG, LONG, LONG);
  86. HRESULT _stdcall wiasSetValidRangeFloat(BYTE*, PROPID, FLOAT, FLOAT, FLOAT, FLOAT);
  87. HRESULT _stdcall wiasSetValidListLong(BYTE*, PROPID, ULONG, LONG, LONG*);
  88. HRESULT _stdcall wiasSetValidListFloat(BYTE*, PROPID, ULONG, FLOAT, FLOAT*);
  89. HRESULT _stdcall wiasSetValidListGuid(BYTE*, PROPID, ULONG, GUID, GUID*);
  90. HRESULT _stdcall wiasSetValidListStr(BYTE*, PROPID, ULONG, BSTR, BSTR*);
  91. HRESULT _stdcall wiasCreatePropContext(ULONG, PROPSPEC*, ULONG, PROPID*, WIA_PROPERTY_CONTEXT*);
  92. HRESULT _stdcall wiasFreePropContext(WIA_PROPERTY_CONTEXT*);
  93. HRESULT _stdcall wiasIsPropChanged(PROPID, WIA_PROPERTY_CONTEXT*, BOOL*);
  94. HRESULT _stdcall wiasSetPropChanged(PROPID, WIA_PROPERTY_CONTEXT*, BOOL);
  95. HRESULT _stdcall wiasGetChangedValueLong(BYTE*, WIA_PROPERTY_CONTEXT*, BOOL, PROPID, WIAS_CHANGED_VALUE_INFO*);
  96. HRESULT _stdcall wiasGetChangedValueFloat(BYTE*, WIA_PROPERTY_CONTEXT*, BOOL, PROPID, WIAS_CHANGED_VALUE_INFO*);
  97. HRESULT _stdcall wiasGetChangedValueGuid(BYTE*, WIA_PROPERTY_CONTEXT*, BOOL, PROPID, WIAS_CHANGED_VALUE_INFO*);
  98. HRESULT _stdcall wiasGetChangedValueStr(BYTE*, WIA_PROPERTY_CONTEXT*, BOOL, PROPID, WIAS_CHANGED_VALUE_INFO*);
  99. HRESULT _stdcall wiasGetContextFromName(BYTE*, LONG, BSTR, BYTE**);
  100. HRESULT _stdcall wiasUpdateScanRect(BYTE*, WIA_PROPERTY_CONTEXT*, LONG, LONG);
  101. HRESULT _stdcall wiasUpdateValidFormat(BYTE*, WIA_PROPERTY_CONTEXT*, IWiaMiniDrv*);
  102. HRESULT _stdcall wiasGetChildrenContexts(BYTE*, ULONG*, BYTE***);
  103. HRESULT _stdcall wiasQueueEvent(BSTR, const GUID*, BSTR);
  104. VOID __cdecl wiasDebugTrace(HINSTANCE, LPCSTR, ...);
  105. VOID __cdecl wiasDebugError(HINSTANCE, LPCSTR, ...);
  106. VOID __stdcall wiasPrintDebugHResult(HINSTANCE, HRESULT);
  107. BSTR __cdecl wiasFormatArgs(LPCSTR lpszFormat, ...);
  108. HRESULT _stdcall wiasCreateChildAppItem(BYTE*, LONG, BSTR, BSTR, BYTE**);
  109. HRESULT _stdcall wiasCreateLogInstance(BYTE*, IWiaLogEx**);
  110. HRESULT _stdcall wiasDownSampleBuffer(LONG, WIAS_DOWN_SAMPLE_INFO*);
  111. HRESULT _stdcall wiasParseEndorserString(BYTE*, LONG, WIAS_ENDORSER_INFO*, BSTR*);
  112. #ifndef WIA_MAP_OLD_DEBUG
  113. #if defined(_DEBUG) || defined(DBG) || defined(WIA_DEBUG)
  114. #define WIAS_TRACE(x) wiasDebugTrace x
  115. #define WIAS_ERROR(x) wiasDebugError x
  116. #define WIAS_HRESULT(x) wiasPrintDebugHResult x
  117. #define WIAS_ASSERT(x, y) \
  118. if (!(y)) { \
  119. WIAS_ERROR((x, (char*) TEXT("ASSERTION FAILED: %hs(%d): %hs"), __FILE__,__LINE__,#x)); \
  120. DebugBreak(); \
  121. }
  122. #else
  123. #define WIAS_TRACE(x)
  124. #define WIAS_ERROR(x)
  125. #define WIAS_HRESULT(x)
  126. #define WIAS_ASSERT(x, y)
  127. #endif
  128. #define WIAS_LTRACE(pILog,ResID,Detail,Args) \
  129. { if ( pILog ) \
  130. pILog->Log(WIALOG_TRACE, ResID, Detail, wiasFormatArgs Args);\
  131. };
  132. #define WIAS_LERROR(pILog,ResID,Args) \
  133. {if ( pILog )\
  134. pILog->Log(WIALOG_ERROR, ResID, WIALOG_NO_LEVEL, wiasFormatArgs Args);\
  135. };
  136. #define WIAS_LWARNING(pILog,ResID,Args) \
  137. {if ( pILog )\
  138. pILog->Log(WIALOG_WARNING, ResID, WIALOG_NO_LEVEL, wiasFormatArgs Args);\
  139. };
  140. #define WIAS_LHRESULT(pILog,hr) \
  141. {if ( pILog )\
  142. pILog->hResult(hr);\
  143. };
  144. //
  145. // IWiaLog Defines
  146. //
  147. // Type of logging
  148. #define WIALOG_TRACE 0x00000001
  149. #define WIALOG_WARNING 0x00000002
  150. #define WIALOG_ERROR 0x00000004
  151. // level of detail for TRACE logging
  152. #define WIALOG_LEVEL1 1 // Entry and Exit point of each function/method
  153. #define WIALOG_LEVEL2 2 // LEVEL 1, + traces within the function/method
  154. #define WIALOG_LEVEL3 3 // LEVEL 1, LEVEL 2, and any extra debugging information
  155. #define WIALOG_LEVEL4 4 // USER DEFINED data + all LEVELS of tracing
  156. #define WIALOG_NO_RESOURCE_ID 0
  157. #define WIALOG_NO_LEVEL 0
  158. //
  159. // Entering / Leaving class
  160. //
  161. class CWiaLogProc {
  162. private:
  163. CHAR m_szMessage[MAX_PATH];
  164. IWiaLog *m_pIWiaLog;
  165. INT m_DetailLevel;
  166. INT m_ResourceID;
  167. public:
  168. inline CWiaLogProc(IWiaLog *pIWiaLog, INT ResourceID, INT DetailLevel, CHAR *pszMsg) {
  169. ZeroMemory(m_szMessage, sizeof(m_szMessage));
  170. lstrcpynA(m_szMessage,pszMsg, sizeof(m_szMessage) / sizeof(m_szMessage[0]) - 1);
  171. m_pIWiaLog = pIWiaLog;
  172. m_DetailLevel = DetailLevel;
  173. m_ResourceID = ResourceID;
  174. WIAS_LTRACE(pIWiaLog,
  175. ResourceID,
  176. DetailLevel,
  177. ("%s, entering",m_szMessage));
  178. }
  179. inline ~CWiaLogProc() {
  180. WIAS_LTRACE(m_pIWiaLog,
  181. m_ResourceID,
  182. m_DetailLevel,
  183. ("%s, leaving",m_szMessage));
  184. }
  185. };
  186. class CWiaLogProcEx {
  187. private:
  188. CHAR m_szMessage[MAX_PATH];
  189. IWiaLogEx *m_pIWiaLog;
  190. INT m_DetailLevel;
  191. INT m_ResourceID;
  192. public:
  193. inline CWiaLogProcEx(IWiaLogEx *pIWiaLog, INT ResourceID, INT DetailLevel, CHAR *pszMsg, LONG lMethodId = 0) {
  194. ZeroMemory(m_szMessage, sizeof(m_szMessage));
  195. lstrcpynA(m_szMessage,pszMsg, sizeof(m_szMessage) / sizeof(m_szMessage[0]) - 1);
  196. m_pIWiaLog = pIWiaLog;
  197. m_DetailLevel = DetailLevel;
  198. m_ResourceID = ResourceID;
  199. WIAS_LTRACE(pIWiaLog,
  200. ResourceID,
  201. DetailLevel,
  202. ("%s, entering",m_szMessage));
  203. }
  204. inline ~CWiaLogProcEx() {
  205. WIAS_LTRACE(m_pIWiaLog,
  206. m_ResourceID,
  207. m_DetailLevel,
  208. ("%s, leaving",m_szMessage));
  209. }
  210. };
  211. #endif // WIA_MAP_OLD_DEBUG
  212. #ifdef __cplusplus
  213. }
  214. #endif