Changeset 26186 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 3, 2010 1:07:12 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57205
- Location:
- trunk/src/VBox/Main
- Files:
-
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r26118 r26186 1035 1035 { 1036 1036 ComPtr<IMedium> medium; 1037 hrc = atts [j]->COMGETTER(Medium)(medium.asOutParam());H();1037 hrc = atts[j]->COMGETTER(Medium)(medium.asOutParam()); H(); 1038 1038 LONG lDev; 1039 1039 hrc = atts[j]->COMGETTER(Device)(&lDev); H(); … … 2096 2096 /* Register VM state change handler */ 2097 2097 int rc2 = VMR3AtStateRegister (pVM, Console::vmstateChangeCallback, pConsole); 2098 AssertRC 2098 AssertRC(rc2); 2099 2099 if (RT_SUCCESS(rc)) 2100 2100 rc = rc2; … … 2102 2102 /* Register VM runtime error handler */ 2103 2103 rc2 = VMR3AtRuntimeErrorRegister (pVM, Console::setVMRuntimeErrorCallback, pConsole); 2104 AssertRC 2104 AssertRC(rc2); 2105 2105 if (RT_SUCCESS(rc)) 2106 2106 rc = rc2; … … 2306 2306 } 2307 2307 2308 Assert 2308 Assert((int)pThis->maTapFD[uInstance] >= 0); 2309 2309 if ((int)pThis->maTapFD[uInstance] >= 0) 2310 2310 { … … 2514 2514 } 2515 2515 2516 Assert 2516 Assert((int)pThis->maTapFD[uInstance] >= 0); 2517 2517 if ((int)pThis->maTapFD[uInstance] >= 0) 2518 2518 { -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r25901 r26186 46 46 { 47 47 public: 48 VRDPConsoleCallback (ConsoleVRDPServer *server) :49 m_server(server)48 VRDPConsoleCallback(ConsoleVRDPServer *server) 49 : m_server(server) 50 50 { 51 51 #ifndef VBOX_WITH_XPCOM … … 60 60 #ifndef VBOX_WITH_XPCOM 61 61 STDMETHOD_(ULONG, AddRef)() { 62 return ::InterlockedIncrement 62 return ::InterlockedIncrement(&refcnt); 63 63 } 64 64 STDMETHOD_(ULONG, Release)() 65 65 { 66 long cnt = ::InterlockedDecrement 66 long cnt = ::InterlockedDecrement(&refcnt); 67 67 if (cnt == 0) 68 68 delete this; 69 69 return cnt; 70 70 } 71 STDMETHOD(QueryInterface) 71 STDMETHOD(QueryInterface)(REFIID riid , void **ppObj) 72 72 { 73 73 if (riid == IID_IUnknown) { … … 103 103 if (m_server) 104 104 { 105 m_server->NotifyKeyboardLedsChange 105 m_server->NotifyKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock); 106 106 } 107 107 return S_OK; … … 128 128 } 129 129 130 STDMETHOD(OnNetworkAdapterChange) 130 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *aNetworkAdapter) 131 131 { 132 132 return S_OK; 133 133 } 134 134 135 STDMETHOD(OnSerialPortChange) 135 STDMETHOD(OnSerialPortChange)(ISerialPort *aSerialPort) 136 136 { 137 137 return S_OK; 138 138 } 139 139 140 STDMETHOD(OnParallelPortChange) 140 STDMETHOD(OnParallelPortChange)(IParallelPort *aParallelPort) 141 141 { 142 142 return S_OK; 143 143 } 144 144 145 STDMETHOD(OnStorageControllerChange) 145 STDMETHOD(OnStorageControllerChange)() 146 146 { 147 147 return S_OK; … … 169 169 } 170 170 171 STDMETHOD(OnSharedFolderChange) 171 STDMETHOD(OnSharedFolderChange)(Scope_T aScope) 172 172 { 173 173 return S_OK; … … 188 188 } 189 189 190 STDMETHOD(OnShowWindow) 190 STDMETHOD(OnShowWindow)(ULONG64 *winId) 191 191 { 192 192 if (!winId) … … 212 212 #ifdef DEBUG_sunlover 213 213 #define LOGDUMPPTR Log 214 void dumpPointer 214 void dumpPointer(const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool fXorMaskRGB32) 215 215 { 216 216 unsigned i; … … 237 237 if (fXorMaskRGB32) 238 238 { 239 uint32_t *pu32Xor = (uint32_t 239 uint32_t *pu32Xor = (uint32_t*)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3)); 240 240 241 241 for (i = 0; i < height; i++) … … 253 253 { 254 254 /* RDP 24 bit RGB mask. */ 255 uint8_t *pu8Xor = (uint8_t 255 uint8_t *pu8Xor = (uint8_t*)(pu8Shape + ((((width + 7) / 8) * height + 3) & ~3)); 256 256 for (i = 0; i < height; i++) 257 257 { … … 271 271 #endif /* DEBUG_sunlover */ 272 272 273 static void findTopLeftBorder 273 static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip) 274 274 { 275 275 /* … … 391 391 } 392 392 393 *pxSkip = RT_MIN 394 *pySkip = RT_MIN 393 *pxSkip = RT_MIN(xSkipAnd, xSkipXor); 394 *pySkip = RT_MIN(ySkipAnd, ySkipXor); 395 395 } 396 396 … … 401 401 * necessary, which we try to avoid. 402 402 */ 403 static void mousePointerGenerateANDMask 404 { 405 memset 403 static void mousePointerGenerateANDMask(uint8_t *pu8DstAndMask, int cbDstAndMask, const uint8_t *pu8SrcAlpha, int w, int h) 404 { 405 memset(pu8DstAndMask, 0xFF, cbDstAndMask); 406 406 407 407 int y; … … 431 431 } 432 432 433 STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange ( 434 BOOL visible, 435 BOOL alpha, 436 ULONG xHot, 437 ULONG yHot, 438 ULONG width, 439 ULONG height, 440 BYTE *shape) 433 STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange(BOOL visible, 434 BOOL alpha, 435 ULONG xHot, 436 ULONG yHot, 437 ULONG width, 438 ULONG height, 439 BYTE *shape) 441 440 { 442 441 LogSunlover(("VRDPConsoleCallback::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n", visible, alpha, width, height, xHot, yHot)); … … 448 447 if (!visible) 449 448 { 450 m_server->MousePointerHide 449 m_server->MousePointerHide(); 451 450 } 452 451 } … … 470 469 */ 471 470 472 dumpPointer 471 dumpPointer(shape, width, height, true); 473 472 474 473 int cbDstAndMask = (((width + 7) / 8) * height + 3) & ~3; … … 479 478 if (alpha) 480 479 { 481 pu8AndMask = (uint8_t *)alloca(cbDstAndMask);482 483 mousePointerGenerateANDMask 480 pu8AndMask = (uint8_t*)alloca(cbDstAndMask); 481 482 mousePointerGenerateANDMask(pu8AndMask, cbDstAndMask, pu8XorMask, width, height); 484 483 } 485 484 … … 493 492 uint32_t xSkip = 0; /* How many columns to skip at the left. */ 494 493 495 findTopLeftBorder 494 findTopLeftBorder(pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip); 496 495 497 496 /* Must not skip the hot spot. */ 498 xSkip = RT_MIN 499 ySkip = RT_MIN 497 xSkip = RT_MIN(xSkip, xHot); 498 ySkip = RT_MIN(ySkip, yHot); 500 499 501 500 /* … … 515 514 uint32_t rdpdatalen = dstheight * rdpdatawidth; 516 515 517 pointer = (VRDPCOLORPOINTER *)RTMemTmpAlloc (sizeof(VRDPCOLORPOINTER) + rdpmasklen + rdpdatalen);516 pointer = (VRDPCOLORPOINTER *)RTMemTmpAlloc(sizeof(VRDPCOLORPOINTER) + rdpmasklen + rdpdatalen); 518 517 519 518 if (pointer) 520 519 { 521 uint8_t *maskarray = (uint8_t *)pointer + sizeof(VRDPCOLORPOINTER);520 uint8_t *maskarray = (uint8_t*)pointer + sizeof(VRDPCOLORPOINTER); 522 521 uint8_t *dataarray = maskarray + rdpmasklen; 523 522 524 memset 525 memset 523 memset(maskarray, 0xFF, rdpmasklen); 524 memset(dataarray, 0x00, rdpdatalen); 526 525 527 526 uint32_t srcmaskwidth = (width + 7) / 8; … … 532 531 uint8_t *dst = maskarray + (dstheight - 1) * rdpmaskwidth; 533 532 534 uint32_t minheight = RT_MIN 535 uint32_t minwidth = RT_MIN 533 uint32_t minheight = RT_MIN(height - ySkip, dstheight); 534 uint32_t minwidth = RT_MIN(width - xSkip, dstwidth); 536 535 537 536 unsigned x, y; … … 567 566 for (x = 0; x < minwidth; x++) 568 567 { 569 memcpy 568 memcpy(dst + x * 3, &src[4 * (x + xSkip)], 3); 570 569 } 571 570 … … 583 582 pointer->u16DataLen = (uint16_t)rdpdatalen; 584 583 585 dumpPointer ((uint8_t *)pointer + sizeof(*pointer), dstwidth, dstheight, false);586 587 m_server->MousePointerUpdate 588 589 RTMemTmpFree 584 dumpPointer((uint8_t*)pointer + sizeof(*pointer), dstwidth, dstheight, false); 585 586 m_server->MousePointerUpdate(pointer); 587 588 RTMemTmpFree(pointer); 590 589 } 591 590 } … … 608 607 VRDPCALLBACKS_1 ConsoleVRDPServer::mCallbacks = 609 608 { 610 { VRDP_INTERFACE_VERSION_1, sizeof 609 { VRDP_INTERFACE_VERSION_1, sizeof(VRDPCALLBACKS_1) }, 611 610 ConsoleVRDPServer::VRDPCallbackQueryProperty, 612 611 ConsoleVRDPServer::VRDPCallbackClientLogon, … … 623 622 }; 624 623 625 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty 626 { 627 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);624 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) 625 { 626 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 628 627 629 628 int rc = VERR_NOT_SUPPORTED; … … 636 635 ULONG port = 0; 637 636 638 if (cbBuffer >= sizeof 637 if (cbBuffer >= sizeof(uint32_t)) 639 638 { 640 639 *(uint32_t *)pvBuffer = (uint32_t)port; … … 646 645 } 647 646 648 *pcbOut = sizeof 647 *pcbOut = sizeof(uint32_t); 649 648 } break; 650 649 … … 652 651 { 653 652 com::Bstr bstr; 654 server->mConsole->getVRDPServer ()->COMGETTER(NetAddress)(bstr.asOutParam());653 server->mConsole->getVRDPServer()->COMGETTER(NetAddress)(bstr.asOutParam()); 655 654 656 655 /* The server expects UTF8. */ 657 656 com::Utf8Str address = bstr; 658 657 659 size_t cbAddress = address.length 658 size_t cbAddress = address.length() + 1; 660 659 661 660 if (cbAddress >= 0x10000) … … 672 671 if (address.raw()) 673 672 { 674 memcpy 673 memcpy(pvBuffer, address.raw(), cbAddress); 675 674 } 676 675 else … … 695 694 ULONG cMonitors = 1; 696 695 697 server->mConsole->machine 698 699 if (cbBuffer >= sizeof 696 server->mConsole->machine()->COMGETTER(MonitorCount)(&cMonitors); 697 698 if (cbBuffer >= sizeof(uint32_t)) 700 699 { 701 700 *(uint32_t *)pvBuffer = (uint32_t)cMonitors; … … 707 706 } 708 707 709 *pcbOut = sizeof 708 *pcbOut = sizeof(uint32_t); 710 709 } break; 711 710 … … 713 712 { 714 713 com::Bstr bstr; 715 HRESULT hrc = server->mConsole->getVRDPServer ()->COMGETTER(Ports)(bstr.asOutParam());714 HRESULT hrc = server->mConsole->getVRDPServer()->COMGETTER(Ports)(bstr.asOutParam()); 716 715 717 716 if (hrc != S_OK) … … 743 742 if (portRange.raw()) 744 743 { 745 memcpy 744 memcpy(pvBuffer, portRange.raw(), cbPortRange); 746 745 } 747 746 else … … 764 763 case VRDP_SP_NETWORK_BIND_PORT: 765 764 { 766 if (cbBuffer != sizeof 765 if (cbBuffer != sizeof(uint32_t)) 767 766 { 768 767 rc = VERR_INVALID_PARAMETER; … … 778 777 if (pcbOut) 779 778 { 780 *pcbOut = sizeof 781 } 782 783 server->mConsole->onRemoteDisplayInfoChange 779 *pcbOut = sizeof(uint32_t); 780 } 781 782 server->mConsole->onRemoteDisplayInfoChange(); 784 783 } break; 785 784 … … 791 790 } 792 791 793 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon 794 { 795 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);792 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon(void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain) 793 { 794 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 796 795 797 796 return server->mConsole->VRDPClientLogon (u32ClientId, pszUser, pszPassword, pszDomain); … … 800 799 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect (void *pvCallback, uint32_t u32ClientId) 801 800 { 802 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);801 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 803 802 804 803 server->mConsole->VRDPClientConnect (u32ClientId); … … 807 806 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted) 808 807 { 809 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);808 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 810 809 811 810 server->mConsole->VRDPClientDisconnect (u32ClientId, fu32Intercepted); … … 814 813 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackIntercept (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept) 815 814 { 816 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);815 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 817 816 818 817 LogFlowFunc(("%x\n", fu32Intercept)); … … 871 870 DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery (void *pvCallback, unsigned uScreenId, VRDPFRAMEBUFFERINFO *pInfo) 872 871 { 873 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);872 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 874 873 875 874 bool fAvailable = false; … … 926 925 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock (void *pvCallback, unsigned uScreenId) 927 926 { 928 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);927 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 929 928 930 929 if (server->maFramebuffers[uScreenId]) … … 936 935 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock (void *pvCallback, unsigned uScreenId) 937 936 { 938 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);937 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 939 938 940 939 if (server->maFramebuffers[uScreenId]) … … 964 963 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput (void *pvCallback, int type, const void *pvInput, unsigned cbInput) 965 964 { 966 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);965 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 967 966 Console *pConsole = server->mConsole; 968 967 … … 1093 1092 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId) 1094 1093 { 1095 ConsoleVRDPServer *server = static_cast <ConsoleVRDPServer *>(pvCallback);1096 1097 server->mConsole->getDisplay 1094 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 1095 1096 server->mConsole->getDisplay()->SetVideoModeHint(cWidth, cHeight, cBitsPerPixel, uScreenId); 1098 1097 } 1099 1098 #endif /* VBOX_WITH_VRDP */ … … 1103 1102 mConsole = console; 1104 1103 1105 int rc = RTCritSectInit 1106 AssertRC 1104 int rc = RTCritSectInit(&mCritSect); 1105 AssertRC(rc); 1107 1106 1108 1107 mcClipboardRefs = 0; … … 1338 1337 mUSBBackends.fThreadRunning = true; 1339 1338 int rc = RTThreadUserSignal (thread); 1340 AssertRC 1339 AssertRC(rc); 1341 1340 } 1342 1341 … … 1378 1377 /* Wait until the thread is ready. */ 1379 1378 rc = RTThreadUserWait (mUSBBackends.thread, 60000); 1380 AssertRC 1379 AssertRC(rc); 1381 1380 Assert (mUSBBackends.fThreadRunning || RT_FAILURE(rc)); 1382 1381 } … … 1394 1393 1395 1394 int rc = RTThreadWait (mUSBBackends.thread, 60000, NULL); 1396 AssertRC 1395 AssertRC(rc); 1397 1396 1398 1397 mUSBBackends.thread = NIL_RTTHREAD; … … 1486 1485 if (RT_FAILURE(rc)) 1487 1486 { 1488 mConsole->reportAuthLibraryError 1487 mConsole->reportAuthLibraryError(filename.raw(), rc); 1489 1488 1490 1489 mpfnAuthEntry = NULL; … … 1546 1545 { 1547 1546 int rc = RTCritSectEnter (&mCritSect); 1548 AssertRC 1547 AssertRC(rc); 1549 1548 return rc; 1550 1549 } … … 1941 1940 #ifdef VBOX_WITH_USB 1942 1941 int rc = lockConsoleVRDPServer (); 1943 AssertRC 1942 AssertRC(rc); 1944 1943 1945 1944 /* Exclude the found instance from the list. */ -
trunk/src/VBox/Main/DHCPServerRunner.cpp
r26163 r26186 86 86 87 87 /* get the path to the executable */ 88 char exePathBuf 89 const char *exePath = RTProcGetExecutableName 88 char exePathBuf[RTPATH_MAX]; 89 const char *exePath = RTProcGetExecutableName(exePathBuf, RTPATH_MAX); 90 90 char *substrSl = strrchr(exePathBuf, '/'); 91 91 char *substrBs = strrchr(exePathBuf, '\\'); … … 121 121 args[index++] = NULL; 122 122 123 int rc = RTProcCreate 123 int rc = RTProcCreate(exePath, args, RTENV_DEFAULT, 0, &mProcess); 124 124 if (RT_FAILURE(rc)) 125 125 mProcess = NIL_RTPROCESS; -
trunk/src/VBox/Main/DisplayImpl.cpp
r26173 r26186 105 105 106 106 #ifdef VBOX_WITH_OLD_VBVA_LOCK 107 int rc = RTCritSectInit 108 AssertRC 107 int rc = RTCritSectInit(&mVBVALock); 108 AssertRC(rc); 109 109 mfu32PendingVideoAccelDisable = false; 110 110 #endif /* VBOX_WITH_OLD_VBVA_LOCK */ … … 2247 2247 2248 2248 if (vrc == VERR_NOT_IMPLEMENTED) 2249 rc = setError 2250 tr("This feature is not implemented"));2249 rc = setError(E_NOTIMPL, 2250 tr("This feature is not implemented")); 2251 2251 else if (RT_FAILURE(vrc)) 2252 rc = setError 2253 tr("Could not take a screenshot (%Rrc)"), vrc);2252 rc = setError(VBOX_E_IPRT_ERROR, 2253 tr("Could not take a screenshot (%Rrc)"), vrc); 2254 2254 2255 2255 LogFlowFunc (("rc=%08X\n", rc)); … … 2323 2323 } 2324 2324 else if (vrc == VERR_NOT_IMPLEMENTED) 2325 rc = setError 2326 tr("This feature is not implemented"));2325 rc = setError(E_NOTIMPL, 2326 tr("This feature is not implemented")); 2327 2327 else 2328 rc = setError 2329 tr("Could not take a screenshot (%Rrc)"), vrc);2328 rc = setError(VBOX_E_IPRT_ERROR, 2329 tr("Could not take a screenshot (%Rrc)"), vrc); 2330 2330 2331 2331 LogFlowFunc (("rc=%08X\n", rc)); … … 2395 2395 } 2396 2396 else if (RT_FAILURE(rcVBox)) 2397 rc = setError 2398 tr("Could not draw to the screen (%Rrc)"), rcVBox);2397 rc = setError(VBOX_E_IPRT_ERROR, 2398 tr("Could not draw to the screen (%Rrc)"), rcVBox); 2399 2399 //@todo 2400 2400 // else … … 2456 2456 2457 2457 if (RT_FAILURE(rcVBox)) 2458 rc = setError 2459 tr("Could not invalidate and update the screen (%Rrc)"), rcVBox);2458 rc = setError(VBOX_E_IPRT_ERROR, 2459 tr("Could not invalidate and update the screen (%Rrc)"), rcVBox); 2460 2460 2461 2461 LogFlowFunc (("rc=%08X\n", rc)); … … 2487 2487 /* this is only valid for external framebuffers */ 2488 2488 if (maFramebuffers[aScreenId].pFramebuffer == NULL) 2489 return setError (VBOX_E_NOT_SUPPORTED, 2490 tr ("Resize completed notification is valid only " 2491 "for external framebuffers")); 2489 return setError(VBOX_E_NOT_SUPPORTED, 2490 tr("Resize completed notification is valid only for external framebuffers")); 2492 2491 2493 2492 /* Set the flag indicating that the resize has completed and display … … 2523 2522 /* this is only valid for external framebuffers */ 2524 2523 if (maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer == NULL) 2525 return setError (VBOX_E_NOT_SUPPORTED, 2526 tr ("Resize completed notification is valid only " 2527 "for external framebuffers")); 2524 return setError(VBOX_E_NOT_SUPPORTED, 2525 tr("Resize completed notification is valid only for external framebuffers")); 2528 2526 2529 2527 return S_OK; -
trunk/src/VBox/Main/GuestImpl.cpp
r25860 r26186 283 283 } 284 284 285 return setError 286 tr("VMM device is not available (is the VM running?)"));285 return setError(VBOX_E_VM_ERROR, 286 tr("VMM device is not available (is the VM running?)")); 287 287 } 288 288 -
trunk/src/VBox/Main/HostImpl.cpp
r26177 r26186 225 225 */ 226 226 # if defined (RT_OS_DARWIN) 227 m->pUSBProxyService = new USBProxyServiceDarwin 227 m->pUSBProxyService = new USBProxyServiceDarwin(this); 228 228 # elif defined (RT_OS_LINUX) 229 m->pUSBProxyService = new USBProxyServiceLinux 229 m->pUSBProxyService = new USBProxyServiceLinux(this); 230 230 # elif defined (RT_OS_OS2) 231 231 m->pUSBProxyService = new USBProxyServiceOs2 (this); 232 232 # elif defined (RT_OS_SOLARIS) 233 m->pUSBProxyService = new USBProxyServiceSolaris 233 m->pUSBProxyService = new USBProxyServiceSolaris(this); 234 234 # elif defined (RT_OS_WINDOWS) 235 m->pUSBProxyService = new USBProxyServiceWindows 235 m->pUSBProxyService = new USBProxyServiceWindows(this); 236 236 # elif defined (RT_OS_FREEBSD) 237 m->pUSBProxyService = new USBProxyServiceFreeBSD 237 m->pUSBProxyService = new USBProxyServiceFreeBSD(this); 238 238 # else 239 m->pUSBProxyService = new USBProxyService 239 m->pUSBProxyService = new USBProxyService(this); 240 240 # endif 241 241 HRESULT hrc = m->pUSBProxyService->init(); … … 248 248 249 249 #if defined (RT_OS_WINDOWS) 250 m->pHostPowerService = new HostPowerServiceWin 250 m->pHostPowerService = new HostPowerServiceWin(m->pParent); 251 251 #elif defined (RT_OS_DARWIN) 252 m->pHostPowerService = new HostPowerServiceDarwin 252 m->pHostPowerService = new HostPowerServiceDarwin(m->pParent); 253 253 #else 254 m->pHostPowerService = new HostPowerService 254 m->pHostPowerService = new HostPowerService(m->pParent); 255 255 #endif 256 256 … … 1157 1157 ComObjPtr<HostUSBDeviceFilter> filter; 1158 1158 filter.createObject(); 1159 HRESULT rc = filter->init 1159 HRESULT rc = filter->init(this, aName); 1160 1160 ComAssertComRCRet (rc, rc); 1161 1161 rc = filter.queryInterfaceTo(aFilter); … … 1203 1203 1204 1204 if (pFilter->mInList) 1205 return setError 1206 tr("The given USB device filter is already in the list"));1205 return setError(E_INVALIDARG, 1206 tr("The given USB device filter is already in the list")); 1207 1207 1208 1208 /* iterate to the position... */ … … 1248 1248 1249 1249 if (!m->llUSBDeviceFilters.size()) 1250 return setError 1251 tr("The USB device filter list is empty"));1250 return setError(E_INVALIDARG, 1251 tr("The USB device filter list is empty")); 1252 1252 1253 1253 if (aPosition >= m->llUSBDeviceFilters.size()) 1254 return setError 1255 tr("Invalid position: %lu (must be in range [0, %lu])"),1256 aPosition, m->llUSBDeviceFilters.size() - 1);1254 return setError(E_INVALIDARG, 1255 tr("Invalid position: %lu (must be in range [0, %lu])"), 1256 aPosition, m->llUSBDeviceFilters.size() - 1); 1257 1257 1258 1258 ComObjPtr<HostUSBDeviceFilter> filter; … … 1369 1369 1370 1370 if (!found) 1371 return setError (E_INVALIDARG, HostNetworkInterface::tr (1372 1371 return setError(E_INVALIDARG, 1372 HostNetworkInterface::tr("The host network interface with the given name could not be found")); 1373 1373 1374 1374 found->setVirtualBox(m->pParent); … … 1407 1407 1408 1408 if (!found) 1409 return setError (E_INVALIDARG, HostNetworkInterface::tr (1410 1409 return setError(E_INVALIDARG, 1410 HostNetworkInterface::tr("The host network interface with the given GUID could not be found")); 1411 1411 1412 1412 found->setVirtualBox(m->pParent); … … 1448 1448 1449 1449 STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress, 1450 IHostUSBDevice **aDevice)1450 IHostUSBDevice **aDevice) 1451 1451 { 1452 1452 #ifdef VBOX_WITH_USB … … 2402 2402 2403 2403 #ifdef VBOX_WITH_RESOURCE_USAGE_API 2404 void Host::registerMetrics 2404 void Host::registerMetrics(PerformanceCollector *aCollector) 2405 2405 { 2406 2406 pm::CollectorHAL *hal = aCollector->getHAL(); 2407 2407 /* Create sub metrics */ 2408 pm::SubMetric *cpuLoadUser = new pm::SubMetric 2408 pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User", 2409 2409 "Percentage of processor time spent in user mode."); 2410 pm::SubMetric *cpuLoadKernel = new pm::SubMetric 2410 pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel", 2411 2411 "Percentage of processor time spent in kernel mode."); 2412 pm::SubMetric *cpuLoadIdle = new pm::SubMetric 2412 pm::SubMetric *cpuLoadIdle = new pm::SubMetric("CPU/Load/Idle", 2413 2413 "Percentage of processor time spent idling."); 2414 pm::SubMetric *cpuMhzSM = new pm::SubMetric 2414 pm::SubMetric *cpuMhzSM = new pm::SubMetric("CPU/MHz", 2415 2415 "Average of current frequency of all processors."); 2416 pm::SubMetric *ramUsageTotal = new pm::SubMetric 2416 pm::SubMetric *ramUsageTotal = new pm::SubMetric("RAM/Usage/Total", 2417 2417 "Total physical memory installed."); 2418 pm::SubMetric *ramUsageUsed = new pm::SubMetric 2418 pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", 2419 2419 "Physical memory currently occupied."); 2420 pm::SubMetric *ramUsageFree = new pm::SubMetric 2420 pm::SubMetric *ramUsageFree = new pm::SubMetric("RAM/Usage/Free", 2421 2421 "Physical memory currently available to applications."); 2422 2422 /* Create and register base metrics */ … … 2424 2424 ComObjPtr<Host> tmp = this; 2425 2425 tmp.queryInterfaceTo(&objptr); 2426 pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw 2426 pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw(hal, objptr, cpuLoadUser, cpuLoadKernel, 2427 2427 cpuLoadIdle); 2428 2428 aCollector->registerBaseMetric (cpuLoad); 2429 pm::BaseMetric *cpuMhz = new pm::HostCpuMhz 2429 pm::BaseMetric *cpuMhz = new pm::HostCpuMhz(hal, objptr, cpuMhzSM); 2430 2430 aCollector->registerBaseMetric (cpuMhz); 2431 pm::BaseMetric *ramUsage = new pm::HostRamUsage 2431 pm::BaseMetric *ramUsage = new pm::HostRamUsage(hal, objptr, ramUsageTotal, ramUsageUsed, 2432 2432 ramUsageFree); 2433 2433 aCollector->registerBaseMetric (ramUsage); 2434 2434 2435 aCollector->registerMetric 2436 aCollector->registerMetric 2437 2438 aCollector->registerMetric 2439 2440 aCollector->registerMetric 2441 2442 2443 aCollector->registerMetric 2444 aCollector->registerMetric 2445 2446 aCollector->registerMetric 2447 2448 aCollector->registerMetric 2449 2450 2451 aCollector->registerMetric 2452 aCollector->registerMetric 2453 2454 aCollector->registerMetric 2455 2456 aCollector->registerMetric 2457 2458 2459 aCollector->registerMetric 2460 aCollector->registerMetric 2461 2462 aCollector->registerMetric 2463 2464 aCollector->registerMetric 2465 2466 2467 aCollector->registerMetric 2468 aCollector->registerMetric 2469 2470 aCollector->registerMetric 2471 2472 aCollector->registerMetric 2473 2474 2475 aCollector->registerMetric 2476 aCollector->registerMetric 2477 2478 aCollector->registerMetric 2479 2480 aCollector->registerMetric 2481 2482 2483 aCollector->registerMetric 2484 aCollector->registerMetric 2485 2486 aCollector->registerMetric 2487 2488 aCollector->registerMetric 2489 2435 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0)); 2436 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 2437 new pm::AggregateAvg())); 2438 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 2439 new pm::AggregateMin())); 2440 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 2441 new pm::AggregateMax())); 2442 2443 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0)); 2444 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 2445 new pm::AggregateAvg())); 2446 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 2447 new pm::AggregateMin())); 2448 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 2449 new pm::AggregateMax())); 2450 2451 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 0)); 2452 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 2453 new pm::AggregateAvg())); 2454 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 2455 new pm::AggregateMin())); 2456 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 2457 new pm::AggregateMax())); 2458 2459 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 0)); 2460 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 2461 new pm::AggregateAvg())); 2462 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 2463 new pm::AggregateMin())); 2464 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 2465 new pm::AggregateMax())); 2466 2467 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 0)); 2468 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 2469 new pm::AggregateAvg())); 2470 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 2471 new pm::AggregateMin())); 2472 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 2473 new pm::AggregateMax())); 2474 2475 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0)); 2476 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 2477 new pm::AggregateAvg())); 2478 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 2479 new pm::AggregateMin())); 2480 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 2481 new pm::AggregateMax())); 2482 2483 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 0)); 2484 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 2485 new pm::AggregateAvg())); 2486 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 2487 new pm::AggregateMin())); 2488 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 2489 new pm::AggregateMax())); 2490 2490 }; 2491 2491 2492 2492 void Host::unregisterMetrics (PerformanceCollector *aCollector) 2493 2493 { 2494 aCollector->unregisterMetricsFor 2495 aCollector->unregisterBaseMetricsFor 2494 aCollector->unregisterMetricsFor(this); 2495 aCollector->unregisterBaseMetricsFor(this); 2496 2496 }; 2497 2497 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ -
trunk/src/VBox/Main/HostPower.cpp
r23327 r26186 36 36 HostPowerService::HostPowerService (VirtualBox *aVirtualBox) 37 37 { 38 Assert 38 Assert(aVirtualBox != NULL); 39 39 mVirtualBox = aVirtualBox; 40 40 } … … 75 75 /* get the remote console */ 76 76 ComPtr<IConsole> console; 77 rc = pControl->GetRemoteConsole 77 rc = pControl->GetRemoteConsole(console.asOutParam()); 78 78 /* the VM could have been powered down and closed or whatever */ 79 if (FAILED 79 if (FAILED(rc)) 80 80 continue; 81 81 … … 83 83 * in an inappropriate state */ 84 84 rc = console->Pause(); 85 if (FAILED 85 if (FAILED(rc)) 86 86 continue; 87 87 … … 102 102 103 103 /* go through VMs we paused on Suspend */ 104 for (size_t i = 0; i < mConsoles.size(); ++ 104 for (size_t i = 0; i < mConsoles.size(); ++i) 105 105 { 106 106 /* note that Resume() will simply return a failure if the VM is … … 108 108 * been somehow closed by this time already so that the 109 109 * console reference we have is dead) */ 110 rc = mConsoles 111 if (FAILED 110 rc = mConsoles[i]->Resume(); 111 if (FAILED(rc)) 112 112 continue; 113 113 … … 148 148 rc = pControl->GetRemoteConsole (console.asOutParam()); 149 149 /* the VM could have been powered down and closed or whatever */ 150 if (FAILED 150 if (FAILED(rc)) 151 151 continue; 152 152 … … 156 156 * is in an inappropriate state */ 157 157 rc = console->SaveState (progress.asOutParam()); 158 if (FAILED 158 if (FAILED(rc)) 159 159 continue; 160 160 -
trunk/src/VBox/Main/KeyboardImpl.cpp
r26173 r26186 138 138 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 139 139 140 CHECK_CONSOLE_DRV 141 142 int vrc = mpDrv->pUpPort->pfnPutEvent 140 CHECK_CONSOLE_DRV(mpDrv); 141 142 int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)scancode); 143 143 144 144 if (RT_FAILURE(vrc)) 145 rc = setError 146 tr("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"),147 scancode, vrc);145 rc = setError(VBOX_E_IPRT_ERROR, 146 tr("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"), 147 scancode, vrc); 148 148 149 149 return rc; … … 179 179 180 180 for (uint32_t i = 0; (i < keys.size()) && RT_SUCCESS(vrc); i++) 181 vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)keys[i]);181 vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]); 182 182 183 183 if (RT_FAILURE(vrc)) 184 return setError 185 tr("Could not send all scan codes to the virtual keyboard (%Rrc)"),186 vrc);184 return setError(VBOX_E_IPRT_ERROR, 185 tr("Could not send all scan codes to the virtual keyboard (%Rrc)"), 186 vrc); 187 187 188 188 /// @todo is it actually possible that not all scancodes can be transmitted? … … 202 202 STDMETHODIMP Keyboard::PutCAD() 203 203 { 204 static com::SafeArray<LONG> cadSequence 205 206 cadSequence 207 cadSequence 208 cadSequence 209 cadSequence 210 cadSequence 211 cadSequence 212 213 return PutScancodes (ComSafeArrayAsInParam(cadSequence), NULL);204 static com::SafeArray<LONG> cadSequence(6); 205 206 cadSequence[0] = 0x1d; // Ctrl down 207 cadSequence[1] = 0x38; // Alt down 208 cadSequence[2] = 0x53; // Del down 209 cadSequence[3] = 0xd3; // Del up 210 cadSequence[4] = 0xb8; // Alt up 211 cadSequence[5] = 0x9d; // Ctrl up 212 213 return PutScancodes(ComSafeArrayAsInParam(cadSequence), NULL); 214 214 } 215 215 -
trunk/src/VBox/Main/MachineImpl.cpp
r26171 r26186 179 179 180 180 /* default boot order: floppy - DVD - HDD */ 181 mBootOrder 182 mBootOrder 183 mBootOrder 184 for (size_t i = 3; i < RT_ELEMENTS 185 mBootOrder 181 mBootOrder[0] = DeviceType_Floppy; 182 mBootOrder[1] = DeviceType_DVD; 183 mBootOrder[2] = DeviceType_HardDisk; 184 for (size_t i = 3; i < RT_ELEMENTS(mBootOrder); ++i) 185 mBootOrder[i] = DeviceType_Null; 186 186 187 187 mClipboardMode = ClipboardMode_Bidirectional; … … 509 509 LogFlowThisFuncEnter(); 510 510 511 Assert 511 Assert(!isWriteLockOnCurrentThread()); 512 512 513 513 /* Enclose the state transition Ready->InUninit->NotReady */ … … 1730 1730 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1731 1731 1732 Assert 1732 Assert(!!mVRDPServer); 1733 1733 mVRDPServer.queryInterfaceTo(vrdpServer); 1734 1734 … … 2278 2278 setModified(IsModified_MachineData); 2279 2279 mHWData.backup(); 2280 mHWData->mBootOrder 2280 mHWData->mBootOrder[aPosition - 1] = aDevice; 2281 2281 2282 2282 return S_OK; … … 2295 2295 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2296 2296 2297 *aDevice = mHWData->mBootOrder 2297 *aDevice = mHWData->mBootOrder[aPosition - 1]; 2298 2298 2299 2299 return S_OK; … … 3035 3035 } 3036 3036 3037 STDMETHODIMP Machine::GetSerialPort 3037 STDMETHODIMP Machine::GetSerialPort(ULONG slot, ISerialPort **port) 3038 3038 { 3039 3039 CheckComArgOutPointerValid(port); 3040 CheckComArgExpr (slot, slot < RT_ELEMENTS(mSerialPorts));3040 CheckComArgExpr(slot, slot < RT_ELEMENTS(mSerialPorts)); 3041 3041 3042 3042 AutoCaller autoCaller(this); … … 3045 3045 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3046 3046 3047 mSerialPorts 3048 3049 return S_OK; 3050 } 3051 3052 STDMETHODIMP Machine::GetParallelPort 3047 mSerialPorts[slot].queryInterfaceTo(port); 3048 3049 return S_OK; 3050 } 3051 3052 STDMETHODIMP Machine::GetParallelPort(ULONG slot, IParallelPort **port) 3053 3053 { 3054 3054 CheckComArgOutPointerValid(port); 3055 CheckComArgExpr (slot, slot < RT_ELEMENTS(mParallelPorts));3055 CheckComArgExpr(slot, slot < RT_ELEMENTS(mParallelPorts)); 3056 3056 3057 3057 AutoCaller autoCaller(this); … … 3060 3060 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3061 3061 3062 mParallelPorts 3063 3064 return S_OK; 3065 } 3066 3067 STDMETHODIMP Machine::GetNetworkAdapter 3062 mParallelPorts[slot].queryInterfaceTo(port); 3063 3064 return S_OK; 3065 } 3066 3067 STDMETHODIMP Machine::GetNetworkAdapter(ULONG slot, INetworkAdapter **adapter) 3068 3068 { 3069 3069 CheckComArgOutPointerValid(adapter); 3070 CheckComArgExpr (slot, slot < RT_ELEMENTS(mNetworkAdapters));3070 CheckComArgExpr(slot, slot < RT_ELEMENTS(mNetworkAdapters)); 3071 3071 3072 3072 AutoCaller autoCaller(this); … … 3251 3251 * been actually changed 3252 3252 */ 3253 rollback 3253 rollback(true /* aNotify */); 3254 3254 3255 3255 return S_OK; … … 3381 3381 // mData->mCurrentStateModified to FALSE 3382 3382 3383 return setError 3383 return setError(E_NOTIMPL, "Not implemented"); 3384 3384 } 3385 3385 … … 3867 3867 if ( (aConnectionType <= StorageBus_Null) 3868 3868 || (aConnectionType > StorageBus_SAS)) 3869 return setError 3870 tr("Invalid connection type: %d"),3871 aConnectionType);3869 return setError(E_INVALIDARG, 3870 tr("Invalid connection type: %d"), 3871 aConnectionType); 3872 3872 3873 3873 AutoCaller autoCaller(this); … … 3884 3884 rc = getStorageControllerByName (aName, ctrl, false /* aSetError */); 3885 3885 if (SUCCEEDED(rc)) 3886 return setError (VBOX_E_OBJECT_IN_USE, 3887 tr ("Storage controller named '%ls' already exists"), aName); 3886 return setError(VBOX_E_OBJECT_IN_USE, 3887 tr("Storage controller named '%ls' already exists"), 3888 aName); 3888 3889 3889 3890 ctrl.createObject(); … … 4146 4147 4147 4148 if (RT_FAILURE(vrc)) 4148 return setError (VBOX_E_IPRT_ERROR, 4149 tr("Saved screenshot data is not available (%Rrc)"), vrc); 4149 return setError(VBOX_E_IPRT_ERROR, 4150 tr("Saved screenshot data is not available (%Rrc)"), 4151 vrc); 4150 4152 4151 4153 *aSize = cbData; … … 4179 4181 4180 4182 if (RT_FAILURE(vrc)) 4181 return setError (VBOX_E_IPRT_ERROR, 4182 tr("Saved screenshot data is not available (%Rrc)"), vrc); 4183 return setError(VBOX_E_IPRT_ERROR, 4184 tr("Saved screenshot data is not available (%Rrc)"), 4185 vrc); 4183 4186 4184 4187 *aWidth = u32Width; … … 4237 4240 4238 4241 if (RT_FAILURE(vrc)) 4239 return setError (VBOX_E_IPRT_ERROR, 4240 tr("Saved screenshot data is not available (%Rrc)"), vrc); 4242 return setError(VBOX_E_IPRT_ERROR, 4243 tr("Saved screenshot data is not available (%Rrc)"), 4244 vrc); 4241 4245 4242 4246 *aSize = cbData; … … 4270 4274 4271 4275 if (RT_FAILURE(vrc)) 4272 return setError (VBOX_E_IPRT_ERROR, 4273 tr("Saved screenshot data is not available (%Rrc)"), vrc); 4276 return setError(VBOX_E_IPRT_ERROR, 4277 tr("Saved screenshot data is not available (%Rrc)"), 4278 vrc); 4274 4279 4275 4280 *aWidth = u32Width; … … 4508 4513 { 4509 4514 /* Log folder is <Machines>/<VM_SnapshotFolder>/Logs */ 4510 Assert 4515 Assert(!mUserData->mSnapshotFolderFull.isEmpty()); 4511 4516 aLogFolder = Utf8StrFmt ("%ls%cLogs", mUserData->mSnapshotFolderFull.raw(), 4512 4517 RTPATH_DELIMITER); … … 4687 4692 * with the relevant part in openSession()). */ 4688 4693 4689 Assert 4694 Assert(mData->mSession.mRemoteControls.size() == 1); 4690 4695 if (mData->mSession.mRemoteControls.size() == 1) 4691 4696 { … … 4850 4855 const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE; 4851 4856 # endif 4852 Assert 4857 Assert(sz >= sizeof (VirtualBox_exe)); 4853 4858 strcpy (cmd, VirtualBox_exe); 4854 4859 … … 4873 4878 { 4874 4879 const char VBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE; 4875 Assert 4880 Assert(sz >= sizeof (VBoxSDL_exe)); 4876 4881 strcpy (cmd, VBoxSDL_exe); 4877 4882 … … 4901 4906 { 4902 4907 const char VBoxHeadless_exe[] = "VBoxHeadless" HOSTSUFF_EXE; 4903 Assert 4908 Assert(sz >= sizeof (VBoxHeadless_exe)); 4904 4909 strcpy (cmd, VBoxHeadless_exe); 4905 4910 … … 4972 4977 4973 4978 /* attach launch data to the machine */ 4974 Assert 4979 Assert(mData->mSession.mPid == NIL_RTPROCESS); 4975 4980 mData->mSession.mRemoteControls.push_back (aControl); 4976 4981 mData->mSession.mProgress = aProgress; … … 4999 5004 5000 5005 if (!mData->mRegistered) 5001 return setError (E_UNEXPECTED, 5002 tr ("The machine '%ls' is not registered"), mUserData->mName.raw()); 5006 return setError(E_UNEXPECTED, 5007 tr("The machine '%ls' is not registered"), 5008 mUserData->mName.raw()); 5003 5009 5004 5010 LogFlowThisFunc(("mSession.state=%s\n", Global::stringifySessionState(mData->mSession.mState))); 5005 5011 5006 5012 if (mData->mSession.mState != SessionState_Open) 5007 return setError 5008 tr("The machine '%ls' does not have an open session"),5009 mUserData->mName.raw());5013 return setError(VBOX_E_INVALID_SESSION_STATE, 5014 tr("The machine '%ls' does not have an open session"), 5015 mUserData->mName.raw()); 5010 5016 5011 5017 ComAssertRet (!mData->mSession.mDirectControl.isNull(), E_FAIL); … … 5018 5024 HRESULT rc = mData->mSession.mDirectControl-> 5019 5025 GetRemoteConsole (console.asOutParam()); 5020 if (FAILED 5026 if (FAILED(rc)) 5021 5027 { 5022 5028 /* The failure may occur w/o any error info (from RPC), so provide one */ 5023 return setError (VBOX_E_VM_ERROR, 5024 tr ("Failed to get a console object from the direct session (%Rrc)"), rc); 5029 return setError(VBOX_E_VM_ERROR, 5030 tr("Failed to get a console object from the direct session (%Rrc)"), 5031 rc); 5025 5032 } 5026 5033 … … 5427 5434 5428 5435 ++mData->mMachineStateDeps; 5429 Assert 5436 Assert(mData->mMachineStateDeps != 0 /* overflow */); 5430 5437 } 5431 5438 … … 5459 5466 if (mData->mMachineStateChangePending != 0) 5460 5467 { 5461 Assert 5468 Assert(mData->mMachineStateDepsSem != NIL_RTSEMEVENTMULTI); 5462 5469 RTSemEventMultiSignal (mData->mMachineStateDepsSem); 5463 5470 } … … 5574 5581 /* create associated BIOS settings object */ 5575 5582 unconst(mBIOSSettings).createObject(); 5576 mBIOSSettings->init 5583 mBIOSSettings->init(this); 5577 5584 5578 5585 #ifdef VBOX_WITH_VRDP 5579 5586 /* create an associated VRDPServer object (default is disabled) */ 5580 5587 unconst(mVRDPServer).createObject(); 5581 mVRDPServer->init 5588 mVRDPServer->init(this); 5582 5589 #endif 5583 5590 5584 5591 /* create associated serial port objects */ 5585 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot++)5586 { 5587 unconst(mSerialPorts 5588 mSerialPorts [slot]->init(this, slot);5592 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 5593 { 5594 unconst(mSerialPorts[slot]).createObject(); 5595 mSerialPorts[slot]->init(this, slot); 5589 5596 } 5590 5597 5591 5598 /* create associated parallel port objects */ 5592 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot++)5593 { 5594 unconst(mParallelPorts 5595 mParallelPorts [slot]->init(this, slot);5599 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 5600 { 5601 unconst(mParallelPorts[slot]).createObject(); 5602 mParallelPorts[slot]->init(this, slot); 5596 5603 } 5597 5604 5598 5605 /* create the audio adapter object (always present, default is disabled) */ 5599 5606 unconst(mAudioAdapter).createObject(); 5600 mAudioAdapter->init 5607 mAudioAdapter->init(this); 5601 5608 5602 5609 /* create the USB controller object (always present, default is disabled) */ 5603 5610 unconst(mUSBController).createObject(); 5604 mUSBController->init 5611 mUSBController->init(this); 5605 5612 5606 5613 /* create associated network adapter objects */ 5607 for (ULONG slot = 0; slot < RT_ELEMENTS 5608 { 5609 unconst(mNetworkAdapters 5610 mNetworkAdapters [slot]->init(this, slot);5614 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot ++) 5615 { 5616 unconst(mNetworkAdapters[slot]).createObject(); 5617 mNetworkAdapters[slot]->init(this, slot); 5611 5618 } 5612 5619 … … 6770 6777 /* new dir and old dir cannot be equal here because of 'if' 6771 6778 * above and because name != newName */ 6772 Assert 6779 Assert(configDir != newConfigDir); 6773 6780 if (!aNew) 6774 6781 { … … 8021 8028 rc = pMedium->UnlockWrite(&state); 8022 8029 /* the disk may be alredy relocked for reading above */ 8023 Assert 8030 Assert(SUCCEEDED(rc) || state == MediumState_LockedRead); 8024 8031 } 8025 8032 } … … 8300 8307 mUSBController->commit(); 8301 8308 8302 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot++)8303 mNetworkAdapters 8304 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot++)8305 mSerialPorts 8306 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot++)8307 mParallelPorts 8309 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) 8310 mNetworkAdapters[slot]->commit(); 8311 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 8312 mSerialPorts[slot]->commit(); 8313 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 8314 mParallelPorts[slot]->commit(); 8308 8315 8309 8316 bool commitStorageControllers = false; … … 8332 8339 * create a peer owning data this device share it with */ 8333 8340 peer.createObject(); 8334 peer->init 8341 peer->init(mPeer, *it, true /* aReshare */); 8335 8342 } 8336 8343 else 8337 8344 { 8338 8345 /* remove peer from the old list */ 8339 mPeer->mStorageControllers->remove 8346 mPeer->mStorageControllers->remove(peer); 8340 8347 } 8341 8348 /* and add it to the new list */ … … 8354 8361 8355 8362 /* attach new list of controllers to our peer */ 8356 mPeer->mStorageControllers.attach 8363 mPeer->mStorageControllers.attach(newList); 8357 8364 } 8358 8365 else … … 8383 8390 { 8384 8391 /* attach new data to the primary machine and reshare it */ 8385 mPeer->mUserData.attach 8386 mPeer->mHWData.attach 8392 mPeer->mUserData.attach(mUserData); 8393 mPeer->mHWData.attach(mHWData); 8387 8394 /* mMediaData is reshared by fixupMedia */ 8388 8395 // mPeer->mMediaData.attach(mMediaData); … … 8408 8415 AssertReturnVoid(aThat->getClassID() == clsidSnapshotMachine); 8409 8416 8410 AssertReturnVoid(!Global::IsOnline 8417 AssertReturnVoid(!Global::IsOnline(mData->mMachineState)); 8411 8418 8412 8419 mHWData.assignCopy(aThat->mHWData); … … 8421 8428 folder.createObject(); 8422 8429 HRESULT rc = folder->initCopy(getMachine(), *it); 8423 AssertComRC 8430 AssertComRC(rc); 8424 8431 *it = folder; 8425 8432 } … … 8441 8448 ComObjPtr<StorageController> ctrl; 8442 8449 ctrl.createObject(); 8443 ctrl->initCopy 8450 ctrl->initCopy(this, *it); 8444 8451 mStorageControllers->push_back(ctrl); 8445 8452 } 8446 8453 8447 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot++)8448 mNetworkAdapters[slot]->copyFrom (aThat->mNetworkAdapters[slot]);8449 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot++)8450 mSerialPorts[slot]->copyFrom (aThat->mSerialPorts[slot]);8451 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot++)8452 mParallelPorts[slot]->copyFrom (aThat->mParallelPorts[slot]);8454 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) 8455 mNetworkAdapters[slot]->copyFrom(aThat->mNetworkAdapters[slot]); 8456 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 8457 mSerialPorts[slot]->copyFrom(aThat->mSerialPorts[slot]); 8458 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 8459 mParallelPorts[slot]->copyFrom(aThat->mParallelPorts[slot]); 8453 8460 } 8454 8461 8455 8462 #ifdef VBOX_WITH_RESOURCE_USAGE_API 8456 void Machine::registerMetrics 8463 void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid) 8457 8464 { 8458 8465 pm::CollectorHAL *hal = aCollector->getHAL(); 8459 8466 /* Create sub metrics */ 8460 pm::SubMetric *cpuLoadUser = new pm::SubMetric 8467 pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User", 8461 8468 "Percentage of processor time spent in user mode by VM process."); 8462 pm::SubMetric *cpuLoadKernel = new pm::SubMetric 8469 pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel", 8463 8470 "Percentage of processor time spent in kernel mode by VM process."); 8464 pm::SubMetric *ramUsageUsed = new pm::SubMetric 8471 pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", 8465 8472 "Size of resident portion of VM process in memory."); 8466 8473 /* Create and register base metrics */ 8467 pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw 8468 8469 aCollector->registerBaseMetric 8470 pm::BaseMetric *ramUsage = new pm::MachineRamUsage 8471 8472 aCollector->registerBaseMetric 8473 8474 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser, 0));8475 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,8474 pm::BaseMetric *cpuLoad = new pm::MachineCpuLoadRaw(hal, aMachine, pid, 8475 cpuLoadUser, cpuLoadKernel); 8476 aCollector->registerBaseMetric(cpuLoad); 8477 pm::BaseMetric *ramUsage = new pm::MachineRamUsage(hal, aMachine, pid, 8478 ramUsageUsed); 8479 aCollector->registerBaseMetric(ramUsage); 8480 8481 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0)); 8482 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 8476 8483 new pm::AggregateAvg())); 8477 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,8478 8479 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadUser,8480 8481 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel, 0));8482 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,8483 8484 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,8485 8486 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadKernel,8487 8488 8489 aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed, 0));8490 aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed,8491 8492 aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed,8493 8494 aCollector->registerMetric (new pm::Metric(ramUsage, ramUsageUsed,8495 8484 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 8485 new pm::AggregateMin())); 8486 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 8487 new pm::AggregateMax())); 8488 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0)); 8489 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 8490 new pm::AggregateAvg())); 8491 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 8492 new pm::AggregateMin())); 8493 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 8494 new pm::AggregateMax())); 8495 8496 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0)); 8497 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 8498 new pm::AggregateAvg())); 8499 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 8500 new pm::AggregateMin())); 8501 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 8502 new pm::AggregateMax())); 8496 8503 }; 8497 8504 8498 void Machine::unregisterMetrics 8499 { 8500 aCollector->unregisterMetricsFor 8501 aCollector->unregisterBaseMetricsFor 8505 void Machine::unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine) 8506 { 8507 aCollector->unregisterMetricsFor(aMachine); 8508 aCollector->unregisterBaseMetricsFor(aMachine); 8502 8509 }; 8503 8510 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ … … 8529 8536 LogFlowThisFunc(("\n")); 8530 8537 8531 uninit 8538 uninit(Uninit::Unexpected); 8532 8539 } 8533 8540 … … 8535 8542 * @note Must be called only by Machine::openSession() from its own write lock. 8536 8543 */ 8537 HRESULT SessionMachine::init 8544 HRESULT SessionMachine::init(Machine *aMachine) 8538 8545 { 8539 8546 LogFlowThisFuncEnter(); … … 8554 8561 if (mIPCSemName[i] == '\\') 8555 8562 mIPCSemName[i] = '/'; 8556 mIPCSem = ::CreateMutex 8557 ComAssertMsgRet 8558 8559 8560 8563 mIPCSem = ::CreateMutex(NULL, FALSE, mIPCSemName); 8564 ComAssertMsgRet(mIPCSem, 8565 ("Cannot create IPC mutex '%ls', err=%d", 8566 mIPCSemName.raw(), ::GetLastError()), 8567 E_FAIL); 8561 8568 #elif defined(RT_OS_OS2) 8562 Utf8Str ipcSem = Utf8StrFmt 8563 8569 Utf8Str ipcSem = Utf8StrFmt("\\SEM32\\VBOX\\VM\\{%RTuuid}", 8570 aMachine->mData->mUuid.raw()); 8564 8571 mIPCSemName = ipcSem; 8565 APIRET arc = ::DosCreateMutexSem ((PSZ)ipcSem.raw(), &mIPCSem, 0, FALSE);8566 ComAssertMsgRet 8567 8568 8569 8572 APIRET arc = ::DosCreateMutexSem((PSZ)ipcSem.raw(), &mIPCSem, 0, FALSE); 8573 ComAssertMsgRet(arc == NO_ERROR, 8574 ("Cannot create IPC mutex '%s', arc=%ld", 8575 ipcSem.raw(), arc), 8576 E_FAIL); 8570 8577 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 8571 8578 # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN … … 8582 8589 { 8583 8590 key = ((uint32_t)'V' << 24) | i; 8584 int sem = ::semget 8591 int sem = ::semget(key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL); 8585 8592 if (sem >= 0 || (errno != EEXIST && errno != EACCES)) 8586 8593 { 8587 8594 mIPCSem = sem; 8588 8595 if (sem >= 0) 8589 mIPCKey = BstrFmt 8596 mIPCKey = BstrFmt("%u", key); 8590 8597 break; 8591 8598 } … … 8594 8601 Utf8Str semName = aMachine->mData->m_strConfigFileFull; 8595 8602 char *pszSemName = NULL; 8596 RTStrUtf8ToCurrentCP 8597 key_t key = ::ftok 8598 RTStrFree 8599 8600 mIPCSem = ::semget 8603 RTStrUtf8ToCurrentCP(&pszSemName, semName); 8604 key_t key = ::ftok(pszSemName, 'V'); 8605 RTStrFree(pszSemName); 8606 8607 mIPCSem = ::semget(key, 1, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT); 8601 8608 # endif /* !VBOX_WITH_NEW_SYS_V_KEYGEN */ 8602 8609 … … 8629 8636 return E_FAIL; 8630 8637 } 8631 ComAssertMsgRet 8632 8638 ComAssertMsgRet(mIPCSem >= 0, ("Cannot create IPC semaphore, errno=%d", errnoSave), 8639 E_FAIL); 8633 8640 /* set the initial value to 1 */ 8634 int rv = ::semctl 8635 ComAssertMsgRet 8636 8641 int rv = ::semctl(mIPCSem, 0, SETVAL, 1); 8642 ComAssertMsgRet(rv == 0, ("Cannot init IPC semaphore, errno=%d", errno), 8643 E_FAIL); 8637 8644 #else 8638 8645 # error "Port me!" … … 8645 8652 8646 8653 /* take the pointers to data to share */ 8647 mData.share 8648 mSSData.share 8649 8650 mUserData.share 8651 mHWData.share 8654 mData.share(aMachine->mData); 8655 mSSData.share(aMachine->mSSData); 8656 8657 mUserData.share(aMachine->mUserData); 8658 mHWData.share(aMachine->mHWData); 8652 8659 mMediaData.share(aMachine->mMediaData); 8653 8660 … … 8660 8667 ctl.createObject(); 8661 8668 ctl->init(this, *it); 8662 mStorageControllers->push_back 8669 mStorageControllers->push_back(ctl); 8663 8670 } 8664 8671 8665 8672 unconst(mBIOSSettings).createObject(); 8666 mBIOSSettings->init 8673 mBIOSSettings->init(this, aMachine->mBIOSSettings); 8667 8674 #ifdef VBOX_WITH_VRDP 8668 8675 /* create another VRDPServer object that will be mutable */ 8669 8676 unconst(mVRDPServer).createObject(); 8670 mVRDPServer->init 8677 mVRDPServer->init(this, aMachine->mVRDPServer); 8671 8678 #endif 8672 8679 /* create another audio adapter object that will be mutable */ 8673 8680 unconst(mAudioAdapter).createObject(); 8674 mAudioAdapter->init 8681 mAudioAdapter->init(this, aMachine->mAudioAdapter); 8675 8682 /* create a list of serial ports that will be mutable */ 8676 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot++)8677 { 8678 unconst(mSerialPorts 8679 mSerialPorts [slot]->init (this, aMachine->mSerialPorts[slot]);8683 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 8684 { 8685 unconst(mSerialPorts[slot]).createObject(); 8686 mSerialPorts[slot]->init(this, aMachine->mSerialPorts[slot]); 8680 8687 } 8681 8688 /* create a list of parallel ports that will be mutable */ 8682 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot++)8683 { 8684 unconst(mParallelPorts 8685 mParallelPorts [slot]->init (this, aMachine->mParallelPorts[slot]);8689 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 8690 { 8691 unconst(mParallelPorts[slot]).createObject(); 8692 mParallelPorts[slot]->init(this, aMachine->mParallelPorts[slot]); 8686 8693 } 8687 8694 /* create another USB controller object that will be mutable */ … … 8692 8699 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) 8693 8700 { 8694 unconst(mNetworkAdapters 8695 mNetworkAdapters[slot]->init (this, aMachine->mNetworkAdapters[slot]);8701 unconst(mNetworkAdapters[slot]).createObject(); 8702 mNetworkAdapters[slot]->init(this, aMachine->mNetworkAdapters[slot]); 8696 8703 } 8697 8704 … … 8714 8721 * @note Locks mParent + this object for writing. 8715 8722 */ 8716 void SessionMachine::uninit 8723 void SessionMachine::uninit(Uninit::Reason aReason) 8717 8724 { 8718 8725 LogFlowThisFuncEnter(); … … 8746 8753 #if defined(RT_OS_WINDOWS) 8747 8754 if (mIPCSem) 8748 ::CloseHandle 8755 ::CloseHandle(mIPCSem); 8749 8756 mIPCSem = NULL; 8750 8757 #elif defined(RT_OS_OS2) 8751 8758 if (mIPCSem != NULLHANDLE) 8752 ::DosCloseMutexSem 8759 ::DosCloseMutexSem(mIPCSem); 8753 8760 mIPCSem = NULLHANDLE; 8754 8761 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 8755 8762 if (mIPCSem >= 0) 8756 ::semctl 8763 ::semctl(mIPCSem, 0, IPC_RMID); 8757 8764 mIPCSem = -1; 8758 8765 # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN … … 8785 8792 { 8786 8793 LogWarningThisFunc(("ABNORMAL client termination! (wasBusy=%d)\n", 8787 Global::IsOnlineOrTransient 8794 Global::IsOnlineOrTransient(lastState))); 8788 8795 8789 8796 /* reset the state to Aborted */ … … 8796 8803 { 8797 8804 LogWarningThisFunc(("Discarding unsaved settings changes!\n")); 8798 rollback 8805 rollback(false /* aNotify */); 8799 8806 } 8800 8807 … … 8821 8828 #ifdef VBOX_WITH_USB 8822 8829 /* release all captured USB devices */ 8823 if (aReason == Uninit::Abnormal && Global::IsOnline 8830 if (aReason == Uninit::Abnormal && Global::IsOnline(lastState)) 8824 8831 { 8825 8832 /* Console::captureUSBDevices() is called in the VM process only after … … 8831 8838 * This is identical to SessionMachine::DetachAllUSBDevices except 8832 8839 * for the aAbnormal argument. */ 8833 HRESULT rc = mUSBController->notifyProxy 8840 HRESULT rc = mUSBController->notifyProxy(false /* aInsertFilters */); 8834 8841 AssertComRC(rc); 8835 NOREF 8842 NOREF(rc); 8836 8843 8837 8844 USBProxyService *service = mParent->host()->usbProxyService(); 8838 8845 if (service) 8839 service->detachAllDevicesFromVM 8846 service->detachAllDevicesFromVM(this, true /* aDone */, true /* aAbnormal */); 8840 8847 } 8841 8848 #endif /* VBOX_WITH_USB */ … … 8847 8854 * need to queue the PID to reap the process (and avoid zombies on 8848 8855 * Linux). */ 8849 Assert 8850 mParent->addProcessToReap 8856 Assert(mData->mSession.mPid != NIL_RTPROCESS); 8857 mParent->addProcessToReap(mData->mSession.mPid); 8851 8858 } 8852 8859 … … 8874 8881 HRESULT rc = (*it)->Uninitialize(); 8875 8882 LogFlowThisFunc((" remoteControl->Uninitialize() returned %08X\n", rc)); 8876 if (FAILED 8883 if (FAILED(rc)) 8877 8884 LogWarningThisFunc(("Forgot to close the remote session?\n")); 8878 8885 ++it; … … 8903 8910 { 8904 8911 /* this must be null here (see #OnSessionEnd()) */ 8905 Assert 8906 Assert 8907 Assert 8912 Assert(mData->mSession.mDirectControl.isNull()); 8913 Assert(mData->mSession.mState == SessionState_Closing); 8914 Assert(!mData->mSession.mProgress.isNull()); 8908 8915 8909 8916 mData->mSession.mProgress->notifyComplete (S_OK); … … 8912 8919 8913 8920 /* remove the association between the peer machine and this session machine */ 8914 Assert 8915 8921 Assert(mData->mSession.mMachine == this || 8922 aReason == Uninit::Unexpected); 8916 8923 8917 8924 /* reset the rest of session data */ … … 9192 9199 /* go to the closing state (essential for all open*Session() calls and 9193 9200 * for #checkForDeath()) */ 9194 Assert 9201 Assert(mData->mSession.mState == SessionState_Open); 9195 9202 mData->mSession.mState = SessionState_Closing; 9196 9203 … … 10197 10204 * Machine::fixupMedia(). The last can happen when e.g a DVD/Floppy 10198 10205 * image was unmounted at runtime. */ 10199 Assert 10206 Assert(SUCCEEDED(rc) || state == MediumState_LockedRead || state == MediumState_Created); 10200 10207 } 10201 10208 -
trunk/src/VBox/Main/Matching.cpp
r21878 r26186 55 55 do 56 56 { 57 end = strcspn 57 end = strcspn(aFilter + start, ",-"); 58 58 end += start; 59 59 60 char delim = aFilter 60 char delim = aFilter[end]; 61 61 62 62 if (delim == '-') … … 73 73 // skip spaces around numbers 74 74 size_t s = start; 75 while (s < end && aFilter [s] == ' ') ++s;75 while (s < end && aFilter[s] == ' ') ++s; 76 76 size_t e = end - 1; 77 while (e > s && aFilter [e] == ' ') --e;78 ++ 79 80 that->parseValue 77 while (e > s && aFilter[e] == ' ') --e; 78 ++e; 79 80 that->parseValue(aFilter, s, e, mode); 81 81 if (!that->mValid) 82 82 return; -
trunk/src/VBox/Main/MediumFormatImpl.cpp
r25860 r26186 198 198 } 199 199 200 STDMETHODIMP MediumFormat:: 201 COMGETTER(FileExtensions)(ComSafeArrayOut (BSTR, aFileExtensions)) 202 { 203 if (ComSafeArrayOutIsNull (aFileExtensions)) 200 STDMETHODIMP MediumFormat::COMGETTER(FileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions)) 201 { 202 if (ComSafeArrayOutIsNull(aFileExtensions)) 204 203 return E_POINTER; 205 204 … … 208 207 209 208 /* this is const, no need to lock */ 210 com::SafeArray <BSTR> fileExtentions(m.fileExtensions.size());209 com::SafeArray<BSTR> fileExtentions(m.fileExtensions.size()); 211 210 int i = 0; 212 211 for (BstrList::const_iterator it = m.fileExtensions.begin(); 213 it != m.fileExtensions.end(); ++ it, ++ i) 214 (*it).cloneTo (&fileExtentions [i]); 215 fileExtentions.detachTo (ComSafeArrayOutArg (aFileExtensions)); 212 it != m.fileExtensions.end(); 213 ++it, ++i) 214 (*it).cloneTo(&fileExtentions[i]); 215 fileExtentions.detachTo(ComSafeArrayOutArg(aFileExtensions)); 216 216 217 217 return S_OK; … … 254 254 255 255 /* this is const, no need to lock */ 256 com::SafeArray <BSTR> propertyNames(m.properties.size());257 com::SafeArray <BSTR>propertyDescriptions (m.properties.size());258 com::SafeArray <DataType_T> propertyTypes(m.properties.size());259 com::SafeArray <ULONG> propertyFlags(m.properties.size());260 com::SafeArray <BSTR> propertyDefaults(m.properties.size());256 com::SafeArray<BSTR> propertyNames(m.properties.size()); 257 com::SafeArray<BSTR> propertyDescriptions (m.properties.size()); 258 com::SafeArray<DataType_T> propertyTypes(m.properties.size()); 259 com::SafeArray<ULONG> propertyFlags(m.properties.size()); 260 com::SafeArray<BSTR> propertyDefaults(m.properties.size()); 261 261 262 262 int i = 0; 263 263 for (PropertyList::const_iterator it = m.properties.begin(); 264 it != m.properties.end(); ++ it, ++ i) 264 it != m.properties.end(); 265 ++it, ++i) 265 266 { 266 267 const Property &prop = (*it); 267 prop.name.cloneTo (&propertyNames[i]);268 prop.description.cloneTo (&propertyDescriptions[i]);269 propertyTypes 270 propertyFlags 271 prop.defaultValue.cloneTo (&propertyDefaults[i]);268 prop.name.cloneTo(&propertyNames[i]); 269 prop.description.cloneTo(&propertyDescriptions[i]); 270 propertyTypes[i] = prop.type; 271 propertyFlags[i] = prop.flags; 272 prop.defaultValue.cloneTo(&propertyDefaults[i]); 272 273 } 273 274 274 propertyNames.detachTo (ComSafeArrayOutArg(aNames));275 propertyDescriptions.detachTo (ComSafeArrayOutArg(aDescriptions));276 propertyTypes.detachTo (ComSafeArrayOutArg(aTypes));277 propertyFlags.detachTo (ComSafeArrayOutArg(aFlags));278 propertyDefaults.detachTo (ComSafeArrayOutArg(aDefaults));275 propertyNames.detachTo(ComSafeArrayOutArg(aNames)); 276 propertyDescriptions.detachTo(ComSafeArrayOutArg(aDescriptions)); 277 propertyTypes.detachTo(ComSafeArrayOutArg(aTypes)); 278 propertyFlags.detachTo(ComSafeArrayOutArg(aFlags)); 279 propertyDefaults.detachTo(ComSafeArrayOutArg(aDefaults)); 279 280 280 281 return S_OK; -
trunk/src/VBox/Main/MediumImpl.cpp
r25930 r26186 1753 1753 it != m->backRefs.end(); ++ it, ++ i) 1754 1754 { 1755 it->machineId.toUtf16().detachTo(&machineIds 1755 it->machineId.toUtf16().detachTo(&machineIds[i]); 1756 1756 } 1757 1757 } … … 2170 2170 it->first.cloneTo(&names[i]); 2171 2171 if (it->second.isEmpty()) 2172 Bstr("").cloneTo(&values 2172 Bstr("").cloneTo(&values[i]); 2173 2173 else 2174 it->second.cloneTo(&values 2174 it->second.cloneTo(&values[i]); 2175 2175 ++ i; 2176 2176 } … … 2218 2218 it->second = (const char *)NULL; 2219 2219 else 2220 it->second = values 2220 it->second = values[i]; 2221 2221 } 2222 2222 … … 2608 2608 } 2609 2609 2610 if (FAILED 2610 if (FAILED(rc)) 2611 2611 { 2612 2612 HRESULT rc2 = UnlockWrite(NULL); -
trunk/src/VBox/Main/MouseImpl.cpp
r26173 r26186 240 240 int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, dx, dy, dz, dw, fButtons); 241 241 if (RT_FAILURE(vrc)) 242 rc = setError 243 tr("Could not send the mouse event to the virtual mouse (%Rrc)"),244 vrc);242 rc = setError(VBOX_E_IPRT_ERROR, 243 tr("Could not send the mouse event to the virtual mouse (%Rrc)"), 244 vrc); 245 245 246 246 return rc; … … 342 342 mLastAbsY = mouseYAbs; 343 343 if (RT_FAILURE(vrc)) 344 rc = setError 345 tr("Could not send the mouse event to the virtual mouse (%Rrc)"),346 vrc);344 rc = setError(VBOX_E_IPRT_ERROR, 345 tr("Could not send the mouse event to the virtual mouse (%Rrc)"), 346 vrc); 347 347 } 348 348 -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r26171 r26186 221 221 break; 222 222 default: 223 return setError 224 tr("Invalid network adapter type '%d'"),225 aAdapterType);223 return setError(E_FAIL, 224 tr("Invalid network adapter type '%d'"), 225 aAdapterType); 226 226 } 227 227 … … 239 239 mlock.release(); 240 240 241 mParent->onNetworkAdapterChange 241 mParent->onNetworkAdapterChange(this, FALSE); 242 242 } 243 243 … … 297 297 mlock.release(); 298 298 299 mParent->onNetworkAdapterChange 299 mParent->onNetworkAdapterChange(this, FALSE); 300 300 } 301 301 … … 408 408 409 409 if (emitChangeEvent) 410 mParent->onNetworkAdapterChange 410 mParent->onNetworkAdapterChange(this, FALSE); 411 411 412 412 return rc; … … 508 508 && mData->mAttachmentType == NetworkAttachmentType_Internal) 509 509 { 510 return setError 511 tr("Empty or null internal network name is not valid"));510 return setError(E_FAIL, 511 tr("Empty or null internal network name is not valid")); 512 512 } 513 513 … … 784 784 mlock.release(); 785 785 786 HRESULT rc = mParent->onNetworkAdapterChange 787 if (FAILED 786 HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); 787 if (FAILED(rc)) 788 788 { 789 789 /* If changing the attachment failed then we can't assume … … 831 831 mlock.release(); 832 832 833 HRESULT rc = mParent->onNetworkAdapterChange 834 if (FAILED 833 HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); 834 if (FAILED(rc)) 835 835 { 836 836 /* If changing the attachment failed then we can't assume … … 886 886 mlock.release(); 887 887 888 HRESULT rc = mParent->onNetworkAdapterChange 889 if (FAILED 888 HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); 889 if (FAILED(rc)) 890 890 { 891 891 /* If changing the attachment failed then we can't assume … … 933 933 mlock.release(); 934 934 935 HRESULT rc = mParent->onNetworkAdapterChange 936 if (FAILED 935 HRESULT rc = mParent->onNetworkAdapterChange(this, TRUE); 936 if (FAILED(rc)) 937 937 { 938 938 /* If changing the attachment failed then we can't assume … … 974 974 mlock.release(); 975 975 976 mParent->onNetworkAdapterChange 976 mParent->onNetworkAdapterChange(this, TRUE); 977 977 } 978 978 -
trunk/src/VBox/Main/ParallelPortImpl.cpp
r26171 r26186 227 227 if (aEnabled && 228 228 m->bd->strPath.isEmpty()) 229 return setError (E_INVALIDARG, 230 tr ("Cannot enable the parallel port %d " 231 "because the port path is empty or null"), 232 m->bd->ulSlot); 229 return setError(E_INVALIDARG, 230 tr("Cannot enable the parallel port %d because the port path is empty or null"), 231 m->bd->ulSlot); 233 232 234 233 m->bd.backup(); … … 282 281 * (when changing this, make sure it corresponds to XML schema */ 283 282 if (aIRQ > 255) 284 return setError (E_INVALIDARG, 285 tr ("Invalid IRQ number of the parallel port %d: " 286 "%lu (must be in range [0, %lu])"), 287 m->bd->ulSlot, aIRQ, 255); 283 return setError(E_INVALIDARG, 284 tr("Invalid IRQ number of the parallel port %d: %lu (must be in range [0, %lu])"), 285 m->bd->ulSlot, aIRQ, 255); 288 286 289 287 AutoCaller autoCaller(this); … … 334 332 * (when changing this, make sure it corresponds to XML schema */ 335 333 if (aIOBase > 0xFFFF) 336 return setError (E_INVALIDARG, 337 tr ("Invalid I/O port base address of the parallel port %d: " 338 "%lu (must be in range [0, 0x%X])"), 339 m->bd->ulSlot, aIOBase, 0, 0xFFFF); 334 return setError(E_INVALIDARG, 335 tr("Invalid I/O port base address of the parallel port %d: %lu (must be in range [0, 0x%X])"), 336 m->bd->ulSlot, aIOBase, 0, 0xFFFF); 340 337 341 338 AutoCaller autoCaller(this); -
trunk/src/VBox/Main/PerformanceImpl.cpp
r25860 r26186 168 168 //////////////////////////////////////////////////////////////////////////////// 169 169 170 STDMETHODIMP 171 PerformanceCollector::COMGETTER(MetricNames) (ComSafeArrayOut(BSTR, theMetricNames)) 170 STDMETHODIMP PerformanceCollector::COMGETTER(MetricNames)(ComSafeArrayOut(BSTR, theMetricNames)) 172 171 { 173 172 if (ComSafeArrayOutIsNull(theMetricNames)) … … 216 215 } 217 216 218 STDMETHODIMP 219 PerformanceCollector::GetMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 220 ComSafeArrayIn (IUnknown *, objects), 221 ComSafeArrayOut(IPerformanceMetric *, outMetrics)) 217 STDMETHODIMP PerformanceCollector::GetMetrics(ComSafeArrayIn(IN_BSTR, metricNames), 218 ComSafeArrayIn(IUnknown *, objects), 219 ComSafeArrayOut(IPerformanceMetric *, outMetrics)) 222 220 { 223 221 LogFlowThisFuncEnter(); … … 251 249 LogFlow (("PerformanceCollector::GetMetrics() store a metric at " 252 250 "retMetrics[%d]...\n", i)); 253 metric.queryInterfaceTo(&retMetrics 251 metric.queryInterfaceTo(&retMetrics[i++]); 254 252 } 255 253 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); … … 258 256 } 259 257 260 STDMETHODIMP 261 PerformanceCollector::SetupMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 262 ComSafeArrayIn (IUnknown *, objects), 263 ULONG aPeriod, ULONG aCount, 264 ComSafeArrayOut(IPerformanceMetric *, 265 outMetrics)) 258 STDMETHODIMP PerformanceCollector::SetupMetrics(ComSafeArrayIn(IN_BSTR, metricNames), 259 ComSafeArrayIn(IUnknown *, objects), 260 ULONG aPeriod, 261 ULONG aCount, 262 ComSafeArrayOut(IPerformanceMetric *, outMetrics)) 266 263 { 267 264 AutoCaller autoCaller(this); 268 265 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 269 266 270 pm::Filter filter 271 267 pm::Filter filter(ComSafeArrayInArg (metricNames), 268 ComSafeArrayInArg (objects)); 272 269 273 270 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 297 294 } 298 295 299 com::SafeIfaceArray<IPerformanceMetric> retMetrics 296 com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size()); 300 297 int i = 0; 301 298 for (it = filteredMetrics.begin(); 302 299 it != filteredMetrics.end() && SUCCEEDED(rc); ++it) 303 rc = toIPerformanceMetric(*it, &retMetrics 300 rc = toIPerformanceMetric(*it, &retMetrics[i++]); 304 301 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 305 302 … … 308 305 } 309 306 310 STDMETHODIMP 311 PerformanceCollector::EnableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 312 ComSafeArrayIn (IUnknown *, objects), 313 ComSafeArrayOut(IPerformanceMetric *, 314 outMetrics)) 307 STDMETHODIMP PerformanceCollector::EnableMetrics(ComSafeArrayIn(IN_BSTR, metricNames), 308 ComSafeArrayIn(IUnknown *, objects), 309 ComSafeArrayOut(IPerformanceMetric *, outMetrics)) 315 310 { 316 311 AutoCaller autoCaller(this); 317 312 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 318 313 319 pm::Filter filter (ComSafeArrayInArg(metricNames),320 ComSafeArrayInArg(objects));314 pm::Filter filter(ComSafeArrayInArg(metricNames), 315 ComSafeArrayInArg(objects)); 321 316 322 317 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Write lock is not needed atm since we are */ … … 334 329 } 335 330 336 com::SafeIfaceArray<IPerformanceMetric> retMetrics 331 com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size()); 337 332 int i = 0; 338 333 for (it = filteredMetrics.begin(); 339 334 it != filteredMetrics.end() && SUCCEEDED(rc); ++it) 340 rc = toIPerformanceMetric(*it, &retMetrics 335 rc = toIPerformanceMetric(*it, &retMetrics[i++]); 341 336 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 342 337 … … 345 340 } 346 341 347 STDMETHODIMP 348 PerformanceCollector::DisableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 349 ComSafeArrayIn (IUnknown *, objects), 350 ComSafeArrayOut(IPerformanceMetric *, 351 outMetrics)) 342 STDMETHODIMP PerformanceCollector::DisableMetrics(ComSafeArrayIn(IN_BSTR, metricNames), 343 ComSafeArrayIn(IUnknown *, objects), 344 ComSafeArrayOut(IPerformanceMetric *, outMetrics)) 352 345 { 353 346 AutoCaller autoCaller(this); 354 347 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 355 348 356 pm::Filter filter (ComSafeArrayInArg(metricNames),357 ComSafeArrayInArg(objects));349 pm::Filter filter(ComSafeArrayInArg(metricNames), 350 ComSafeArrayInArg(objects)); 358 351 359 352 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Write lock is not needed atm since we are */ … … 371 364 } 372 365 373 com::SafeIfaceArray<IPerformanceMetric> retMetrics 366 com::SafeIfaceArray<IPerformanceMetric> retMetrics(filteredMetrics.size()); 374 367 int i = 0; 375 368 for (it = filteredMetrics.begin(); 376 369 it != filteredMetrics.end() && SUCCEEDED(rc); ++it) 377 rc = toIPerformanceMetric(*it, &retMetrics 370 rc = toIPerformanceMetric(*it, &retMetrics[i++]); 378 371 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 379 372 … … 382 375 } 383 376 384 STDMETHODIMP 385 PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames), 386 ComSafeArrayIn (IUnknown *, objects), 387 ComSafeArrayOut(BSTR, outMetricNames), 388 ComSafeArrayOut(IUnknown *, outObjects), 389 ComSafeArrayOut(BSTR, outUnits), 390 ComSafeArrayOut(ULONG, outScales), 391 ComSafeArrayOut(ULONG, outSequenceNumbers), 392 ComSafeArrayOut(ULONG, outDataIndices), 393 ComSafeArrayOut(ULONG, outDataLengths), 394 ComSafeArrayOut(LONG, outData)) 377 STDMETHODIMP PerformanceCollector::QueryMetricsData(ComSafeArrayIn (IN_BSTR, metricNames), 378 ComSafeArrayIn (IUnknown *, objects), 379 ComSafeArrayOut(BSTR, outMetricNames), 380 ComSafeArrayOut(IUnknown *, outObjects), 381 ComSafeArrayOut(BSTR, outUnits), 382 ComSafeArrayOut(ULONG, outScales), 383 ComSafeArrayOut(ULONG, outSequenceNumbers), 384 ComSafeArrayOut(ULONG, outDataIndices), 385 ComSafeArrayOut(ULONG, outDataLengths), 386 ComSafeArrayOut(LONG, outData)) 395 387 { 396 388 AutoCaller autoCaller(this); 397 389 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 398 390 399 pm::Filter filter (ComSafeArrayInArg(metricNames),400 ComSafeArrayInArg(objects));391 pm::Filter filter(ComSafeArrayInArg(metricNames), 392 ComSafeArrayInArg(objects)); 401 393 402 394 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 416 408 size_t flatIndex = 0; 417 409 size_t numberOfMetrics = filteredMetrics.size(); 418 com::SafeArray<BSTR> retNames 419 com::SafeIfaceArray<IUnknown> retObjects 420 com::SafeArray<BSTR> retUnits 421 com::SafeArray<ULONG> retScales 422 com::SafeArray<ULONG> retSequenceNumbers 423 com::SafeArray<ULONG> retIndices 424 com::SafeArray<ULONG> retLengths 425 com::SafeArray<LONG> retData 410 com::SafeArray<BSTR> retNames(numberOfMetrics); 411 com::SafeIfaceArray<IUnknown> retObjects(numberOfMetrics); 412 com::SafeArray<BSTR> retUnits(numberOfMetrics); 413 com::SafeArray<ULONG> retScales(numberOfMetrics); 414 com::SafeArray<ULONG> retSequenceNumbers(numberOfMetrics); 415 com::SafeArray<ULONG> retIndices(numberOfMetrics); 416 com::SafeArray<ULONG> retLengths(numberOfMetrics); 417 com::SafeArray<LONG> retData(flatSize); 426 418 427 419 for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i) … … 459 451 /////////////////////////////////////////////////////////////////////////////// 460 452 461 void PerformanceCollector::registerBaseMetric 453 void PerformanceCollector::registerBaseMetric(pm::BaseMetric *baseMetric) 462 454 { 463 455 //LogFlowThisFuncEnter(); … … 471 463 } 472 464 473 void PerformanceCollector::registerMetric 465 void PerformanceCollector::registerMetric(pm::Metric *metric) 474 466 { 475 467 //LogFlowThisFuncEnter(); … … 483 475 } 484 476 485 void PerformanceCollector::unregisterBaseMetricsFor 477 void PerformanceCollector::unregisterBaseMetricsFor(const ComPtr<IUnknown> &aObject) 486 478 { 487 479 //LogFlowThisFuncEnter(); … … 504 496 } 505 497 506 void PerformanceCollector::unregisterMetricsFor 498 void PerformanceCollector::unregisterMetricsFor(const ComPtr<IUnknown> &aObject) 507 499 { 508 500 //LogFlowThisFuncEnter(); … … 547 539 548 540 /* static */ 549 void PerformanceCollector::staticSamplerCallback 550 541 void PerformanceCollector::staticSamplerCallback(RTTIMERLR hTimerLR, void *pvUser, 542 uint64_t /* iTick */) 551 543 { 552 544 AssertReturnVoid (pvUser != NULL); 553 545 PerformanceCollector *collector = static_cast <PerformanceCollector *> (pvUser); 554 Assert 546 Assert(collector->mMagic == MAGIC); 555 547 if (collector->mMagic == MAGIC) 556 548 { … … 621 613 //////////////////////////////////////////////////////////////////////////////// 622 614 623 HRESULT PerformanceMetric::init 615 HRESULT PerformanceMetric::init(pm::Metric *aMetric) 624 616 { 625 617 m.name = aMetric->getName(); … … 634 626 } 635 627 636 HRESULT PerformanceMetric::init 628 HRESULT PerformanceMetric::init(pm::BaseMetric *aMetric) 637 629 { 638 630 m.name = aMetric->getName(); … … 651 643 } 652 644 653 STDMETHODIMP PerformanceMetric::COMGETTER(MetricName) 645 STDMETHODIMP PerformanceMetric::COMGETTER(MetricName)(BSTR *aMetricName) 654 646 { 655 647 /// @todo (r=dmik) why do all these getters not do AutoCaller and … … 660 652 } 661 653 662 STDMETHODIMP PerformanceMetric::COMGETTER(Object) 654 STDMETHODIMP PerformanceMetric::COMGETTER(Object)(IUnknown **anObject) 663 655 { 664 656 m.object.queryInterfaceTo(anObject); … … 666 658 } 667 659 668 STDMETHODIMP PerformanceMetric::COMGETTER(Description) 660 STDMETHODIMP PerformanceMetric::COMGETTER(Description)(BSTR *aDescription) 669 661 { 670 662 m.description.cloneTo(aDescription); … … 672 664 } 673 665 674 STDMETHODIMP PerformanceMetric::COMGETTER(Period) 666 STDMETHODIMP PerformanceMetric::COMGETTER(Period)(ULONG *aPeriod) 675 667 { 676 668 *aPeriod = m.period; … … 678 670 } 679 671 680 STDMETHODIMP PerformanceMetric::COMGETTER(Count) 672 STDMETHODIMP PerformanceMetric::COMGETTER(Count)(ULONG *aCount) 681 673 { 682 674 *aCount = m.count; … … 684 676 } 685 677 686 STDMETHODIMP PerformanceMetric::COMGETTER(Unit) 678 STDMETHODIMP PerformanceMetric::COMGETTER(Unit)(BSTR *aUnit) 687 679 { 688 680 m.unit.cloneTo(aUnit); … … 690 682 } 691 683 692 STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue) 684 STDMETHODIMP PerformanceMetric::COMGETTER(MinimumValue)(LONG *aMinValue) 693 685 { 694 686 *aMinValue = m.min; … … 696 688 } 697 689 698 STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue) 690 STDMETHODIMP PerformanceMetric::COMGETTER(MaximumValue)(LONG *aMaxValue) 699 691 { 700 692 *aMaxValue = m.max; -
trunk/src/VBox/Main/ProgressImpl.cpp
r25860 r26186 140 140 /* add to the global collection of progress operations (note: after 141 141 * creating mId) */ 142 mParent->addProgress 142 mParent->addProgress(this); 143 143 #endif 144 144 … … 402 402 403 403 if (!mCompleted) 404 return setError 405 tr("Result code is not available, operation is still in progress"));404 return setError(E_FAIL, 405 tr("Result code is not available, operation is still in progress")); 406 406 407 407 *aResultCode = mResultCode; … … 420 420 421 421 if (!mCompleted) 422 return setError 423 tr("Error info is not available, operation is still in progress"));422 return setError(E_FAIL, 423 tr("Error info is not available, operation is still in progress")); 424 424 425 425 mErrorInfo.queryInterfaceTo(aErrorInfo); … … 1087 1087 * Marks the whole task as complete and sets the result code. 1088 1088 * 1089 * If the result code indicates a failure (|FAILED 1089 * If the result code indicates a failure (|FAILED(@a aResultCode)|) then this 1090 1090 * method will import the error info from the current thread and assign it to 1091 1091 * the errorInfo attribute (it will return an error if no info is available in … … 1172 1172 mResultCode = aResultCode; 1173 1173 1174 AssertReturn(FAILED 1174 AssertReturn(FAILED(aResultCode), E_FAIL); 1175 1175 1176 1176 ComObjPtr<VirtualBoxErrorInfo> errorInfo; … … 1286 1286 1287 1287 m_ulCurrentOperation = 0; 1288 rc = mProgresses [0]->COMGETTER(OperationDescription) ( 1289 m_bstrOperationDescription.asOutParam()); 1288 rc = mProgresses[0]->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam()); 1290 1289 if (FAILED(rc)) return rc; 1291 1290 … … 1295 1294 { 1296 1295 BOOL cancelable = FALSE; 1297 rc = mProgresses [i]->COMGETTER(Cancelable)(&cancelable);1296 rc = mProgresses[i]->COMGETTER(Cancelable)(&cancelable); 1298 1297 if (FAILED(rc)) return rc; 1299 1298 … … 1304 1303 { 1305 1304 ULONG opCount = 0; 1306 rc = mProgresses [i]->COMGETTER(OperationCount)(&opCount);1305 rc = mProgresses[i]->COMGETTER(OperationCount)(&opCount); 1307 1306 if (FAILED(rc)) return rc; 1308 1307 … … 1328 1327 * @param aId See ProgressBase::init(). 1329 1328 */ 1330 HRESULT CombinedProgress::init 1329 HRESULT CombinedProgress::init( 1331 1330 #if !defined (VBOX_COM_INPROC) 1332 1331 VirtualBox *aParent, 1333 1332 #endif 1334 IUnknown *aInitiator, 1335 CBSTR aDescription, 1336 IProgress *aProgress1, IProgress *aProgress2, 1337 OUT_GUID aId /* = NULL */) 1333 IUnknown *aInitiator, 1334 CBSTR aDescription, 1335 IProgress *aProgress1, 1336 IProgress *aProgress2, 1337 OUT_GUID aId /* = NULL */) 1338 1338 { 1339 1339 /* Enclose the state transition NotReady->InInit->Ready */ … … 1341 1341 AssertReturn(autoInitSpan.isOk(), E_FAIL); 1342 1342 1343 mProgresses.resize 1344 mProgresses 1345 mProgresses 1346 1347 HRESULT rc = protectedInit 1343 mProgresses.resize(2); 1344 mProgresses[0] = aProgress1; 1345 mProgresses[1] = aProgress2; 1346 1347 HRESULT rc = protectedInit(autoInitSpan, 1348 1348 #if !defined (VBOX_COM_INPROC) 1349 1349 aParent, 1350 1350 #endif 1351 aInitiator, aDescription, aId); 1351 aInitiator, 1352 aDescription, 1353 aId); 1352 1354 1353 1355 /* Confirm a successful initialization when it's the case */ … … 1608 1610 1609 1611 if (aOperation >= m_cOperations) 1610 return setError 1611 tr("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1);1612 return setError(E_FAIL, 1613 tr("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1); 1612 1614 1613 1615 /* if we're already completed or if the given operation is already done, … … 1623 1625 { 1624 1626 ULONG opCount = 0; 1625 rc = mProgresses [progress]->COMGETTER(OperationCount)(&opCount);1626 if (FAILED 1627 rc = mProgresses[progress]->COMGETTER(OperationCount)(&opCount); 1628 if (FAILED(rc)) 1627 1629 return rc; 1628 1630 … … 1688 1690 1689 1691 if (!mCancelable) 1690 return setError (E_FAIL, tr("Operation cannot be canceled"));1692 return setError(E_FAIL, tr("Operation cannot be canceled")); 1691 1693 1692 1694 if (!mCanceled) … … 1731 1733 { 1732 1734 rc = progress->COMGETTER(Completed)(&fCompleted); 1733 if (FAILED 1735 if (FAILED(rc)) 1734 1736 return rc; 1735 1737 … … 1737 1739 { 1738 1740 rc = progress->COMGETTER(Canceled)(&mCanceled); 1739 if (FAILED 1741 if (FAILED(rc)) 1740 1742 return rc; 1741 1743 1742 1744 LONG iRc; 1743 1745 rc = progress->COMGETTER(ResultCode)(&iRc); 1744 if (FAILED 1746 if (FAILED(rc)) 1745 1747 return rc; 1746 1748 mResultCode = iRc; 1747 1749 1748 if (FAILED 1750 if (FAILED(mResultCode)) 1749 1751 { 1750 1752 rc = progress->COMGETTER(ErrorInfo) (mErrorInfo.asOutParam()); 1751 if (FAILED 1753 if (FAILED(rc)) 1752 1754 return rc; 1753 1755 } 1754 1756 1755 if (FAILED 1757 if (FAILED(mResultCode) || mCanceled) 1756 1758 { 1757 1759 mCompleted = TRUE; … … 1761 1763 ULONG opCount = 0; 1762 1764 rc = progress->COMGETTER(OperationCount) (&opCount); 1763 if (FAILED 1765 if (FAILED(rc)) 1764 1766 return rc; 1765 1767 … … 1768 1770 1769 1771 if (mProgress < mProgresses.size()) 1770 progress = mProgresses 1772 progress = mProgresses[mProgress]; 1771 1773 else 1772 1774 mCompleted = TRUE; -
trunk/src/VBox/Main/SerialPortImpl.cpp
r26171 r26186 349 349 * (when changing this, make sure it corresponds to XML schema */ 350 350 if (aIRQ > 255) 351 return setError (E_INVALIDARG, 352 tr ("Invalid IRQ number of the serial port %d: " 353 "%lu (must be in range [0, %lu])"), 354 m->bd->ulSlot, aIRQ, 255); 351 return setError(E_INVALIDARG, 352 tr("Invalid IRQ number of the serial port %d: %lu (must be in range [0, %lu])"), 353 m->bd->ulSlot, aIRQ, 255); 355 354 356 355 AutoCaller autoCaller(this); … … 401 400 * (when changing this, make sure it corresponds to XML schema */ 402 401 if (aIOBase > 0xFFFF) 403 return setError (E_INVALIDARG, 404 tr ("Invalid I/O port base address of the serial port %d: " 405 "%lu (must be in range [0, 0x%X])"), 406 m->bd->ulSlot, aIOBase, 0, 0xFFFF); 402 return setError(E_INVALIDARG, 403 tr("Invalid I/O port base address of the serial port %d: %lu (must be in range [0, 0x%X])"), 404 m->bd->ulSlot, aIOBase, 0, 0xFFFF); 407 405 408 406 AutoCaller autoCaller(this); -
trunk/src/VBox/Main/SessionImpl.cpp
r26068 r26186 40 40 #if defined(RT_OS_WINDOWS) || defined (RT_OS_OS2) 41 41 /** VM IPC mutex holder thread */ 42 static DECLCALLBACK(int) IPCMutexHolderThread 42 static DECLCALLBACK(int) IPCMutexHolderThread(RTTHREAD Thread, void *pvUser); 43 43 #endif 44 44 … … 51 51 do { \ 52 52 if (mState != SessionState_Open) \ 53 return setError (E_UNEXPECTED, \ 54 tr ("The session is not open (session state: %s)"), \ 55 Global::stringifySessionState(mState)); \ 53 return setError(E_UNEXPECTED, tr ("The session is not open (session state: %s)"), Global::stringifySessionState(mState)); \ 56 54 } while (0) 57 55 … … 70 68 LogFlowThisFunc(("\n")); 71 69 72 uninit 70 uninit(true /* aFinalRelease */); 73 71 } 74 72 … … 115 113 * @note Locks this object for writing. 116 114 */ 117 void Session::uninit 115 void Session::uninit(bool aFinalRelease) 118 116 { 119 117 LogFlowThisFuncEnter(); … … 134 132 if (mState != SessionState_Closed) 135 133 { 136 Assert 137 138 139 HRESULT rc = close 140 AssertComRC 134 Assert(mState == SessionState_Open || 135 mState == SessionState_Spawning); 136 137 HRESULT rc = close(aFinalRelease, false /* aFromServer */); 138 AssertComRC(rc); 141 139 } 142 140 … … 147 145 ///////////////////////////////////////////////////////////////////////////// 148 146 149 STDMETHODIMP Session::COMGETTER(State) 147 STDMETHODIMP Session::COMGETTER(State)(SessionState_T *aState) 150 148 { 151 149 CheckComArgOutPointerValid(aState); … … 161 159 } 162 160 163 STDMETHODIMP Session::COMGETTER(Type) 161 STDMETHODIMP Session::COMGETTER(Type)(SessionType_T *aType) 164 162 { 165 163 CheckComArgOutPointerValid(aType); … … 176 174 } 177 175 178 STDMETHODIMP Session::COMGETTER(Machine) 176 STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine) 179 177 { 180 178 CheckComArgOutPointerValid(aMachine); … … 193 191 else 194 192 rc = mRemoteMachine.queryInterfaceTo(aMachine); 195 ComAssertComRC 193 ComAssertComRC(rc); 196 194 197 195 return rc; 198 196 } 199 197 200 STDMETHODIMP Session::COMGETTER(Console) 198 STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole) 201 199 { 202 200 CheckComArgOutPointerValid(aConsole); … … 215 213 else 216 214 rc = mRemoteConsole.queryInterfaceTo(aConsole); 217 ComAssertComRC 215 ComAssertComRC(rc); 218 216 219 217 return rc; … … 235 233 CHECK_OPEN(); 236 234 237 return close 235 return close(false /* aFinalRelease */, false /* aFromServer */); 238 236 } 239 237 … … 241 239 ///////////////////////////////////////////////////////////////////////////// 242 240 243 STDMETHODIMP Session::GetPID 241 STDMETHODIMP Session::GetPID(ULONG *aPid) 244 242 { 245 243 AssertReturn(aPid, E_POINTER); 246 244 247 245 AutoCaller autoCaller(this); 248 AssertComRCReturn 249 250 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 251 252 *aPid = (ULONG) 253 AssertCompile (sizeof (*aPid) == sizeof(RTPROCESS));246 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 247 248 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 249 250 *aPid = (ULONG)RTProcSelf(); 251 AssertCompile(sizeof(*aPid) == sizeof(RTPROCESS)); 254 252 255 253 return S_OK; 256 254 } 257 255 258 STDMETHODIMP Session::GetRemoteConsole 256 STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole) 259 257 { 260 258 LogFlowThisFuncEnter(); … … 262 260 263 261 AutoCaller autoCaller(this); 264 AssertComRCReturn 262 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 265 263 266 264 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 268 266 AssertReturn(mState != SessionState_Closed, VBOX_E_INVALID_VM_STATE); 269 267 270 AssertMsgReturn (mType == SessionType_Direct && !!mConsole, 271 ("This is not a direct session!\n"), VBOX_E_INVALID_OBJECT_STATE); 268 AssertMsgReturn(mType == SessionType_Direct && !!mConsole, 269 ("This is not a direct session!\n"), 270 VBOX_E_INVALID_OBJECT_STATE); 272 271 273 272 /* return a failure if the session already transitioned to Closing … … 283 282 } 284 283 285 STDMETHODIMP Session::AssignMachine 284 STDMETHODIMP Session::AssignMachine(IMachine *aMachine) 286 285 { 287 286 LogFlowThisFuncEnter(); … … 289 288 290 289 AutoCaller autoCaller(this); 291 AssertComRCReturn 290 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 292 291 293 292 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 319 318 320 319 rc = mConsole.createObject(); 321 AssertComRCReturn 322 323 rc = mConsole->init 324 AssertComRCReturn 320 AssertComRCReturn(rc, rc); 321 322 rc = mConsole->init(aMachine, mControl); 323 AssertComRCReturn(rc, rc); 325 324 326 325 rc = grabIPCSemaphore(); … … 331 330 */ 332 331 if (SUCCEEDED(rc)) 333 rc = aMachine->COMGETTER(Parent) 332 rc = aMachine->COMGETTER(Parent)(mVirtualBox.asOutParam()); 334 333 335 334 if (SUCCEEDED(rc)) … … 352 351 } 353 352 354 STDMETHODIMP Session::AssignRemoteMachine 353 STDMETHODIMP Session::AssignRemoteMachine(IMachine *aMachine, IConsole *aConsole) 355 354 { 356 355 LogFlowThisFuncEnter(); … … 360 359 361 360 AutoCaller autoCaller(this); 362 AssertComRCReturn 361 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 363 362 364 363 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 396 395 * until the session is closed 397 396 */ 398 rc = aMachine->COMGETTER(Parent) 397 rc = aMachine->COMGETTER(Parent)(mVirtualBox.asOutParam()); 399 398 400 399 if (SUCCEEDED(rc)) … … 407 406 mType = SessionType_Existing; 408 407 else 409 Assert 408 Assert(mState == SessionState_Spawning); 410 409 411 410 mState = SessionState_Open; … … 425 424 } 426 425 427 STDMETHODIMP Session::UpdateMachineState 426 STDMETHODIMP Session::UpdateMachineState(MachineState_T aMachineState) 428 427 { 429 428 AutoCaller autoCaller(this); … … 453 452 AssertReturn(!mConsole.isNull(), E_FAIL); 454 453 455 return mConsole->updateMachineState 454 return mConsole->updateMachineState(aMachineState); 456 455 } 457 456 … … 481 480 482 481 /* close ourselves */ 483 rc = close 482 rc = close(false /* aFinalRelease */, true /* aFromServer */); 484 483 } 485 484 else if (autoCaller.state() == InUninit) … … 508 507 509 508 AutoCaller autoCaller(this); 510 AssertComRCReturn 509 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 511 510 512 511 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 522 521 523 522 AutoCaller autoCaller(this); 524 AssertComRCReturn 523 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 525 524 526 525 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 536 535 537 536 AutoCaller autoCaller(this); 538 AssertComRCReturn 537 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 539 538 540 539 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 550 549 551 550 AutoCaller autoCaller(this); 552 AssertComRCReturn 551 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 553 552 554 553 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 564 563 565 564 AutoCaller autoCaller(this); 566 AssertComRCReturn 565 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 567 566 568 567 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 578 577 579 578 AutoCaller autoCaller(this); 580 AssertComRCReturn 579 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 581 580 582 581 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 592 591 593 592 AutoCaller autoCaller(this); 594 AssertComRCReturn 593 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 595 594 596 595 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 606 605 607 606 AutoCaller autoCaller(this); 608 AssertComRCReturn 607 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 609 608 610 609 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 615 614 } 616 615 617 STDMETHODIMP Session::OnSharedFolderChange 618 { 619 LogFlowThisFunc(("\n")); 620 621 AutoCaller autoCaller(this); 622 AssertComRCReturn 616 STDMETHODIMP Session::OnSharedFolderChange(BOOL aGlobal) 617 { 618 LogFlowThisFunc(("\n")); 619 620 AutoCaller autoCaller(this); 621 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 623 622 624 623 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 626 625 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 627 626 628 return mConsole->onSharedFolderChange 629 } 630 631 STDMETHODIMP Session::OnUSBDeviceAttach 632 633 634 { 635 LogFlowThisFunc(("\n")); 636 637 AutoCaller autoCaller(this); 638 AssertComRCReturn 627 return mConsole->onSharedFolderChange(aGlobal); 628 } 629 630 STDMETHODIMP Session::OnUSBDeviceAttach(IUSBDevice *aDevice, 631 IVirtualBoxErrorInfo *aError, 632 ULONG aMaskedIfs) 633 { 634 LogFlowThisFunc(("\n")); 635 636 AutoCaller autoCaller(this); 637 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 639 638 640 639 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 642 641 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 643 642 644 return mConsole->onUSBDeviceAttach 645 } 646 647 STDMETHODIMP Session::OnUSBDeviceDetach 648 649 { 650 LogFlowThisFunc(("\n")); 651 652 AutoCaller autoCaller(this); 653 AssertComRCReturn 643 return mConsole->onUSBDeviceAttach(aDevice, aError, aMaskedIfs); 644 } 645 646 STDMETHODIMP Session::OnUSBDeviceDetach(IN_BSTR aId, 647 IVirtualBoxErrorInfo *aError) 648 { 649 LogFlowThisFunc(("\n")); 650 651 AutoCaller autoCaller(this); 652 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 654 653 655 654 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 657 656 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 658 657 659 return mConsole->onUSBDeviceDetach 660 } 661 662 STDMETHODIMP Session::OnShowWindow 663 { 664 AutoCaller autoCaller(this); 665 AssertComRCReturn 658 return mConsole->onUSBDeviceDetach(aId, aError); 659 } 660 661 STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId) 662 { 663 AutoCaller autoCaller(this); 664 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 666 665 667 666 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 680 679 } 681 680 682 return mConsole->onShowWindow 683 } 684 685 STDMETHODIMP Session::AccessGuestProperty 686 681 return mConsole->onShowWindow(aCheck, aCanShow, aWinId); 682 } 683 684 STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags, 685 BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags) 687 686 { 688 687 #ifdef VBOX_WITH_GUEST_PROPS 689 688 AutoCaller autoCaller(this); 690 AssertComRCReturn 689 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 691 690 692 691 if (mState != SessionState_Open) 693 return setError 694 tr("Machine session is not open (session state: %s)."),695 Global::stringifySessionState(mState));692 return setError(VBOX_E_INVALID_VM_STATE, 693 tr("Machine session is not open (session state: %s)."), 694 Global::stringifySessionState(mState)); 696 695 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 697 696 CheckComArgNotNull(aName); 698 if (!aIsSetter && !VALID_PTR 697 if (!aIsSetter && !VALID_PTR(aRetValue)) 699 698 return E_POINTER; 700 if (!aIsSetter && !VALID_PTR 699 if (!aIsSetter && !VALID_PTR(aRetTimestamp)) 701 700 return E_POINTER; 702 if (!aIsSetter && !VALID_PTR 701 if (!aIsSetter && !VALID_PTR(aRetFlags)) 703 702 return E_POINTER; 704 703 /* aValue can be NULL for a setter call if the property is to be deleted. */ 705 if (aIsSetter && (aValue != NULL) && !VALID_PTR 704 if (aIsSetter && (aValue != NULL) && !VALID_PTR(aValue)) 706 705 return E_INVALIDARG; 707 706 /* aFlags can be null if it is to be left as is */ 708 if (aIsSetter && (aFlags != NULL) && !VALID_PTR 707 if (aIsSetter && (aFlags != NULL) && !VALID_PTR(aFlags)) 709 708 return E_INVALIDARG; 710 709 if (!aIsSetter) 711 return mConsole->getGuestProperty 710 return mConsole->getGuestProperty(aName, aRetValue, aRetTimestamp, aRetFlags); 712 711 else 713 return mConsole->setGuestProperty 712 return mConsole->setGuestProperty(aName, aValue, aFlags); 714 713 #else /* VBOX_WITH_GUEST_PROPS not defined */ 715 714 ReturnComNotImplemented(); … … 717 716 } 718 717 719 STDMETHODIMP Session::EnumerateGuestProperties 720 721 722 723 718 STDMETHODIMP Session::EnumerateGuestProperties(IN_BSTR aPatterns, 719 ComSafeArrayOut(BSTR, aNames), 720 ComSafeArrayOut(BSTR, aValues), 721 ComSafeArrayOut(ULONG64, aTimestamps), 722 ComSafeArrayOut(BSTR, aFlags)) 724 723 { 725 724 #ifdef VBOX_WITH_GUEST_PROPS 726 725 AutoCaller autoCaller(this); 727 AssertComRCReturn 726 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 728 727 729 728 if (mState != SessionState_Open) 730 return setError 731 tr("Machine session is not open (session state: %s)."),732 Global::stringifySessionState(mState));733 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 734 if (!VALID_PTR 729 return setError(VBOX_E_INVALID_VM_STATE, 730 tr("Machine session is not open (session state: %s)."), 731 Global::stringifySessionState(mState)); 732 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 733 if (!VALID_PTR(aPatterns) && (aPatterns != NULL)) 735 734 return E_POINTER; 736 735 if (ComSafeArrayOutIsNull(aNames)) … … 764 763 * @note Locks this object for writing. 765 764 */ 766 HRESULT Session::close 765 HRESULT Session::close(bool aFinalRelease, bool aFromServer) 767 766 { 768 767 LogFlowThisFuncEnter(); … … 779 778 if (mState != SessionState_Open) 780 779 { 781 Assert 780 Assert(mState == SessionState_Spawning); 782 781 783 782 /* The session object is going to be uninitialized before it has been … … 789 788 * trying to close the session before waiting for the progress object it 790 789 * got from IVirtualBox:: openRemoteSession() to complete, so assert. */ 791 Assert 790 Assert(aFromServer); 792 791 793 792 mState = SessionState_Closed; 794 793 mType = SessionType_Null; 795 794 #if defined(RT_OS_WINDOWS) 796 Assert 795 Assert(!mIPCSem && !mIPCThreadSem); 797 796 #elif defined(RT_OS_OS2) 798 Assert 799 797 Assert(mIPCThread == NIL_RTTHREAD && 798 mIPCThreadSem == NIL_RTSEMEVENT); 800 799 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 801 Assert 800 Assert(mIPCSem == -1); 802 801 #else 803 802 # error "Port me!" … … 845 844 846 845 LogFlowThisFunc(("Calling mControl->OnSessionEnd()...\n")); 847 HRESULT rc = mControl->OnSessionEnd 846 HRESULT rc = mControl->OnSessionEnd(this, progress.asOutParam()); 848 847 LogFlowThisFunc(("mControl->OnSessionEnd()=%08X\n", rc)); 849 848 … … 857 856 rc = S_OK; 858 857 859 AssertComRC 858 AssertComRC(rc); 860 859 } 861 860 … … 872 871 * once this method returns) 873 872 */ 874 Assert 873 Assert(!!progress); 875 874 if (progress) 876 progress->WaitForCompletion 875 progress->WaitForCompletion(-1); 877 876 } 878 877 } … … 895 894 /* open the IPC semaphore based on the sessionId and try to grab it */ 896 895 Bstr ipcId; 897 rc = mControl->GetIPCId 896 rc = mControl->GetIPCId(ipcId.asOutParam()); 898 897 AssertComRCReturnRC(rc); 899 898 … … 909 908 */ 910 909 911 mIPCThreadSem = ::CreateEvent 912 AssertMsgReturn 913 914 915 916 void *data 917 data [0] = (void *) (BSTR)ipcId;918 data [1] = (void *)mIPCThreadSem;919 data 910 mIPCThreadSem = ::CreateEvent(NULL, FALSE, FALSE, NULL); 911 AssertMsgReturn(mIPCThreadSem, 912 ("Cannot create an event sem, err=%d", ::GetLastError()), 913 E_FAIL); 914 915 void *data[3]; 916 data[0] = (void*)(BSTR)ipcId; 917 data[1] = (void*)mIPCThreadSem; 918 data[2] = 0; /* will get an output from the thread */ 920 919 921 920 /* create a thread to hold the IPC mutex until signalled to release it */ 922 921 RTTHREAD tid; 923 int vrc = RTThreadCreate (&tid, IPCMutexHolderThread, (void *) data, 924 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); 925 AssertRCReturn (vrc, E_FAIL); 922 int vrc = RTThreadCreate(&tid, IPCMutexHolderThread, (void*)data, 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); 923 AssertRCReturn(vrc, E_FAIL); 926 924 927 925 /* wait until thread init is completed */ 928 DWORD wrc = ::WaitForSingleObject 929 AssertMsg 930 Assert (data[2]);931 932 if (wrc == WAIT_OBJECT_0 && data 926 DWORD wrc = ::WaitForSingleObject(mIPCThreadSem, INFINITE); 927 AssertMsg(wrc == WAIT_OBJECT_0, ("Wait failed, err=%d\n", ::GetLastError())); 928 Assert(data[2]); 929 930 if (wrc == WAIT_OBJECT_0 && data[2]) 933 931 { 934 932 /* memorize the event sem we should signal in close() */ 935 mIPCSem = (HANDLE) data[2];933 mIPCSem = (HANDLE)data[2]; 936 934 rc = S_OK; 937 935 } 938 936 else 939 937 { 940 ::CloseHandle 938 ::CloseHandle(mIPCThreadSem); 941 939 mIPCThreadSem = NULL; 942 940 rc = E_FAIL; … … 950 948 * and then release it in close(). */ 951 949 952 int vrc = RTSemEventCreate 953 AssertRCReturn 954 955 void *data 956 data [0] = (void *)ipcId.raw();957 data [1] = (void *)mIPCThreadSem;958 data [2] = (void *)false; /* will get the thread result here */950 int vrc = RTSemEventCreate(&mIPCThreadSem); 951 AssertRCReturn(vrc, E_FAIL); 952 953 void *data[3]; 954 data[0] = (void*)ipcId.raw(); 955 data[1] = (void*)mIPCThreadSem; 956 data[2] = (void*)false; /* will get the thread result here */ 959 957 960 958 /* create a thread to hold the IPC mutex until signalled to release it */ 961 vrc = RTThreadCreate 962 963 AssertRCReturn 959 vrc = RTThreadCreate(&mIPCThread, IPCMutexHolderThread, (void *) data, 960 0, RTTHREADTYPE_MAIN_WORKER, 0, "IPCHolder"); 961 AssertRCReturn(vrc, E_FAIL); 964 962 965 963 /* wait until thread init is completed */ … … 968 966 969 967 /* the thread must succeed */ 970 AssertReturn((bool) data[2], E_FAIL);968 AssertReturn((bool)data[2], E_FAIL); 971 969 972 970 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) … … 1034 1032 /* tell the thread holding the IPC mutex to release it */ 1035 1033 int vrc = RTSemEventSignal (mIPCThreadSem); 1036 AssertRC 1034 AssertRC(vrc == NO_ERROR); 1037 1035 1038 1036 /* wait for the thread to finish */ … … 1073 1071 void **data = (void **) pvUser; 1074 1072 1075 BSTR sessionId = (BSTR) data[0];1076 HANDLE initDoneSem = (HANDLE) data[1];1073 BSTR sessionId = (BSTR)data[0]; 1074 HANDLE initDoneSem = (HANDLE)data[1]; 1077 1075 1078 1076 HANDLE ipcMutex = ::OpenMutex (MUTEX_ALL_ACCESS, FALSE, sessionId); … … 1090 1088 if (finishSem) 1091 1089 { 1092 data [2] = (void *)finishSem;1090 data[2] = (void*)finishSem; 1093 1091 /* signal we're done with init */ 1094 1092 ::SetEvent (initDoneSem); … … 1123 1121 void **data = (void **) pvUser; 1124 1122 1125 Utf8Str ipcId = (BSTR) data[0];1126 RTSEMEVENT finishSem = (RTSEMEVENT) data[1];1123 Utf8Str ipcId = (BSTR)data[0]; 1124 RTSEMEVENT finishSem = (RTSEMEVENT)data[1]; 1127 1125 1128 1126 LogFlowFunc (("ipcId='%s', finishSem=%p\n", ipcId.raw(), finishSem)); … … 1141 1139 { 1142 1140 /* store the answer */ 1143 data [2] = (void *)true;1141 data[2] = (void*)true; 1144 1142 /* signal we're done */ 1145 1143 int vrc = RTThreadUserSignal (Thread); 1146 AssertRC 1144 AssertRC(vrc); 1147 1145 1148 1146 /* wait until we're signaled to release the IPC mutex */ … … 1161 1159 1162 1160 /* store the answer */ 1163 data [1] = (void *)false;1161 data[1] = (void*)false; 1164 1162 /* signal we're done */ 1165 1163 int vrc = RTThreadUserSignal (Thread); 1166 AssertRC 1164 AssertRC(vrc); 1167 1165 1168 1166 LogFlowFuncLeave(); -
trunk/src/VBox/Main/SharedFolderImpl.cpp
r25860 r26186 209 209 210 210 /* Check whether the path is full (absolute) */ 211 char hostPathFull 211 char hostPathFull[RTPATH_MAX]; 212 212 int vrc = RTPathAbsEx(NULL, 213 213 hostPath.c_str(), … … 215 215 sizeof (hostPathFull)); 216 216 if (RT_FAILURE(vrc)) 217 return setError (E_INVALIDARG, 218 tr ("Invalid shared folder path: '%s' (%Rrc)"), hostPath.raw(), vrc); 217 return setError(E_INVALIDARG, 218 tr("Invalid shared folder path: '%s' (%Rrc)"), 219 hostPath.raw(), vrc); 219 220 220 221 if (RTPathCompare(hostPath.c_str(), hostPathFull) != 0) 221 return setError (E_INVALIDARG, 222 tr ("Shared folder path '%s' is not absolute"), hostPath.raw()); 222 return setError(E_INVALIDARG, 223 tr("Shared folder path '%s' is not absolute"), 224 hostPath.raw()); 223 225 224 226 unconst(mParent) = aParent; -
trunk/src/VBox/Main/SnapshotImpl.cpp
r26167 r26186 106 106 HRESULT Snapshot::FinalConstruct() 107 107 { 108 LogFlowMember 108 LogFlowMember(("Snapshot::FinalConstruct()\n")); 109 109 return S_OK; 110 110 } … … 112 112 void Snapshot::FinalRelease() 113 113 { 114 LogFlowMember 114 LogFlowMember(("Snapshot::FinalRelease()\n")); 115 115 uninit(); 116 116 } … … 136 136 LogFlowMember(("Snapshot::init(uuid: %s, aParent->uuid=%s)\n", aId.toString().c_str(), (aParent) ? aParent->m->uuid.toString().c_str() : "")); 137 137 138 ComAssertRet 138 ComAssertRet(!aId.isEmpty() && !aName.isEmpty() && aMachine, E_INVALIDARG); 139 139 140 140 /* Enclose the state transition NotReady->InInit->Ready */ … … 174 174 void Snapshot::uninit() 175 175 { 176 LogFlowMember 176 LogFlowMember(("Snapshot::uninit()\n")); 177 177 178 178 /* Enclose the state transition Ready->InUninit->NotReady */ … … 310 310 //////////////////////////////////////////////////////////////////////////////// 311 311 312 STDMETHODIMP Snapshot::COMGETTER(Id) 312 STDMETHODIMP Snapshot::COMGETTER(Id)(BSTR *aId) 313 313 { 314 314 CheckComArgOutPointerValid(aId); … … 323 323 } 324 324 325 STDMETHODIMP Snapshot::COMGETTER(Name) 325 STDMETHODIMP Snapshot::COMGETTER(Name)(BSTR *aName) 326 326 { 327 327 CheckComArgOutPointerValid(aName); … … 363 363 } 364 364 365 STDMETHODIMP Snapshot::COMGETTER(Description) 365 STDMETHODIMP Snapshot::COMGETTER(Description)(BSTR *aDescription) 366 366 { 367 367 CheckComArgOutPointerValid(aDescription); … … 376 376 } 377 377 378 STDMETHODIMP Snapshot::COMSETTER(Description) 378 STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription) 379 379 { 380 380 CheckComArgNotNull(aDescription); … … 399 399 } 400 400 401 STDMETHODIMP Snapshot::COMGETTER(TimeStamp) 401 STDMETHODIMP Snapshot::COMGETTER(TimeStamp)(LONG64 *aTimeStamp) 402 402 { 403 403 CheckComArgOutPointerValid(aTimeStamp); … … 425 425 } 426 426 427 STDMETHODIMP Snapshot::COMGETTER(Machine) 427 STDMETHODIMP Snapshot::COMGETTER(Machine)(IMachine **aMachine) 428 428 { 429 429 CheckComArgOutPointerValid(aMachine); … … 438 438 } 439 439 440 STDMETHODIMP Snapshot::COMGETTER(Parent) 440 STDMETHODIMP Snapshot::COMGETTER(Parent)(ISnapshot **aParent) 441 441 { 442 442 CheckComArgOutPointerValid(aParent); … … 451 451 } 452 452 453 STDMETHODIMP Snapshot::COMGETTER(Children) 453 STDMETHODIMP Snapshot::COMGETTER(Children)(ComSafeArrayOut(ISnapshot *, aChildren)) 454 454 { 455 455 CheckComArgOutSafeArrayPointerValid(aChildren); … … 816 816 LogFlowThisFunc(("mName={%ls}\n", aSessionMachine->mUserData->mName.raw())); 817 817 818 AssertReturn(aSessionMachine && !Guid 818 AssertReturn(aSessionMachine && !Guid(aSnapshotId).isEmpty(), E_INVALIDARG); 819 819 820 820 /* Enclose the state transition NotReady->InInit->Ready */ … … 832 832 833 833 /* take the pointer to Data to share */ 834 mData.share 834 mData.share(mPeer->mData); 835 835 836 836 /* take the pointer to UserData to share (our UserData must always be the 837 837 * same as Machine's data) */ 838 mUserData.share 838 mUserData.share(mPeer->mUserData); 839 839 /* make a private copy of all other data (recent changes from SessionMachine) */ 840 mHWData.attachCopy 840 mHWData.attachCopy(aSessionMachine->mHWData); 841 841 mMediaData.attachCopy(aSessionMachine->mMediaData); 842 842 … … 855 855 ComObjPtr<SharedFolder> folder; 856 856 folder.createObject(); 857 rc = folder->initCopy 857 rc = folder->initCopy(this, *it); 858 858 if (FAILED(rc)) return rc; 859 859 *it = folder; … … 885 885 ComObjPtr<StorageController> ctrl; 886 886 ctrl.createObject(); 887 ctrl->initCopy 887 ctrl->initCopy(this, *it); 888 888 mStorageControllers->push_back(ctrl); 889 889 } … … 892 892 893 893 unconst(mBIOSSettings).createObject(); 894 mBIOSSettings->initCopy 894 mBIOSSettings->initCopy(this, mPeer->mBIOSSettings); 895 895 896 896 #ifdef VBOX_WITH_VRDP 897 897 unconst(mVRDPServer).createObject(); 898 mVRDPServer->initCopy 898 mVRDPServer->initCopy(this, mPeer->mVRDPServer); 899 899 #endif 900 900 901 901 unconst(mAudioAdapter).createObject(); 902 mAudioAdapter->initCopy 902 mAudioAdapter->initCopy(this, mPeer->mAudioAdapter); 903 903 904 904 unconst(mUSBController).createObject(); 905 905 mUSBController->initCopy(this, mPeer->mUSBController); 906 906 907 for (ULONG slot = 0; slot < RT_ELEMENTS 907 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) 908 908 { 909 909 unconst(mNetworkAdapters[slot]).createObject(); 910 mNetworkAdapters[slot]->initCopy (this, mPeer->mNetworkAdapters[slot]);911 } 912 913 for (ULONG slot = 0; slot < RT_ELEMENTS 914 { 915 unconst(mSerialPorts 916 mSerialPorts[slot]->initCopy 917 } 918 919 for (ULONG slot = 0; slot < RT_ELEMENTS 910 mNetworkAdapters[slot]->initCopy(this, mPeer->mNetworkAdapters[slot]); 911 } 912 913 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 914 { 915 unconst(mSerialPorts[slot]).createObject(); 916 mSerialPorts[slot]->initCopy(this, mPeer->mSerialPorts[slot]); 917 } 918 919 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 920 920 { 921 921 unconst(mParallelPorts[slot]).createObject(); 922 mParallelPorts[slot]->initCopy 922 mParallelPorts[slot]->initCopy(this, mPeer->mParallelPorts[slot]); 923 923 } 924 924 … … 967 967 968 968 /* take the pointer to Data to share */ 969 mData.share 969 mData.share(mPeer->mData); 970 970 /* 971 971 * take the pointer to UserData to share 972 972 * (our UserData must always be the same as Machine's data) 973 973 */ 974 mUserData.share 974 mUserData.share(mPeer->mUserData); 975 975 /* allocate private copies of all other data (will be loaded from settings) */ 976 976 mHWData.allocate(); … … 1079 1079 * @note Locks this object for writing. 1080 1080 */ 1081 HRESULT SnapshotMachine::onSnapshotChange 1081 HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot) 1082 1082 { 1083 1083 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1538 1538 1539 1539 AutoCaller autoCaller(this); 1540 AssertComRCReturn 1540 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1541 1541 1542 1542 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1952 1952 1953 1953 AutoCaller autoCaller(this); 1954 AssertComRCReturn 1954 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1955 1955 1956 1956 /* saveSettings() needs mParent lock */ … … 2208 2208 /* The below assert would be nice but I don't want to move 2209 2209 * Medium::MergeChain to the header just for that 2210 * Assert 2210 * Assert(!chain->isForward()); */ 2211 2211 2212 2212 // prepareDiscard() should have raised an error already -
trunk/src/VBox/Main/StorageControllerImpl.cpp
r26171 r26186 123 123 if ( (aStorageBus <= StorageBus_Null) 124 124 || (aStorageBus > StorageBus_SAS)) 125 return setError 126 tr("Invalid storage connection type"));125 return setError(E_INVALIDARG, 126 tr("Invalid storage connection type")); 127 127 128 128 /* Enclose the state transition NotReady->InInit->Ready */ … … 137 137 /* register with parent early, since uninit() will unconditionally 138 138 * unregister on failure */ 139 m->pParent->addDependentChild 139 m->pParent->addDependentChild(this); 140 140 141 141 m->bd.allocate(); … … 211 211 /* register with parent early, since uninit() will unconditionally 212 212 * unregister on failure */ 213 m->pParent->addDependentChild 213 m->pParent->addDependentChild(this); 214 214 215 215 /* sanity */ … … 258 258 /* m->pPeer is left null */ 259 259 260 m->pParent->addDependentChild 261 262 AutoCaller thatCaller 260 m->pParent->addDependentChild(this); 261 262 AutoCaller thatCaller(aThat); 263 263 AssertComRCReturnRC(thatCaller.rc()); 264 264 265 265 AutoReadLock thatlock(aThat COMMA_LOCKVAL_SRC_POS); 266 m->bd.attachCopy 266 m->bd.attachCopy(aThat->m->bd); 267 267 268 268 /* Confirm a successful initialization */ … … 288 288 m->bd.free(); 289 289 290 m->pParent->removeDependentChild 290 m->pParent->removeDependentChild(this); 291 291 292 292 unconst(m->pPeer).setNull(); … … 494 494 /* AHCI SATA supports a maximum of 30 ports. */ 495 495 if ((aPortCount < 1) || (aPortCount > 30)) 496 return setError 497 tr("Invalid port count: %lu (must be in range [%lu, %lu])"),498 aPortCount, 1, 30);496 return setError(E_INVALIDARG, 497 tr("Invalid port count: %lu (must be in range [%lu, %lu])"), 498 aPortCount, 1, 30); 499 499 break; 500 500 } … … 508 508 */ 509 509 if (aPortCount != 16) 510 return setError 511 tr("Invalid port count: %lu (must be in range [%lu, %lu])"),512 aPortCount, 16, 16);510 return setError(E_INVALIDARG, 511 tr("Invalid port count: %lu (must be in range [%lu, %lu])"), 512 aPortCount, 16, 16); 513 513 break; 514 514 } … … 519 519 */ 520 520 if (aPortCount != 2) 521 return setError 522 tr("Invalid port count: %lu (must be in range [%lu, %lu])"),523 aPortCount, 2, 2);521 return setError(E_INVALIDARG, 522 tr("Invalid port count: %lu (must be in range [%lu, %lu])"), 523 aPortCount, 2, 2); 524 524 break; 525 525 } … … 531 531 */ 532 532 if (aPortCount != 1) 533 return setError 534 tr("Invalid port count: %lu (must be in range [%lu, %lu])"),535 aPortCount, 1, 1);533 return setError(E_INVALIDARG, 534 tr("Invalid port count: %lu (must be in range [%lu, %lu])"), 535 aPortCount, 1, 1); 536 536 break; 537 537 } … … 542 542 */ 543 543 if (aPortCount != 8) 544 return setError 545 tr("Invalid port count: %lu (must be in range [%lu, %lu])"),546 aPortCount, 8, 8);544 return setError(E_INVALIDARG, 545 tr("Invalid port count: %lu (must be in range [%lu, %lu])"), 546 aPortCount, 8, 8); 547 547 break; 548 548 } … … 617 617 618 618 if (m->bd->mStorageControllerType != StorageControllerType_IntelAhci) 619 return setError 620 tr("Invalid controller type"));619 return setError(E_NOTIMPL, 620 tr("Invalid controller type")); 621 621 622 622 switch (DevicePosition) … … 652 652 653 653 if (m->bd->mStorageControllerType != StorageControllerType_IntelAhci) 654 return setError 655 tr("Invalid controller type"));654 return setError(E_NOTIMPL, 655 tr("Invalid controller type")); 656 656 657 657 if ((aPortNumber < 0) || (aPortNumber >= 30)) 658 return setError 659 tr("Invalid port number: %l (must be in range [%lu, %lu])"),660 aPortNumber, 0, 29);658 return setError(E_INVALIDARG, 659 tr("Invalid port number: %l (must be in range [%lu, %lu])"), 660 aPortNumber, 0, 29); 661 661 662 662 switch (DevicePosition) -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r25860 r26186 97 97 /// free in structures returned by VDBackendInfo. Must be fixed ASAP! 98 98 99 VDBACKENDINFO aVDInfo 99 VDBACKENDINFO aVDInfo[100]; 100 100 unsigned cEntries; 101 int vrc = VDBackendInfo 102 AssertRC 101 int vrc = VDBackendInfo(RT_ELEMENTS (aVDInfo), aVDInfo, &cEntries); 102 AssertRC(vrc); 103 103 if (RT_SUCCESS(vrc)) 104 104 { … … 109 109 if (FAILED(rc)) break; 110 110 111 rc = hdf->init (&aVDInfo[i]);111 rc = hdf->init(&aVDInfo[i]); 112 112 if (FAILED(rc)) break; 113 113 114 mMediumFormats.push_back 114 mMediumFormats.push_back(hdf); 115 115 } 116 116 } -
trunk/src/VBox/Main/USBControllerImpl.cpp
r26171 r26186 560 560 561 561 if (!m->llDeviceFilters->size()) 562 return setError 563 tr("The USB device filter list is empty"));562 return setError(E_INVALIDARG, 563 tr("The USB device filter list is empty")); 564 564 565 565 if (aPosition >= m->llDeviceFilters->size()) 566 return setError 567 tr("Invalid position: %lu (must be in range [0, %lu])"),568 aPosition, m->llDeviceFilters->size() - 1);566 return setError(E_INVALIDARG, 567 tr("Invalid position: %lu (must be in range [0, %lu])"), 568 aPosition, m->llDeviceFilters->size() - 1); 569 569 570 570 /* backup the list before modification */ -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r25939 r26186 63 63 if (mObjectLock) 64 64 delete mObjectLock; 65 Assert 66 Assert 65 Assert(mInitUninitWaiters == 0); 66 Assert(mInitUninitSem == NIL_RTSEMEVENTMULTI); 67 67 if (mZeroCallersSem != NIL_RTSEMEVENT) 68 68 RTSemEventDestroy (mZeroCallersSem); … … 217 217 { 218 218 RTSemEventMultiCreate (&mInitUninitSem); 219 Assert 219 Assert(mInitUninitWaiters == 0); 220 220 } 221 221 … … 242 242 else 243 243 { 244 Assert 244 Assert(mCallers != 0); 245 245 -- mCallers; 246 246 if (mCallers == 0 && mState == InUninit) … … 272 272 { 273 273 /* if Ready or Limited, decrease the number of callers */ 274 AssertMsgReturn 275 -- 274 AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0); 275 --mCallers; 276 276 277 277 return; … … 291 291 /* the caller is being released after AutoUninitSpan or 292 292 * AutoMayUninitSpan has begun */ 293 AssertMsgReturn 294 -- 293 AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0); 294 --mCallers; 295 295 296 296 if (mCallers == 0) 297 {298 297 /* inform the Auto*UninitSpan ctor there are no more callers */ 299 RTSemEventSignal (mZeroCallersSem); 300 } 298 RTSemEventSignal(mZeroCallersSem); 301 299 302 300 return; … … 600 598 * something else but set error info. */ 601 599 mRC = mObj->addCaller(); 602 Assert(FAILED 600 Assert(FAILED(mRC)); 603 601 return; 604 602 } … … 634 632 { 635 633 /* if we did nothing in the constructor, do nothing here */ 636 if (mAlreadyInProgress || FAILED 634 if (mAlreadyInProgress || FAILED(mRC)) 637 635 return; 638 636 … … 730 728 bool VirtualBoxSupportTranslationBase::cutClassNameFrom__PRETTY_FUNCTION__ (char *fn) 731 729 { 732 Assert 730 Assert(fn); 733 731 if (!fn) 734 732 return false; … … 752 750 #endif 753 751 754 char *start = strstr 755 Assert 752 char *start = strstr(fn, START); 753 Assert(start); 756 754 if (start) 757 755 { 758 start += sizeof 759 char *end = strstr 760 Assert 756 start += sizeof(START) - 1; 757 char *end = strstr(start, END); 758 Assert(end && (end > start)); 761 759 if (end && (end > start)) 762 760 { 763 761 size_t len = end - start; 764 memmove 765 fn 762 memmove(fn, start, len); 763 fn[len] = 0; 766 764 return true; 767 765 } … … 827 825 828 826 /* these are mandatory, others -- not */ 829 AssertReturn((!aWarning && FAILED 827 AssertReturn((!aWarning && FAILED(aResultCode)) || 830 828 (aWarning && aResultCode != S_OK), 831 829 E_FAIL); … … 854 852 if (FAILED(rc)) break; 855 853 rc = err.queryInterfaceTo(curInfo.asOutParam()); 856 if (FAILED 854 if (FAILED(rc)) 857 855 { 858 856 /* create a IVirtualBoxErrorInfo wrapper for the native … … 869 867 } 870 868 /* On failure, curInfo will stay null */ 871 Assert 869 Assert(SUCCEEDED(rc) || curInfo.isNull()); 872 870 873 871 /* set the current error info and preserve the previous one if any */ … … 913 911 } 914 912 /* On failure, curInfo will stay null */ 915 Assert 913 Assert(SUCCEEDED(rc) || curInfo.isNull()); 916 914 917 915 /* set the current error info and preserve the previous one if any */ … … 991 989 DependentChildren::iterator it = mDependentChildren.begin(); 992 990 ComPtr<IUnknown> unk = it->first; 993 Assert 991 Assert(!unk.isNull()); 994 992 995 993 VirtualBoxBase *child = it->second; … … 1003 1001 * uninit() call will wait until the first one has done so 1004 1002 * (thanks to AutoUninitSpan). */ 1005 Assert 1003 Assert(child); 1006 1004 if (child) 1007 1005 child->uninit(); … … 1017 1015 mDependentChildren.erase (it); 1018 1016 1019 Assert 1017 Assert(count == mDependentChildren.size()); 1020 1018 } 1021 1019 } -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r26156 r26186 314 314 int vrc = com::GetVBoxUserHomeDirectory(szHomeDir, sizeof(szHomeDir)); 315 315 if (RT_FAILURE(vrc)) 316 return setError (E_FAIL, 317 tr ("Could not create the VirtualBox home directory '%s'" 318 "(%Rrc)"), 319 szHomeDir, vrc); 316 return setError(E_FAIL, 317 tr("Could not create the VirtualBox home directory '%s' (%Rrc)"), 318 szHomeDir, vrc); 320 319 321 320 unconst(m->strHomeDir) = szHomeDir; … … 380 379 if (SUCCEEDED(rc)) 381 380 { 382 rc = guestOSTypeObj->init(Global::sOSTypes 383 Global::sOSTypes 384 Global::sOSTypes 385 Global::sOSTypes 386 Global::sOSTypes 387 Global::sOSTypes 388 Global::sOSTypes 389 Global::sOSTypes 390 Global::sOSTypes 391 Global::sOSTypes 392 Global::sOSTypes 381 rc = guestOSTypeObj->init(Global::sOSTypes[i].familyId, 382 Global::sOSTypes[i].familyDescription, 383 Global::sOSTypes[i].id, 384 Global::sOSTypes[i].description, 385 Global::sOSTypes[i].osType, 386 Global::sOSTypes[i].osHint, 387 Global::sOSTypes[i].recommendedRAM, 388 Global::sOSTypes[i].recommendedVRAM, 389 Global::sOSTypes[i].recommendedHDD, 390 Global::sOSTypes[i].networkAdapterType, 391 Global::sOSTypes[i].numSerialEnabled); 393 392 if (SUCCEEDED(rc)) 394 393 m->ollGuestOSTypes.addChild(guestOSTypeObj); … … 456 455 RTTHREADFLAGS_WAITABLE, 457 456 "Watcher"); 458 ComAssertRC 457 ComAssertRC(vrc); 459 458 if (RT_FAILURE(vrc)) 460 459 rc = E_FAIL; … … 887 886 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 888 887 889 return setError 888 return setError(E_NOTIMPL, "Not yet implemented"); 890 889 } 891 890 … … 1365 1364 imageId = Guid(aImageId); 1366 1365 if (imageId.isEmpty()) 1367 return setError (E_INVALIDARG, tr("Argument %s is empty"), "aImageId");1366 return setError(E_INVALIDARG, tr("Argument %s is empty"), "aImageId"); 1368 1367 } 1369 1368 if (aSetParentId) … … 1624 1623 for (size_t i = 0; i < RT_ELEMENTS (kOldNewIDs) / 2; i += 2) 1625 1624 { 1626 if (id == kOldNewIDs 1627 { 1628 id = kOldNewIDs 1625 if (id == kOldNewIDs[i]) 1626 { 1627 id = kOldNewIDs[i + 1]; 1629 1628 break; 1630 1629 } … … 1648 1647 1649 1648 return (*aType) ? S_OK : 1650 setError 1651 tr("'%ls' is not a valid Guest OS type"),1652 aId);1649 setError(E_INVALIDARG, 1650 tr("'%ls' is not a valid Guest OS type"), 1651 aId); 1653 1652 } 1654 1653 … … 1661 1660 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1662 1661 1663 return setError 1662 return setError(E_NOTIMPL, "Not yet implemented"); 1664 1663 } 1665 1664 … … 1671 1670 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1672 1671 1673 return setError 1672 return setError(E_NOTIMPL, "Not yet implemented"); 1674 1673 } 1675 1674 … … 1830 1829 1831 1830 if (state != SessionState_Closed) 1832 return setError 1833 tr("The given session is already open or being opened"));1831 return setError(VBOX_E_INVALID_OBJECT_STATE, 1832 tr("The given session is already open or being opened")); 1834 1833 1835 1834 /* get the IInternalSessionControl interface */ … … 1886 1885 1887 1886 if (state != SessionState_Closed) 1888 return setError 1889 tr("The given session is already open or being opened"));1887 return setError(VBOX_E_INVALID_OBJECT_STATE, 1888 tr("The given session is already open or being opened")); 1890 1889 1891 1890 /* get the IInternalSessionControl interface */ … … 1940 1939 1941 1940 if (state != SessionState_Closed) 1942 return setError 1943 tr("The given session is already open or being opened"));1941 return setError(VBOX_E_INVALID_OBJECT_STATE, 1942 tr("The given session is already open or being opened")); 1944 1943 1945 1944 /* get the IInternalSessionControl interface */ … … 2271 2270 2272 2271 /* get the path to the executable */ 2273 char exePathBuf 2272 char exePathBuf[RTPATH_MAX]; 2274 2273 char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX); 2275 2274 ComAssertBreak (exePath, E_FAIL); … … 2307 2306 * (pressing the Cancel button to close the Run As dialog) */ 2308 2307 if (vrc2 == VERR_CANCELLED) 2309 rc = setError 2310 tr("Operation cancelled by the user"));2308 rc = setError(E_FAIL, 2309 tr("Operation cancelled by the user")); 2311 2310 else 2312 rc = setError 2313 tr("Could not launch a privileged process '%s' (%Rrc)"),2314 exePath, vrc2);2311 rc = setError(E_FAIL, 2312 tr("Could not launch a privileged process '%s' (%Rrc)"), 2313 exePath, vrc2); 2315 2314 break; 2316 2315 } … … 2322 2321 if (RT_FAILURE(vrc)) 2323 2322 { 2324 rc = setError 2325 tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc);2323 rc = setError(E_FAIL, 2324 tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc); 2326 2325 break; 2327 2326 } … … 2346 2345 if (SUCCEEDED(rc) && RT_FAILURE(vrc)) 2347 2346 { 2348 rc = setError 2349 tr("Could not operate the communication channel (%Rrc)"), vrc);2347 rc = setError(E_FAIL, 2348 tr("Could not operate the communication channel (%Rrc)"), vrc); 2350 2349 break; 2351 2350 } … … 2353 2352 while (0); 2354 2353 2355 if (FAILED 2354 if (FAILED(rc) && !userFuncCalled) 2356 2355 { 2357 2356 /* call the user function in the "cleanup only" mode … … 2499 2498 HRESULT rc = (*it++)->OnExtraDataCanChange (id, aKey, aValue, 2500 2499 aError.asOutParam(), &allowChange); 2501 if (FAILED 2500 if (FAILED(rc)) 2502 2501 { 2503 2502 /* if a call to this method fails for some reason (for ex., because … … 2978 2977 int vrc = calculateFullPath(Utf8Str(aLocation), location); 2979 2978 if (RT_FAILURE(vrc)) 2980 return setError 2981 tr("Invalid image file location '%ls' (%Rrc)"),2982 aLocation, vrc);2979 return setError(VBOX_E_FILE_ERROR, 2980 tr("Invalid image file location '%ls' (%Rrc)"), 2981 aLocation, vrc); 2983 2982 } 2984 2983 … … 3869 3868 { 3870 3869 /* spawned VM process has terminated (normally or abnormally) */ 3871 (spawnedMachines 3870 (spawnedMachines[rc - WAIT_OBJECT_0 - cnt - 1])-> 3872 3871 checkForSpawnFailure(); 3873 3872 update = true; … … 3945 3944 /* close old process handles */ 3946 3945 for (size_t i = 1 + cnt; i < 1 + cnt + cntSpawned; ++ i) 3947 CloseHandle (handles 3946 CloseHandle (handles[i]); 3948 3947 3949 3948 /* release sets of machines if any */ … … 3958 3957 3959 3958 /* according to PMREF, 64 is the maximum for the muxwait list */ 3960 SEMRECORD handles 3959 SEMRECORD handles[64]; 3961 3960 3962 3961 HMUX muxSem = NULLHANDLE; … … 4008 4007 { 4009 4008 /* machine mutex is normally released */ 4010 Assert 4009 Assert(semId >= 0 && semId < cnt); 4011 4010 if (semId >= 0 && semId < cnt) 4012 4011 { … … 4031 4030 PID pid; TID tid; 4032 4031 unsigned long reqCnt; 4033 arc = DosQueryMutexSem ((HMTX) handles [i].hsemCur, &pid, 4034 &tid, &reqCnt); 4032 arc = DosQueryMutexSem((HMTX)handles[i].hsemCur, &pid, &tid, &reqCnt); 4035 4033 if (arc == ERROR_SEM_OWNER_DIED) 4036 4034 { 4037 4035 /* close the dead mutex as asked by PMREF */ 4038 ::DosCloseMutexSem ((HMTX) handles[i].hsemCur);4039 4040 Assert 4036 ::DosCloseMutexSem((HMTX)handles[i].hsemCur); 4037 4038 Assert(i >= 0 && i < cnt); 4041 4039 if (i >= 0 && i < cnt) 4042 4040 { … … 4063 4061 { 4064 4062 for (size_t i = 0; i < cntSpawned; ++ i) 4065 updateSpawned |= (spawnedMachines 4063 updateSpawned |= (spawnedMachines[i])-> 4066 4064 checkForSpawnFailure(); 4067 4065 } … … 4217 4215 update = false; 4218 4216 for (size_t i = 0; i < cnt; ++ i) 4219 update |= (machines 4217 update |= (machines[i])->checkForDeath(); 4220 4218 4221 4219 updateSpawned = false; 4222 4220 for (size_t i = 0; i < cntSpawned; ++ i) 4223 updateSpawned |= (spawnedMachines 4221 updateSpawned |= (spawnedMachines[i])->checkForSpawnFailure(); 4224 4222 4225 4223 /* reap child processes */ … … 4470 4468 { 4471 4469 rc = saveSettings(); 4472 if (FAILED 4470 if (FAILED(rc)) 4473 4471 unregisterDHCPServer(aDHCPServer, false /* aSaveRegistry */); 4474 4472 } … … 4512 4510 { 4513 4511 rc = saveSettings(); 4514 if (FAILED 4512 if (FAILED(rc)) 4515 4513 registerDHCPServer(aDHCPServer, false /* aSaveRegistry */); 4516 4514 } -
trunk/src/VBox/Main/generic/NetIf-generic.cpp
r26177 r26186 231 231 Bstr ifname; 232 232 ComPtr<IHostNetworkInterface> iface; 233 if (FAILED 233 if (FAILED(host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam()))) 234 234 return VERR_INVALID_PARAMETER; 235 iface->COMGETTER 235 iface->COMGETTER(Name) (ifname.asOutParam()); 236 236 if (ifname.isNull()) 237 237 return VERR_INTERNAL_ERROR; -
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r21878 r26186 145 145 void ErrorInfo::init (IUnknown *aI, const GUID &aIID, bool aKeepObj /* = false */) 146 146 { 147 Assert 147 Assert(aI); 148 148 if (!aI) 149 149 return; … … 210 210 { 211 211 mNext.reset (new ErrorInfo (next)); 212 Assert 212 Assert(mNext.get()); 213 213 if (!mNext.get()) 214 214 rc = E_OUTOFMEMORY; … … 235 235 ErrorInfo (false /* aDummy */) 236 236 { 237 Assert 237 Assert(progress); 238 238 if (!progress) 239 239 return; -
trunk/src/VBox/Main/glue/EventQueue.cpp
r23128 r26186 485 485 BOOL EventQueue::waitForEvent (Event **event) 486 486 { 487 Assert 487 Assert(event); 488 488 if (!event) 489 489 return FALSE; … … 518 518 rc = mEventQ->WaitForEvent (&ev); 519 519 // check for error 520 if (FAILED 520 if (FAILED(rc)) 521 521 return FALSE; 522 522 // check for EINTR signal … … 545 545 BOOL EventQueue::handleEvent (Event *event) 546 546 { 547 Assert 547 Assert(event); 548 548 if (!event) 549 549 return FALSE; -
trunk/src/VBox/Main/glue/SupportErrorInfo.cpp
r26177 r26186 50 50 { 51 51 sCounter = RTTlsAlloc(); 52 AssertReturnVoid 52 AssertReturnVoid(sCounter != NIL_RTTLS); 53 53 } 54 54 55 uintptr_t counter = (uintptr_t) RTTlsGet(sCounter);56 ++ 57 RTTlsSet (sCounter, (void *)counter);55 uintptr_t counter = (uintptr_t)RTTlsGet(sCounter); 56 ++counter; 57 RTTlsSet(sCounter, (void*)counter); 58 58 } 59 59 … … 61 61 void MultiResult::decCounter() 62 62 { 63 uintptr_t counter = (uintptr_t) RTTlsGet(sCounter);64 AssertReturnVoid 65 -- 66 RTTlsSet (sCounter, (void *)counter);63 uintptr_t counter = (uintptr_t)RTTlsGet(sCounter); 64 AssertReturnVoid(counter != 0); 65 --counter; 66 RTTlsSet(sCounter, (void*)counter); 67 67 } 68 68 … … 106 106 { 107 107 /* whether multi-error mode is turned on */ 108 bool preserve = ((uintptr_t) RTTlsGet(MultiResult::sCounter)) > 0;108 bool preserve = ((uintptr_t)RTTlsGet(MultiResult::sCounter)) > 0; 109 109 110 110 LogRel(("ERROR [COM]: aRC=%#08x aIID={%RTuuid} aComponent={%s} aText={%s} aWarning=%RTbool, aInfo=%p, preserve=%RTbool\n", … … 120 120 { 121 121 /* these are mandatory, others -- not */ 122 AssertReturn((!aWarning && FAILED 122 AssertReturn((!aWarning && FAILED(aResultCode)) || 123 123 (aWarning && aResultCode != S_OK), 124 124 E_FAIL); … … 143 143 /* get the current error info if any */ 144 144 ComPtr<IErrorInfo> err; 145 rc = ::GetErrorInfo 145 rc = ::GetErrorInfo(0, err.asOutParam()); 146 146 if (FAILED(rc)) break; 147 147 rc = err.queryInterfaceTo(curInfo.asOutParam()); 148 if (FAILED 148 if (FAILED(rc)) 149 149 { 150 150 /* create a IVirtualBoxErrorInfo wrapper for the native … … 154 154 if (SUCCEEDED(rc)) 155 155 { 156 rc = wrapper->init 156 rc = wrapper->init(err); 157 157 if (SUCCEEDED(rc)) 158 158 curInfo = wrapper; … … 176 176 if (FAILED(rc)) break; 177 177 178 rc = infoObj->init 178 rc = infoObj->init(aInfo, curInfo); 179 179 if (FAILED(rc)) break; 180 180 … … 183 183 184 184 /* we want to return the head's result code */ 185 rc = info->COMGETTER(ResultCode) 185 rc = info->COMGETTER(ResultCode)(&aResultCode); 186 186 if (FAILED(rc)) break; 187 187 } … … 192 192 if (FAILED(rc)) break; 193 193 194 rc = infoObj->init 194 rc = infoObj->init(aResultCode, aIID, aComponent, strText.c_str(), curInfo); 195 195 if (FAILED(rc)) break; 196 196 … … 201 201 rc = info.queryInterfaceTo(err.asOutParam()); 202 202 if (SUCCEEDED(rc)) 203 rc = ::SetErrorInfo 203 rc = ::SetErrorInfo(0, err); 204 204 205 205 #else // !defined (VBOX_WITH_XPCOM) 206 206 207 207 nsCOMPtr <nsIExceptionService> es; 208 es = do_GetService 208 es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 209 209 if (NS_SUCCEEDED(rc)) 210 210 { 211 211 nsCOMPtr <nsIExceptionManager> em; 212 rc = es->GetCurrentExceptionManager (getter_AddRefs(em));212 rc = es->GetCurrentExceptionManager(getter_AddRefs(em)); 213 213 if (FAILED(rc)) break; 214 214 … … 218 218 /* get the current error info if any */ 219 219 ComPtr<nsIException> ex; 220 rc = em->GetCurrentException 220 rc = em->GetCurrentException(ex.asOutParam()); 221 221 if (FAILED(rc)) break; 222 222 rc = ex.queryInterfaceTo(curInfo.asOutParam()); 223 if (FAILED 223 if (FAILED(rc)) 224 224 { 225 225 /* create a IVirtualBoxErrorInfo wrapper for the native … … 229 229 if (SUCCEEDED(rc)) 230 230 { 231 rc = wrapper->init 231 rc = wrapper->init(ex); 232 232 if (SUCCEEDED(rc)) 233 233 curInfo = wrapper; … … 236 236 } 237 237 /* On failure, curInfo will stay null */ 238 Assert 238 Assert(SUCCEEDED(rc) || curInfo.isNull()); 239 239 240 240 /* set the current error info and preserve the previous one if any */ … … 251 251 if (FAILED(rc)) break; 252 252 253 rc = infoObj->init 253 rc = infoObj->init(aInfo, curInfo); 254 254 if (FAILED(rc)) break; 255 255 … … 259 259 /* we want to return the head's result code */ 260 260 PRInt32 lrc; 261 rc = info->COMGETTER(ResultCode) 261 rc = info->COMGETTER(ResultCode)(&lrc); aResultCode = lrc; 262 262 if (FAILED(rc)) break; 263 263 } … … 277 277 rc = info.queryInterfaceTo(ex.asOutParam()); 278 278 if (SUCCEEDED(rc)) 279 rc = em->SetCurrentException 279 rc = em->SetCurrentException(ex); 280 280 } 281 281 else if (rc == NS_ERROR_UNEXPECTED) … … 301 301 while (0); 302 302 303 AssertComRC 303 AssertComRC(rc); 304 304 305 305 return SUCCEEDED(rc) ? aResultCode : rc; … … 307 307 308 308 /* static */ 309 HRESULT SupportErrorInfoBase::setError 310 311 312 { 313 va_list args; 314 va_start 315 HRESULT rc = setErrorV 316 va_end 309 HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const GUID &aIID, 310 const char *aComponent, const char *aText, 311 ...) 312 { 313 va_list args; 314 va_start(args, aText); 315 HRESULT rc = setErrorV(aResultCode, aIID, aComponent, aText, args); 316 va_end(args); 317 317 return rc; 318 318 } 319 319 320 320 /* static */ 321 HRESULT SupportErrorInfoBase::setWarning 322 323 324 { 325 va_list args; 326 va_start 327 HRESULT rc = setWarningV 328 va_end 329 return rc; 330 } 331 332 HRESULT SupportErrorInfoBase::setError 333 { 334 va_list args; 335 va_start 336 HRESULT rc = setErrorV 337 338 va_end 339 return rc; 340 } 341 342 HRESULT SupportErrorInfoBase::setError 321 HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const GUID &aIID, 322 const char *aComponent, const char *aText, 323 ...) 324 { 325 va_list args; 326 va_start(args, aText); 327 HRESULT rc = setWarningV(aResultCode, aIID, aComponent, aText, args); 328 va_end(args); 329 return rc; 330 } 331 332 HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const char *aText, ...) 333 { 334 va_list args; 335 va_start(args, aText); 336 HRESULT rc = setErrorV(aResultCode, mainInterfaceID(), componentName(), 337 aText, args); 338 va_end(args); 339 return rc; 340 } 341 342 HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const Utf8Str &strText) 343 343 { 344 344 HRESULT rc = setError(aResultCode, … … 349 349 } 350 350 351 HRESULT SupportErrorInfoBase::setWarning 352 { 353 va_list args; 354 va_start 355 HRESULT rc = setWarningV 356 357 va_end 358 return rc; 359 } 360 361 HRESULT SupportErrorInfoBase::setError 362 363 { 364 va_list args; 365 va_start 366 HRESULT rc = setErrorV 367 va_end 368 return rc; 369 } 370 371 HRESULT SupportErrorInfoBase::setWarning 372 373 { 374 va_list args; 375 va_start 376 HRESULT rc = setWarningV 377 va_end 351 HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const char *aText, ...) 352 { 353 va_list args; 354 va_start(args, aText); 355 HRESULT rc = setWarningV(aResultCode, mainInterfaceID(), componentName(), 356 aText, args); 357 va_end(args); 358 return rc; 359 } 360 361 HRESULT SupportErrorInfoBase::setError(HRESULT aResultCode, const GUID &aIID, 362 const char *aText, ...) 363 { 364 va_list args; 365 va_start(args, aText); 366 HRESULT rc = setErrorV(aResultCode, aIID, componentName(), aText, args); 367 va_end(args); 368 return rc; 369 } 370 371 HRESULT SupportErrorInfoBase::setWarning(HRESULT aResultCode, const GUID &aIID, 372 const char *aText, ...) 373 { 374 va_list args; 375 va_start(args, aText); 376 HRESULT rc = setWarningV(aResultCode, aIID, componentName(), aText, args); 377 va_end(args); 378 378 return rc; 379 379 } -
trunk/src/VBox/Main/glue/initterm.cpp
r25942 r26186 444 444 /* Use RTPathAppPrivateArch() first */ 445 445 vrc = RTPathAppPrivateArch(szAppHomeDir, sizeof(szAppHomeDir)); 446 AssertRC 446 AssertRC(vrc); 447 447 } 448 448 else … … 450 450 /* Iterate over all other paths */ 451 451 szAppHomeDir[RTPATH_MAX - 1] = '\0'; 452 strncpy(szAppHomeDir, kAppPathsToProbe 452 strncpy(szAppHomeDir, kAppPathsToProbe[i], RTPATH_MAX - 1); 453 453 vrc = VINF_SUCCESS; 454 454 } -
trunk/src/VBox/Main/glue/string.cpp
r21588 r26186 77 77 }; 78 78 79 void Utf8StrFmt::init 79 void Utf8StrFmt::init(const char *format, va_list args) 80 80 { 81 81 if (!format) … … 83 83 84 84 // assume an extra byte for a terminating zero 85 size_t fmtlen = strlen 85 size_t fmtlen = strlen(format) + 1; 86 86 87 87 FormatData data; … … 90 90 data.size += fmtlen; 91 91 data.pos = 0; 92 data.cache = (char *) ::RTMemTmpAllocZ(data.size);92 data.cache = (char*)::RTMemTmpAllocZ(data.size); 93 93 94 size_t n = ::RTStrFormatV 94 size_t n = ::RTStrFormatV(strOutput, &data, NULL, NULL, format, args); 95 95 96 AssertMsg (n == data.pos, 97 ("The number of bytes formatted doesn't match: %d and %d!", 98 n, data.pos)); 99 NOREF (n); 96 AssertMsg(n == data.pos, 97 ("The number of bytes formatted doesn't match: %d and %d!", n, data.pos)); 98 NOREF(n); 100 99 101 100 // finalize formatting 102 data.cache 103 (*static_cast <Utf8Str *>(this)) = data.cache;104 ::RTMemTmpFree 101 data.cache[data.pos] = 0; 102 (*static_cast<Utf8Str*>(this)) = data.cache; 103 ::RTMemTmpFree(data.cache); 105 104 } 106 105 107 106 // static 108 DECLCALLBACK(size_t) Utf8StrFmt::strOutput 109 107 DECLCALLBACK(size_t) Utf8StrFmt::strOutput(void *pvArg, const char *pachChars, 108 size_t cbChars) 110 109 { 111 Assert 110 Assert(pvArg); 112 111 FormatData &data = *(FormatData *) pvArg; 113 112 114 113 if (!(pachChars == NULL && cbChars == 0)) 115 114 { 116 Assert 115 Assert(pachChars); 117 116 118 117 // append to cache (always assume an extra byte for a terminating zero) … … 123 122 if (needed >= FormatData::CacheIncrement) 124 123 data.size += needed; 125 data.cache = (char *) ::RTMemRealloc(data.cache, data.size);124 data.cache = (char*)::RTMemRealloc(data.cache, data.size); 126 125 } 127 strncpy 126 strncpy(data.cache + data.pos, pachChars, cbChars); 128 127 data.pos += cbChars; 129 128 } -
trunk/src/VBox/Main/hgcm/HGCMThread.cpp
r21878 r26186 194 194 pThread->m_fu32ThreadFlags &= ~HGCMMSG_TF_INITIALIZING; 195 195 rc = RTThreadUserSignal (ThreadSelf); 196 AssertRC 196 AssertRC(rc); 197 197 198 198 pThread->m_pfnThread (pThread->Handle (), pThread->m_pvUser); … … 300 300 /* Wait until the thread is ready. */ 301 301 rc = RTThreadUserWait (thread, 30000); 302 AssertRC 303 Assert 302 AssertRC(rc); 303 Assert(!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE(rc)); 304 304 } 305 305 else … … 484 484 485 485 /* Remove the message from the head of Queue list. */ 486 Assert 486 Assert(m_pMsgInputQueueHead->m_pPrev == NULL); 487 487 488 488 if (m_pMsgInputQueueHead->m_pNext) … … 493 493 else 494 494 { 495 Assert 495 Assert(m_pMsgInputQueueHead == m_pMsgInputQueueTail); 496 496 497 497 m_pMsgInputQueueHead = NULL; -
trunk/src/VBox/Main/include/AutoCaller.h
r25859 r26186 90 90 91 91 /** 92 * Returns |true| if |SUCCEEDED 92 * Returns |true| if |SUCCEEDED(rc())| is |true|, for convenience. 93 93 * |true| means the number of callers was successfully increased. 94 94 */ … … 245 245 * AssertReturn (autoInitSpan.isOk(), E_FAIL); 246 246 * ... 247 * if (FAILED 247 * if (FAILED(rc)) 248 248 * return rc; 249 249 * ... 250 * if (SUCCEEDED 250 * if (SUCCEEDED(rc)) 251 251 * autoInitSpan.setSucceeded(); 252 252 * return rc; … … 341 341 * AssertReturn (autoReinitSpan.isOk(), E_FAIL); 342 342 * ... 343 * if (FAILED 343 * if (FAILED(rc)) 344 344 * return rc; 345 345 * ... 346 * if (SUCCEEDED 346 * if (SUCCEEDED(rc)) 347 347 * autoReinitSpan.setSucceeded(); 348 348 * return rc; … … 478 478 * return S_OK; 479 479 * ... 480 * if (FAILED 480 * if (FAILED(rc)) 481 481 * return rc; // will go back to Ready 482 482 * ... 483 * if (SUCCEEDED 483 * if (SUCCEEDED(rc)) 484 484 * mayUninitSpan.acceptUninit(); // will call uninit() 485 485 * return rc; -
trunk/src/VBox/Main/include/ConsoleImpl.h
r26173 r26186 69 69 do { \ 70 70 if (!(drv)) \ 71 return setError (E_ACCESSDENIED, tr("The console is not powered up")); \71 return setError(E_ACCESSDENIED, tr("The console is not powered up")); \ 72 72 } while (0) 73 73 … … 217 217 static const PDMDRVREG DrvStatusReg; 218 218 219 void reportAuthLibraryError 219 void reportAuthLibraryError(const char *filename, int rc) 220 220 { 221 setError 221 setError(E_FAIL, tr("Could not load the external authentication library '%s' (%Rrc)"), filename, rc); 222 222 } 223 223 … … 242 242 AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK) 243 243 { 244 Assert 244 Assert(aThat); 245 245 mRC = aThat->addVMCaller (taQuiet, taAllowNullVM); 246 246 } 247 247 ~AutoVMCallerBase() 248 248 { 249 if (SUCCEEDED 249 if (SUCCEEDED(mRC)) 250 250 mThat->releaseVMCaller(); 251 251 } … … 253 253 void release() 254 254 { 255 AssertReturnVoid (SUCCEEDED(mRC));255 AssertReturnVoid(SUCCEEDED(mRC)); 256 256 mThat->releaseVMCaller(); 257 257 mRC = E_FAIL; … … 261 261 void add() 262 262 { 263 AssertReturnVoid (!SUCCEEDED(mRC));263 AssertReturnVoid(!SUCCEEDED(mRC)); 264 264 mRC = mThat->addVMCaller (taQuiet, taAllowNullVM); 265 265 } 266 266 /** Returns the result of Console::addVMCaller() */ 267 267 HRESULT rc() const { return mRC; } 268 /** Shortcut to SUCCEEDED 269 bool isOk() const { return SUCCEEDED 268 /** Shortcut to SUCCEEDED(rc()) */ 269 bool isOk() const { return SUCCEEDED(mRC); } 270 270 protected: 271 271 Console *mThat; … … 328 328 SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL) 329 329 { 330 if (SUCCEEDED 330 if (SUCCEEDED(Base::mRC)) 331 331 mpVM = aThat->mpVM; 332 332 } -
trunk/src/VBox/Main/include/ProgressCombinedImpl.h
r25859 r26186 131 131 132 132 /* Confirm a successful initialization when it's the case */ 133 if (SUCCEEDED 133 if (SUCCEEDED(rc)) 134 134 autoInitSpan.setSucceeded(); 135 135 -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r26171 r26186 149 149 * 150 150 * In the debug build, this macro is equivalent to Assert. 151 * In the release build, this macro uses |setError 151 * In the release build, this macro uses |setError(E_FAIL, ...)| to set the 152 152 * error info from the asserted expression. 153 153 * … … 960 960 * On all platforms, the template argument must also define the following 961 961 * method: |public static const wchar_t *C::getComponentName()|. See 962 * #setError 962 * #setError(HRESULT, const char *, ...) for a description on how it is 963 963 * used. 964 964 * … … 1041 1041 * overloaded versions, that automatically substitute some arguments 1042 1042 * taking their values from the template parameters. See 1043 * #setError 1043 * #setError(HRESULT, const char *, ...) for an example. 1044 1044 * 1045 1045 * @param aResultCode result (error) code, must not be S_OK … … 1094 1094 * (a value of C::getComponentName()). 1095 1095 * 1096 * See #setError 1096 * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1097 1097 * for details. 1098 1098 * … … 1102 1102 * 1103 1103 * <code> 1104 * return setError 1104 * return setError(E_FAIL, "Terrible Error"); 1105 1105 * </code> 1106 1106 * or 1107 1107 * <code> 1108 * HRESULT rc = setError 1108 * HRESULT rc = setError(E_FAIL, "Terrible Error"); 1109 1109 * ... 1110 1110 * return rc; … … 1146 1146 * (a value of C::getComponentName()). 1147 1147 * 1148 * See #setError 1149 * and #setError 1148 * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1149 * and #setError(HRESULT, const char *, ...) for details. 1150 1150 */ 1151 1151 static HRESULT setErrorV(HRESULT aResultCode, const char *aText, … … 1183 1183 * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. 1184 1184 * 1185 * See #setError 1186 * and #setError 1185 * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1186 * and #setError(HRESULT, const char *, ...) for details. 1187 1187 */ 1188 1188 static HRESULT setErrorBstr(HRESULT aResultCode, const Bstr &aText) … … 1215 1215 * id manually. 1216 1216 * 1217 * See #setError 1217 * See #setError(HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1218 1218 * for details. 1219 1219 */ … … 1254 1254 * harmless error from causing confusion. 1255 1255 * 1256 * It is otherwise identical to #setError 1256 * It is otherwise identical to #setError(HRESULT, const char *text, ...). 1257 1257 */ 1258 1258 static HRESULT setErrorNoLog(HRESULT aResultCode, const char *aText, ...) -
trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
r23223 r26186 78 78 // is available in this class. 79 79 static const char *tr (const char *a) { return a; } 80 static HRESULT setError 81 82 83 80 static HRESULT setError(HRESULT rc, 81 const char * /* a */, 82 const char * /* b */, 83 void * /* c */) { return rc; } 84 84 85 85 HRESULT mResultCode; -
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r25942 r26186 1166 1166 bool IsSet () 1167 1167 { 1168 Assert 1168 Assert((mError.name == NULL) == (mError.message == NULL)); 1169 1169 return (mError.name != NULL); 1170 1170 } 1171 1171 bool HasName (const char *pcszName) 1172 1172 { 1173 Assert 1173 Assert((mError.name == NULL) == (mError.message == NULL)); 1174 1174 return (RTStrCmp (mError.name, pcszName) == 0); 1175 1175 } … … 1624 1624 if (RT_SUCCESS(rc) && halSuccess) 1625 1625 { 1626 Assert 1627 AssertForEach 1628 1629 1626 Assert(pMatches->size() == cProps); 1627 AssertForEach(j, size_t, 0, cProps, (pfMatches == NULL) 1628 || (pfMatches[j] == true) 1629 || ((pfMatches[j] == false) && (pMatches[j].size() == 0))); 1630 1630 } 1631 1631 LogFlowFunc (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); … … 1654 1654 autoDBusError dbusError; 1655 1655 1656 RTMemAutoPtr 1657 RTMemAutoPtr 1656 RTMemAutoPtr<DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet; 1657 RTMemAutoPtr<DBusConnection, VBoxHalShutdown> dbusConnection; 1658 1658 DBusMessageIter iterFind, iterUdis; 1659 1659 … … 1665 1665 if (halSuccess && RT_SUCCESS(rc)) 1666 1666 { 1667 rc = halFindDeviceStringMatch 1668 1667 rc = halFindDeviceStringMatch(dbusConnection.get(), "info.subsystem", 1668 "usb_device", &replyFind); 1669 1669 if (!replyFind) 1670 1670 halSuccess = false; … … 1672 1672 if (halSuccess && RT_SUCCESS(rc)) 1673 1673 { 1674 dbus_message_iter_init 1674 dbus_message_iter_init(replyFind.get(), &iterFind); 1675 1675 if (dbus_message_iter_get_arg_type (&iterFind) != DBUS_TYPE_ARRAY) 1676 1676 halSuccess = false; … … 1679 1679 * entries. */ 1680 1680 if (halSuccess && RT_SUCCESS(rc)) 1681 dbus_message_iter_recurse 1681 dbus_message_iter_recurse(&iterFind, &iterUdis); 1682 1682 for (; halSuccess && RT_SUCCESS(rc) 1683 && dbus_message_iter_get_arg_type 1683 && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING; 1684 1684 dbus_message_iter_next(&iterUdis)) 1685 1685 { … … 1688 1688 dbus_message_iter_get_basic (&iterUdis, &pszUdi); 1689 1689 static const char *papszKeys[] = { "linux.device_file", "linux.sysfs_path" }; 1690 char *papszValues[RT_ELEMENTS 1691 rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys),1692 1690 char *papszValues[RT_ELEMENTS(papszKeys)]; 1691 rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys), 1692 papszKeys, papszValues, &replyGet); 1693 1693 const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1]; 1694 1694 /* Get the interfaces. */ 1695 1695 if (!!replyGet && pszDevice && pszSysfsPath) 1696 1696 { 1697 USBDeviceInfo info 1697 USBDeviceInfo info(pszDevice, pszSysfsPath); 1698 1698 bool ifaceSuccess = true; /* If we can't get the interfaces, just 1699 1699 * skip this one device. */ 1700 rc = getUSBInterfacesFromHal 1700 rc = getUSBInterfacesFromHal(&info.mInterfaces, pszUdi, &ifaceSuccess); 1701 1701 if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess) 1702 1702 try 1703 1703 { 1704 pList->push_back 1704 pList->push_back(info); 1705 1705 } 1706 1706 catch(std::bad_alloc &e) … … 1714 1714 if (pfSuccess != NULL) 1715 1715 *pfSuccess = halSuccess; 1716 LogFlow 1716 LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); 1717 1717 dbusError.FlowLog(); 1718 1718 return rc; … … 1739 1739 autoDBusError dbusError; 1740 1740 1741 RTMemAutoPtr 1742 RTMemAutoPtr 1741 RTMemAutoPtr<DBusMessage, VBoxDBusMessageUnref> message, replyFind, replyGet; 1742 RTMemAutoPtr<DBusConnection, VBoxHalShutdown> dbusConnection; 1743 1743 DBusMessageIter iterFind, iterUdis; 1744 1744 1745 1745 /* Connect to hal */ 1746 rc = halInit 1746 rc = halInit(&dbusConnection); 1747 1747 if (!dbusConnection) 1748 1748 halSuccess = false; … … 1750 1750 if (halSuccess && RT_SUCCESS(rc)) 1751 1751 { 1752 rc = halFindDeviceStringMatch 1752 rc = halFindDeviceStringMatch(dbusConnection.get(), "info.category", 1753 1753 "usbraw", &replyFind); 1754 1754 if (!replyFind) … … 1757 1757 if (halSuccess && RT_SUCCESS(rc)) 1758 1758 { 1759 dbus_message_iter_init 1760 if (dbus_message_iter_get_arg_type 1759 dbus_message_iter_init(replyFind.get(), &iterFind); 1760 if (dbus_message_iter_get_arg_type(&iterFind) != DBUS_TYPE_ARRAY) 1761 1761 halSuccess = false; 1762 1762 } … … 1764 1764 * entries. */ 1765 1765 if (halSuccess && RT_SUCCESS(rc)) 1766 dbus_message_iter_recurse 1766 dbus_message_iter_recurse(&iterFind, &iterUdis); 1767 1767 for (; halSuccess && RT_SUCCESS(rc) 1768 && dbus_message_iter_get_arg_type 1768 && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING; 1769 1769 dbus_message_iter_next(&iterUdis)) 1770 1770 { 1771 1771 /* Get the device node and the sysfs path for the current entry. */ 1772 1772 const char *pszUdi; 1773 dbus_message_iter_get_basic 1773 dbus_message_iter_get_basic(&iterUdis, &pszUdi); 1774 1774 static const char *papszKeys[] = { "linux.device_file", "info.parent" }; 1775 char *papszValues[RT_ELEMENTS 1776 rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys),1777 1775 char *papszValues[RT_ELEMENTS(papszKeys)]; 1776 rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys), 1777 papszKeys, papszValues, &replyGet); 1778 1778 const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1]; 1779 1779 /* Get the interfaces. */ 1780 1780 if (!!replyGet && pszDevice && pszSysfsPath) 1781 1781 { 1782 USBDeviceInfo info 1782 USBDeviceInfo info(pszDevice, pszSysfsPath); 1783 1783 bool ifaceSuccess = false; /* If we can't get the interfaces, just 1784 1784 * skip this one device. */ 1785 rc = getUSBInterfacesFromHal 1786 1785 rc = getUSBInterfacesFromHal(&info.mInterfaces, pszSysfsPath, 1786 &ifaceSuccess); 1787 1787 if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess) 1788 1788 try 1789 1789 { 1790 pList->push_back 1790 pList->push_back(info); 1791 1791 } 1792 1792 catch(std::bad_alloc &e) … … 1796 1796 } 1797 1797 } 1798 if (dbusError.HasName 1798 if (dbusError.HasName(DBUS_ERROR_NO_MEMORY)) 1799 1799 rc = VERR_NO_MEMORY; 1800 1800 if (pfSuccess != NULL) 1801 1801 *pfSuccess = halSuccess; 1802 LogFlow 1802 LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); 1803 1803 dbusError.FlowLog(); 1804 1804 return rc; … … 1822 1822 const char *pcszUdi, bool *pfSuccess) 1823 1823 { 1824 AssertReturn(VALID_PTR (pList) && VALID_PTR(pcszUdi) &&1824 AssertReturn(VALID_PTR(pList) && VALID_PTR(pcszUdi) && 1825 1825 (pfSuccess == NULL || VALID_PTR (pfSuccess)), 1826 1826 VERR_INVALID_POINTER); 1827 LogFlowFunc 1828 1827 LogFlowFunc(("pList=%p, pcszUdi=%s, pfSuccess=%p\n", pList, pcszUdi, 1828 pfSuccess)); 1829 1829 int rc = VINF_SUCCESS; /* We set this to failure on fatal errors. */ 1830 1830 bool halSuccess = true; /* We set this to false to abort the operation. */ … … 1835 1835 DBusMessageIter iterFind, iterUdis; 1836 1836 1837 rc = halInit 1837 rc = halInit(&dbusConnection); 1838 1838 if (!dbusConnection) 1839 1839 halSuccess = false; … … 1841 1841 { 1842 1842 /* Look for children of the current UDI. */ 1843 rc = halFindDeviceStringMatch 1844 1843 rc = halFindDeviceStringMatch(dbusConnection.get(), "info.parent", 1844 pcszUdi, &replyFind); 1845 1845 if (!replyFind) 1846 1846 halSuccess = false; … … 1848 1848 if (halSuccess && RT_SUCCESS(rc)) 1849 1849 { 1850 dbus_message_iter_init 1851 if (dbus_message_iter_get_arg_type 1850 dbus_message_iter_init(replyFind.get(), &iterFind); 1851 if (dbus_message_iter_get_arg_type(&iterFind) != DBUS_TYPE_ARRAY) 1852 1852 halSuccess = false; 1853 1853 } 1854 1854 if (halSuccess && RT_SUCCESS(rc)) 1855 dbus_message_iter_recurse 1855 dbus_message_iter_recurse(&iterFind, &iterUdis); 1856 1856 for (; halSuccess && RT_SUCCESS(rc) 1857 && dbus_message_iter_get_arg_type 1857 && dbus_message_iter_get_arg_type(&iterUdis) == DBUS_TYPE_STRING; 1858 1858 dbus_message_iter_next(&iterUdis)) 1859 1859 { 1860 1860 /* Now get the sysfs path and the subsystem from the iterator */ 1861 1861 const char *pszUdi; 1862 dbus_message_iter_get_basic 1862 dbus_message_iter_get_basic(&iterUdis, &pszUdi); 1863 1863 static const char *papszKeys[] = { "linux.sysfs_path", "info.subsystem", 1864 1864 "linux.subsystem" }; 1865 char *papszValues[RT_ELEMENTS 1866 rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys),1867 1865 char *papszValues[RT_ELEMENTS(papszKeys)]; 1866 rc = halGetPropertyStrings(dbusConnection.get(), pszUdi, RT_ELEMENTS(papszKeys), 1867 papszKeys, papszValues, &replyGet); 1868 1868 const char *pszSysfsPath = papszValues[0], *pszInfoSubsystem = papszValues[1], 1869 1869 *pszLinuxSubsystem = papszValues[2]; … … 1877 1877 try 1878 1878 { 1879 pList->push_back 1879 pList->push_back(pszSysfsPath); 1880 1880 } 1881 1881 catch(std::bad_alloc &e) … … 1884 1884 } 1885 1885 } 1886 if (dbusError.HasName 1886 if (dbusError.HasName(DBUS_ERROR_NO_MEMORY)) 1887 1887 rc = VERR_NO_MEMORY; 1888 1888 if (pfSuccess != NULL) 1889 1889 *pfSuccess = halSuccess; 1890 LogFlow 1890 LogFlow(("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); 1891 1891 dbusError.FlowLog(); 1892 1892 return rc; … … 1906 1906 */ 1907 1907 /* static */ 1908 DBusHandlerResult dbusFilterFunction 1909 1910 { 1911 volatile bool *pTriggered = reinterpret_cast<volatile bool *> 1912 if ( dbus_message_is_signal 1913 1914 || dbus_message_is_signal 1915 1908 DBusHandlerResult dbusFilterFunction(DBusConnection * /* pConnection */, 1909 DBusMessage *pMessage, void *pvUser) 1910 { 1911 volatile bool *pTriggered = reinterpret_cast<volatile bool *>(pvUser); 1912 if ( dbus_message_is_signal(pMessage, "org.freedesktop.Hal.Manager", 1913 "DeviceAdded") 1914 || dbus_message_is_signal(pMessage, "org.freedesktop.Hal.Manager", 1915 "DeviceRemoved")) 1916 1916 { 1917 1917 *pTriggered = true; -
trunk/src/VBox/Main/testcase/tstVBoxAPILinux.cpp
r24499 r26186 124 124 for (PRUint32 i = 0; i < machineCnt; ++ i) 125 125 { 126 IMachine *machine = machines 126 IMachine *machine = machines[i]; 127 127 if (machine) 128 128 { 129 129 PRBool isAccessible = PR_FALSE; 130 machine->GetAccessible 130 machine->GetAccessible(&isAccessible); 131 131 132 132 if (isAccessible) -
trunk/src/VBox/Main/win/NetIf-win.cpp
r26177 r26186 877 877 0, KEY_QUERY_VALUE, &hKey); 878 878 879 Assert 879 Assert(rc == ERROR_SUCCESS || rc == ERROR_PATH_NOT_FOUND); 880 880 if (rc == ERROR_SUCCESS) 881 881 { … … 887 887 RegCloseKey (hKey); 888 888 889 Assert 889 Assert(rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND); 890 890 } 891 891 -
trunk/src/VBox/Main/win/svchlp.cpp
r21878 r26186 235 235 236 236 aVal.reserve(len + 1); 237 aVal.mutableRaw() 237 aVal.mutableRaw()[len] = 0; 238 238 239 239 /* read string data */ … … 283 283 { 284 284 #ifdef VBOX_WITH_NETFLT 285 vrc = netIfNetworkInterfaceHelperServer 285 vrc = netIfNetworkInterfaceHelperServer(this, msgCode); 286 286 #endif 287 287 break; 288 288 } 289 289 default: 290 AssertMsgFailedReturn (( 291 "Invalid message code %d (%08lX)\n", msgCode, msgCode), 292 VERR_GENERAL_FAILURE); 290 AssertMsgFailedReturn(("Invalid message code %d (%08lX)\n", msgCode, msgCode), 291 VERR_GENERAL_FAILURE); 293 292 } 294 293 -
trunk/src/VBox/Main/win/svcmain.cpp
r22184 r26186 233 233 { 234 234 Bstr str (lpszToken); 235 LPCTSTR lpszToken2 = FindOneOf 235 LPCTSTR lpszToken2 = FindOneOf(lpszToken, szTokens); 236 236 if (lpszToken2) 237 str.mutableRaw() 237 str.mutableRaw()[lpszToken2 - lpszToken] = '\0'; 238 238 pipeName = Utf8Str(lpszToken); 239 239 } -
trunk/src/VBox/Main/xpcom/server.cpp
r26089 r26186 978 978 979 979 nsCOMPtr<ipcIService> ipcServ (do_GetService(IPC_SERVICE_CONTRACTID, &rc)); 980 if (NS_FAILED 980 if (NS_FAILED(rc)) 981 981 { 982 982 RTMsgError("Failed to get IPC service! (rc=%Rhrc)", rc); -
trunk/src/VBox/Main/xpcom/server_module.cpp
r24847 r26186 84 84 * Full path to the VBoxSVC executable. 85 85 */ 86 static char VBoxSVCPath 86 static char VBoxSVCPath[RTPATH_MAX]; 87 87 static bool IsVBoxSVCPathSet = false; 88 88 … … 160 160 } 161 161 } 162 if (NS_FAILED 162 if (NS_FAILED(rc)) 163 163 break; 164 164 } 165 165 166 166 nsCOMPtr <ipcIService> ipcServ = do_GetService (IPC_SERVICE_CONTRACTID, &rc); 167 if (NS_FAILED 167 if (NS_FAILED(rc)) 168 168 break; 169 169 … … 179 179 PRUint32 serverID = 0; 180 180 rc = ipcServ->ResolveClientName (VBOXSVC_IPC_NAME, &serverID); 181 if (NS_FAILED 181 if (NS_FAILED(rc)) 182 182 { 183 183 LogFlowFunc (("Starting server \"%s\"...\n", VBoxSVCPath)); … … 241 241 nsCOMPtr <ipcIDConnectService> dconServ = 242 242 do_GetService (IPC_DCONNECTSERVICE_CONTRACTID, &rc); 243 if (NS_FAILED 243 if (NS_FAILED(rc)) 244 244 break; 245 245
Note:
See TracChangeset
for help on using the changeset viewer.