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.

91 lines
2.4 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1996 Microsoft Corporation. All Rights Reserved.
  5. Component: IDispatch implementation
  6. File: Dispatch.h
  7. Owner: DGottner
  8. This file contains our implementation of IDispatch
  9. ===================================================================*/
  10. #ifndef _Dispatch_H
  11. #define _Dispatch_H
  12. /*
  13. * C D i s p a t c h
  14. *
  15. * IDispatch interface implementation for OLE objects
  16. *
  17. * This class contains the basic four IDispatch members. The Big Three
  18. * (QueryInterface, AddRef, Release) are left as pure virtual, as this
  19. * class is designed as an intermediate class for further derivation.
  20. *
  21. * This also means that we no longer need a pointer to the controlling unknown.
  22. */
  23. class CDispatch : public IDispatch
  24. {
  25. private:
  26. const GUID * m_pGuidDispInterface;
  27. ITypeLib * m_pITypeLib;
  28. ITypeInfo * m_pITINeutral;
  29. public:
  30. CDispatch();
  31. ~CDispatch();
  32. // Do this in Init because OLE interfaces in general do not take
  33. // parameters in the constructor. This call CANNOT fail, however.
  34. //
  35. void Init(const IID &GuidDispInterface, const ITypeLib *pITypeLib = NULL);
  36. // IDispatch members
  37. //
  38. STDMETHODIMP GetTypeInfoCount(UINT *);
  39. STDMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo **);
  40. STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR **, UINT, LCID, DISPID *);
  41. STDMETHODIMP Invoke(DISPID, REFIID, LCID, WORD,
  42. DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
  43. };
  44. /*
  45. * C S u p p o r t E r r o r I n f o
  46. *
  47. * Implemention of ISupportErrorInfo for Denali classes
  48. */
  49. class CSupportErrorInfo : public ISupportErrorInfo
  50. {
  51. private:
  52. IUnknown * m_pUnkObj;
  53. IUnknown * m_pUnkOuter;
  54. const GUID *m_pGuidDispInterface;
  55. public:
  56. CSupportErrorInfo(void);
  57. CSupportErrorInfo(IUnknown *pUnkObj, IUnknown *pUnkOuter, const IID &GuidDispInterface);
  58. void Init(IUnknown *pUnkObj, IUnknown *pUnkOuter, const GUID &GuidDispInterface);
  59. // IUnknown members that delegate to m_pUnkOuter.
  60. //
  61. STDMETHODIMP QueryInterface(REFIID, void **);
  62. STDMETHODIMP_(ULONG) AddRef(void);
  63. STDMETHODIMP_(ULONG) Release(void);
  64. // ISupportErrorInfo members
  65. //
  66. STDMETHODIMP InterfaceSupportsErrorInfo(REFIID);
  67. };
  68. extern void Exception(REFIID ObjID, LPOLESTR strSource, LPOLESTR strDescr);
  69. extern void ExceptionId(REFIID ObjID, UINT SourceID, UINT DescrID, HRESULT hrCode = S_OK);
  70. #endif /* _Dispatch_H */