2025-04-27 07:49:33 -04:00

163 lines
3.4 KiB
C++

//***************************************************************************
//
// MINISERV.CPP
//
// Module: OLE MS Property Provider
//
// Purpose: Implementation for the GetEventObject class.
//
// Copyright (c) 1996-2001 Microsoft Corporation, All Rights Reserved
//
//***************************************************************************
#include <windows.h>
#include <snmptempl.h>
#include <snmpmt.h>
#include <typeinfo.h>
#include <process.h>
#include <objbase.h>
#include <stdio.h>
#include <wbemidl.h>
#include <wbemint.h>
#include "classfac.h"
#include "guids.h"
#include <snmpcont.h>
#include <snmpevt.h>
#include <snmpthrd.h>
#include <snmplog.h>
#include <instpath.h>
#include <genlex.h>
#include <sql_1.h>
#include <objpath.h>
#include "trrtcomm.h"
#include "trrtprov.h"
#include "trrt.h"
BOOL GetObjectEventObject :: GetObject ( WbemProviderErrorObject &a_ErrorObject )
{
BOOL t_Status;
int iParseResult = m_ObjectPathParser.Parse ( m_ObjectPath , &m_ParsedObjectPath ) ;
if ( CObjectPathParser::NoError == iParseResult )
{
t_Status = TRUE;
ProcessComplete () ;
}
else
{
t_Status = FALSE ;
a_ErrorObject.SetStatus ( WBEM_PROVIDER_E_INVALID_CLASS ) ;
a_ErrorObject.SetWbemStatus ( WBEM_E_FAILED ) ;
a_ErrorObject.SetMessage ( L"Unknown Class" ) ;
}
return t_Status ;
}
GetObjectEventObject :: GetObjectEventObject (
CImpFrameworkProv *a_Provider ,
BSTR a_ObjectPath ,
ULONG a_OperationFlag ,
IWbemObjectSink *a_NotificationHandler ,
IWbemContext *a_Ctx
) : WbemTaskObject ( a_Provider , a_NotificationHandler , a_OperationFlag , a_Ctx ) ,
m_Class ( NULL )
{
m_ObjectPath = UnicodeStringDuplicate ( a_ObjectPath ) ;
}
GetObjectEventObject :: ~GetObjectEventObject ()
{
// Get Status object
delete [] m_ObjectPath ;
if ( FAILED ( m_ErrorObject.GetWbemStatus () ) )
{
IWbemClassObject *t_NotifyStatus = NULL ;
BOOL t_Status = GetExtendedNotifyStatusObject ( &t_NotifyStatus ) ;
if ( t_Status )
{
HRESULT t_Result = m_NotificationHandler->SetStatus ( 0 , m_ErrorObject.GetWbemStatus () , m_ErrorObject.GetMessage () , t_NotifyStatus ) ;
t_NotifyStatus->Release () ;
}
}
else
{
HRESULT t_Result = m_NotificationHandler->SetStatus ( 0 , m_ErrorObject.GetWbemStatus () , NULL , NULL ) ;
}
}
void GetObjectEventObject :: ProcessComplete ()
{
}
void GetObjectEventObject :: Process ()
{
switch ( m_State )
{
case 0:
{
Complete () ;
WaitAcknowledgement () ;
BOOL t_Status = GetObject ( m_ErrorObject ) ;
if ( t_Status )
{
}
else
{
ProcessComplete () ;
}
}
break ;
default:
{
}
break ;
}
}
GetObjectAsyncEventObject :: GetObjectAsyncEventObject (
CImpFrameworkProv *a_Provider ,
BSTR a_ObjectPath ,
ULONG a_OperationFlag ,
IWbemObjectSink *a_NotificationHandler ,
IWbemContext *a_Ctx
) : GetObjectEventObject ( a_Provider , a_ObjectPath , a_OperationFlag , a_NotificationHandler , a_Ctx )
{
}
GetObjectAsyncEventObject :: ~GetObjectAsyncEventObject ()
{
}
void GetObjectAsyncEventObject :: ProcessComplete ()
{
GetObjectEventObject :: ProcessComplete () ;
/*
* Remove worker object from worker thread container
*/
CImpFrameworkProv:: s_DefaultThreadObject->ReapTask ( *this ) ;
Release () ;
}