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.

297 lines
8.2 KiB

  1. //*******************************************************************
  2. //
  3. //
  4. // win2mac.h
  5. //
  6. // Compatability transforms
  7. //
  8. //
  9. //
  10. //*******************************************************************
  11. #ifndef _WIN2MAC_H_
  12. #define _WIN2MAC_H_
  13. #ifdef MACPORT
  14. #define USE_UNICODE_WRAPPER
  15. #if defined(UNICODE)
  16. #include "ourmac.h"
  17. #include "msostd.h"
  18. #include "msostr.h"
  19. #include "msointl.h"
  20. #include <winnls.h>
  21. #include <WINUSER.H>
  22. #include <tchar.h>
  23. //----------------------------------------------------------------------------
  24. // We have to re-define some of the clipboard formats
  25. #ifdef CF_TEXT
  26. #undef CF_TEXT
  27. #endif
  28. #define CF_TEXT cfText
  29. #ifdef CF_UNICODETEXT
  30. #undef CF_UNICODETEXT
  31. #endif
  32. #define CF_UNICODETEXT 'UNIC'
  33. //----------------------------------------------------------------------------
  34. // These are from WINERROR.H which is no longer being included
  35. // now that we compile for native MACOLE
  36. #define ERROR_INVALID_FLAGS 1004L
  37. #define CO_E_RELEASED 0x800401FFL
  38. #define FACILITY_WIN32 0x0007
  39. #define HRESULT_FROM_WIN32(x) \
  40. (x ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : 0 )
  41. //----------------------------------------------------------------------------
  42. // maximum unsigned 16 bit value - from MSDEV\limits.h
  43. #define _UI16_MAX 0xffffui16
  44. //----------------------------------------------------------------------------
  45. //
  46. // Misc functions/macros
  47. //
  48. //----------------------------------------------------------------------------
  49. EXTERN_C int __pascal GetLocaleInfoA(LCID, LCTYPE, char FAR*, int);
  50. LRESULT CALLBACK MacRichEditWndProc(HWND, UINT, WPARAM, LPARAM);
  51. UINT MacSimulateKey (UINT& msg, WPARAM& wParam);
  52. UINT MacSimulateMouseButtons (UINT& msg, WPARAM& wParam);
  53. #define ActivateKeyboardLayout(a,b)
  54. #define CreateFileW CreateFileA
  55. #define GetHGlobalFromStream(a, b) GetHGlobalFromStream(a, (Handle *)b)
  56. #define GetProfileIntA(a,b,c) c
  57. #define OleDuplicateData(a,b,c) OleDuplicateData((Handle)a, b, c)
  58. #define ReleaseStgMedium(a) ReleaseStgMedium((DUAL_STGMEDIUM*)a)
  59. //----------------------------------------------------------------------------
  60. #ifdef ExtTextOutW
  61. #undef ExtTextOutW
  62. #endif
  63. #define ExtTextOutW MsoExtTextOutW
  64. MSOAPI_(BOOL) MsoTextOutW(HDC, int, int, LPCWSTR, int);
  65. //----------------------------------------------------------------------------
  66. #ifdef TextOutW
  67. #undef TextOutW
  68. #endif
  69. #define TextOutW MsoTextOutW
  70. MSOAPI_(BOOL) MsoExtTextOutW(HDC, int, int, UINT, CONST RECT *,LPCWSTR, UINT, CONST INT *);
  71. //----------------------------------------------------------------------------
  72. #ifdef GetTextExtentPointW
  73. #undef GetTextExtentPointW
  74. #endif
  75. #define GetTextExtentPointW MsoGetTextExtentPointW
  76. MSOAPI_(BOOL) MsoGetTextExtentPointW(HDC, LPCWSTR, int, LPSIZE);
  77. //----------------------------------------------------------------------------
  78. #ifdef MultiByteToWideChar
  79. #undef MultiByteToWideChar
  80. #endif
  81. #define MultiByteToWideChar MsoMultiByteToWideChar
  82. //----------------------------------------------------------------------------
  83. #ifdef WideCharToMultiByte
  84. #undef WideCharToMultiByte
  85. #endif
  86. #define WideCharToMultiByte MsoWideCharToMultiByte
  87. //----------------------------------------------------------------------------
  88. //
  89. // Mac wrappers
  90. //
  91. //----------------------------------------------------------------------------
  92. //----------------------------------------------------------------------------
  93. #ifdef CoTaskMemAlloc
  94. #undef CoTaskMemAlloc
  95. #endif
  96. #define CoTaskMemAlloc MacCoTaskMemAlloc
  97. STDAPI_(LPVOID) MacCoTaskMemAlloc(
  98. ULONG cb
  99. );
  100. //----------------------------------------------------------------------------
  101. #ifdef CoTaskMemRealloc
  102. #undef CoTaskMemRealloc
  103. #endif
  104. #define CoTaskMemRealloc MacCoTaskMemRealloc
  105. STDAPI_(LPVOID) MacCoTaskMemRealloc(
  106. LPVOID pv,
  107. ULONG cb
  108. );
  109. //----------------------------------------------------------------------------
  110. #ifdef CoTaskMemFree
  111. #undef CoTaskMemFree
  112. #endif
  113. #define CoTaskMemFree MacCoTaskMemFree
  114. STDAPI_(void) MacCoTaskMemFree(
  115. LPVOID pv
  116. );
  117. //----------------------------------------------------------------------------
  118. #ifdef CLSIDFromProgID
  119. #undef CLSIDFromProgID
  120. #endif
  121. #define CLSIDFromProgID MacCLSIDFromProgID
  122. STDAPI MacCLSIDFromProgID(
  123. LPCWSTR lpszProgID,
  124. LPCLSID lpclsid
  125. );
  126. //----------------------------------------------------------------------------
  127. #ifdef DoDragDrop
  128. #undef DoDragDrop
  129. #endif
  130. #define DoDragDrop MacDoDragDrop
  131. STDAPI MacDoDragDrop(
  132. LPDATAOBJECT pDataObj,
  133. LPDROPSOURCE pDropSource,
  134. DWORD dwOKEffects,
  135. LPDWORD pdwEffect
  136. );
  137. //----------------------------------------------------------------------------
  138. #ifdef GetCurrentObject
  139. #undef GetCurrentObject
  140. #endif
  141. #define GetCurrentObject MacGetCurrentObject
  142. HGDIOBJ WINAPI MacGetCurrentObject(HDC hdc,
  143. UINT uObjectType);
  144. //----------------------------------------------------------------------------
  145. #ifdef GetDoubleClickTime
  146. #undef GetDoubleClickTime
  147. #endif
  148. #define GetDoubleClickTime MacGetDoubleClickTime;
  149. UINT MacGetDoubleClickTime();
  150. //----------------------------------------------------------------------------
  151. #ifdef GetMetaFileBitsEx
  152. #undef GetMetaFileBitsEx
  153. #endif
  154. #define GetMetaFileBitsEx MacGetMetaFileBitsEx
  155. UINT WINAPI MacGetMetaFileBitsEx(
  156. HMETAFILE hmf,
  157. UINT nSize,
  158. LPVOID lpvData
  159. );
  160. //----------------------------------------------------------------------------
  161. #ifdef IsValidCodePage
  162. #undef IsValidCodePage
  163. #endif
  164. #define IsValidCodePage MacIsValidCodePage
  165. WINBASEAPI BOOL WINAPI MacIsValidCodePage(
  166. UINT CodePage
  167. );
  168. //----------------------------------------------------------------------------
  169. #ifdef OleDraw
  170. #undef OleDraw
  171. #endif
  172. #define OleDraw MacOleDraw
  173. STDAPI MacOleDraw(
  174. IUnknown * pUnk,
  175. DWORD dwAspect,
  176. HDC hdcDraw,
  177. LPCRECT lprcBounds
  178. );
  179. //----------------------------------------------------------------------------
  180. #ifdef ProgIDFromCLSID
  181. #undef ProgIDFromCLSID
  182. #endif
  183. #define ProgIDFromCLSID MacProgIDFromCLSID
  184. STDAPI MacProgIDFromCLSID(
  185. REFCLSID clsid,
  186. LPWSTR FAR* lplpszProgID
  187. );
  188. //----------------------------------------------------------------------------
  189. #ifdef RegisterDragDrop
  190. #undef RegisterDragDrop
  191. #endif
  192. #define RegisterDragDrop MacRegisterDragDrop
  193. STDAPI MacRegisterDragDrop(
  194. HWND hwnd,
  195. LPDROPTARGET pDropTarget
  196. );
  197. //----------------------------------------------------------------------------
  198. #ifdef RevokeDragDrop
  199. #undef RevokeDragDrop
  200. #endif
  201. #define RevokeDragDrop MacRevokeDragDrop
  202. STDAPI MacRevokeDragDrop(
  203. HWND hwnd
  204. );
  205. //----------------------------------------------------------------------------
  206. #ifdef SelectPalette
  207. #undef SelectPalette
  208. #endif
  209. #define SelectPalette MacSelectPalette
  210. HPALETTE WINAPI MacSelectPalette(
  211. HDC,
  212. HPALETTE,
  213. BOOL
  214. );
  215. //----------------------------------------------------------------------------
  216. #ifdef SetCursor
  217. #undef SetCursor
  218. #endif
  219. // note we have not named this MacSetCursor
  220. // since this function already exists in WLM
  221. #define SetCursor MacportSetCursor
  222. HCURSOR MacportSetCursor(
  223. HCURSOR hCursor
  224. );
  225. //----------------------------------------------------------------------------
  226. #ifdef SetMetaFileBitsEx
  227. #undef SetMetaFileBitsEx
  228. #endif
  229. #define SetMetaFileBitsEx MacSetMetaFileBitsEx
  230. HMETAFILE WINAPI MacSetMetaFileBitsEx(
  231. UINT nSize,
  232. CONST BYTE * lpData
  233. );
  234. //----------------------------------------------------------------------------
  235. #ifdef SysAllocStringLen
  236. #undef SysAllocStringLen
  237. #endif
  238. #define SysAllocStringLen MacSysAllocStringLen
  239. STDAPI_(BSTR) MacSysAllocStringLen(
  240. LPCWSTR,
  241. UINT
  242. );
  243. //----------------------------------------------------------------------------
  244. #ifdef WORDSWAPLONG
  245. #undef WORDSWAPLONG
  246. #endif
  247. #define WORDSWAPLONG MacWordSwapLong
  248. ULONG MacWordSwapLong(
  249. ULONG ul
  250. );
  251. #endif //UNICODE
  252. #endif //MACPORT
  253. #endif // _WIN2MAC_H_