Example #1
0
//
// Constructor
//
CoCOMServer::CoCOMServer() : m_cRef(1)

{ 
	InterlockedIncrement(&g_cComponents) ; 

	m_ptinfo = NULL;
	LoadTypeInfo(&m_ptinfo, LIBID_AutoHotkey, IID_ICOMServer, 0);
}
Example #2
0
//
// Constructor
//
GitWCRev::GitWCRev()
	: m_cRef(1)
	, GitStat()
	, m_ptinfo(nullptr)
{
	LockServer(true);
	LoadTypeInfo(&m_ptinfo, LIBID_LibGitWCRev, IID_IGitWCRev, 0);
}
HRESULT CoFoldersMonitor::Init()
{
	// load the type library
	//DebugBreak();
	HRESULT hr = LoadTypeInfo(&m_typeInfo, LIBID_FoldersMonitorLib, IID_IFoldersMonitor, 0);

	com::Trace(L"[%s] : LoadTypeInfo returned %d", hr);
	_ASSERT(SUCCEEDED(hr));

	return S_OK;
}
Example #4
0
//Constructor
RTDServer::RTDServer(IUnknown* pUnkOuter)
{
    m_refCount = 0;
    m_pTypeInfoInterface = NULL;
    m_dwDataThread = -1;

    //Get the TypeInfo for this object
    LoadTypeInfo(&m_pTypeInfoInterface, IID_IRtdServer, 0x0);

    //Set up the aggregation
    if (pUnkOuter != NULL)
        m_pOuterUnknown = pUnkOuter;
    else
        m_pOuterUnknown = reinterpret_cast<IUnknown*>
                          (static_cast<INonDelegatingUnknown*>(this));

    //Increment the object count so the server knows not to unload
    InterlockedIncrement( &g_cOb );
}
Example #5
0
int main(int argc, char **argv)
{
    IVirtualBoxClient *vboxclient = NULL;
    IVirtualBox *vbox            = NULL;
    ISession   *session          = NULL;
    ULONG       revision         = 0;
    BSTR        versionUtf16     = NULL;
    BSTR        homefolderUtf16  = NULL;
    HRESULT     rc;     /* Result code of various function (method) calls. */
    (void)argc;

    printf("Starting main()\n");

    if (VBoxCGlueInit())
    {
        fprintf(stderr, "%s: FATAL: VBoxCGlueInit failed: %s\n",
                argv[0], g_szVBoxErrMsg);
        return EXIT_FAILURE;
    }

    {
        unsigned ver = g_pVBoxFuncs->pfnGetVersion();
        printf("VirtualBox version: %u.%u.%u\n", ver / 1000000, ver / 1000 % 1000, ver % 1000);
        ver = g_pVBoxFuncs->pfnGetAPIVersion();
        printf("VirtualBox API version: %u.%u\n", ver / 1000, ver % 1000);
    }

    g_pVBoxFuncs->pfnClientInitialize(NULL, &vboxclient);
    if (!vboxclient)
    {
        fprintf(stderr, "%s: FATAL: could not get VirtualBoxClient reference\n", argv[0]);
        return EXIT_FAILURE;
    }

    printf("----------------------------------------------------\n");

    rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &vbox);
    if (FAILED(rc) || !vbox)
    {
        PrintErrorInfo(argv[0], "FATAL: could not get VirtualBox reference", rc);
        return EXIT_FAILURE;
    }
    rc = IVirtualBoxClient_get_Session(vboxclient, &session);
    if (FAILED(rc) || !session)
    {
        PrintErrorInfo(argv[0], "FATAL: could not get Session reference", rc);
        return EXIT_FAILURE;
    }

#ifdef USE_ACTIVE_EVENT_LISTENER
# ifdef WIN32
    rc = LoadTypeInfo(&IID_IEventListener, &g_pTInfoIEventListener);
    if (FAILED(rc) || !g_pTInfoIEventListener)
    {
        PrintErrorInfo(argv[0], "FATAL: could not get type information for IEventListener", rc);
        return EXIT_FAILURE;
    }
# endif /* WIN32 */
#endif /* USE_ACTIVE_EVENT_LISTENER */

    /*
     * Now ask for revision, version and home folder information of
     * this vbox. Were not using fancy macros here so it
     * remains easy to see how we access C++'s vtable.
     */

    /* 1. Revision */
    rc = IVirtualBox_get_Revision(vbox, &revision);
    if (SUCCEEDED(rc))
        printf("\tRevision: %u\n", revision);
    else
        PrintErrorInfo(argv[0], "GetRevision() failed", rc);

    /* 2. Version */
    rc = IVirtualBox_get_Version(vbox, &versionUtf16);
    if (SUCCEEDED(rc))
    {
        char *version = NULL;
        g_pVBoxFuncs->pfnUtf16ToUtf8(versionUtf16, &version);
        printf("\tVersion: %s\n", version);
        g_pVBoxFuncs->pfnUtf8Free(version);
        g_pVBoxFuncs->pfnComUnallocString(versionUtf16);
    }
    else
        PrintErrorInfo(argv[0], "GetVersion() failed", rc);

    /* 3. Home Folder */
    rc = IVirtualBox_get_HomeFolder(vbox, &homefolderUtf16);
    if (SUCCEEDED(rc))
    {
        char *homefolder = NULL;
        g_pVBoxFuncs->pfnUtf16ToUtf8(homefolderUtf16, &homefolder);
        printf("\tHomeFolder: %s\n", homefolder);
        g_pVBoxFuncs->pfnUtf8Free(homefolder);
        g_pVBoxFuncs->pfnComUnallocString(homefolderUtf16);
    }
    else
        PrintErrorInfo(argv[0], "GetHomeFolder() failed", rc);

    listVMs(argv[0], vbox, session);
    ISession_UnlockMachine(session);

    printf("----------------------------------------------------\n");

    /*
     * Do as mom told us: always clean up after yourself.
     */
#ifdef USE_ACTIVE_EVENT_LISTENER
# ifdef WIN32
    if (g_pTInfoIEventListener)
    {
        ITypeInfo_Release(g_pTInfoIEventListener);
        g_pTInfoIEventListener = NULL;
    }
# endif /* WIN32 */
#endif /* USE_ACTIVE_EVENT_LISTENER */

    if (session)
    {
        ISession_Release(session);
        session = NULL;
    }
    if (vbox)
    {
        IVirtualBox_Release(vbox);
        vbox = NULL;
    }
    if (vboxclient)
    {
        IVirtualBoxClient_Release(vboxclient);
        vboxclient = NULL;
    }

    g_pVBoxFuncs->pfnClientUninitialize();
    VBoxCGlueTerm();
    printf("Finished main()\n");

    return 0;
}
Example #6
0
void CMatchTipCtrl::LoadFromFile()
{
	m_sName = m_pFile->m_sName;
	if ( m_pFile->GetTotalHitsCount() == 1 )
	{
		m_sCountryCode = m_pFile->GetBestCountry();
		m_sCountry = theApp.GetCountryName( m_pFile->GetBestAddress() );
	}
	else
	{
		m_sCountryCode = _T("");
		m_sCountry = _T("");
	}
	m_sSize = LoadString( IDS_TIP_SIZE ) + _T(": ") + m_pFile->m_sSize;
	LoadTypeInfo();

	if ( Settings.General.GUIMode == GUI_BASIC )
	{
		m_sSHA1.Empty();
		m_sTiger.Empty();
		m_sED2K.Empty();
		m_sBTH.Empty();
		m_sMD5.Empty();
	}
	else
	{
		m_sSHA1 = m_pFile->m_oSHA1.toShortUrn();
		m_sTiger = m_pFile->m_oTiger.toShortUrn();
		m_sED2K = m_pFile->m_oED2K.toShortUrn();
		m_sBTH = m_pFile->m_oBTH.toShortUrn();
		m_sMD5 = m_pFile->m_oMD5.toShortUrn();
	}

	m_pFile->GetPartialTip( m_sPartial );
	m_pFile->GetQueueTip( m_sQueue );

	m_pSchema = m_pFile->AddHitsToMetadata( m_pMetadata );

	if ( m_pSchema != NULL )
	{
		m_pMetadata.Vote();
		m_pMetadata.Clean( 72 );
	}

	m_nRating = m_pFile->m_nRated ? m_pFile->m_nRating / m_pFile->m_nRated : 0;

	m_pFile->GetStatusTip( m_sStatus, m_crStatus );
	m_pFile->GetUser( m_sUser );

	if (m_pFile->m_bBusy == 2)
	{
		LoadString( m_sBusy, IDS_TIP_FILE_BUSY );
	}
	else
	{
		m_sBusy.Empty();
	}

	if (m_pFile->m_bPush == 2)
	{
		LoadString( m_sPush, IDS_TIP_FILE_FIREWALLED );
	}
	else
	{
		m_sPush.Empty();
	}

	if (m_pFile->m_bStable == 1)
	{
		LoadString( m_sUnstable, IDS_TIP_FILE_UNSTABLE );
	}
	else
	{
		m_sUnstable.Empty();
	}
}
Example #7
0
void CMatchTipCtrl::LoadFromHit()
{
	m_sName = m_pHit->m_sName;
	m_sSize = LoadString( IDS_TIP_SIZE ) + _T(": ") + Settings.SmartVolume( m_pHit->m_nSize );
	LoadTypeInfo();

	if ( Settings.General.GUIMode == GUI_BASIC )
	{
		m_sSHA1.Empty();
		m_sTiger.Empty();
		m_sED2K.Empty();
		m_sBTH.Empty();
		m_sMD5.Empty();
	}
	else
	{
		m_sSHA1 = m_pHit->m_oSHA1.toShortUrn();
		m_sTiger = m_pHit->m_oTiger.toShortUrn();
		m_sED2K = m_pHit->m_oED2K.toShortUrn();
		m_sBTH = m_pHit->m_oBTH.toShortUrn();
		m_sMD5 = m_pHit->m_oMD5.toShortUrn();
	}

	if ( m_pHit->m_nPartial )
	{
		m_sPartial.Format( LoadString( IDS_TIP_PARTIAL ), 100.0f * (float)m_pHit->m_nPartial / (float)m_pHit->m_nSize );
	}
	else
	{
		m_sPartial.Empty();
	}

	if ( m_pHit->m_nUpSlots )
	{
		m_sQueue.Format( LoadString( IDS_TIP_QUEUE ), m_pHit->m_nUpSlots, max( 0, m_pHit->m_nUpQueue - m_pHit->m_nUpSlots ) );
	}
	else
	{
		m_sQueue.Empty();
	}

	m_pSchema = m_pHit->m_pSchema;

	m_pMetadata.Setup( m_pSchema );

	if ( m_pSchema != NULL )
	{
		if ( m_pHit->m_pXML && m_pSchema->Equals( m_pHit->m_pSchema ) )
		{
			m_pMetadata.Combine( m_pHit->m_pXML );
		}
		m_pMetadata.Clean( 72 );
	}

	m_nRating = m_pHit->m_nRating;

	m_sStatus.Empty();

	if ( m_pFile->GetLibraryStatus() == TRI_FALSE )
	{
		LoadString( m_sStatus, IDS_TIP_EXISTS_LIBRARY );
		m_crStatus = CoolInterface.m_crTextStatus ;
	}
	else if ( m_pFile->m_bDownload || m_pHit->m_bDownload )
	{
		LoadString( m_sStatus, IDS_TIP_EXISTS_DOWNLOAD );
		m_crStatus = CoolInterface.m_crTextStatus ;
	}
	else if ( m_pHit->m_bBogus )
	{
		LoadString( m_sStatus, IDS_TIP_BOGUS );
		m_crStatus = CoolInterface.m_crTextAlert ;
	}
	else if ( m_pHit->m_sComments.GetLength() )
	{
		if ( m_pHit->m_nRating == 1 )
			LoadString( m_sStatus, IDS_TIP_EXISTS_BLACKLISTED );
		m_sStatus += m_pHit->m_sComments;
		m_crStatus = CoolInterface.m_crTextAlert ;
	}
	else if ( m_pFile->GetLibraryStatus() == TRI_TRUE )  // ghost rated
	{
		LoadString( m_sStatus, IDS_TIP_EXISTS_DELETED );
		m_crStatus = CoolInterface.m_crTextAlert ;
	}

	// Is this a firewalled eDonkey client
	if ( ( m_pHit->m_nProtocol == PROTOCOL_ED2K ) && ( m_pHit->m_bPush == TRI_TRUE ) )
	{
		m_sUser.Format( _T("%lu@%s - %s"),
			m_pHit->m_oClientID.begin()[2],
			(LPCTSTR)CString( inet_ntoa( (IN_ADDR&)*m_pHit->m_oClientID.begin() ) ),
			(LPCTSTR)m_pHit->m_pVendor->m_sName );
	}
	else
	{
		m_sUser.Format( _T("%s:%u - %s"),
			(LPCTSTR)CString( inet_ntoa( m_pHit->m_pAddress ) ),
			m_pHit->m_nPort,
			(LPCTSTR)m_pHit->m_pVendor->m_sName );
	}

	// Add the Nickname if there is one and they are being shown
	if ( Settings.Search.ShowNames && !m_pHit->m_sNick.IsEmpty() )
		m_sUser = m_pHit->m_sNick + _T(" (") + m_sUser + _T(")");

	m_sCountryCode = m_pHit->m_sCountry;
	m_sCountry = theApp.GetCountryName( m_pHit->m_pAddress );

	if (m_pHit->m_bBusy == 2)
	{
		LoadString( m_sBusy, IDS_TIP_SOURCE_BUSY );
	}
	else
	{
		m_sBusy.Empty();
	}

	if (m_pHit->m_bPush == 2)
	{
		LoadString( m_sPush, IDS_TIP_SOURCE_FIREWALLED );
	}
	else
	{
		m_sPush.Empty();
	}

	if (m_pHit->m_bStable == 1)
	{
		LoadString( m_sUnstable, IDS_TIP_SOURCE_UNSTABLE );
	}
	else
	{
		m_sUnstable.Empty();
	}
}