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

/*++
Copyright (C) 1999-2001 Microsoft Corporation
Module Name:
ADAPREG.H
Abstract:
History:
--*/
// Use this guy to build a list of class objects we can retrieve via
// class name. At this time, it just brute forces a class and a flex
// array, but could be modified to use an STL map just as easily.
#ifndef __ADAPREG_H__
#define __ADAPREG_H__
#include <wbemcomn.h>
#include "ntreg.h"
#include "adapcls.h"
#include <statsync.h>
#define HKEY_PERFORMANCE_TEXT (( HKEY ) (ULONG_PTR)((LONG)0x80000050) )
#define HKEY_PERFORMANCE_NLSTEXT (( HKEY ) (ULONG_PTR)((LONG)0x80000060) )
//
// common THROTTLING PARAMS
//
#define ADAP_IDLE_USER 3000
#define ADAP_IDLE_IO 500000
#define ADAP_LOOP_SLEEP 200
#define ADAP_MAX_WAIT (2*60*1000)
#define ADAP_LOCALE_KEY L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\PerfLib"
#define WMI_ADAP_REVERSE_PERFLIB L"WMIAPRPL"
#define ADAP_EVENT_MESSAGE_LENGTH 2048
#define ADAP_EVENT_MESSAGE_PREFIX "An unhandled exception occured. The following performance libraries were processed: "
#define ADAP_EVENT_MESSAGE_DELIM L", "
#define ADAP_KEY_MAX_COLLECT L"ADAPPerflibMaxSizeBlobCollect"
// These are the various statuses we can set while ADAP is running
typedef enum
{
eADAPStatusPending,
eADAPStatusRunning,
eADAPStatusProcessLibs,
eADAPStatusCommit,
eADAPStatusFinished
} eADAPStatus;
// HRESULT GetServicePID( WCHAR* wszService, DWORD* pdwPID );
class CPerfLibList
{
WCHAR* m_wszPerfLibList;
CStaticCritSec m_csPerfLibList;
public:
CPerfLibList() : m_wszPerfLibList( NULL )
{
}
~CPerfLibList()
{
delete m_wszPerfLibList;
}
HRESULT AddPerfLib( WCHAR* wszPerfLib );
HRESULT HandleFailure();
};
class CAdapRegPerf : public CNTRegistry
///////////////////////////////////////////////////////////////////////////////
//
// This is the control mechanism which interfaces with the
//
///////////////////////////////////////////////////////////////////////////////
{
private:
// The unified 'master' class lists for both the raw and the cooked classes
// ========================================================================
CMasterClassList* m_apMasterClassList[WMI_ADAP_NUM_TYPES];
// The repository containing all names databases
// =============================================
CLocaleCache* m_pLocaleCache;
// The winmgmt synchronization members
// ===================================
DWORD m_dwPID;
HANDLE m_hSyncThread;
HANDLE m_hTerminationEvent;
BOOL m_fQuit;
IWbemServices* m_pRootDefault;
IWbemClassObject* m_pADAPStatus;
// Registry change notification members
// ====================================
HKEY m_hPerflibKey;
HANDLE m_hRegChangeEvent;
//
//
CKnownSvcs * m_pKnownSvcs;
BOOL m_bFull;
// Private methods
// ===============
HRESULT ProcessLibrary( WCHAR* pwcsServiceName, BOOL bDelta );
static unsigned int __stdcall GoGershwin( void * pParam );
static LONG __stdcall AdapUnhandledExceptionFilter( LPEXCEPTION_POINTERS lpexpExceptionInfo );
HRESULT GetADAPStatusObject( void );
void SetADAPStatus( eADAPStatus status );
void GetTime( LPWSTR Buff, size_t cchBuffSize );
public:
CAdapRegPerf(BOOL bFull);
~CAdapRegPerf();
HRESULT Initialize(BOOL bDelta, BOOL bThrottle);
HRESULT Dredge( BOOL bDelta, BOOL bThrottle );
static HRESULT Clean();
};
#endif