Changeset 88783 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 29, 2021 1:35:47 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144113
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/win/svcmain.cpp
r85121 r88783 57 57 { 58 58 public: 59 LONG Lock(); 59 60 LONG Unlock(); 60 61 DWORD dwThreadID; … … 104 105 } 105 106 107 108 LONG CExeModule::Lock() 109 { 110 LONG cLocks = ATL::CComModule::Lock(); 111 LogRel(("CExeModule::Lock: cLocks = %d\n", (int)cLocks)); 112 return cLocks; 113 } 114 115 106 116 LONG CExeModule::Unlock() 107 117 { 108 118 LONG cLocks = ATL::CComModule::Unlock(); 119 LogRel(("CExeModule::Unlock: cLocks = %d\n", (int)cLocks)); 109 120 if (isIdleLockCount(cLocks)) 110 121 { … … 117 128 bool CExeModule::HasActiveConnection() 118 129 { 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); 120 136 } 121 137 … … 139 155 while (1) 140 156 { 141 WaitForSingleObject(hEventShutdown, INFINITE);142 157 DWORD dwWait; 158 dwWait = WaitForSingleObject(hEventShutdown, INFINITE); 159 LogRel(("%s: dwWait INFINITE = 0x%x\n", __FUNCTION__, dwWait)); 143 160 do 144 161 { 145 162 bActivity = false; 146 163 dwWait = WaitForSingleObject(hEventShutdown, dwTimeOut); 164 LogRel(("%s: dwWait %d = 0x%x\n", __FUNCTION__, dwTimeOut, dwWait)); 147 165 } while (dwWait == WAIT_OBJECT_0); 148 166 /* timed out */ 167 // LogRel(("%s: dwWait = %x\n", __FUNCTION__, dwWait)); 149 168 if (!HasActiveConnection()) /* if no activity let's really bail */ 150 169 { … … 171 190 #if _WIN32_WINNT >= 0x0400 172 191 CoSuspendClassObjects(); 192 LogRel(("%s (end of loop)\n", __FUNCTION__)); 173 193 if (!HasActiveConnection()) 174 194 #endif … … 324 344 rcRpc, CallAttribs.ClientPID, CallAttribs.IsClientLocal, CallAttribs.ProtocolSequence, CallAttribs.CallStatus, 325 345 CallAttribs.CallType, CallAttribs.OpNum, &CallAttribs.InterfaceUuid)); 346 # else // XXX: uwe 347 LogRel(("VirtualBoxClassFactory::i_registerWithSds\n")); 326 348 # endif 327 349 … … 354 376 void VirtualBoxClassFactory::i_deregisterWithSds(void) 355 377 { 356 Log (("VirtualBoxClassFactory::i_deregisterWithSds\n"));378 LogRel(("VirtualBoxClassFactory::i_deregisterWithSds\n")); 357 379 358 380 if (m_ptrVirtualBoxSDS.isNotNull()) … … 391 413 pObj->AddRef(); 392 414 *ppResult = pObj; 393 Log (("VirtualBoxClassFactory::GetVirtualBox: S_OK - %p\n", pObj));415 LogRel(("VirtualBoxClassFactory::GetVirtualBox: S_OK - %p\n", pObj)); 394 416 return S_OK; 395 417 } 396 418 *ppResult = NULL; 397 Log (("VirtualBoxClassFactory::GetVirtualBox: E_FAIL\n"));419 LogRel(("VirtualBoxClassFactory::GetVirtualBox: E_FAIL\n")); 398 420 return E_FAIL; 399 421 } … … 431 453 { 432 454 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")); 433 456 ATL::_pAtlModule->Lock(); 457 } 458 else 459 { 460 LogRel(("VirtualBoxObjectCached::AddRef: cRefs = %u\n", (unsigned)cRefs)); 434 461 } 435 462 return cRefs; … … 440 467 ULONG cRefs = InternalRelease(); 441 468 if (cRefs == 0) 469 { 470 LogRel(("VirtualBoxObjectCached::Release: cRefs = 0: deleting...\n")); 442 471 delete this; 472 } 443 473 else if (cRefs == 1) 444 474 { 445 475 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")); 446 477 ATL::_pAtlModule->Unlock(); 478 } 479 else 480 { 481 LogRel(("VirtualBoxObjectCached::Release: cRefs = %u\n", (unsigned)cRefs)); 447 482 } 448 483 return cRefs; … … 480 515 *ppObj = p; 481 516 } 517 LogRel(("VirtualBoxObjectCached::CreateInstance: %Rhrc\n", hrc)); 482 518 return hrc; 483 519 } … … 526 562 * terminate the module in case when CreateInstance() fails) 527 563 */ 564 LogRel(("VirtualBoxClassFactory::CreateInstance: LOCKING the module\n")); 528 565 ATL::_pAtlModule->Lock(); 529 566 __try … … 538 575 else if (SUCCEEDED(hrc)) 539 576 { 577 LogRel(("VirtualBoxClassFactory::CreateInstance: LOCKING the module\n")); 540 578 ATL::_pAtlModule->Lock(); 541 579 VirtualBoxObjectCached *p; … … 558 596 __finally 559 597 { 598 LogRel(("VirtualBoxClassFactory::CreateInstance: finally unlocking the module\n")); 560 599 ATL::_pAtlModule->Unlock(); 561 600 } … … 630 669 case WM_QUERYENDSESSION: 631 670 { 671 LogRel(("WM_QUERYENDSESSION\n")); 632 672 if (g_pModule) 633 673 { … … 639 679 /* decrease a latency of MonitorShutdown loop */ 640 680 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", 642 682 g_pModule->bActivity, g_pModule->GetLockCount())); 643 683 } … … 650 690 case WM_ENDSESSION: 651 691 { 692 LogRel(("WM_ENDSESSION(%s)\n", wParam == FALSE ? "false" : "true")); 652 693 /* Restore timeout of Monitor Shutdown if user canceled system shutdown */ 653 694 if (wParam == FALSE) 654 695 { 655 696 ASMAtomicXchgU32(&dwTimeOut, dwNormalTimeout); 656 Log (("VBoxSVCWinMain: user canceled system shutdown.\n"));697 LogRel(("VBoxSVCWinMain: user canceled system shutdown.\n")); 657 698 } 658 699 break; … … 694 735 if (atomWindowClass == 0) 695 736 { 696 Log (("Failed to register main window class\n"));737 LogRel(("Failed to register main window class\n")); 697 738 rc = VERR_NOT_SUPPORTED; 698 739 } … … 706 747 if (g_hMainWindow == NULL) 707 748 { 708 Log (("Failed to create main window\n"));749 LogRel(("Failed to create main window\n")); 709 750 rc = VERR_NOT_SUPPORTED; 710 751 } … … 723 764 { 724 765 Assert(g_hMainWindow != NULL); 725 Log (("SVCMain: DestroyMainWindow \n"));766 LogRel(("SVCMain: DestroyMainWindow \n")); 726 767 if (g_hMainWindow != NULL) 727 768 { … … 973 1014 if (pszPipeName) 974 1015 { 975 Log (("SVCMAIN: Processing Helper request (cmdline=\"%s\")...\n", pszPipeName));1016 LogRel(("SVCMAIN: Processing Helper request (cmdline=\"%s\")...\n", pszPipeName)); 976 1017 977 1018 if (!*pszPipeName) … … 988 1029 if (RT_FAILURE(vrc)) 989 1030 { 990 Log (("SVCMAIN: Failed to process Helper request (%Rrc).\n", vrc));1031 LogRel(("SVCMAIN: Failed to process Helper request (%Rrc).\n", vrc)); 991 1032 nRet = 1; 992 1033 } … … 1006 1047 1007 1048 if (RT_SUCCESS(CreateMainWindow())) 1008 Log (("SVCMain: Main window succesfully created\n"));1049 LogRel(("SVCMain: Main window succesfully created\n")); 1009 1050 else 1010 Log (("SVCMain: Failed to create main window\n"));1051 LogRel(("SVCMain: Failed to create main window\n")); 1011 1052 1012 1053 MSG msg; 1013 1054 while (GetMessage(&msg, 0, 0, 0) > 0) 1014 1055 { 1056 TranslateMessage(&msg); 1015 1057 DispatchMessage(&msg); 1016 TranslateMessage(&msg);1017 1058 } 1018 1059 … … 1033 1074 g_pModule = NULL; 1034 1075 1035 Log (("SVCMAIN: Returning, COM server process ends.\n"));1076 LogRel(("SVCMAIN: Returning, COM server process ends.\n")); 1036 1077 return nRet; 1037 1078 }
Note:
See TracChangeset
for help on using the changeset viewer.