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.

224 lines
5.3 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation
  4. //
  5. // method.h
  6. //
  7. // alanbos 27-Mar-00 Created.
  8. //
  9. // CSWbemMethod and CSWbemMethodSet definitions.
  10. //
  11. //***************************************************************************
  12. #ifndef _METHOD_H_
  13. #define _METHOD_H_
  14. //***************************************************************************
  15. //
  16. // CLASS NAME:
  17. //
  18. // CSWbemMethod
  19. //
  20. // DESCRIPTION:
  21. //
  22. // Implements the ISWbemMethod interface.
  23. //
  24. //***************************************************************************
  25. class CSWbemMethod : public ISWbemMethod,
  26. public ISupportErrorInfo,
  27. public IProvideClassInfo
  28. {
  29. private:
  30. class CMethodDispatchHelp : public CDispatchHelp
  31. {
  32. public:
  33. bool HandleNulls (
  34. DISPID dispidMember,
  35. unsigned short wFlags)
  36. {
  37. return false;
  38. }
  39. };
  40. CSWbemServices *m_pSWbemServices;
  41. IWbemClassObject *m_pIWbemClassObject;
  42. CMethodDispatchHelp m_Dispatch;
  43. BSTR m_name;
  44. protected:
  45. long m_cRef; //Object reference count
  46. public:
  47. CSWbemMethod (CSWbemServices *pService, IWbemClassObject *pObject,
  48. BSTR name);
  49. ~CSWbemMethod (void);
  50. //Non-delegating object IUnknown
  51. STDMETHODIMP QueryInterface(REFIID, LPVOID*);
  52. STDMETHODIMP_(ULONG) AddRef(void);
  53. STDMETHODIMP_(ULONG) Release(void);
  54. // IDispatch
  55. STDMETHODIMP GetTypeInfoCount(UINT* pctinfo)
  56. {return m_Dispatch.GetTypeInfoCount(pctinfo);}
  57. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
  58. {return m_Dispatch.GetTypeInfo(itinfo, lcid, pptinfo);}
  59. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames,
  60. UINT cNames, LCID lcid, DISPID* rgdispid)
  61. {return m_Dispatch.GetIDsOfNames(riid, rgszNames, cNames,
  62. lcid,
  63. rgdispid);}
  64. STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid,
  65. WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult,
  66. EXCEPINFO* pexcepinfo, UINT* puArgErr)
  67. {return m_Dispatch.Invoke(dispidMember, riid, lcid, wFlags,
  68. pdispparams, pvarResult, pexcepinfo, puArgErr);}
  69. // ISWbemProperty methods
  70. HRESULT STDMETHODCALLTYPE get_Name
  71. (
  72. /*[out]*/ BSTR *name
  73. );
  74. HRESULT STDMETHODCALLTYPE get_Origin
  75. (
  76. /*[out]*/ BSTR *pOrigin
  77. );
  78. HRESULT STDMETHODCALLTYPE get_InParameters
  79. (
  80. /*[out]*/ ISWbemObject **ppInParameters
  81. );
  82. HRESULT STDMETHODCALLTYPE get_OutParameters
  83. (
  84. /*[out]*/ ISWbemObject **ppOutParameters
  85. );
  86. HRESULT STDMETHODCALLTYPE get_Qualifiers_
  87. (
  88. /*[out]*/ ISWbemQualifierSet **ppQualSet
  89. );
  90. // ISupportErrorInfo methods
  91. HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo
  92. (
  93. /* [in] */ REFIID riid
  94. );
  95. // IProvideClassInfo methods
  96. HRESULT STDMETHODCALLTYPE GetClassInfo
  97. (
  98. /* [in,out] */ ITypeInfo **ppTI
  99. )
  100. {
  101. return m_Dispatch.GetClassInfo (ppTI);
  102. };
  103. };
  104. //***************************************************************************
  105. //
  106. // CLASS NAME:
  107. //
  108. // CSWbemMethodSet
  109. //
  110. // DESCRIPTION:
  111. //
  112. // Implements the ISWbemMethodSet interface.
  113. //
  114. //***************************************************************************
  115. class CSWbemMethodSet : public ISWbemMethodSet,
  116. public ISupportErrorInfo,
  117. public IProvideClassInfo
  118. {
  119. private:
  120. CSWbemServices *m_pSWbemServices;
  121. IWbemClassObject *m_pIWbemClassObject;
  122. CDispatchHelp m_Dispatch;
  123. long m_Count;
  124. protected:
  125. long m_cRef; //Object reference count
  126. public:
  127. CSWbemMethodSet (CSWbemServices *pService, IWbemClassObject *pObject);
  128. ~CSWbemMethodSet (void);
  129. //Non-delegating object IUnknown
  130. STDMETHODIMP QueryInterface(REFIID, LPVOID*);
  131. STDMETHODIMP_(ULONG) AddRef(void);
  132. STDMETHODIMP_(ULONG) Release(void);
  133. // IDispatch
  134. STDMETHODIMP GetTypeInfoCount(UINT* pctinfo)
  135. {return m_Dispatch.GetTypeInfoCount(pctinfo);}
  136. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
  137. {return m_Dispatch.GetTypeInfo(itinfo, lcid, pptinfo);}
  138. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames,
  139. UINT cNames, LCID lcid, DISPID* rgdispid)
  140. {return m_Dispatch.GetIDsOfNames(riid, rgszNames, cNames,
  141. lcid,
  142. rgdispid);}
  143. STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid,
  144. WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult,
  145. EXCEPINFO* pexcepinfo, UINT* puArgErr)
  146. {return m_Dispatch.Invoke(dispidMember, riid, lcid, wFlags,
  147. pdispparams, pvarResult, pexcepinfo, puArgErr);}
  148. // Collection methods
  149. HRESULT STDMETHODCALLTYPE get__NewEnum
  150. (
  151. /*[out]*/ IUnknown **ppUnk
  152. );
  153. HRESULT STDMETHODCALLTYPE Item
  154. (
  155. /*[in]*/ BSTR Name,
  156. /*[in]*/ long lFlags,
  157. /*[out]*/ ISWbemMethod **ppMethod
  158. );
  159. HRESULT STDMETHODCALLTYPE get_Count
  160. (
  161. /*[in]*/ long *plCount
  162. );
  163. // ISWbemMethodSet methods
  164. HRESULT STDMETHODCALLTYPE BeginEnumeration
  165. (
  166. );
  167. HRESULT STDMETHODCALLTYPE Next
  168. (
  169. /*[in]*/ long lFlags,
  170. /*[out]*/ ISWbemMethod **ppMethod
  171. );
  172. // ISupportErrorInfo methods
  173. HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo
  174. (
  175. /* [in] */ REFIID riid
  176. );
  177. // IProvideClassInfo methods
  178. HRESULT STDMETHODCALLTYPE GetClassInfo
  179. (
  180. /* [in,out] */ ITypeInfo **ppTI
  181. )
  182. {
  183. return m_Dispatch.GetClassInfo (ppTI);
  184. };
  185. };
  186. #endif