Source code of Windows XP (NT5)
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.

283 lines
8.6 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: Global Interface Pointer API support
  6. File: Gip.h
  7. Owner: DmitryR
  8. This is the GIP header file.
  9. ===================================================================*/
  10. #ifndef _ASP_GIP_H
  11. #define _ASP_GIP_H
  12. // ***********************************************************************
  13. // =======================================================================
  14. // -----------------------------------------------------------------------
  15. // START OF SP3 1.78 SDK Additions
  16. // -----------------------------------------------------------------------
  17. // The following are SP3 1.78 Additions from Rick Hill (rickhi)
  18. // extracted from CGUID.H and OBJIDL.H
  19. // -----------------------------------------------------------------------
  20. // UNDONE: Once the new SDK is available the stuff below will be gone
  21. // -----------------------------------------------------------------------
  22. // =======================================================================
  23. // ***********************************************************************
  24. EXTERN_C const CLSID CLSID_StdGlobalInterfaceTable;
  25. #ifndef __IGlobalInterfaceTable_FWD_DEFINED__
  26. #define __IGlobalInterfaceTable_FWD_DEFINED__
  27. typedef interface IGlobalInterfaceTable IGlobalInterfaceTable;
  28. #endif /* __IGlobalInterfaceTable_FWD_DEFINED__ */
  29. #ifndef __IGlobalInterfaceTable_INTERFACE_DEFINED__
  30. #define __IGlobalInterfaceTable_INTERFACE_DEFINED__
  31. /****************************************
  32. * Generated header for interface: IGlobalInterfaceTable
  33. * at Fri Apr 04 10:36:42 1997
  34. * using MIDL 3.00.44
  35. ****************************************/
  36. /* [uuid][object][local] */
  37. typedef /* [unique] */ __RPC_FAR *LPGLOBALINTERFACETABLE;
  38. EXTERN_C const IID IID_IGlobalInterfaceTable;
  39. #if defined(__cplusplus) && !defined(CINTERFACE)
  40. interface IGlobalInterfaceTable : public IUnknown
  41. {
  42. public:
  43. virtual HRESULT STDMETHODCALLTYPE RegisterInterfaceInGlobal(
  44. /* [in] */ IUnknown __RPC_FAR *pUnk,
  45. /* [in] */ REFIID riid,
  46. /* [out] */ DWORD __RPC_FAR *pdwCookie) = 0;
  47. virtual HRESULT STDMETHODCALLTYPE RevokeInterfaceFromGlobal(
  48. /* [in] */ DWORD dwCookie) = 0;
  49. virtual HRESULT STDMETHODCALLTYPE GetInterfaceFromGlobal(
  50. /* [in] */ DWORD dwCookie,
  51. /* [in] */ REFIID riid,
  52. /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppv) = 0;
  53. };
  54. #else /* C style interface */
  55. typedef struct IGlobalInterfaceTableVtbl
  56. {
  57. BEGIN_INTERFACE
  58. HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
  59. IGlobalInterfaceTable __RPC_FAR * This,
  60. /* [in] */ REFIID riid,
  61. /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
  62. ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
  63. IGlobalInterfaceTable __RPC_FAR * This);
  64. ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
  65. IGlobalInterfaceTable __RPC_FAR * This);
  66. HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RegisterInterfaceInGlobal )(
  67. IGlobalInterfaceTable __RPC_FAR * This,
  68. /* [in] */ IUnknown __RPC_FAR *pUnk,
  69. /* [in] */ REFIID riid,
  70. /* [out] */ DWORD __RPC_FAR *pdwCookie);
  71. HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RevokeInterfaceFromGlobal )(
  72. IGlobalInterfaceTable __RPC_FAR * This,
  73. /* [in] */ DWORD dwCookie);
  74. HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetInterfaceFromGlobal )(
  75. IGlobalInterfaceTable __RPC_FAR * This,
  76. /* [in] */ DWORD dwCookie,
  77. /* [in] */ REFIID riid,
  78. /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppv);
  79. END_INTERFACE
  80. } IGlobalInterfaceTableVtbl;
  81. interface IGlobalInterfaceTable
  82. {
  83. CONST_VTBL struct IGlobalInterfaceTableVtbl __RPC_FAR *lpVtbl;
  84. };
  85. #ifdef COBJMACROS
  86. #define IGlobalInterfaceTable_QueryInterface(This,riid,ppvObject) \
  87. (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
  88. #define IGlobalInterfaceTable_AddRef(This) \
  89. (This)->lpVtbl -> AddRef(This)
  90. #define IGlobalInterfaceTable_Release(This) \
  91. (This)->lpVtbl -> Release(This)
  92. #define IGlobalInterfaceTable_RegisterInterfaceInGlobal(This,pUnk,riid,
  93. pdwCookie) \
  94. (This)->lpVtbl -> RegisterInterfaceInGlobal(This,pUnk,riid,pdwCookie)
  95. #define IGlobalInterfaceTable_RevokeInterfaceFromGlobal(This,dwCookie) \
  96. (This)->lpVtbl -> RevokeInterfaceFromGlobal(This,dwCookie)
  97. #define IGlobalInterfaceTable_GetInterfaceFromGlobal(This,dwCookie,riid,ppv) \
  98. (This)->lpVtbl -> GetInterfaceFromGlobal(This,dwCookie,riid,ppv)
  99. #endif /* COBJMACROS */
  100. #endif /* C style interface */
  101. HRESULT STDMETHODCALLTYPE
  102. IGlobalInterfaceTable_RegisterInterfaceInGlobal_Proxy(
  103. IGlobalInterfaceTable __RPC_FAR * This,
  104. /* [in] */ IUnknown __RPC_FAR *pUnk,
  105. /* [in] */ REFIID riid,
  106. /* [out] */ DWORD __RPC_FAR *pdwCookie);
  107. void __RPC_STUB IGlobalInterfaceTable_RegisterInterfaceInGlobal_Stub(
  108. IRpcStubBuffer *This,
  109. IRpcChannelBuffer *_pRpcChannelBuffer,
  110. PRPC_MESSAGE _pRpcMessage,
  111. DWORD *_pdwStubPhase);
  112. HRESULT STDMETHODCALLTYPE
  113. IGlobalInterfaceTable_RevokeInterfaceFromGlobal_Proxy(
  114. IGlobalInterfaceTable __RPC_FAR * This,
  115. /* [in] */ DWORD dwCookie);
  116. void __RPC_STUB IGlobalInterfaceTable_RevokeInterfaceFromGlobal_Stub(
  117. IRpcStubBuffer *This,
  118. IRpcChannelBuffer *_pRpcChannelBuffer,
  119. PRPC_MESSAGE _pRpcMessage,
  120. DWORD *_pdwStubPhase);
  121. HRESULT STDMETHODCALLTYPE IGlobalInterfaceTable_GetInterfaceFromGlobal_Proxy(
  122. IGlobalInterfaceTable __RPC_FAR * This,
  123. /* [in] */ DWORD dwCookie,
  124. /* [in] */ REFIID riid,
  125. /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppv);
  126. void __RPC_STUB IGlobalInterfaceTable_GetInterfaceFromGlobal_Stub(
  127. IRpcStubBuffer *This,
  128. IRpcChannelBuffer *_pRpcChannelBuffer,
  129. PRPC_MESSAGE _pRpcMessage,
  130. DWORD *_pdwStubPhase);
  131. #endif /* __IGlobalInterfaceTable_INTERFACE_DEFINED__ */
  132. // ***********************************************************************
  133. // =======================================================================
  134. // -----------------------------------------------------------------------
  135. // END OF SP3 1.78 SDK Additions
  136. // -----------------------------------------------------------------------
  137. // =======================================================================
  138. // ***********************************************************************
  139. /*===================================================================
  140. Includes
  141. ===================================================================*/
  142. /*===================================================================
  143. Defines
  144. ===================================================================*/
  145. #define NULL_GIP_COOKIE 0xFFFFFFFF
  146. /*===================================================================
  147. C G l o b a l I n t e r f a c e A P I
  148. ===================================================================*/
  149. class CGlobalInterfaceAPI
  150. {
  151. private:
  152. // Is inited?
  153. DWORD m_fInited : 1;
  154. // Pointer to the COM object
  155. IGlobalInterfaceTable *m_pGIT;
  156. public:
  157. CGlobalInterfaceAPI();
  158. ~CGlobalInterfaceAPI();
  159. HRESULT Init();
  160. HRESULT UnInit();
  161. // inlines for the real API calls:
  162. HRESULT Register(IUnknown *pUnk, REFIID riid, DWORD *pdwCookie);
  163. HRESULT Get(DWORD dwCookie, REFIID riid, void **ppv);
  164. HRESULT Revoke(DWORD dwCookie);
  165. public:
  166. #if DBG
  167. inline void AssertValid() const
  168. {
  169. DBG_ASSERT(m_fInited);
  170. DBG_ASSERT(m_pGIT);
  171. }
  172. #else
  173. inline void AssertValid() const {}
  174. #endif
  175. };
  176. /*===================================================================
  177. CGlobalInterfaceAPI inlines
  178. ===================================================================*/
  179. inline HRESULT CGlobalInterfaceAPI::Register
  180. (
  181. IUnknown *pUnk,
  182. REFIID riid,
  183. DWORD *pdwCookie
  184. )
  185. {
  186. AssertValid();
  187. return m_pGIT->RegisterInterfaceInGlobal(pUnk, riid, pdwCookie);
  188. }
  189. inline HRESULT CGlobalInterfaceAPI::Get
  190. (
  191. DWORD dwCookie,
  192. REFIID riid,
  193. void **ppv
  194. )
  195. {
  196. AssertValid();
  197. return m_pGIT->GetInterfaceFromGlobal(dwCookie, riid, ppv);
  198. }
  199. inline HRESULT CGlobalInterfaceAPI::Revoke
  200. (
  201. DWORD dwCookie
  202. )
  203. {
  204. AssertValid();
  205. return m_pGIT->RevokeInterfaceFromGlobal(dwCookie);
  206. }
  207. /*===================================================================
  208. Globals
  209. ===================================================================*/
  210. extern CGlobalInterfaceAPI g_GIPAPI;
  211. #endif // _ASP_GIP_H