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.

145 lines
3.4 KiB

  1. /*++
  2. Copyright (C) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. ADAPREG.H
  5. Abstract:
  6. History:
  7. --*/
  8. // Use this guy to build a list of class objects we can retrieve via
  9. // class name. At this time, it just brute forces a class and a flex
  10. // array, but could be modified to use an STL map just as easily.
  11. #ifndef __ADAPREG_H__
  12. #define __ADAPREG_H__
  13. #include <wbemcomn.h>
  14. #include "ntreg.h"
  15. #include "adapcls.h"
  16. #include <statsync.h>
  17. #define HKEY_PERFORMANCE_TEXT (( HKEY ) (ULONG_PTR)((LONG)0x80000050) )
  18. #define HKEY_PERFORMANCE_NLSTEXT (( HKEY ) (ULONG_PTR)((LONG)0x80000060) )
  19. //
  20. // common THROTTLING PARAMS
  21. //
  22. #define ADAP_IDLE_USER 3000
  23. #define ADAP_IDLE_IO 500000
  24. #define ADAP_LOOP_SLEEP 200
  25. #define ADAP_MAX_WAIT (2*60*1000)
  26. #define ADAP_LOCALE_KEY L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\PerfLib"
  27. #define WMI_ADAP_REVERSE_PERFLIB L"WMIAPRPL"
  28. #define ADAP_EVENT_MESSAGE_LENGTH 2048
  29. #define ADAP_EVENT_MESSAGE_PREFIX "An unhandled exception occured. The following performance libraries were processed: "
  30. #define ADAP_EVENT_MESSAGE_DELIM L", "
  31. #define ADAP_KEY_MAX_COLLECT L"ADAPPerflibMaxSizeBlobCollect"
  32. // These are the various statuses we can set while ADAP is running
  33. typedef enum
  34. {
  35. eADAPStatusPending,
  36. eADAPStatusRunning,
  37. eADAPStatusProcessLibs,
  38. eADAPStatusCommit,
  39. eADAPStatusFinished
  40. } eADAPStatus;
  41. // HRESULT GetServicePID( WCHAR* wszService, DWORD* pdwPID );
  42. class CPerfLibList
  43. {
  44. WCHAR* m_wszPerfLibList;
  45. CStaticCritSec m_csPerfLibList;
  46. public:
  47. CPerfLibList() : m_wszPerfLibList( NULL )
  48. {
  49. }
  50. ~CPerfLibList()
  51. {
  52. delete m_wszPerfLibList;
  53. }
  54. HRESULT AddPerfLib( WCHAR* wszPerfLib );
  55. HRESULT HandleFailure();
  56. };
  57. class CAdapRegPerf : public CNTRegistry
  58. ///////////////////////////////////////////////////////////////////////////////
  59. //
  60. // This is the control mechanism which interfaces with the
  61. //
  62. ///////////////////////////////////////////////////////////////////////////////
  63. {
  64. private:
  65. // The unified 'master' class lists for both the raw and the cooked classes
  66. // ========================================================================
  67. CMasterClassList* m_apMasterClassList[WMI_ADAP_NUM_TYPES];
  68. // The repository containing all names databases
  69. // =============================================
  70. CLocaleCache* m_pLocaleCache;
  71. // The winmgmt synchronization members
  72. // ===================================
  73. DWORD m_dwPID;
  74. HANDLE m_hSyncThread;
  75. HANDLE m_hTerminationEvent;
  76. BOOL m_fQuit;
  77. IWbemServices* m_pRootDefault;
  78. IWbemClassObject* m_pADAPStatus;
  79. // Registry change notification members
  80. // ====================================
  81. HKEY m_hPerflibKey;
  82. HANDLE m_hRegChangeEvent;
  83. //
  84. //
  85. CKnownSvcs * m_pKnownSvcs;
  86. BOOL m_bFull;
  87. // Private methods
  88. // ===============
  89. HRESULT ProcessLibrary( WCHAR* pwcsServiceName, BOOL bDelta );
  90. static unsigned int __stdcall GoGershwin( void * pParam );
  91. static LONG __stdcall AdapUnhandledExceptionFilter( LPEXCEPTION_POINTERS lpexpExceptionInfo );
  92. HRESULT GetADAPStatusObject( void );
  93. void SetADAPStatus( eADAPStatus status );
  94. void GetTime( LPWSTR Buff, size_t cchBuffSize );
  95. public:
  96. CAdapRegPerf(BOOL bFull);
  97. ~CAdapRegPerf();
  98. HRESULT Initialize(BOOL bDelta, BOOL bThrottle);
  99. HRESULT Dredge( BOOL bDelta, BOOL bThrottle );
  100. static HRESULT Clean();
  101. };
  102. #endif