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.

123 lines
4.2 KiB

  1. // Copyright (c) 1999 Microsoft Corporation. All rights reserved.
  2. //
  3. // Declaration of EngineDispatch.
  4. //
  5. // Implements the IDispatch interface for the script that exposes its routines, variables, and type information.
  6. #include "engcontrol.h"
  7. #include "engexec.h"
  8. class EngineDispatch
  9. : public IDispatch,
  10. public ITypeInfo
  11. {
  12. public:
  13. // CAudioVBScriptEngine will create EngineDispatch and pass itself as the punkParent.
  14. // CAudioVBScriptEngine::Close releases CAudioVBScriptEngine's ref (coming from the creation) on EngineDispatch.
  15. // The final call of EngineDispatch::Release in turn releases the ref (coming from holding the parent) on CAudioVBScriptEngine.
  16. EngineDispatch(IUnknown *punkParent, Script &script, IDispatch *pGlobalDispatch);
  17. // IUnknown
  18. STDMETHOD(QueryInterface)(const IID &iid, void **ppv);
  19. STDMETHOD_(ULONG, AddRef)();
  20. STDMETHOD_(ULONG, Release)();
  21. // IDispatch
  22. STDMETHOD(GetTypeInfoCount)(UINT *pctinfo);
  23. STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
  24. STDMETHOD(GetIDsOfNames)(
  25. REFIID riid,
  26. LPOLESTR *rgszNames,
  27. UINT cNames,
  28. LCID lcid,
  29. DISPID *rgDispId);
  30. STDMETHOD(Invoke)(
  31. DISPID dispIdMember,
  32. REFIID riid,
  33. LCID lcid,
  34. WORD wFlags,
  35. DISPPARAMS *pDispParams,
  36. VARIANT *pVarResult,
  37. EXCEPINFO *pExcepInfo,
  38. UINT *puArgErr);
  39. // implemented ITypeInfo methods
  40. HRESULT STDMETHODCALLTYPE GetTypeAttr(
  41. /* [out] */ TYPEATTR **ppTypeAttr);
  42. void STDMETHODCALLTYPE ReleaseTypeAttr(
  43. /* [in] */ TYPEATTR *pTypeAttr);
  44. HRESULT STDMETHODCALLTYPE GetFuncDesc(
  45. /* [in] */ UINT index,
  46. /* [out] */ FUNCDESC **ppFuncDesc);
  47. void STDMETHODCALLTYPE ReleaseFuncDesc(
  48. /* [in] */ FUNCDESC *pFuncDesc);
  49. HRESULT STDMETHODCALLTYPE GetVarDesc(
  50. /* [in] */ UINT index,
  51. /* [out] */ VARDESC **ppVarDesc);
  52. void STDMETHODCALLTYPE ReleaseVarDesc(
  53. /* [in] */ VARDESC *pVarDesc);
  54. HRESULT STDMETHODCALLTYPE GetNames(
  55. /* [in] */ MEMBERID memid,
  56. /* [length_is][size_is][out] */ BSTR *rgBstrNames,
  57. /* [in] */ UINT cMaxNames,
  58. /* [out] */ UINT *pcNames);
  59. // unimplemented ITypeInfo methods
  60. HRESULT STDMETHODCALLTYPE GetTypeComp(
  61. /* [out] */ ITypeComp **ppTComp) { assert(false); return E_NOTIMPL; }
  62. HRESULT STDMETHODCALLTYPE GetRefTypeOfImplType(
  63. /* [in] */ UINT index,
  64. /* [out] */ HREFTYPE *pRefType) { assert(false); return E_NOTIMPL; }
  65. HRESULT STDMETHODCALLTYPE GetImplTypeFlags(
  66. /* [in] */ UINT index,
  67. /* [out] */ INT *pImplTypeFlags) { assert(false); return E_NOTIMPL; }
  68. HRESULT STDMETHODCALLTYPE GetIDsOfNames(
  69. /* [size_is][in] */ LPOLESTR *rgszNames,
  70. /* [in] */ UINT cNames,
  71. /* [size_is][out] */ MEMBERID *pMemId) { assert(false); return E_NOTIMPL; }
  72. HRESULT STDMETHODCALLTYPE Invoke(
  73. /* [in] */ PVOID pvInstance,
  74. /* [in] */ MEMBERID memid,
  75. /* [in] */ WORD wFlags,
  76. /* [out][in] */ DISPPARAMS *pDispParams,
  77. /* [out] */ VARIANT *pVarResult,
  78. /* [out] */ EXCEPINFO *pExcepInfo,
  79. /* [out] */ UINT *puArgErr) { assert(false); return E_NOTIMPL; }
  80. HRESULT STDMETHODCALLTYPE GetDocumentation(
  81. /* [in] */ MEMBERID memid,
  82. /* [out] */ BSTR *pBstrName,
  83. /* [out] */ BSTR *pBstrDocString,
  84. /* [out] */ DWORD *pdwHelpContext,
  85. /* [out] */ BSTR *pBstrHelpFile) { assert(false); return E_NOTIMPL; }
  86. HRESULT STDMETHODCALLTYPE GetDllEntry(
  87. /* [in] */ MEMBERID memid,
  88. /* [in] */ INVOKEKIND invKind,
  89. /* [out] */ BSTR *pBstrDllName,
  90. /* [out] */ BSTR *pBstrName,
  91. /* [out] */ WORD *pwOrdinal) { assert(false); return E_NOTIMPL; }
  92. HRESULT STDMETHODCALLTYPE GetRefTypeInfo(
  93. /* [in] */ HREFTYPE hRefType,
  94. /* [out] */ ITypeInfo **ppTInfo) { assert(false); return E_NOTIMPL; }
  95. HRESULT STDMETHODCALLTYPE AddressOfMember(
  96. /* [in] */ MEMBERID memid,
  97. /* [in] */ INVOKEKIND invKind,
  98. /* [out] */ PVOID *ppv) { assert(false); return E_NOTIMPL; }
  99. HRESULT STDMETHODCALLTYPE CreateInstance(
  100. /* [in] */ IUnknown *pUnkOuter,
  101. /* [in] */ REFIID riid,
  102. /* [iid_is][out] */ PVOID *ppvObj) { assert(false); return E_NOTIMPL; }
  103. HRESULT STDMETHODCALLTYPE GetMops(
  104. /* [in] */ MEMBERID memid,
  105. /* [out] */ BSTR *pBstrMops) { assert(false); return E_NOTIMPL; }
  106. HRESULT STDMETHODCALLTYPE GetContainingTypeLib(
  107. /* [out] */ ITypeLib **ppTLib,
  108. /* [out] */ UINT *pIndex) { assert(false); return E_NOTIMPL; }
  109. private:
  110. // Data
  111. long m_cRef;
  112. SmartRef::ComPtr<IUnknown> m_scomParent;
  113. Script &m_script;
  114. Executor m_exec;
  115. };