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.

44 lines
1.4 KiB

  1. #ifndef _WMISCRIPT_CLASSFAC_HEADER_
  2. #define _WMISCRIPT_CLASSFAC_HEADER_
  3. #include <clsfac.h>
  4. #include <Script.h>
  5. class WMIScriptClassFactory : public CClassFactory<CScriptConsumer>
  6. {
  7. public:
  8. WMIScriptClassFactory(CLifeControl* pControl = NULL) :
  9. CClassFactory<CScriptConsumer>(pControl)
  10. {}
  11. HRESULT CreateInstance(IUnknown* pOuter, REFIID riid, void** ppv);
  12. static void FindScriptsAllowed(void);
  13. static void IncrementScriptsRun(void);
  14. static bool LimitReached(void);
  15. static void CALLBACK TimeoutProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
  16. protected:
  17. // statics to control how many scripts we're allowed to run
  18. // note that we don't bother wrapping these in critical sections
  19. // The worst that can happen is that we initialize m_scriptsAllowed twice
  20. // or that we run one too many scripts. I can live with that.
  21. // number of scripts we've been asked to run
  22. static DWORD m_scriptsStarted;
  23. // number of scripts we've been configured to run
  24. static DWORD m_scriptsAllowed;
  25. // whether we've gone & looked at how many we need
  26. static bool m_bIsScriptsAllowedInitialized;
  27. // id for the timer, only valid if we've been asked to time out
  28. static DWORD m_timerID;
  29. // toggled when we reach our timeout limit or max # scripts
  30. static bool m_bWeDeadNow;
  31. };
  32. #endif // _WMISCRIPT_CLASSFAC_HEADER_