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.

87 lines
2.2 KiB

  1. #ifndef __WBEM_SCRIPT_CONSUMER__H_
  2. #define __WBEM_SCRIPT_CONSUMER__H_
  3. #include <unk.h>
  4. #include <wbemidl.h>
  5. #include "txttempl.h"
  6. #include <stdio.h>
  7. #include <activscp.h>
  8. #include <ErrorObj.h>
  9. class CScriptConsumer : public CUnk
  10. {
  11. protected:
  12. class XProvider : public CImpl<IWbemEventConsumerProvider, CScriptConsumer>
  13. {
  14. public:
  15. XProvider(CScriptConsumer* pObj)
  16. : CImpl<IWbemEventConsumerProvider, CScriptConsumer>(pObj){}
  17. HRESULT STDMETHODCALLTYPE FindConsumer(
  18. IWbemClassObject* pLogicalConsumer,
  19. IWbemUnboundObjectSink** ppConsumer);
  20. } m_XProvider;
  21. friend XProvider;
  22. public:
  23. CScriptConsumer(CLifeControl* pControl = NULL, IUnknown* pOuter = NULL)
  24. : CUnk(pControl, pOuter), m_XProvider(this)
  25. {}
  26. ~CScriptConsumer(){}
  27. void* GetInterface(REFIID riid);
  28. };
  29. class CScriptSink : public CUnk
  30. {
  31. protected:
  32. class XSink : public CImpl<IWbemUnboundObjectSink, CScriptSink>
  33. {
  34. public:
  35. XSink(CScriptSink* pObj) :
  36. CImpl<IWbemUnboundObjectSink, CScriptSink>(pObj){}
  37. HRESULT STDMETHODCALLTYPE IndicateToConsumer(
  38. IWbemClassObject* pLogicalConsumer, long lNumObjects,
  39. IWbemClassObject** apObjects);
  40. } m_XSink;
  41. friend XSink;
  42. protected:
  43. // do the dirty work of making the script go
  44. HRESULT RunScriptFile(IWbemClassObject *pObj);
  45. HRESULT RunScriptText(IWbemClassObject *pObj);
  46. // logical consumer values
  47. WString m_wsScript;
  48. WString m_wsScriptFileName;
  49. PSID m_pSidCreator;
  50. // delay in seconds before killing script.
  51. // If zero, script will not be killed; it must suicide.
  52. DWORD m_dwKillTimeout;
  53. IClassFactory* m_pEngineFac;
  54. // scripting DLL
  55. HMODULE m_hMod;
  56. WString m_wsErrorMessage;
  57. WString m_wsErrorLine;
  58. ErrorObj* m_pErrorObj;
  59. friend class CScriptSite;
  60. public:
  61. CScriptSink(CLifeControl* pControl = NULL)
  62. : CUnk(pControl), m_XSink(this), m_pEngineFac(NULL), m_pSidCreator(NULL), m_pErrorObj(NULL)
  63. {}
  64. HRESULT Initialize(IWbemClassObject* pLogicalConsumer);
  65. ~CScriptSink();
  66. void* GetInterface(REFIID riid);
  67. };
  68. #endif