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.
 
 
 
 
 
 

96 lines
2.0 KiB

/*++
Copyright (C) 1996-2001 Microsoft Corporation
Module Name:
WBEMERROR.H
Abstract:
Implements string table based, error msgs for all of wbem.
History:
a-khint 5-mar-98 Created.
--*/
#include "wbemcli.h"
typedef LPVOID * PPVOID;
extern long g_cObj;
//***************************************************************************
//
// CLASS NAME:
//
// CWbemError
//
// DESCRIPTION:
//
// Provides error and facility code info.
//
//***************************************************************************
class CWbemError : IWbemStatusCodeText
{
protected:
long m_cRef;
public:
CWbemError(void)
{
InterlockedIncrement(&g_cObj);
m_cRef=1L;
return;
};
~CWbemError(void)
{
InterlockedDecrement(&g_cObj);
return;
}
//IUnknown members
STDMETHODIMP QueryInterface(REFIID riid, PPVOID ppv)
{
*ppv=NULL;
if (IID_IUnknown==riid || IID_IWbemStatusCodeText==riid)
*ppv=this;
if (NULL!=*ppv)
{
AddRef();
return NOERROR;
}
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void)
{
return ++m_cRef;
};
STDMETHODIMP_(ULONG) Release(void)
{
long lRef = InterlockedDecrement(&m_cRef);
if (0L == lRef)
delete this;
return lRef;
};
HRESULT STDMETHODCALLTYPE GetErrorCodeText(
HRESULT hRes,
LCID LocaleId,
long lFlags,
BSTR * MessageText);
HRESULT STDMETHODCALLTYPE GetFacilityCodeText(
HRESULT hRes,
LCID LocaleId,
long lFlags,
BSTR * MessageText);
void InitEmpty(){};
};