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.

112 lines
3.1 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. CALLRES.H
  5. Abstract:
  6. Call Result Class
  7. History:
  8. --*/
  9. #ifndef __CALL_RESULT__H_
  10. #define __CALL_RESULT__H_
  11. class CCallResult : public IWbemCallResult
  12. {
  13. protected:
  14. long m_lRef;
  15. IWbemClassObject* m_pResObj;
  16. HRESULT m_hres;
  17. BSTR m_strResult;
  18. IWbemServices* m_pResNamespace;
  19. IWbemClassObject* m_pErrorObj;
  20. BOOL m_bReady;
  21. HANDLE m_hReady;
  22. IWbemClassObject** m_ppResObjDest;
  23. CCritSec m_cs;
  24. CIdentitySecurity m_Security;
  25. LIST_ENTRY m_Entry;
  26. protected:
  27. class CResultSink : public CBasicObjectSink
  28. {
  29. CCallResult* m_pOwner;
  30. public:
  31. STDMETHOD_(ULONG, AddRef)() {return m_pOwner->AddRef();}
  32. STDMETHOD_(ULONG, Release)() {return m_pOwner->Release();}
  33. STDMETHOD(Indicate)(long lNumObjects, IWbemClassObject** aObjects);
  34. STDMETHOD(SetStatus)(long lFlags, HRESULT hres, BSTR strParam,
  35. IWbemClassObject* pErrorObj);
  36. public:
  37. CResultSink(CCallResult* pOwner) : m_pOwner(pOwner){}
  38. } m_XSink;
  39. friend CResultSink;
  40. public:
  41. STDMETHOD_(ULONG, AddRef)() {return InterlockedIncrement(&m_lRef);}
  42. STDMETHOD_(ULONG, Release)()
  43. {
  44. long lRef = InterlockedDecrement(&m_lRef);
  45. if(lRef == 0)
  46. delete this;
  47. return lRef;
  48. }
  49. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  50. STDMETHOD(GetTypeInfoCount)(UINT* pctinfo)
  51. {return E_NOTIMPL;}
  52. STDMETHOD(GetTypeInfo)(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
  53. {return E_NOTIMPL;}
  54. STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR** rgszNames, UINT cNames,
  55. LCID lcid, DISPID* rgdispid)
  56. {return E_NOTIMPL;}
  57. STDMETHOD(Invoke)(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
  58. DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo,
  59. UINT* puArgErr)
  60. {return E_NOTIMPL;}
  61. STDMETHOD(GetResultObject)(long lTimeout, IWbemClassObject** ppObj);
  62. STDMETHOD(GetResultString)(long lTimeout, BSTR* pstr);
  63. STDMETHOD(GetCallStatus)(long lTimeout, long* plStatus);
  64. STDMETHOD(GetResultServices)(long lTimeout, IWbemServices** ppServices);
  65. virtual HRESULT STDMETHODCALLTYPE GetResult(
  66. /* [in] */ long lTimeout,
  67. /* [in] */ long lFlags,
  68. /* [in] */ REFIID riid,
  69. /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvResult
  70. );
  71. HRESULT Indicate(long lNumObjects, IWbemClassObject** aObjects);
  72. HRESULT SetStatus(HRESULT hres, BSTR strParam, IWbemClassObject* pErrorObj);
  73. public:
  74. CCallResult(IWbemClassObject** ppResObjDest = NULL);
  75. CCallResult(IWbemClassObject* pResObj, HRESULT hres,
  76. IWbemClassObject* pErrorObj);
  77. ~CCallResult();
  78. INTERNAL CBasicObjectSink* GetSink() {return &m_XSink;}
  79. void SetResultString(LPWSTR wszRes);
  80. void SetResultServices(IWbemServices* pRes);
  81. HRESULT SetResultObject(IWbemClassObject* pRes);
  82. void SetErrorInfo();
  83. };
  84. #endif
  85.