VirtualBox

Changeset 59368 in vbox


Ignore:
Timestamp:
Jan 17, 2016 5:48:01 AM (9 years ago)
Author:
vboxsync
Message:

VBoxCOM,VBoxSVC: Call VBoxProxyStub to gently update the MS COM registrations for the VBox components (requires VBOX_WITH_MIDL_PROXY_STUB=1).

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/com.h

    r58110 r59368  
    4141 *  willing to perform COM operations.
    4242 *
    43  *  @param fGui     if call is performed on the GUI thread
     43 *  @param fGui             if call is performed on the GUI thread
     44 *  @param fAutoRegUpdate   if to do auto MS COM registration updates.
    4445 *  @return COM result code
    4546 */
    46 HRESULT Initialize(bool fGui = false);
     47HRESULT Initialize(bool fGui = false, bool fAutoRegUpdate = true);
    4748
    4849/**
  • trunk/src/VBox/Main/glue/initterm.cpp

    r55451 r59368  
    4646#include <iprt/asm.h>
    4747#include <iprt/env.h>
     48#include <iprt/ldr.h>
    4849#include <iprt/param.h>
    4950#include <iprt/path.h>
     
    237238 * @return S_OK on success and a COM result code in case of failure.
    238239 */
    239 HRESULT Initialize(bool fGui)
     240HRESULT Initialize(bool fGui /*= false*/, bool fAutoRegUpdate /*= true*/)
    240241{
    241242    HRESULT rc = E_FAIL;
     243    NOREF(fAutoRegUpdate);
    242244
    243245#if !defined(VBOX_WITH_XPCOM)
     246
     247# ifdef VBOX_WITH_AUTO_COM_REG_UPDATE
     248    /*
     249     * First time we're called in a process, we refresh the VBox COM registrations.
     250     */
     251    if (fAutoRegUpdate && gCOMMainThread == NIL_RTTHREAD)
     252    {
     253        char szPath[RTPATH_MAX];
     254        int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
     255        if (RT_SUCCESS(vrc))
     256#  ifndef VBOX_IN_32_ON_64_MAIN_API
     257            rc = RTPathAppend(szPath, sizeof(szPath), "VBoxProxyStub.dll");
     258#  else
     259            rc = RTPathAppend(szPath, sizeof(szPath), "x86\\VBoxProxyStub-x86.dll");
     260#  endif
     261        if (RT_SUCCESS(vrc))
     262        {
     263            RTLDRMOD hMod;
     264            vrc = RTLdrLoad(szPath, &hMod);
     265            if (RT_SUCCESS(vrc))
     266            {
     267                union
     268                {
     269                    void *pv;
     270                    DECLCALLBACKMEMBER(uint32_t, pfnRegUpdate)(void);
     271                } u;
     272                rc = RTLdrGetSymbol(hMod, "VbpsUpdateRegistrations", &u.pv);
     273                if (RT_SUCCESS(rc))
     274                    u.pfnRegUpdate();
     275                /* Just keep it loaded. */
     276            }
     277        }
     278    }
     279# endif
    244280
    245281    /*
  • trunk/src/VBox/Main/src-server/win/svcmain.cpp

    r55980 r59368  
    339339
    340340    int nRet = 0;
    341     HRESULT hRes = com::Initialize();
     341    HRESULT hRes = com::Initialize(false /*fGui*/, fRun /*fAutoRegUpdate*/);
    342342
    343343    _ASSERTE(SUCCEEDED(hRes));
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