VirtualBox

Changeset 63705 in vbox


Ignore:
Timestamp:
Sep 2, 2016 7:38:00 PM (8 years ago)
Author:
vboxsync
Message:

BugReport(bugref:7809): Use RTProcGetExecutablePath instead of argv0, fall back to creating VirtualBox if VirtualBoxClient is not registered.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.cpp

    r63703 r63705  
    601601    try
    602602    {
    603         /* Figure out full path to VBoxManage */
    604         char *pszVBoxBin = RTStrDup(argv[0]);
    605         if (!pszVBoxBin)
    606             throw RTCError("Out of memory\n");
    607         RTPathStripFilename(pszVBoxBin);
    608         g_pszVBoxManage = RTPathJoinA(pszVBoxBin, VBOXMANAGE);
     603        /* Figure out the full path to VBoxManage */
     604        char szVBoxBin[RTPATH_MAX];
     605        if (!RTProcGetExecutablePath(szVBoxBin, sizeof(szVBoxBin)))
     606            throw RTCError("RTProcGetExecutablePath failed\n");
     607        RTPathStripFilename(szVBoxBin);
     608        g_pszVBoxManage = RTPathJoinA(szVBoxBin, VBOXMANAGE);
    609609        if (!g_pszVBoxManage)
    610610            throw RTCError("Out of memory\n");
    611         RTStrFree(pszVBoxBin);
    612611
    613612        handleComError(com::Initialize(), "Failed to initialize COM");
     
    624623            if (SUCCEEDED(hr))
    625624                hr = virtualBoxClient->COMGETTER(VirtualBox)(virtualBox.asOutParam());
     625            else if (hr == REGDB_E_CLASSNOTREG)
     626                hr = virtualBox.createLocalObject(CLSID_VirtualBox);
    626627            if (FAILED(hr))
    627628                RTStrmPrintf(g_pStdErr, "WARNING: Failed to create the VirtualBox object (hr=0x%x)\n", hr);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette