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.

103 lines
3.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999.
  5. //
  6. // File: scminfo.hxx
  7. //
  8. // Contents: Definitions/objects for use by scm-level activators
  9. //
  10. // History: 05-Sep-99 JSimmons Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __SCMINFO_HXX__
  14. #define __SCMINFO_HXX__
  15. #define SPENUM_INITIAL_SIZE 10
  16. #define SPENUM_GROWTH_SIZEADD 10
  17. class CSCMProcessControl;
  18. class CSCMProcessEnumerator : public IEnumSCMProcessInfo
  19. {
  20. public:
  21. CSCMProcessEnumerator();
  22. CSCMProcessEnumerator(CSCMProcessEnumerator* pCSPEOrig, HRESULT* phrInit);
  23. CSCMProcessEnumerator(CSCMProcessControl* pOuterUnk);
  24. ~CSCMProcessEnumerator();
  25. // IUnknown methods
  26. STDMETHOD (QueryInterface) (REFIID rid, void** ppv);
  27. STDMETHOD_(ULONG,AddRef) ();
  28. STDMETHOD_(ULONG,Release) ();
  29. // IEnumSCMProcessInfo methods
  30. STDMETHOD (Next) (ULONG cElems, SCMProcessInfo** pSCMProcessInfo, ULONG* pcFetched);
  31. STDMETHOD (Skip) (ULONG cElems);
  32. STDMETHOD (Reset) ();
  33. STDMETHOD (Clone) (IEnumSCMProcessInfo **ppESPI);
  34. // Public non-interface methods:
  35. HRESULT AddProcess(SCMProcessInfo* pSPI);
  36. private:
  37. // private data:
  38. LONG _lRefs;
  39. DWORD _dwNumSPInfos;
  40. DWORD _dwMaxSPInfos;
  41. DWORD _dwCurSPInfo;
  42. CSCMProcessControl* _pOuterUnk;
  43. SCMProcessInfo** _ppSPInfos;
  44. SCMProcessInfo** _ppSPInfosForReal;
  45. SCMProcessInfo* _pSPInfosInitial[SPENUM_INITIAL_SIZE];
  46. // private methods:
  47. };
  48. class CSCMProcessControl : public ISCMProcessControl
  49. {
  50. public:
  51. CSCMProcessControl();
  52. ~CSCMProcessControl();
  53. // IUnknown methods
  54. STDMETHOD (QueryInterface) (REFIID rid, void** ppv);
  55. STDMETHOD_(ULONG,AddRef) ();
  56. STDMETHOD_(ULONG,Release) ();
  57. // ISCMProcessControl methods
  58. STDMETHOD (FindApplication) (REFGUID rappid, IEnumSCMProcessInfo** ppESPI);
  59. STDMETHOD (FindClass) (REFCLSID rclsid, IEnumSCMProcessInfo** ppESPI);
  60. STDMETHOD (FindProcess) (DWORD pid, SCMProcessInfo** ppSCMProcessInfo);
  61. STDMETHOD (SuspendApplication) (REFGUID rappid);
  62. STDMETHOD (SuspendClass) (REFCLSID rclsid);
  63. STDMETHOD (SuspendProcess) (DWORD pid);
  64. STDMETHOD (ResumeApplication) (REFGUID rappid);
  65. STDMETHOD (ResumeClass) (REFCLSID rclsid);
  66. STDMETHOD (ResumeProcess) (DWORD pid);
  67. STDMETHOD (RetireApplication) (REFGUID rappid);
  68. STDMETHOD (RetireClass) (REFCLSID rclsid);
  69. STDMETHOD (RetireProcess) (DWORD pid);
  70. STDMETHOD (FreeSCMProcessInfo) (SCMProcessInfo** ppSCMProcessInfo);
  71. // Public non-interface methods:
  72. static HRESULT CopySCMProcessInfo(SCMProcessInfo* pSPISrc, SCMProcessInfo** ppSPIDest);
  73. static HRESULT FreeSCMProcessInfoPriv(SCMProcessInfo** ppSCMProcessInfo);
  74. private:
  75. // private data:
  76. LONG _lRefs;
  77. BOOL _bInitializedEnum;
  78. //CSCMProcessEnumerator _SPEnum;
  79. // private methods:
  80. HRESULT FillInSCMProcessInfo(CProcess* pprocess, BOOL bProcessReady, SCMProcessInfo** ppSPI);
  81. HRESULT FindAppOrClass(const GUID& rguid, CServerTable* pServerTable, IEnumSCMProcessInfo** ppESPI);
  82. HRESULT InitializeEnumerator();
  83. };
  84. #endif // __SCMINFO_HXX__