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.

275 lines
8.1 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. spfusion.h
  5. Abstract:
  6. Wrappers and functions for fusionizing SetupAPI
  7. without effecting 3rd party DLL's
  8. and without dll-load overhead
  9. Author:
  10. Jamie Hunter (JamieHun) 12/4/2000
  11. Revision History:
  12. --*/
  13. //
  14. // redirect these API's to our internal implementation
  15. // that initializes fusion if needed
  16. //
  17. #ifdef FUSIONAWARE
  18. #undef CreateWindow
  19. #undef CreateWindowEx
  20. #undef CreateDialogParam
  21. #undef CreateDialogIndirectParam
  22. #undef DialogBoxParam
  23. #undef DialogBoxIndirectParam
  24. #undef MessageBox
  25. #undef PropertySheet
  26. #undef CreatePropertySheetPage
  27. #undef DestroyPropertySheetPage
  28. #undef ImageList_Create
  29. #undef ImageList_Destroy
  30. #undef ImageList_GetImageCount
  31. #undef ImageList_SetImageCount
  32. #undef ImageList_Add
  33. #undef ImageList_ReplaceIcon
  34. #undef ImageList_SetBkColor
  35. #undef ImageList_GetBkColor
  36. #undef ImageList_SetOverlayImage
  37. #undef GetOpenFileName
  38. #undef GetSaveFileName
  39. #undef ChooseColor
  40. #undef ChooseFont
  41. #undef CommDlgExtendedError
  42. #undef FindText
  43. #undef GetFileTitle
  44. #undef PageSetupDlg
  45. #undef PrintDlg
  46. #undef PrintDlgEx
  47. #undef ReplaceText
  48. #define CreateWindow spFusionCreateWindow
  49. #define CreateWindowEx spFusionCreateWindowEx
  50. #define CreateDialogParam spFusionCreateDialogParam
  51. #define CreateDialogIndirectParam spFusionCreateDialogIndirectParam
  52. #define DialogBoxParam spFusionDialogBoxParam
  53. #define DialogBoxIndirectParam spFusionDialogBoxIndirectParam
  54. #define MessageBox spFusionMessageBox
  55. #define PropertySheet spFusionPropertySheet
  56. #define CreatePropertySheetPage spFusionCreatePropertySheetPage
  57. #define DestroyPropertySheetPage spFusionDestroyPropertySheetPage
  58. #define ImageList_Create spFusionImageList_Create
  59. #define ImageList_Destroy spFusionImageList_Destroy
  60. #define ImageList_GetImageCount spFusionImageList_GetImageCount
  61. #define ImageList_SetImageCount spFusionImageList_SetImageCount
  62. #define ImageList_Add spFusionImageList_Add
  63. #define ImageList_ReplaceIcon spFusionImageList_ReplaceIcon
  64. #define ImageList_SetBkColor spFusionImageList_SetBkColor
  65. #define ImageList_GetBkColor spFusionImageList_GetBkColor
  66. #define ImageList_SetOverlayImage spFusionImageList_SetOverlayImage
  67. #define GetOpenFileName spFusionGetOpenFileName
  68. BOOL spFusionInitialize();
  69. BOOL spFusionUninitialize(BOOL Full);
  70. HWND spFusionCreateWindow(
  71. LPCTSTR lpClassName, // registered class name
  72. LPCTSTR lpWindowName, // window name
  73. DWORD dwStyle, // window style
  74. int x, // horizontal position of window
  75. int y, // vertical position of window
  76. int nWidth, // window width
  77. int nHeight, // window height
  78. HWND hWndParent, // handle to parent or owner window
  79. HMENU hMenu, // menu handle or child identifier
  80. HINSTANCE hInstance, // handle to application instance
  81. LPVOID lpParam // window-creation data
  82. );
  83. HWND spFusionCreateWindowEx(
  84. DWORD dwExStyle, // extended window style
  85. LPCTSTR lpClassName, // registered class name
  86. LPCTSTR lpWindowName, // window name
  87. DWORD dwStyle, // window style
  88. int x, // horizontal position of window
  89. int y, // vertical position of window
  90. int nWidth, // window width
  91. int nHeight, // window height
  92. HWND hWndParent, // handle to parent or owner window
  93. HMENU hMenu, // menu handle or child identifier
  94. HINSTANCE hInstance, // handle to application instance
  95. LPVOID lpParam // window-creation data
  96. );
  97. HWND spFusionCreateDialogParam(
  98. HINSTANCE hInstance, // handle to module
  99. LPCTSTR lpTemplateName, // dialog box template
  100. HWND hWndParent, // handle to owner window
  101. DLGPROC lpDialogFunc, // dialog box procedure
  102. LPARAM dwInitParam // initialization value
  103. );
  104. HWND spFusionCreateDialogIndirectParam(
  105. HINSTANCE hInstance, // handle to module
  106. LPCDLGTEMPLATE lpTemplate, // dialog box template
  107. HWND hWndParent, // handle to owner window
  108. DLGPROC lpDialogFunc, // dialog box procedure
  109. LPARAM lParamInit // initialization value
  110. );
  111. INT_PTR spFusionDialogBoxParam(
  112. HINSTANCE hInstance, // handle to module
  113. LPCTSTR lpTemplateName, // dialog box template
  114. HWND hWndParent, // handle to owner window
  115. DLGPROC lpDialogFunc, // dialog box procedure
  116. LPARAM dwInitParam // initialization value
  117. );
  118. INT_PTR spFusionDialogBoxIndirectParam(
  119. HINSTANCE hInstance, // handle to module
  120. LPCDLGTEMPLATE hDialogTemplate, // dialog box template
  121. HWND hWndParent, // handle to owner window
  122. DLGPROC lpDialogFunc, // dialog box procedure
  123. LPARAM dwInitParam // initialization value
  124. );
  125. int spFusionMessageBox(
  126. IN HWND hWnd,
  127. IN LPCTSTR lpText,
  128. IN LPCTSTR lpCaption,
  129. IN UINT uType
  130. );
  131. int spNonFusionMessageBox(
  132. IN HWND hWnd,
  133. IN LPCTSTR lpText,
  134. IN LPCTSTR lpCaption,
  135. IN UINT uType
  136. );
  137. INT_PTR spFusionPropertySheet(
  138. LPCPROPSHEETHEADER pPropSheetHeader
  139. );
  140. HPROPSHEETPAGE spFusionCreatePropertySheetPage(
  141. LPPROPSHEETPAGE pPropSheetPage
  142. );
  143. BOOL spFusionDestroyPropertySheetPage(
  144. HPROPSHEETPAGE hPropSheetPage
  145. );
  146. //
  147. // from commctrl.h
  148. //
  149. HIMAGELIST spFusionImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
  150. BOOL spFusionImageList_Destroy(HIMAGELIST himl);
  151. int spFusionImageList_GetImageCount(HIMAGELIST himl);
  152. BOOL spFusionImageList_SetImageCount(HIMAGELIST himl, UINT uNewCount);
  153. int spFusionImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  154. int spFusionImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  155. COLORREF spFusionImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  156. COLORREF spFusionImageList_GetBkColor(HIMAGELIST himl);
  157. BOOL spFusionImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  158. //
  159. // from commdlg.h
  160. //
  161. BOOL spFusionGetOpenFileName(LPOPENFILENAME lpofn);
  162. //
  163. // private stuff
  164. //
  165. typedef struct _SPFUSIONINSTANCE {
  166. BOOL Acquired;
  167. ULONG_PTR Cookie;
  168. } SPFUSIONINSTANCE, *PSPFUSIONINSTANCE;
  169. HANDLE
  170. spFusionContextFromModule(
  171. IN PCTSTR ModuleName
  172. );
  173. BOOL
  174. spFusionKillContext(
  175. IN HANDLE hContext
  176. );
  177. BOOL
  178. spFusionEnterContext(
  179. IN HANDLE hContext,
  180. OUT PSPFUSIONINSTANCE pInst
  181. );
  182. BOOL
  183. spFusionLeaveContext(
  184. IN PSPFUSIONINSTANCE pInst
  185. );
  186. #else
  187. //
  188. // dummy structure/API's that do nothing
  189. //
  190. typedef struct _SPFUSIONINSTANCE {
  191. BOOL Acquired;
  192. } SPFUSIONINSTANCE, *PSPFUSIONINSTANCE;
  193. __inline
  194. HANDLE
  195. spFusionContextFromModule(
  196. IN PCTSTR ModuleName
  197. )
  198. {
  199. ModuleName = ModuleName;
  200. return NULL;
  201. }
  202. __inline
  203. BOOL
  204. spFusionKillContext(
  205. IN HANDLE hContext
  206. )
  207. {
  208. hContext = hContext;
  209. return TRUE;
  210. }
  211. __inline
  212. BOOL
  213. spFusionEnterContext(
  214. IN HANDLE hContext,
  215. OUT PSPFUSIONINSTANCE pInst
  216. )
  217. {
  218. hContext = hContext;
  219. pInst->Acquired = TRUE;
  220. return TRUE;
  221. }
  222. __inline
  223. BOOL
  224. spFusionLeaveContext(
  225. IN PSPFUSIONINSTANCE pInst
  226. )
  227. {
  228. pInst->Acquired = FALSE;
  229. return TRUE;
  230. }
  231. #endif // FUSIONAWARE