void CAdminSessionEventSink::Term() { assert(m_dwGITCookie); // Revoke all events for which we are registered GetAGCGlobal()->RevokeAllEvents(reinterpret_cast<IAGCEventSink*>(this)); // Revoke ourself from the GIT GetAGCGlobal()->RevokeInterfaceFromGlobal(m_dwGITCookie); m_dwGITCookie = 0; }
void CPigShip::SetIGC(IshipIGC* pShipIGC) { // Remove the AGC mapping of this object if (GetIGC()) GetAGCGlobal()->RemoveAGCObject(GetIGC(), false); // Set the base IGC pointer of the object IAGCShipImplBase::Init(pShipIGC); // Add this as the AGC wrapper to the map if (pShipIGC) GetAGCGlobal()->AddAGCObject(pShipIGC, GetUnknown()); }
/*------------------------------------------------------------------------- * DeactivateAllEvents() *------------------------------------------------------------------------- * Purpose: * Use this to deactivate event firing all events for this session * */ STDMETHODIMP CAdminSession::DeactivateAllEvents() { assert(m_pEventSink); GetAGCGlobal()->RevokeAllEvents( reinterpret_cast<IAGCEventSink*>(m_pEventSink)); return S_OK; }
/*------------------------------------------------------------------------- * get_Server() *------------------------------------------------------------------------- * Purpose: * * */ STDMETHODIMP CAdminSession::get_Server(IAdminServer** ppAdminServer) { // Get the CAdminServer instance from the GIT HRESULT hr; assert(g.dwServerGITCookie); ZSucceeded(hr = GetAGCGlobal()->GetInterfaceFromGlobal( g.dwServerGITCookie, IID_IAdminServer, (void**)ppAdminServer)); return hr; }
/*------------------------------------------------------------------------- * DeactivateEvents() *------------------------------------------------------------------------- * Purpose: * Use this to activate event firing for events of a certain type * * Parameters: * event: id of the event to be deactivated * uniqueID: if not AGC_Any_Objects, then this is AGC unqiue object id telling who the event * should be fired for. AGC_Any_Objects means for all applicable objects * * Remarks: * There should be a DeactivateEvents() call for each ActivateEvents() call. * A single DeactivateEvents() call with AGC_Any_Objects as the unique ID does not turn off * all event firing for the AGCEventID event. */ STDMETHODIMP CAdminSession::DeactivateEvents(AGCEventID event, AGCUniqueID uniqueID) { if (-1 == uniqueID) uniqueID = AGC_Any_Objects; assert(m_pEventSink); GetAGCGlobal()->RevokeEvent(event, uniqueID, reinterpret_cast<IAGCEventSink*>(m_pEventSink)); return S_OK; }
/*------------------------------------------------------------------------- * get_SessionInfos() *------------------------------------------------------------------------- * Purpose: * Use this to find out of an event of a certain type is firing * * A uniqueID of AGC_Any_Objects causes the check to be done for global event firing, * otherwise this id is used to check for specialized event firing for the AGC * object with this id. * */ STDMETHODIMP CAdminSession::get_IsEventActivated(AGCEventID event, AGCUniqueID uniqueID, BOOL *pVal) { if (uniqueID == -1) uniqueID = AGC_Any_Objects; assert(m_pEventSink); *pVal = GetAGCGlobal()->IsRegistered(event, uniqueID, reinterpret_cast<IAGCEventSink*>(m_pEventSink)); return S_OK; }
void CPigSessionEventSink::Init(CPigSession* pSession) { // Save the owning session object assert(pSession); assert(!m_pSession); m_pSession = pSession; // Add ourself to the GIT GetAGCGlobal()->RegisterInterfaceInGlobal( static_cast<IAGCEventSink*>(this), IID_IAGCEventSink, &m_dwGITCookie); }
HRESULT CServiceModule::InitAGC() { // Initialize AGC HRESULT hr; ZSucceeded(hr = _AGCModule.Init()); RETURN_FAILED(hr); _AGCModule.SetDebugBreakOnErrors(g.fWantInt3); #ifdef _DEBUG _AGCModule.GetAGCGlobal()->SetDebugHook(&g_DebugHook); #endif // _DEBUG // Create the set of available AGCEventID ranges CComPtr<IAGCEventIDRanges> spRanges; ZSucceeded(hr = spRanges.CoCreateInstance(L"AGC.EventIDRanges")); RETURN_FAILED(hr); // Add our ranges to it ZSucceeded(spRanges->AddByValues(EventID_AGC_LowerBound, EventID_AGC_UpperBound)); ZSucceeded(spRanges->AddByValues(AllsrvEventID_Allsrv_LowerBound, AllsrvEventID_Allsrv_UpperBound)); ZSucceeded(spRanges->AddByValues(EventID_Admin_LowerBound, EventID_Admin_UpperBound)); // Set the ranges of available events GetAGCGlobal()->SetAvailableEventIDRanges(spRanges); // Create the event logger object ZSucceeded(hr = m_spEventLogger.CreateInstance("AGC.EventLogger")); RETURN_FAILED(hr); // Initialize the event logger object CComBSTR bstrEventSource(__MODULE__); CComBSTR bstrRegKey("HKLM\\" HKLM_FedSrvA); IAGCEventLoggerPrivatePtr spPrivate(m_spEventLogger); hr = spPrivate->Initialize(bstrEventSource, bstrRegKey); ZSucceeded(hr); RETURN_FAILED(hr); // Hook the event logger for DB event logging ZSucceeded(hr = spPrivate->put_HookForDBLogging(&g_DBLoggingHook)); // Indicate success return S_OK; }