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.

388 lines
8.7 KiB

  1. /*++
  2. Copyright (c) 1996 - 1999 Microsoft Corporation
  3. Module Name:
  4. oemkm.h
  5. Abstract:
  6. Header file to support kernel mode OEM plugins
  7. Environment:
  8. Windows NT Universal Printer driver (UNIDRV)
  9. Revision History:
  10. 03/28/97 -zhanw-
  11. Adapted from Pscript driver.
  12. --*/
  13. #ifndef _OEMKM_H_
  14. #define _OEMKM_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <printoem.h>
  19. #include "oemutil.h"
  20. //
  21. // Information about OEM hooks
  22. //
  23. typedef struct _OEM_HOOK_INFO
  24. {
  25. OEMPROC pfnHook; // function address of the hook
  26. POEM_PLUGIN_ENTRY pOemEntry; // which OEM plugin hooked it
  27. } OEM_HOOK_INFO, *POEM_HOOK_INFO;
  28. //
  29. // This macro should be placed near the beginning of every
  30. // DDI entrypoint which can be hooked by OEM plugin
  31. //
  32. #define HANDLE_OEMHOOKS(pdev, ep, pfnType, resultType, args) \
  33. if ((pdev)->pOemHookInfo != NULL && \
  34. (pdev)->pOemHookInfo[ep].pfnHook != NULL && \
  35. (pdev)->dwCallingFuncID != ep) \
  36. { \
  37. resultType result; \
  38. DWORD dwCallerFuncID;\
  39. dwCallerFuncID = (pdev)->dwCallingFuncID;\
  40. (pdev)->dwCallingFuncID = ep; \
  41. (pdev)->devobj.hOEM = ((pdev)->pOemHookInfo[ep].pOemEntry)->hInstance; \
  42. (pdev)->devobj.pdevOEM = ((pdev)->pOemHookInfo[ep].pOemEntry)->pParam; \
  43. (pdev)->devobj.pOEMDM = ((pdev)->pOemHookInfo[ep].pOemEntry)->pOEMDM; \
  44. result = ((pfnType) (pdev)->pOemHookInfo[ep].pfnHook) args; \
  45. (pdev)->dwCallingFuncID = dwCallerFuncID; \
  46. return result; \
  47. }
  48. //
  49. // Macros used to call an entrypoint for all OEM plugins
  50. //
  51. #define START_OEMENTRYPOINT_LOOP(pdev) \
  52. { \
  53. DWORD _oemCount = (pdev)->pOemPlugins->dwCount; \
  54. POEM_PLUGIN_ENTRY pOemEntry = (pdev)->pOemPlugins->aPlugins; \
  55. for ( ; _oemCount--; pOemEntry++) \
  56. { \
  57. if (pOemEntry->hInstance == NULL) continue; \
  58. (pdev)->devobj.hOEM = pOemEntry->hInstance; \
  59. (pdev)->devobj.pdevOEM = pOemEntry->pParam; \
  60. (pdev)->devobj.pOEMDM = pOemEntry->pOEMDM;
  61. #define END_OEMENTRYPOINT_LOOP \
  62. } \
  63. }
  64. //
  65. // Get information about OEM plugins associated with the current device
  66. // Load them into memory and call OEMEnableDriver for each of them
  67. //
  68. typedef struct _PDEV PDEV;
  69. #ifdef WINNT_40
  70. PVOID
  71. DrvMemAllocZ(
  72. ULONG ulSize
  73. );
  74. VOID
  75. DrvMemFree(
  76. PVOID pMem
  77. );
  78. LONG
  79. DrvInterlockedIncrement(
  80. PLONG pRef
  81. );
  82. LONG
  83. DrvInterlockedDecrement(
  84. PLONG pRef
  85. );
  86. #endif //WINNT_40
  87. BOOL
  88. BLoadAndInitOemPlugins(
  89. PDEV *pPDev
  90. );
  91. // Constant flag bits for OEM_PLUGIN_ENTRY.dwFlags field
  92. #define OEMENABLEDRIVER_CALLED 0x0001
  93. #define OEMENABLEPDEV_CALLED 0x0002
  94. //
  95. // Unload OEM plugins and free all relevant resources
  96. //
  97. VOID
  98. VUnloadOemPlugins(
  99. PDEV *pPDev
  100. );
  101. #define FIX_DEVOBJ(pPDev, ep) \
  102. { \
  103. (pPDev)->devobj.pdevOEM = (pPDev)->pOemHookInfo[ep].pOemEntry->pParam; \
  104. (pPDev)->devobj.pOEMDM = (pPDev)->pOemHookInfo[ep].pOemEntry->pOEMDM; \
  105. (pPDev)->pOemEntry = (PVOID)((pPDev)->pOemHookInfo[ep].pOemEntry); \
  106. } \
  107. //
  108. // Provide OEM plugins access to driver private settings
  109. //
  110. BOOL
  111. BGetDriverSettingForOEM(
  112. PDEV *pPDev,
  113. PCSTR pFeatureKeyword,
  114. PVOID pOutput,
  115. DWORD cbSize,
  116. PDWORD pcbNeeded,
  117. PDWORD pdwOptionsReturned
  118. );
  119. BOOL
  120. BSetDriverSettingForOEM(
  121. PDEVMODE pdm,
  122. PTSTR pPrinterName,
  123. PCSTR pFeatureKeyword,
  124. PCSTR pOptionKeyword
  125. );
  126. //
  127. // Unidrv specific COM wrappers
  128. //
  129. //
  130. // Method for getting the implemented method.
  131. // Returns S_OK if the given method is implemneted.
  132. // Returns S_FALSE if the given method is notimplemneted.
  133. //
  134. HRESULT HComGetImplementedMethod(
  135. POEM_PLUGIN_ENTRY pOemEntry,
  136. PSTR pMethodName
  137. );
  138. //
  139. // OEMDriverDMS - UNIDRV only,
  140. //
  141. HRESULT HComDriverDMS(
  142. POEM_PLUGIN_ENTRY pOemEntry,
  143. PVOID pDevObj,
  144. PVOID pBuffer,
  145. WORD cbSize,
  146. PDWORD pcbNeeded
  147. );
  148. //
  149. // OEMCommandCallback - UNIDRV only,
  150. //
  151. HRESULT HComCommandCallback(
  152. POEM_PLUGIN_ENTRY pOemEntry,
  153. PDEVOBJ pdevobj,
  154. DWORD dwCallbackID,
  155. DWORD dwCount,
  156. PDWORD pdwParams,
  157. OUT INT *piResult
  158. ) ;
  159. //
  160. // OEMImageProcessing - UNIDRV only,
  161. //
  162. HRESULT HComImageProcessing(
  163. POEM_PLUGIN_ENTRY pOemEntry,
  164. PDEVOBJ pdevobj,
  165. PBYTE pSrcBitmap,
  166. PBITMAPINFOHEADER pBitmapInfoHeader,
  167. PBYTE pColorTable,
  168. DWORD dwCallbackID,
  169. PIPPARAMS pIPParams,
  170. OUT PBYTE *ppbResult
  171. );
  172. //
  173. // OEMFilterGraphics - UNIDRV only,
  174. //
  175. HRESULT HComFilterGraphics(
  176. POEM_PLUGIN_ENTRY pOemEntry,
  177. PDEVOBJ pdevobj,
  178. PBYTE pBuf,
  179. DWORD dwLen
  180. );
  181. //
  182. // OEMCompression - UNIDRV only,
  183. //
  184. HRESULT HComCompression(
  185. POEM_PLUGIN_ENTRY pOemEntry,
  186. PDEVOBJ pdevobj,
  187. PBYTE pInBuf,
  188. PBYTE pOutBuf,
  189. DWORD dwInLen,
  190. DWORD dwOutLen,
  191. OUT INT *piResult
  192. );
  193. //
  194. // OEMHalftone - UNIDRV only
  195. //
  196. HRESULT HComHalftonePattern(
  197. POEM_PLUGIN_ENTRY pOemEntry,
  198. PDEVOBJ pdevobj,
  199. PBYTE pHTPattern,
  200. DWORD dwHTPatternX,
  201. DWORD dwHTPatternY,
  202. DWORD dwHTNumPatterns,
  203. DWORD dwCallbackID,
  204. PBYTE pResource,
  205. DWORD dwResourceSize
  206. ) ;
  207. //
  208. // OEMMemoryUsage - UNIDRV only,
  209. //
  210. HRESULT HComMemoryUsage(
  211. POEM_PLUGIN_ENTRY pOemEntry,
  212. PDEVOBJ pdevobj,
  213. POEMMEMORYUSAGE pMemoryUsage
  214. );
  215. //
  216. // OEMTTYGetInfo - UNIDRV only
  217. //
  218. HRESULT HComTTYGetInfo(
  219. POEM_PLUGIN_ENTRY pOemEntry,
  220. PDEVOBJ pdevobj,
  221. DWORD dwInfoIndex,
  222. PVOID pOutputBuf,
  223. DWORD dwSize,
  224. DWORD *pcbcNeeded
  225. );
  226. //
  227. // OEMDownloadFontheader - UNIDRV only
  228. //
  229. HRESULT HComDownloadFontHeader(
  230. POEM_PLUGIN_ENTRY pOemEntry,
  231. PDEVOBJ pdevobj,
  232. PUNIFONTOBJ pUFObj,
  233. OUT DWORD *pdwResult
  234. );
  235. //
  236. // OEMDownloadCharGlyph - UNIDRV only
  237. //
  238. HRESULT HComDownloadCharGlyph(
  239. POEM_PLUGIN_ENTRY pOemEntry,
  240. PDEVOBJ pdevobj,
  241. PUNIFONTOBJ pUFObj,
  242. HGLYPH hGlyph,
  243. PDWORD pdwWidth,
  244. OUT DWORD *pdwResult
  245. );
  246. //
  247. // OEMTTDownloadMethod - UNIDRV only
  248. //
  249. HRESULT HComTTDownloadMethod(
  250. POEM_PLUGIN_ENTRY pOemEntry,
  251. PDEVOBJ pdevobj,
  252. PUNIFONTOBJ pUFObj,
  253. OUT DWORD *pdwResult
  254. );
  255. //
  256. // OEMOutputCharStr - UNIDRV only
  257. //
  258. HRESULT HComOutputCharStr(
  259. POEM_PLUGIN_ENTRY pOemEntry,
  260. PDEVOBJ pdevobj,
  261. PUNIFONTOBJ pUFObj,
  262. DWORD dwType,
  263. DWORD dwCount,
  264. PVOID pGlyph
  265. );
  266. //
  267. // OEMSendFontCmd - UNIDRV only
  268. //
  269. HRESULT HComSendFontCmd(
  270. POEM_PLUGIN_ENTRY pOemEntry,
  271. PDEVOBJ pdevobj,
  272. PUNIFONTOBJ pUFObj,
  273. PFINVOCATION pFInv
  274. );
  275. //
  276. // OEMTextOutAsBitmap - UNIDRV only
  277. //
  278. HRESULT HComTextOutAsBitmap(
  279. POEM_PLUGIN_ENTRY pOemEntry,
  280. SURFOBJ *pso,
  281. STROBJ *pstro,
  282. FONTOBJ *pfo,
  283. CLIPOBJ *pco,
  284. RECTL *prclExtra,
  285. RECTL *prclOpaque,
  286. BRUSHOBJ *pboFore,
  287. BRUSHOBJ *pboOpaque,
  288. POINTL *pptlOrg,
  289. MIX mix
  290. );
  291. //
  292. // OEMWritePrinter - UNIDRV only (Interface 2 only)
  293. //
  294. HRESULT HComWritePrinter(
  295. POEM_PLUGIN_ENTRY pOemEntry,
  296. PDEVOBJ pdevobj,
  297. LPVOID pBuf,
  298. DWORD cbBuf,
  299. LPDWORD pcbWritten
  300. );
  301. #ifdef __cplusplus
  302. }
  303. #endif
  304. #endif // !_OEMKM_H_