AxibugEmuOnline/References/VirtuaNESex_src_191105/Com.cpp
2024-08-05 17:58:53 +08:00

36 lines
594 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// COM—˜—pƒTƒ|<7C>[ƒgƒNƒ‰ƒX
//
#include <objbase.h>
#include "DebugOut.h"
#include "Com.h"
INT COM::m_nRefCount = 0;
LRESULT COM::AddRef()
{
if( !m_nRefCount ) {
HRESULT hr;
if( (hr = ::CoInitialize( NULL )) != S_OK ) {
DEBUGOUT( "COM::AddRef() CoInitialize failed.\n" );
return hr;
}
DEBUGOUT( "COM::AddRef() CoInitialize.\n" );
}
m_nRefCount++;
return 0L;
}
void COM::Release()
{
if( !m_nRefCount ) {
DEBUGOUT( "COM::Release() too many released.\n" );
return;
}
if( !(--m_nRefCount) ) {
::CoUninitialize();
DEBUGOUT( "COM::AddRef() CoUninitialize.\n" );
}
}