windows-nt/Source/XPSP1/NT/net/snmp/subagent/snmpevnt/evntcmd/registry.h
2020-09-26 16:20:57 +08:00

43 lines
1.2 KiB
C++

#ifndef _REGISTRY_H
#define _REGISTRY_H
#define REGPATH_SNMPTRAPS "SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\TrapConfiguration"
#define REGPATH_EVNTAGENT "Software\\Microsoft\\SNMP_EVENTS\\EventLog\\Sources"
#define REG_SRC_ENTOID "EnterpriseOID"
#define REG_SRC_APPEND "Append"
#define REG_EVNT_COUNT "Count"
#define REG_EVNT_ID "FullID"
#define REG_EVNT_TIME "Time"
#define REG_FLG_NEEDRESTART 1
class CRegistry
{
HKEY m_hRegRoot;
HKEY m_hRegSnmpTraps;
HKEY m_hRegEvntSources;
DWORD ConfigureRegSource(HKEY hRegSource, char *szEventSource);
DWORD ConfigureRegEvent(HKEY hRegEvent, DWORD dwEventID, DWORD dwCount, DWORD dwTime);
DWORD ScanForTrap(HKEY hRegCommunity, char *szAddress, char *szName, DWORD & nNameLen);
public:
DWORD m_dwFlags;
CRegistry();
~CRegistry();
DWORD Connect();
DWORD AddEvent(char *szEventSource, DWORD dwEventID, DWORD dwCount, DWORD dwTime);
DWORD DelEvent(char *szEventSource, DWORD dwEventID);
DWORD AddTrap(char *szCommunity, char *szAddress);
DWORD DelTrap(char *szCommunity, char *szAddress);
};
extern CRegistry gRegistry;
#endif