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.

151 lines
4.2 KiB

  1. //***************************************************************************
  2. //
  3. // cdisphlp.h
  4. //
  5. // Module: Client side of WBEMS marshalling.
  6. //
  7. // Purpose: Defines the CDispatchHelper object
  8. //
  9. // Copyright (c) 1998-1999 Microsoft Corporation
  10. //
  11. //***************************************************************************
  12. #ifndef _disphlp_H_
  13. #define _disphlp_H_
  14. // This class implements the IDispatch interface using a type library.
  15. class CDispatchHelp
  16. {
  17. private:
  18. BSTR m_objectName;
  19. HRESULT m_hResult; // Last HRESULT returned from CIMOM call
  20. protected:
  21. ITypeInfo *m_pITINeutral; //Type information for interface
  22. ITypeInfo *m_pCITINeutral; //Type information for class
  23. IDispatch *m_pObj;
  24. GUID m_iGUID; // Interface GUID
  25. GUID m_cGUID; // Class GUID
  26. /*
  27. * May be overriden in subclass to provide bespoke
  28. * handling of exceptions.
  29. */
  30. virtual HRESULT HandleError (
  31. DISPID dispidMember,
  32. unsigned short wFlags,
  33. DISPPARAMS FAR* pdispparams,
  34. VARIANT FAR* pvarResult,
  35. UINT FAR* puArgErr,
  36. HRESULT hRes)
  37. {
  38. return hRes;
  39. }
  40. /*
  41. * May be overriden in subclass to provide
  42. * bespoke handling of VT_NULL dispparams.
  43. */
  44. virtual bool HandleNulls (
  45. DISPID dispidMember,
  46. unsigned short wFlags)
  47. {
  48. // By default treat a VT_NULL as a default
  49. // value in all methods.
  50. return (wFlags & DISPATCH_METHOD);
  51. }
  52. public:
  53. CDispatchHelp();
  54. virtual ~CDispatchHelp(void);
  55. void SetObj(IDispatch * pObj, GUID interfaceGuid,
  56. GUID classGuid, LPWSTR objectName);
  57. STDMETHOD(GetTypeInfoCount)(THIS_ UINT FAR* pctinfo);
  58. STDMETHOD(GetTypeInfo)(
  59. THIS_
  60. UINT itinfo,
  61. LCID lcid,
  62. ITypeInfo FAR* FAR* pptinfo);
  63. STDMETHOD(GetIDsOfNames)(
  64. THIS_
  65. REFIID riid,
  66. OLECHAR FAR* FAR* rgszNames,
  67. UINT cNames,
  68. LCID lcid,
  69. DISPID FAR* rgdispid);
  70. STDMETHOD(Invoke)(
  71. THIS_
  72. DISPID dispidMember,
  73. REFIID riid,
  74. LCID lcid,
  75. WORD wFlags,
  76. DISPPARAMS FAR* pdispparams,
  77. VARIANT FAR* pvarResult,
  78. EXCEPINFO FAR* pexcepinfo,
  79. UINT FAR* puArgErr);
  80. // IDispatchEx methods
  81. HRESULT STDMETHODCALLTYPE GetDispID(
  82. /* [in] */ BSTR bstrName,
  83. /* [in] */ DWORD grfdex,
  84. /* [out] */ DISPID __RPC_FAR *pid);
  85. /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx(
  86. /* [in] */ DISPID id,
  87. /* [in] */ LCID lcid,
  88. /* [in] */ WORD wFlags,
  89. /* [in] */ DISPPARAMS __RPC_FAR *pdp,
  90. /* [out] */ VARIANT __RPC_FAR *pvarRes,
  91. /* [out] */ EXCEPINFO __RPC_FAR *pei,
  92. /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller)
  93. {
  94. UINT uArgErr;
  95. return Invoke(id, IID_NULL, lcid, wFlags, pdp, pvarRes, pei, &uArgErr);
  96. }
  97. HRESULT STDMETHODCALLTYPE DeleteMemberByName(
  98. /* [in] */ BSTR bstr,
  99. /* [in] */ DWORD grfdex)
  100. { return S_FALSE; }
  101. HRESULT STDMETHODCALLTYPE DeleteMemberByDispID(
  102. /* [in] */ DISPID id)
  103. { return S_FALSE; }
  104. HRESULT STDMETHODCALLTYPE GetMemberProperties(
  105. /* [in] */ DISPID id,
  106. /* [in] */ DWORD grfdexFetch,
  107. /* [out] */ DWORD __RPC_FAR *pgrfdex)
  108. { return S_FALSE; }
  109. HRESULT STDMETHODCALLTYPE GetMemberName(
  110. /* [in] */ DISPID id,
  111. /* [out] */ BSTR __RPC_FAR *pbstrName)
  112. { return S_FALSE; }
  113. HRESULT STDMETHODCALLTYPE GetNextDispID(
  114. /* [in] */ DWORD grfdex,
  115. /* [in] */ DISPID id,
  116. /* [out] */ DISPID __RPC_FAR *pid)
  117. { return S_FALSE; }
  118. HRESULT STDMETHODCALLTYPE GetNameSpaceParent(
  119. /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk)
  120. { return S_FALSE; }
  121. // IProvideClassInfo methods
  122. HRESULT STDMETHODCALLTYPE GetClassInfo(
  123. /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTI);
  124. // Other methods
  125. void RaiseException (HRESULT hr);
  126. };
  127. #endif