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.

310 lines
8.3 KiB

  1. /*************************************************************************
  2. msostd.h
  3. Owner: rickp
  4. Copyright (c) 1994 Microsoft Corporation
  5. Standard common definitions shared by all office stuff
  6. *************************************************************************/
  7. #if !defined(MSOSTD_H)
  8. #define MSOSTD_H
  9. /*************************************************************************
  10. make sure we have our processor type set up right - note that we
  11. now have three - count 'em, three - different symbols defined for
  12. each processor we support (e.g., X86, _X86_, and _M_IX386)
  13. *************************************************************************/
  14. #if !defined(PPCMAC) && !defined(PPCLIB) && !defined(X86) && !defined(M68K)
  15. #if defined(_M_IX86)
  16. #define X86 1
  17. #elif defined(_M_IA64)
  18. #define X86 1
  19. #elif defined(_M_MPPC)
  20. //#define MAC 1
  21. #define PPCMAC 1
  22. #elif defined(_M_M68K)
  23. //#define MAC 1
  24. #error Hey howd we get here?
  25. #define M68K 1
  26. #elif defined(_M_AMD64)
  27. #elif defined(_M_PPC) || defined(PPCNT)
  28. // REVIEW brianwen: Much as we'd like to actually define PPC,
  29. // a bunch of code erroneously assumes PPC == PPCMAC....
  30. // #define PPC 1
  31. #else
  32. #error Must define a target architecture
  33. #endif
  34. #endif
  35. /*************************************************************************
  36. Pull in standard Windows and C definitions.
  37. *************************************************************************/
  38. /* make sure the compiler generates intrinsic calls of all crt functions,
  39. or else we'll pull in a ton of crt stuff we probably don't want. */
  40. #ifndef RC_INVOKED
  41. #include <string.h>
  42. #pragma intrinsic(memcpy, memset, memcmp)
  43. #endif
  44. #define OEMRESOURCE
  45. #if MAC
  46. // By default, use Native Mac OLE interfaces (instead of WLM)
  47. #if !defined(MSO_NATIVE_MACOLE)
  48. #define MSO_NATIVE_MACOLE 1
  49. #endif
  50. #if !defined(MSO_USE_OLENLS) && !defined(_WIN32NLS)
  51. #define _WIN32NLS
  52. #endif
  53. #if MSO_NATIVE_MACOLE && !defined(_MACOLENAMES)
  54. #define _MACOLENAMES
  55. #endif
  56. #define GUID_DEFINED
  57. #define __OBJECTID_DEFINED
  58. #ifndef _WIN32
  59. #define _WIN32
  60. #endif
  61. #endif
  62. #include <windows.h>
  63. #if !defined(RC_INVOKED)
  64. #include <ole2.h>
  65. #endif
  66. #if MAC && !defined(RC_INVOKED)
  67. #include <macname1.h>
  68. #undef CopyRgn
  69. #undef UnionRgn
  70. #undef XorRgn
  71. #include <Types.h>
  72. #include <macos\Resource.h>
  73. #include <Lowmem.h>
  74. #include <Fragload.h>
  75. #include <Files.h>
  76. #include <OSUtils.h>
  77. #include <GestaltEqu.h>
  78. #include <Errors.h>
  79. #include <Aliases.h>
  80. #include <macname2.h>
  81. #undef CopyRgn
  82. #undef UnionRgn
  83. #undef XorRgn
  84. #include <winver.h>
  85. #if MSO_NATIVE_MACOLE
  86. #pragma warning(disable:4142)
  87. #include <macname1.h>
  88. #undef CopyRgn
  89. #undef UnionRgn
  90. #undef XorRgn
  91. #include <dispatch.h>
  92. #define __IDispatch_INTERFACE_DEFINED__
  93. #include <macname2.h>
  94. #undef CopyRgn
  95. #undef UnionRgn
  96. #undef XorRgn
  97. typedef UINT CLIPFORMAT;
  98. #endif
  99. #define LPCRECT const Rect*
  100. #pragma warning(disable:4041)
  101. #endif
  102. #include <stdarg.h>
  103. #define MsoMemcpy memcpy
  104. #define MsoMemset memset
  105. #define MsoMemcmp memcmp
  106. #define MsoMemmove memmove
  107. #if MAC
  108. #define ExtTextOutW MsoExtTextOutW
  109. #define TextOutW MsoTextOutW
  110. #define GetTextExtentPointW MsoGetTextExtentPointW
  111. #ifdef __cplusplus
  112. extern "C" {
  113. #endif
  114. WINGDIAPI BOOL APIENTRY MsoGetTextExtentPointW(HDC, LPCWSTR, int, LPSIZE);
  115. WINGDIAPI BOOL WINAPI MsoExtTextOutW(HDC, int, int, UINT, CONST RECT *,LPCWSTR, UINT, CONST INT *);
  116. WINGDIAPI BOOL WINAPI MsoTextOutW(HDC, int, int, LPCWSTR, int);
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif
  121. /*************************************************************************
  122. Pre-processor magic to simplify Mac vs. Windows expressions.
  123. *************************************************************************/
  124. #if MAC
  125. #define Mac(foo) foo
  126. #define MacElse(mac, win) mac
  127. #define NotMac(foo)
  128. #define Win(foo)
  129. #define WinMac(win,mac) mac
  130. #else
  131. #define Mac(foo)
  132. #define MacElse(mac, win) win
  133. #define NotMac(foo) foo
  134. #define Win(foo) foo
  135. #define WinMac(win,mac) win
  136. #endif
  137. /*************************************************************************
  138. Calling conventions
  139. If you futz with these, check the cloned copies in inc\msosdm.h
  140. *************************************************************************/
  141. #if !defined(OFFICE_BUILD)
  142. #define MSOPUB __declspec(dllimport)
  143. #define MSOPUBDATA __declspec(dllimport)
  144. #else
  145. #define MSOPUB __declspec(dllexport)
  146. #define MSOPUBDATA __declspec(dllexport)
  147. #endif
  148. /* MSOPUBX are APIs that used to be public but no one currently uses,
  149. so we've unexported them. If someone decides they want/need one of
  150. these APIs, we should feel free to re-export them */
  151. #if GELTEST
  152. #define MSOPUBX MSOPUB
  153. #define MSOPUBDATAX MSOPUBDATA
  154. #else
  155. #define MSOPUBX
  156. #define MSOPUBDATAX
  157. #endif
  158. /* used for interface that rely on using the OS (stdcall) convention */
  159. #define MSOSTDAPICALLTYPE __stdcall
  160. /* used for interfaces that don't depend on using the OS (stdcall) convention */
  161. #define MSOAPICALLTYPE __stdcall
  162. #if defined(__cplusplus)
  163. #define MSOEXTERN_C extern "C"
  164. #else
  165. #define MSOEXTERN_C
  166. #endif
  167. #define MSOAPI_(t) MSOEXTERN_C MSOPUB t MSOAPICALLTYPE
  168. #define MSOSTDAPI_(t) MSOEXTERN_C MSOPUB t MSOSTDAPICALLTYPE
  169. #define MSOAPIX_(t) MSOEXTERN_C MSOPUBX t MSOAPICALLTYPE
  170. #define MSOSTDAPIX_(t) MSOEXTERN_C MSOPUBX t MSOSTDAPICALLTYPE
  171. #if MAC
  172. #define MSOPUBXX
  173. #define MSOAPIMX_(t) MSOAPI_(t)
  174. #define MSOAPIXX_(t) MSOAPIX_(t)
  175. #else
  176. #define MSOPUBXX MSOPUB
  177. #define MSOAPIMX_(t) MSOAPIX_(t)
  178. #define MSOAPIXX_(t) MSOAPI_(t)
  179. #endif
  180. #define MSOMETHOD(m) STDMETHOD(m)
  181. #define MSOMETHOD_(t,m) STDMETHOD_(t,m)
  182. #define MSOMETHODIMP STDMETHODIMP
  183. #define MSOMETHODIMP_(t) STDMETHODIMP_(t)
  184. /* Interfaces derived from IUnknown behave in funny ways on the Mac */
  185. #if MAC && MSO_NATIVE_MACOLE
  186. #define BEGIN_MSOINTERFACE BEGIN_INTERFACE
  187. #else
  188. #define BEGIN_MSOINTERFACE
  189. #endif
  190. // Deal with "split" DLLs for the Mac PPC Build
  191. #if MAC && MACDLLSPLIT
  192. #define MSOMACPUB MSOPUB
  193. #define MSOMACPUBDATA MSOPUBDATA
  194. #define MSOMACAPI_(t) MSOAPI_(t)
  195. #define MSOMACAPIX_(t) MSOAPIX_(t)
  196. #else
  197. #define MSOMACPUB
  198. #define MSOMACPUBDATA
  199. #define MSOMACAPI_(t) t
  200. #define MSOMACAPIX_(t) t
  201. #endif
  202. #if X86 && !DEBUG
  203. #define MSOPRIVCALLTYPE __fastcall
  204. #else
  205. #define MSOPRIVCALLTYPE __cdecl
  206. #endif
  207. #if MAC
  208. #define MSOCONSTFIXUP(t) t
  209. #else
  210. #define MSOCONSTFIXUP(t) const t
  211. #endif
  212. /*************************************************************************
  213. Extensions to winuser.h from \\ole\access\inc\winuser.h
  214. ***************************************************************** DAVEPA */
  215. #if !MAC
  216. #define WM_GETOBJECT 0x003D
  217. #define WMOBJ_ID 0x0000
  218. #define WMOBJ_POINT 0x0001
  219. #define WMOBJID_SELF 0x00000000
  220. #endif
  221. /*************************************************************************
  222. Common #define section
  223. *************************************************************************/
  224. /* All Microsoft Office specific windows messages should use WM_MSO.
  225. Submessages passed through wParam should be defined in offpch.h. */
  226. // TODO: This value has been okay'ed by Word, Excel, PowerPoint, and Access.
  227. // Still waiting to hear from Ren and Project.
  228. #define WM_MSO (WM_USER + 0x0900)
  229. /* All Microsoft Office specific Apple events should use MSO_EVENTCLASS
  230. as the EventClass of their Apple Events */
  231. // TODO: This value needs to be okay'd by Word, Excel, PowerPoint, Access and
  232. // possibly Apple
  233. #if MAC
  234. #define MSO_EVENTCLASS '_mso'
  235. #define MSO_WPARAM 'wprm'
  236. #define MSO_LPARAM 'lprm'
  237. #define MSO_NSTI 'nsti'
  238. #endif
  239. // NA means not applicable. Use NA to help document parameters to functions.
  240. #undef NA
  241. #define NA 0L
  242. /* End of common #define section */
  243. /*************************************************************************
  244. Common segmentation definitions
  245. *************************************************************************/
  246. /* Used with #pragma to swap-tune global variables into the boot section
  247. of the data segment. Should link with -merge:.bootdata=.data when
  248. using these pragmas */
  249. #if MAC || DEBUG
  250. #define MSO_BOOTDATA
  251. #define MSO_ENDBOOTDATA
  252. #else
  253. #define MSO_BOOTDATA data_seg(".bootdata")
  254. #define MSO_ENDBOOTDATA data_seg()
  255. #endif
  256. #endif // MSOSTD_H