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.

282 lines
8.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: interop.hxx
  7. //
  8. // Contents: Common definitions for the interop project
  9. //
  10. // History: 18-Feb-94 DrewB Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __INTEROP_HXX__
  14. #define __INTEROP_HXX__
  15. //+---------------------------------------------------------------------------
  16. //
  17. // Purpose: Standard debugging support
  18. //
  19. // History: 18-Feb-94 DrewB Created
  20. //
  21. //----------------------------------------------------------------------------
  22. #include <debnot.h>
  23. //
  24. // The rest of the OACF flags are defined in thunkapi.hxx. This one is here
  25. // because it is shared between ole2.dll and olethk32.dll. The 16-bit binaries
  26. // do not include thunkapi.hxx at the moment. KevinRo promises to fix this someday
  27. // Feel free to fix this if you wish.
  28. //
  29. #define OACF_CORELTRASHMEM 0x10000000 // CorelDraw relies on the fact that
  30. // OLE16 trashed memory during paste-
  31. // link. Therefore, we'll go ahead
  32. // and trash it for them if this
  33. // flag is on.
  34. #define OACF_CRLPNTPERSIST 0x01000000 // CorelPaint IPersistStg used in their
  35. // OleSave screws up in QI
  36. #define OACF_WORKSCLIPOBJ 0x00100000 // Works 3.0b creates a clipboard
  37. // data object with a zero ref count
  38. // Word 6 does this too. Same flag used.
  39. // Also Paradox5, Novel/Corel WrdPft.
  40. // They all call OleIsCurrentClipboard
  41. // with a 0-refcount 16-bit IDataObject ptr.
  42. #define OACF_TEXTARTDOBJ 0x00010000 // TextArt IDataAdvHolder::DAdvise has
  43. // data object with a zero ref count
  44. #if DBG == 1
  45. #ifdef WIN32
  46. DECLARE_DEBUG(thk);
  47. #else
  48. DECLARE_DEBUG(thk1);
  49. #endif
  50. #define DEB_DLL 0x0008
  51. #define DEB_THOPS DEB_USER1
  52. #define DEB_INVOKES DEB_USER2
  53. #define DEB_ARGS DEB_USER3
  54. #define DEB_NESTING DEB_USER4
  55. #define DEB_CALLTRACE DEB_USER5
  56. #define DEB_THUNKMGR DEB_USER6
  57. #define DEB_MEMORY DEB_USER7
  58. #define DEB_TLSTHK DEB_USER8
  59. #define DEB_UNKNOWN DEB_USER9
  60. #define DEB_FAILURES DEB_USER10
  61. #define DEB_DLLS16 DEB_USER11
  62. #define DEB_APIS16 DEB_USER12 // api calls to 16 bit entry point
  63. #define DEB_DBGFAIL DEB_USER13 // Pop up dialog to allow debugging
  64. #endif
  65. #if DBG == 1
  66. #ifdef WIN32
  67. #define thkDebugOut(x) thkInlineDebugOut x
  68. #else
  69. #define thkDebugOut(x) thk1InlineDebugOut x
  70. #endif
  71. #define thkAssert(e) Win4Assert(e)
  72. #define thkVerify(e) Win4Assert(e)
  73. #else
  74. #define thkDebugOut(x)
  75. #define thkAssert(e)
  76. #define thkVerify(e) (e)
  77. #endif
  78. #define OLETHUNK_DLL16NOTFOUND 0x88880002
  79. //+---------------------------------------------------------------------------
  80. //
  81. // Purpose: Declarations and definitions shared across everything
  82. //
  83. // History: 18-Feb-94 DrewB Created
  84. //
  85. //----------------------------------------------------------------------------
  86. // An IID pointer or an index into the list of known interfaces
  87. // If the high word is zero, it's an index, otherwise it's a pointer
  88. typedef DWORD IIDIDX;
  89. #define IIDIDX_IS_INDEX(ii) (HIWORD(ii) == 0)
  90. #define IIDIDX_IS_IID(ii) (!IIDIDX_IS_INDEX(ii))
  91. #define IIDIDX_INVALID ((IIDIDX)0xffff)
  92. #define INDEX_IIDIDX(idx) ((IIDIDX)(idx))
  93. #define IID_IIDIDX(piid) ((IIDIDX)(piid))
  94. #define IIDIDX_INDEX(ii) ((int)(ii))
  95. #define IIDIDX_IID(ii) ((IID const *)(ii))
  96. // Methods are treated as if they all existed on a single interface
  97. // Their method numbers are biased to distinguish them from real methods
  98. #define THK_API_BASE 0xf0000000
  99. #define THK_API_METHOD(method) (THK_API_BASE+(method))
  100. // Standard method indices in the vtable
  101. #define SMI_QUERYINTERFACE 0
  102. #define SMI_ADDREF 1
  103. #define SMI_RELEASE 2
  104. #define SMI_COUNT 3
  105. #ifndef WIN32
  106. #define UNALIGNED
  107. #endif
  108. //+---------------------------------------------------------------------------
  109. //
  110. // Struct: CALLDATA
  111. //
  112. // Purpose: Data describing a 16-bit call to be made on behalf of
  113. // the 32-bit code, used since Callback16 can only pass
  114. // one parameter
  115. //
  116. // History: 18-Feb-94 JohannP Created
  117. //
  118. //----------------------------------------------------------------------------
  119. typedef struct tagCallData
  120. {
  121. DWORD vpfn;
  122. DWORD vpvStack16;
  123. DWORD cbStack;
  124. } CALLDATA;
  125. typedef CALLDATA UNALIGNED FAR *LPCALLDATA;
  126. //+---------------------------------------------------------------------------
  127. //
  128. // Struct: DATA16
  129. //
  130. // Purpose: Data describing things in the 16-bit world that need to be
  131. // known to the 32-bit world.
  132. //
  133. // History: 3-Mar-94 BobDay Created
  134. //
  135. //----------------------------------------------------------------------------
  136. typedef struct tagDATA16
  137. {
  138. DWORD atfnProxy1632Vtbl;
  139. DWORD fnCallbackHandler;
  140. DWORD fnTaskAlloc;
  141. DWORD fnTaskFree;
  142. DWORD fnLoadProcDll;
  143. DWORD fnUnloadProcDll;
  144. DWORD fnCallGetClassObject;
  145. DWORD fnCallCanUnloadNow;
  146. DWORD fnQueryInterface16;
  147. DWORD fnAddRef16;
  148. DWORD fnRelease16;
  149. DWORD fnReleaseStgMedium16;
  150. DWORD avpfnSm16ReleaseHandlerVtbl;
  151. DWORD fnTouchPointer16;
  152. DWORD fnStgMediumStreamHandler16;
  153. DWORD fnCallStub16;
  154. DWORD fnSetOwnerPublic16;
  155. DWORD fnWinExec16;
  156. } DATA16;
  157. typedef DATA16 UNALIGNED FAR * LPDATA16;
  158. //+---------------------------------------------------------------------------
  159. //
  160. // Struct: LOADPROCDLLSTRUCT
  161. //
  162. // Purpose: Data passed to the LoadProcDll function that is called from
  163. // the 32-bit function of similar name.
  164. //
  165. // History: 11-Mar-94 BobDay Created
  166. //
  167. //----------------------------------------------------------------------------
  168. typedef struct tagLOADPROCDLLSTRUCT
  169. {
  170. DWORD vpDllName;
  171. DWORD vpfnGetClassObject;
  172. DWORD vpfnCanUnloadNow;
  173. DWORD vhmodule;
  174. } LOADPROCDLLSTRUCT;
  175. typedef LOADPROCDLLSTRUCT UNALIGNED FAR * LPLOADPROCDLLSTRUCT;
  176. //+---------------------------------------------------------------------------
  177. //
  178. // Struct: CALLGETCLASSOBJECTSTRUCT
  179. //
  180. // Purpose: Data passed to the CallGetClassObject function that is called
  181. // from the 32-bit function of similar name.
  182. //
  183. // History: 11-Mar-94 BobDay Created
  184. //
  185. //----------------------------------------------------------------------------
  186. typedef struct tagCALLGETCLASSOBJECTSTRUCT
  187. {
  188. DWORD vpfnGetClassObject;
  189. CLSID clsid;
  190. IID iid;
  191. DWORD iface;
  192. } CALLGETCLASSOBJECTSTRUCT;
  193. typedef CALLGETCLASSOBJECTSTRUCT UNALIGNED FAR * LPCALLGETCLASSOBJECTSTRUCT;
  194. //+---------------------------------------------------------------------------
  195. //
  196. // Struct: WINEXEC16STRUCT
  197. //
  198. // Purpose: Data passed to the WinExec16 function that is called from
  199. // the 32-bit function of similar name.
  200. //
  201. // History: 27-Jul-94 AlexT Created
  202. //
  203. //----------------------------------------------------------------------------
  204. typedef struct tagWINEXEC16STRUCT
  205. {
  206. DWORD vpCommandLine;
  207. unsigned short vusShow;
  208. } WINEXEC16STRUCT;
  209. typedef WINEXEC16STRUCT UNALIGNED FAR * LPWINEXEC16STRUCT;
  210. //+---------------------------------------------------------------------------
  211. //
  212. // Class: CSm16ReleaseHandler (srh)
  213. //
  214. // Purpose: Provides punkForRelease for 32->16 STGMEDIUM conversion
  215. //
  216. // Interface: IUnknown
  217. //
  218. // History: 24-Apr-94 DrewB Created
  219. //
  220. //----------------------------------------------------------------------------
  221. #ifdef __cplusplus
  222. class CSm16ReleaseHandler
  223. {
  224. public:
  225. void Init(IUnknown *pUnk,
  226. STGMEDIUM *psm32,
  227. STGMEDIUM UNALIGNED *psm16,
  228. IUnknown *punkForRelease,
  229. CLIPFORMAT cfFormat);
  230. void CallFailed() {
  231. _punkForRelease = NULL;
  232. }
  233. DWORD _avpfnVtbl;
  234. STGMEDIUM _sm32;
  235. STGMEDIUM _sm16;
  236. IUnknown *_punkForRelease;
  237. LONG _cReferences;
  238. CLIPFORMAT _cfFormat;
  239. IUnknown *_pUnkThkMgr;
  240. };
  241. #endif
  242. #endif // __INTEROP_HXX__