VirtualBox

Changeset 88783 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 29, 2021 1:35:47 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144113
Message:

VBoxSVC: The order is TranslateMessage *then* DispatchMessage. Here
it shouldn't affect anything I guess as the window is hidden. But do
the right thing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/win/svcmain.cpp

    r85121 r88783  
    5757{
    5858public:
     59    LONG Lock();
    5960    LONG Unlock();
    6061    DWORD dwThreadID;
     
    104105}
    105106
     107
     108LONG CExeModule::Lock()
     109{
     110    LONG cLocks = ATL::CComModule::Lock();
     111    LogRel(("CExeModule::Lock: cLocks = %d\n", (int)cLocks));
     112    return cLocks;
     113}
     114
     115
    106116LONG CExeModule::Unlock()
    107117{
    108118    LONG cLocks = ATL::CComModule::Unlock();
     119    LogRel(("CExeModule::Unlock: cLocks = %d\n", (int)cLocks));
    109120    if (isIdleLockCount(cLocks))
    110121    {
     
    117128bool CExeModule::HasActiveConnection()
    118129{
    119     return bActivity || !isIdleLockCount(GetLockCount());
     130    const LONG cLocks = GetLockCount();
     131    LogRel(("%s: bActivity = %s;  cLocks = %d\n",
     132            __FUNCTION__,
     133            bActivity ? "TRUE" : "false",
     134            (int)cLocks));
     135    return bActivity || !isIdleLockCount(cLocks);
    120136}
    121137
     
    139155    while (1)
    140156    {
    141         WaitForSingleObject(hEventShutdown, INFINITE);
    142157        DWORD dwWait;
     158        dwWait = WaitForSingleObject(hEventShutdown, INFINITE);
     159        LogRel(("%s: dwWait INFINITE = 0x%x\n", __FUNCTION__, dwWait));       
    143160        do
    144161        {
    145162            bActivity = false;
    146163            dwWait = WaitForSingleObject(hEventShutdown, dwTimeOut);
     164            LogRel(("%s: dwWait %d = 0x%x\n", __FUNCTION__, dwTimeOut, dwWait));
    147165        } while (dwWait == WAIT_OBJECT_0);
    148166        /* timed out */
     167        // LogRel(("%s: dwWait = %x\n", __FUNCTION__, dwWait));
    149168        if (!HasActiveConnection()) /* if no activity let's really bail */
    150169        {
     
    171190#if _WIN32_WINNT >= 0x0400
    172191            CoSuspendClassObjects();
     192            LogRel(("%s (end of loop)\n", __FUNCTION__));
    173193            if (!HasActiveConnection())
    174194#endif
     
    324344            rcRpc, CallAttribs.ClientPID, CallAttribs.IsClientLocal, CallAttribs.ProtocolSequence, CallAttribs.CallStatus,
    325345            CallAttribs.CallType, CallAttribs.OpNum, &CallAttribs.InterfaceUuid));
     346# else  // XXX: uwe
     347    LogRel(("VirtualBoxClassFactory::i_registerWithSds\n"));
    326348# endif
    327349
     
    354376void VirtualBoxClassFactory::i_deregisterWithSds(void)
    355377{
    356     Log(("VirtualBoxClassFactory::i_deregisterWithSds\n"));
     378    LogRel(("VirtualBoxClassFactory::i_deregisterWithSds\n"));
    357379
    358380    if (m_ptrVirtualBoxSDS.isNotNull())
     
    391413        pObj->AddRef();
    392414        *ppResult = pObj;
    393         Log(("VirtualBoxClassFactory::GetVirtualBox: S_OK - %p\n", pObj));
     415        LogRel(("VirtualBoxClassFactory::GetVirtualBox: S_OK - %p\n", pObj));
    394416        return S_OK;
    395417    }
    396418    *ppResult = NULL;
    397     Log(("VirtualBoxClassFactory::GetVirtualBox: E_FAIL\n"));
     419    LogRel(("VirtualBoxClassFactory::GetVirtualBox: E_FAIL\n"));
    398420    return E_FAIL;
    399421}
     
    431453        {
    432454            AssertMsg(ATL::_pAtlModule, ("ATL: referring to ATL module without having one declared in this linking namespace\n"));
     455            LogRel(("VirtualBoxObjectCached::AddRef: cRefs = 2, LOCKING the module\n"));
    433456            ATL::_pAtlModule->Lock();
     457        }
     458        else
     459        {
     460            LogRel(("VirtualBoxObjectCached::AddRef: cRefs = %u\n", (unsigned)cRefs));
    434461        }
    435462        return cRefs;
     
    440467        ULONG cRefs = InternalRelease();
    441468        if (cRefs == 0)
     469        {
     470            LogRel(("VirtualBoxObjectCached::Release: cRefs = 0: deleting...\n"));
    442471            delete this;
     472        }
    443473        else if (cRefs == 1)
    444474        {
    445475            AssertMsg(ATL::_pAtlModule, ("ATL: referring to ATL module without having one declared in this linking namespace\n"));
     476            LogRel(("VirtualBoxObjectCached::Release: cRefs = 1: unlocking the module\n"));
    446477            ATL::_pAtlModule->Unlock();
     478        }
     479        else
     480        {
     481            LogRel(("VirtualBoxObjectCached::Release: cRefs = %u\n", (unsigned)cRefs));
    447482        }
    448483        return cRefs;
     
    480515                *ppObj = p;
    481516        }
     517        LogRel(("VirtualBoxObjectCached::CreateInstance: %Rhrc\n", hrc));
    482518        return hrc;
    483519    }
     
    526562                     * terminate the module in case when CreateInstance() fails)
    527563                     */
     564                    LogRel(("VirtualBoxClassFactory::CreateInstance: LOCKING the module\n"));
    528565                    ATL::_pAtlModule->Lock();
    529566                    __try
     
    538575                        else if (SUCCEEDED(hrc))
    539576                        {
     577                            LogRel(("VirtualBoxClassFactory::CreateInstance: LOCKING the module\n"));
    540578                            ATL::_pAtlModule->Lock();
    541579                            VirtualBoxObjectCached *p;
     
    558596                    __finally
    559597                    {
     598                        LogRel(("VirtualBoxClassFactory::CreateInstance: finally unlocking the module\n"));
    560599                        ATL::_pAtlModule->Unlock();
    561600                    }
     
    630669        case WM_QUERYENDSESSION:
    631670        {
     671            LogRel(("WM_QUERYENDSESSION\n"));
    632672            if (g_pModule)
    633673            {
     
    639679                    /* decrease a latency of MonitorShutdown loop */
    640680                    ASMAtomicXchgU32(&dwTimeOut, 100);
    641                     Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: VBoxSvc has active connections. bActivity = %d. Loc count = %d\n",
     681                    LogRel(("VBoxSVCWinMain: WM_QUERYENDSESSION: VBoxSvc has active connections. bActivity = %d. Loc count = %d\n",
    642682                         g_pModule->bActivity, g_pModule->GetLockCount()));
    643683                }
     
    650690        case WM_ENDSESSION:
    651691        {
     692            LogRel(("WM_ENDSESSION(%s)\n", wParam == FALSE ? "false" : "true"));
    652693            /* Restore timeout of Monitor Shutdown if user canceled system shutdown */
    653694            if (wParam == FALSE)
    654695            {
    655696                ASMAtomicXchgU32(&dwTimeOut, dwNormalTimeout);
    656                 Log(("VBoxSVCWinMain: user canceled system shutdown.\n"));
     697                LogRel(("VBoxSVCWinMain: user canceled system shutdown.\n"));
    657698            }
    658699            break;
     
    694735    if (atomWindowClass == 0)
    695736    {
    696         Log(("Failed to register main window class\n"));
     737        LogRel(("Failed to register main window class\n"));
    697738        rc = VERR_NOT_SUPPORTED;
    698739    }
     
    706747        if (g_hMainWindow == NULL)
    707748        {
    708             Log(("Failed to create main window\n"));
     749            LogRel(("Failed to create main window\n"));
    709750            rc = VERR_NOT_SUPPORTED;
    710751        }
     
    723764{
    724765    Assert(g_hMainWindow != NULL);
    725     Log(("SVCMain: DestroyMainWindow \n"));
     766    LogRel(("SVCMain: DestroyMainWindow \n"));
    726767    if (g_hMainWindow != NULL)
    727768    {
     
    9731014        if (pszPipeName)
    9741015        {
    975             Log(("SVCMAIN: Processing Helper request (cmdline=\"%s\")...\n", pszPipeName));
     1016            LogRel(("SVCMAIN: Processing Helper request (cmdline=\"%s\")...\n", pszPipeName));
    9761017
    9771018            if (!*pszPipeName)
     
    9881029            if (RT_FAILURE(vrc))
    9891030            {
    990                 Log(("SVCMAIN: Failed to process Helper request (%Rrc).\n", vrc));
     1031                LogRel(("SVCMAIN: Failed to process Helper request (%Rrc).\n", vrc));
    9911032                nRet = 1;
    9921033            }
     
    10061047
    10071048        if (RT_SUCCESS(CreateMainWindow()))
    1008             Log(("SVCMain: Main window succesfully created\n"));
     1049            LogRel(("SVCMain: Main window succesfully created\n"));
    10091050        else
    1010             Log(("SVCMain: Failed to create main window\n"));
     1051            LogRel(("SVCMain: Failed to create main window\n"));
    10111052
    10121053        MSG msg;
    10131054        while (GetMessage(&msg, 0, 0, 0) > 0)
    10141055        {
     1056            TranslateMessage(&msg);
    10151057            DispatchMessage(&msg);
    1016             TranslateMessage(&msg);
    10171058        }
    10181059
     
    10331074    g_pModule = NULL;
    10341075
    1035     Log(("SVCMAIN: Returning, COM server process ends.\n"));
     1076    LogRel(("SVCMAIN: Returning, COM server process ends.\n"));
    10361077    return nRet;
    10371078}
Note: See TracChangeset for help on using the changeset viewer.

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