Changeset 28205 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 12, 2010 1:39:18 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59945
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r27797 r28205 1025 1025 if (RT_FAILURE(vrc)) 1026 1026 rc = setError(VBOX_E_FILE_ERROR, 1027 tr("The saved state file '%ls' is invalid (%Rrc). D iscardthe saved state and try again"),1027 tr("The saved state file '%ls' is invalid (%Rrc). Delete the saved state and try again"), 1028 1028 savedStateFile.raw(), vrc); 1029 1029 … … 2297 2297 if (mMachineState != MachineState_Saved) 2298 2298 return setError(VBOX_E_INVALID_VM_STATE, 2299 tr("Cannot d iscardthe machine state as the machine is not in the saved state (machine state: %s)"),2299 tr("Cannot delete the machine state as the machine is not in the saved state (machine state: %s)"), 2300 2300 Global::stringifyMachineState(mMachineState)); 2301 2301 … … 2843 2843 if (Global::IsOnlineOrTransient(mMachineState)) 2844 2844 return setError(VBOX_E_INVALID_VM_STATE, 2845 tr("Cannot d iscarda snapshot of the running machine (machine state: %s)"),2845 tr("Cannot delete a snapshot of the running machine (machine state: %s)"), 2846 2846 Global::stringifyMachineState(mMachineState)); 2847 2847 … … 2863 2863 if (Global::IsOnlineOrTransient(mMachineState)) 2864 2864 return setError(VBOX_E_INVALID_VM_STATE, 2865 tr("Cannot d iscardthe current state of the running machine (machine state: %s)"),2865 tr("Cannot delete the current state of the running machine (machine state: %s)"), 2866 2866 Global::stringifyMachineState(mMachineState)); 2867 2867 … … 5002 5002 if (RT_FAILURE(vrc)) 5003 5003 return setError(VBOX_E_FILE_ERROR, 5004 tr("VM cannot start because the saved state file '%ls' is invalid (%Rrc). D iscardthe saved state prior to starting the VM"),5004 tr("VM cannot start because the saved state file '%ls' is invalid (%Rrc). Delete the saved state prior to starting the VM"), 5005 5005 savedStateFile.raw(), vrc); 5006 5006 } -
trunk/src/VBox/Main/VirtualBoxCallbackImpl.cpp
r26782 r28205 138 138 } 139 139 140 STDMETHODIMP CallbackWrapper::OnSnapshotD iscarded(IN_BSTR aMachineId, IN_BSTR aSnapshotId)141 { 142 if (mVBoxCallback.isNull()) 143 return S_OK; 144 145 return mVBoxCallback->OnSnapshotD iscarded(aMachineId, aSnapshotId);140 STDMETHODIMP CallbackWrapper::OnSnapshotDeleted(IN_BSTR aMachineId, IN_BSTR aSnapshotId) 141 { 142 if (mVBoxCallback.isNull()) 143 return S_OK; 144 145 return mVBoxCallback->OnSnapshotDeleted(aMachineId, aSnapshotId); 146 146 } 147 147 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r28091 r28205 308 308 m = new Data; 309 309 310 LogFlow 310 LogFlow(("===========================================================\n")); 311 311 LogFlowThisFuncEnter(); 312 312 … … 376 376 unconst(m->pSystemProperties).createObject(); 377 377 rc = m->pSystemProperties->init(this); 378 ComAssertComRCThrowRC 378 ComAssertComRCThrowRC(rc); 379 379 380 380 rc = m->pSystemProperties->loadSettings(m->pMainConfigFile->systemProperties); … … 382 382 383 383 /* guest OS type objects, needed by machines */ 384 for (size_t i = 0; i < RT_ELEMENTS 384 for (size_t i = 0; i < RT_ELEMENTS(Global::sOSTypes); ++ i) 385 385 { 386 386 ComObjPtr <GuestOSType> guestOSTypeObj; … … 403 403 m->ollGuestOSTypes.addChild(guestOSTypeObj); 404 404 } 405 ComAssertComRCThrowRC 405 ComAssertComRCThrowRC(rc); 406 406 } 407 407 … … 450 450 /* start the client watcher thread */ 451 451 #if defined(RT_OS_WINDOWS) 452 unconst(m->updateReq) = ::CreateEvent 452 unconst(m->updateReq) = ::CreateEvent(NULL, FALSE, FALSE, NULL); 453 453 #elif defined(RT_OS_OS2) 454 454 RTSemEventCreate(&unconst(m->updateReq)); … … 460 460 int vrc = RTThreadCreate(&unconst(m->threadClientWatcher), 461 461 ClientWatcher, 462 (void *) 462 (void *)this, 463 463 0, 464 464 RTTHREADTYPE_MAIN_WORKER, … … 470 470 } 471 471 472 if (SUCCEEDED(rc)) do 473 { 474 /* start the async event handler thread */ 475 int vrc = RTThreadCreate(&unconst(m->threadAsyncEvent), 476 AsyncEventHandler, 477 &unconst(m->pAsyncEventQ), 478 0, 479 RTTHREADTYPE_MAIN_WORKER, 480 RTTHREADFLAGS_WAITABLE, 481 "EventHandler"); 482 ComAssertRCBreak (vrc, rc = E_FAIL); 483 484 /* wait until the thread sets m->pAsyncEventQ */ 485 RTThreadUserWait(m->threadAsyncEvent, RT_INDEFINITE_WAIT); 486 ComAssertBreak(m->pAsyncEventQ, rc = E_FAIL); 487 } 488 while (0); 472 if (SUCCEEDED(rc)) 473 { 474 try 475 { 476 /* start the async event handler thread */ 477 int vrc = RTThreadCreate(&unconst(m->threadAsyncEvent), 478 AsyncEventHandler, 479 &unconst(m->pAsyncEventQ), 480 0, 481 RTTHREADTYPE_MAIN_WORKER, 482 RTTHREADFLAGS_WAITABLE, 483 "EventHandler"); 484 ComAssertRCThrow(vrc, E_FAIL); 485 486 /* wait until the thread sets m->pAsyncEventQ */ 487 RTThreadUserWait(m->threadAsyncEvent, RT_INDEFINITE_WAIT); 488 ComAssertThrow(m->pAsyncEventQ, E_FAIL); 489 } 490 catch (HRESULT aRC) 491 { 492 rc = aRC; 493 } 494 } 489 495 490 496 /* Confirm a successful initialization when it's the case */ … … 494 500 LogFlowThisFunc(("rc=%08X\n", rc)); 495 501 LogFlowThisFuncLeave(); 496 LogFlow 502 LogFlow(("===========================================================\n")); 497 503 return rc; 498 504 } … … 588 594 return; 589 595 590 LogFlow 596 LogFlow(("===========================================================\n")); 591 597 LogFlowThisFuncEnter(); 592 598 LogFlowThisFunc(("initFailed()=%d\n", autoUninitSpan.initFailed())); … … 634 640 { 635 641 /* release all callbacks */ 636 LogWarningFunc 637 642 LogWarningFunc(("%d unregistered callbacks!\n", 643 m->llCallbacks.size())); 638 644 m->llCallbacks.clear(); 639 645 } … … 643 649 { 644 650 /* signal to exit the event loop */ 645 if (m->pAsyncEventQ->postEvent 651 if (m->pAsyncEventQ->postEvent(NULL)) 646 652 { 647 653 /* … … 677 683 if (m->updateReq != NULL) 678 684 { 679 ::CloseHandle 685 ::CloseHandle(m->updateReq); 680 686 unconst(m->updateReq) = NULL; 681 687 } … … 683 689 if (m->updateReq != NIL_RTSEMEVENT) 684 690 { 685 RTSemEventDestroy 691 RTSemEventDestroy(m->updateReq); 686 692 unconst(m->updateReq) = NIL_RTSEMEVENT; 687 693 } … … 689 695 if (m->updateReq != NIL_RTSEMEVENT) 690 696 { 691 RTSemEventDestroy 697 RTSemEventDestroy(m->updateReq); 692 698 unconst(m->updateReq) = NIL_RTSEMEVENT; 693 699 } … … 703 709 704 710 LogFlowThisFuncLeave(); 705 LogFlow 711 LogFlow(("===========================================================\n")); 706 712 } 707 713 … … 709 715 ///////////////////////////////////////////////////////////////////////////// 710 716 711 STDMETHODIMP VirtualBox::COMGETTER(Version) 717 STDMETHODIMP VirtualBox::COMGETTER(Version)(BSTR *aVersion) 712 718 { 713 719 CheckComArgNotNull(aVersion); … … 720 726 } 721 727 722 STDMETHODIMP VirtualBox::COMGETTER(Revision) 728 STDMETHODIMP VirtualBox::COMGETTER(Revision)(ULONG *aRevision) 723 729 { 724 730 CheckComArgNotNull(aRevision); … … 731 737 } 732 738 733 STDMETHODIMP VirtualBox::COMGETTER(PackageType) 739 STDMETHODIMP VirtualBox::COMGETTER(PackageType)(BSTR *aPackageType) 734 740 { 735 741 CheckComArgNotNull(aPackageType); … … 742 748 } 743 749 744 STDMETHODIMP VirtualBox::COMGETTER(HomeFolder) 750 STDMETHODIMP VirtualBox::COMGETTER(HomeFolder)(BSTR *aHomeFolder) 745 751 { 746 752 CheckComArgNotNull(aHomeFolder); … … 754 760 } 755 761 756 STDMETHODIMP VirtualBox::COMGETTER(SettingsFilePath) 762 STDMETHODIMP VirtualBox::COMGETTER(SettingsFilePath)(BSTR *aSettingsFilePath) 757 763 { 758 764 CheckComArgNotNull(aSettingsFilePath); … … 766 772 } 767 773 768 STDMETHODIMP VirtualBox::COMGETTER(Host) 774 STDMETHODIMP VirtualBox::COMGETTER(Host)(IHost **aHost) 769 775 { 770 776 CheckComArgOutSafeArrayPointerValid(aHost); … … 779 785 780 786 STDMETHODIMP 781 VirtualBox::COMGETTER(SystemProperties) 787 VirtualBox::COMGETTER(SystemProperties)(ISystemProperties **aSystemProperties) 782 788 { 783 789 CheckComArgOutSafeArrayPointerValid(aSystemProperties); … … 792 798 793 799 STDMETHODIMP 794 VirtualBox::COMGETTER(Machines) 800 VirtualBox::COMGETTER(Machines)(ComSafeArrayOut(IMachine *, aMachines)) 795 801 { 796 802 if (ComSafeArrayOutIsNull(aMachines)) … … 807 813 } 808 814 809 STDMETHODIMP VirtualBox::COMGETTER(HardDisks) 815 STDMETHODIMP VirtualBox::COMGETTER(HardDisks)(ComSafeArrayOut(IMedium *, aHardDisks)) 810 816 { 811 817 if (ComSafeArrayOutIsNull(aHardDisks)) … … 822 828 } 823 829 824 STDMETHODIMP VirtualBox::COMGETTER(DVDImages) 830 STDMETHODIMP VirtualBox::COMGETTER(DVDImages)(ComSafeArrayOut(IMedium *, aDVDImages)) 825 831 { 826 832 if (ComSafeArrayOutIsNull(aDVDImages)) … … 837 843 } 838 844 839 STDMETHODIMP VirtualBox::COMGETTER(FloppyImages) 845 STDMETHODIMP VirtualBox::COMGETTER(FloppyImages)(ComSafeArrayOut(IMedium *, aFloppyImages)) 840 846 { 841 847 if (ComSafeArrayOutIsNull(aFloppyImages)) … … 852 858 } 853 859 854 STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations) 860 STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations)(ComSafeArrayOut(IProgress *, aOperations)) 855 861 { 856 862 CheckComArgOutSafeArrayPointerValid(aOperations); … … 867 873 } 868 874 869 STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes) 875 STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes)(ComSafeArrayOut(IGuestOSType *, aGuestOSTypes)) 870 876 { 871 877 CheckComArgOutSafeArrayPointerValid(aGuestOSTypes); … … 881 887 } 882 888 883 STDMETHODIMP VirtualBox::COMGETTER(SharedFolders) 889 STDMETHODIMP VirtualBox::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders)) 884 890 { 885 891 #ifndef RT_OS_WINDOWS … … 896 902 897 903 STDMETHODIMP 898 VirtualBox::COMGETTER(PerformanceCollector) 904 VirtualBox::COMGETTER(PerformanceCollector)(IPerformanceCollector **aPerformanceCollector) 899 905 { 900 906 #ifdef VBOX_WITH_RESOURCE_USAGE_API … … 914 920 915 921 STDMETHODIMP 916 VirtualBox::COMGETTER(DHCPServers) 922 VirtualBox::COMGETTER(DHCPServers)(ComSafeArrayOut(IDHCPServer *, aDHCPServers)) 917 923 { 918 924 if (ComSafeArrayOutIsNull(aDHCPServers)) … … 923 929 924 930 AutoReadLock al(m->ollDHCPServers.getLockHandle() COMMA_LOCKVAL_SRC_POS); 925 SafeIfaceArray<IDHCPServer> svrs 931 SafeIfaceArray<IDHCPServer> svrs(m->ollDHCPServers.getList()); 926 932 svrs.detachTo(ComSafeArrayOutArg(aDHCPServers)); 927 933 … … 1033 1039 LogFlowThisFunc(("aName=\"%ls\",aOsTypeId =\"%ls\",aBaseFolder=\"%ls\"\n", aName, aOsTypeId, aBaseFolder)); 1034 1040 1035 CheckComArgStrNotEmptyOrNull 1041 CheckComArgStrNotEmptyOrNull(aName); 1036 1042 /** @todo tighten checks on aId? */ 1037 1043 CheckComArgOutPointerValid(aMachine); … … 1087 1093 /* set the return value */ 1088 1094 rc = machine.queryInterfaceTo(aMachine); 1089 AssertComRC 1095 AssertComRC(rc); 1090 1096 } 1091 1097 … … 1101 1107 IMachine **aMachine) 1102 1108 { 1103 CheckComArgStrNotEmptyOrNull 1104 CheckComArgStrNotEmptyOrNull 1109 CheckComArgStrNotEmptyOrNull(aName); 1110 CheckComArgStrNotEmptyOrNull(aSettingsFile); 1105 1111 /** @todo tighten checks on aId? */ 1106 1112 CheckComArgOutPointerValid(aMachine); … … 1142 1148 /* set the return value */ 1143 1149 rc = machine.queryInterfaceTo(aMachine); 1144 AssertComRC 1150 AssertComRC(rc); 1145 1151 } 1146 1152 … … 1172 1178 /* set the return value */ 1173 1179 rc = machine.queryInterfaceTo(aMachine); 1174 ComAssertComRC 1180 ComAssertComRC(rc); 1175 1181 } 1176 1182 } … … 1190 1196 1191 1197 Bstr name; 1192 rc = aMachine->COMGETTER(Name) 1198 rc = aMachine->COMGETTER(Name)(name.asOutParam()); 1193 1199 if (FAILED(rc)) return rc; 1194 1200 … … 1217 1223 1218 1224 ComObjPtr<Machine> machine; 1219 HRESULT rc = findMachine (Guid(aId), true /* setError */, &machine);1225 HRESULT rc = findMachine(Guid(aId), true /* setError */, &machine); 1220 1226 1221 1227 /* the below will set *aMachine to NULL if machine is null */ … … 1488 1494 1489 1495 /** @note Locks objects! */ 1490 STDMETHODIMP VirtualBox::GetDVDImage 1496 STDMETHODIMP VirtualBox::GetDVDImage(IN_BSTR aId, IMedium **aDVDImage) 1491 1497 { 1492 1498 CheckComArgOutSafeArrayPointerValid(aDVDImage); … … 1497 1503 Guid id(aId); 1498 1504 ComObjPtr<Medium> image; 1499 HRESULT rc = findDVDImage 1505 HRESULT rc = findDVDImage(&id, NULL, true /* setError */, &image); 1500 1506 1501 1507 /* the below will set *aDVDImage to NULL if image is null */ … … 1506 1512 1507 1513 /** @note Locks objects! */ 1508 STDMETHODIMP VirtualBox::FindDVDImage 1514 STDMETHODIMP VirtualBox::FindDVDImage(IN_BSTR aLocation, IMedium **aDVDImage) 1509 1515 { 1510 1516 CheckComArgStrNotEmptyOrNull(aLocation); … … 1515 1521 1516 1522 ComObjPtr<Medium> image; 1517 HRESULT rc = findDVDImage 1523 HRESULT rc = findDVDImage(NULL, aLocation, true /* setError */, &image); 1518 1524 1519 1525 /* the below will set *aDVDImage to NULL if dvd is null */ … … 1524 1530 1525 1531 /** @note Doesn't lock anything. */ 1526 STDMETHODIMP VirtualBox::OpenFloppyImage 1527 1532 STDMETHODIMP VirtualBox::OpenFloppyImage(IN_BSTR aLocation, IN_BSTR aId, 1533 IMedium **aFloppyImage) 1528 1534 { 1529 1535 CheckComArgStrNotEmptyOrNull(aLocation); … … 1542 1548 ComObjPtr<Medium> image; 1543 1549 image.createObject(); 1544 rc = image->init 1550 rc = image->init(this, aLocation, Medium::OpenReadWrite, DeviceType_Floppy, true, id, false, Guid()); 1545 1551 if (SUCCEEDED(rc)) 1546 1552 { … … 1564 1570 1565 1571 /** @note Locks objects! */ 1566 STDMETHODIMP VirtualBox::GetFloppyImage (IN_BSTR aId, 1567 IMedium **aFloppyImage) 1572 STDMETHODIMP VirtualBox::GetFloppyImage(IN_BSTR aId, IMedium **aFloppyImage) 1568 1573 1569 1574 { … … 1575 1580 Guid id(aId); 1576 1581 ComObjPtr<Medium> image; 1577 HRESULT rc = findFloppyImage 1582 HRESULT rc = findFloppyImage(&id, NULL, true /* setError */, &image); 1578 1583 1579 1584 /* the below will set *aFloppyImage to NULL if image is null */ … … 1584 1589 1585 1590 /** @note Locks objects! */ 1586 STDMETHODIMP VirtualBox::FindFloppyImage 1587 1591 STDMETHODIMP VirtualBox::FindFloppyImage(IN_BSTR aLocation, 1592 IMedium **aFloppyImage) 1588 1593 { 1589 1594 CheckComArgStrNotEmptyOrNull(aLocation); … … 1603 1608 1604 1609 /** @note Locks this object for reading. */ 1605 STDMETHODIMP VirtualBox::GetGuestOSType 1610 STDMETHODIMP VirtualBox::GetGuestOSType(IN_BSTR aId, IGuestOSType **aType) 1606 1611 { 1607 1612 /* Old ID to new ID conversion table. See r39691 for a source */ … … 1631 1636 /* first, look for a substitution */ 1632 1637 Bstr id = aId; 1633 for (size_t i = 0; i < RT_ELEMENTS 1638 for (size_t i = 0; i < RT_ELEMENTS(kOldNewIDs) / 2; i += 2) 1634 1639 { 1635 1640 if (id == kOldNewIDs[i]) … … 1817 1822 * @note Locks objects! 1818 1823 */ 1819 STDMETHODIMP VirtualBox::OpenSession 1824 STDMETHODIMP VirtualBox::OpenSession(ISession *aSession, IN_BSTR aMachineId) 1820 1825 { 1821 1826 CheckComArgNotNull(aSession); … … 1827 1832 ComObjPtr<Machine> machine; 1828 1833 1829 HRESULT rc = findMachine 1834 HRESULT rc = findMachine(id, true /* setError */, &machine); 1830 1835 if (FAILED(rc)) return rc; 1831 1836 1832 1837 /* check the session state */ 1833 1838 SessionState_T state; 1834 rc = aSession->COMGETTER(State) 1839 rc = aSession->COMGETTER(State)(&state); 1835 1840 if (FAILED(rc)) return rc; 1836 1841 … … 1841 1846 /* get the IInternalSessionControl interface */ 1842 1847 ComPtr<IInternalSessionControl> control = aSession; 1843 ComAssertMsgRet 1844 1845 1846 rc = machine->openSession 1848 ComAssertMsgRet(!!control, ("No IInternalSessionControl interface"), 1849 E_INVALIDARG); 1850 1851 rc = machine->openSession(control); 1847 1852 1848 1853 if (SUCCEEDED(rc)) … … 1855 1860 1856 1861 /* fire an event */ 1857 onSessionStateChange 1862 onSessionStateChange(id, SessionState_Open); 1858 1863 } 1859 1864 … … 1864 1869 * @note Locks objects! 1865 1870 */ 1866 STDMETHODIMP VirtualBox::OpenRemoteSession 1867 1868 1869 1870 1871 STDMETHODIMP VirtualBox::OpenRemoteSession(ISession *aSession, 1872 IN_BSTR aMachineId, 1873 IN_BSTR aType, 1874 IN_BSTR aEnvironment, 1875 IProgress **aProgress) 1871 1876 { 1872 1877 LogRel(("remotesession=%s\n", Utf8Str(aMachineId).c_str())); … … 1883 1888 ComObjPtr<Machine> machine; 1884 1889 1885 HRESULT rc = findMachine 1890 HRESULT rc = findMachine(id, true /* setError */, &machine); 1886 1891 if (FAILED(rc)) return rc; 1887 1892 1888 1893 /* check the session state */ 1889 1894 SessionState_T state; 1890 rc = aSession->COMGETTER(State) 1895 rc = aSession->COMGETTER(State)(&state); 1891 1896 if (FAILED(rc)) return rc; 1892 1897 … … 1897 1902 /* get the IInternalSessionControl interface */ 1898 1903 ComPtr<IInternalSessionControl> control = aSession; 1899 ComAssertMsgRet 1900 1904 ComAssertMsgRet(!!control, ("No IInternalSessionControl interface"), 1905 E_INVALIDARG); 1901 1906 1902 1907 /* create a progress object */ 1903 1908 ComObjPtr<Progress> progress; 1904 1909 progress.createObject(); 1905 progress->init (this, static_cast <IMachine *>(machine),1906 Bstr (tr("Spawning session")),1907 1908 1909 rc = machine->openRemoteSession 1910 progress->init(this, static_cast <IMachine *>(machine), 1911 Bstr(tr("Spawning session")), 1912 FALSE /* aCancelable */); 1913 1914 rc = machine->openRemoteSession(control, aType, aEnvironment, progress); 1910 1915 1911 1916 if (SUCCEEDED(rc)) … … 1917 1922 1918 1923 /* fire an event */ 1919 onSessionStateChange 1924 onSessionStateChange(id, SessionState_Spawning); 1920 1925 } 1921 1926 … … 1926 1931 * @note Locks objects! 1927 1932 */ 1928 STDMETHODIMP VirtualBox::OpenExistingSession 1929 1933 STDMETHODIMP VirtualBox::OpenExistingSession(ISession *aSession, 1934 IN_BSTR aMachineId) 1930 1935 { 1931 1936 CheckComArgNotNull(aSession); … … 1937 1942 ComObjPtr<Machine> machine; 1938 1943 1939 HRESULT rc = findMachine 1944 HRESULT rc = findMachine(id, true /* setError */, &machine); 1940 1945 if (FAILED(rc)) return rc; 1941 1946 1942 1947 /* check the session state */ 1943 1948 SessionState_T state; 1944 rc = aSession->COMGETTER(State) 1949 rc = aSession->COMGETTER(State)(&state); 1945 1950 if (FAILED(rc)) return rc; 1946 1951 … … 1951 1956 /* get the IInternalSessionControl interface */ 1952 1957 ComPtr<IInternalSessionControl> control = aSession; 1953 ComAssertMsgRet 1954 1955 1956 rc = machine->openExistingSession 1958 ComAssertMsgRet(!!control, ("No IInternalSessionControl interface"), 1959 E_INVALIDARG); 1960 1961 rc = machine->openExistingSession(control); 1957 1962 1958 1963 return rc; … … 1962 1967 * @note Locks this object for writing. 1963 1968 */ 1964 STDMETHODIMP VirtualBox::RegisterCallback 1969 STDMETHODIMP VirtualBox::RegisterCallback(IVirtualBoxCallback *aCallback) 1965 1970 { 1966 1971 LogFlowThisFunc(("aCallback=%p\n", aCallback)); … … 1980 1985 1981 1986 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1982 m->llCallbacks.push_back (CallbackList::value_type(aCallback));1987 m->llCallbacks.push_back(CallbackList::value_type(aCallback)); 1983 1988 1984 1989 return S_OK; … … 1988 1993 * @note Locks this object for writing. 1989 1994 */ 1990 STDMETHODIMP VirtualBox::UnregisterCallback 1995 STDMETHODIMP VirtualBox::UnregisterCallback(IVirtualBoxCallback *aCallback) 1991 1996 { 1992 1997 CheckComArgNotNull(aCallback); … … 2000 2005 2001 2006 CallbackList::iterator it; 2002 it = std::find 2003 2004 CallbackList::value_type(aCallback));2007 it = std::find(m->llCallbacks.begin(), 2008 m->llCallbacks.end(), 2009 CallbackList::value_type(aCallback)); 2005 2010 if (it == m->llCallbacks.end()) 2006 2011 rc = E_INVALIDARG; 2007 2012 else 2008 m->llCallbacks.erase 2013 m->llCallbacks.erase(it); 2009 2014 2010 2015 LogFlowThisFunc(("aCallback=%p, rc=%08X\n", aCallback, rc)); … … 2072 2077 if (autoCaller.state() != Ready) 2073 2078 { 2074 LogWarningFunc (("VirtualBox has been uninitialized (state=%d), " 2075 "the event is discarded!\n", 2076 autoCaller.state())); 2079 LogWarningFunc(("VirtualBox has been uninitialized (state=%d), the event is discarded!\n", 2080 autoCaller.state())); 2077 2081 return S_OK; 2078 2082 } … … 2103 2107 2104 2108 Bstr id; 2105 HRESULT rc = aProgress->COMGETTER(Id) 2109 HRESULT rc = aProgress->COMGETTER(Id)(id.asOutParam()); 2106 2110 AssertComRCReturnRC(rc); 2107 2111 … … 2109 2113 AutoWriteLock safeLock(m->mtxProgressOperations COMMA_LOCKVAL_SRC_POS); 2110 2114 2111 m->mapProgressOperations.insert (ProgressMap::value_type(Guid(id), aProgress));2115 m->mapProgressOperations.insert(ProgressMap::value_type(Guid(id), aProgress)); 2112 2116 return S_OK; 2113 2117 } … … 2197 2201 * @note Doesn't lock anything. 2198 2202 */ 2199 HRESULT VirtualBox::startSVCHelperClient 2200 2201 2203 HRESULT VirtualBox::startSVCHelperClient(bool aPrivileged, 2204 SVCHelperClientFunc aFunc, 2205 void *aUser, Progress *aProgress) 2202 2206 { 2203 2207 AssertReturn(aFunc, E_POINTER); … … 2209 2213 /* create the SVCHelperClientThread() argument */ 2210 2214 std::auto_ptr <StartSVCHelperClientData> 2211 d 2215 d(new StartSVCHelperClientData()); 2212 2216 AssertReturn(d.get(), E_OUTOFMEMORY); 2213 2217 … … 2219 2223 2220 2224 RTTHREAD tid = NIL_RTTHREAD; 2221 int vrc = RTThreadCreate 2222 static_cast <void *>(d.get()),2223 2224 2225 2226 ComAssertMsgRCRet 2225 int vrc = RTThreadCreate(&tid, SVCHelperClientThread, 2226 static_cast <void *>(d.get()), 2227 0, RTTHREADTYPE_MAIN_WORKER, 2228 RTTHREADFLAGS_WAITABLE, "SVCHelper"); 2229 2230 ComAssertMsgRCRet(vrc, ("Could not create SVCHelper thread (%Rrc)", vrc), 2227 2231 E_FAIL); 2228 2232 … … 2238 2242 /* static */ 2239 2243 DECLCALLBACK(int) 2240 VirtualBox::SVCHelperClientThread 2244 VirtualBox::SVCHelperClientThread(RTTHREAD aThread, void *aUser) 2241 2245 { 2242 2246 LogFlowFuncEnter(); 2243 2247 2244 2248 std::auto_ptr <StartSVCHelperClientData> 2245 d (static_cast <StartSVCHelperClientData *>(aUser));2249 d(static_cast <StartSVCHelperClientData *>(aUser)); 2246 2250 2247 2251 HRESULT rc = S_OK; … … 2250 2254 do 2251 2255 { 2252 AssertBreakStmt 2256 AssertBreakStmt(d.get(), rc = E_POINTER); 2253 2257 AssertReturn(!d->progress.isNull(), E_POINTER); 2254 2258 … … 2278 2282 /* get the path to the executable */ 2279 2283 char exePathBuf[RTPATH_MAX]; 2280 char *exePath = RTProcGetExecutableName 2281 ComAssertBreak 2282 2283 Utf8Str argsStr = Utf8StrFmt 2284 2285 LogFlowFunc 2284 char *exePath = RTProcGetExecutableName(exePathBuf, RTPATH_MAX); 2285 ComAssertBreak(exePath, E_FAIL); 2286 2287 Utf8Str argsStr = Utf8StrFmt("/Helper %s", client.name().raw()); 2288 2289 LogFlowFunc(("Starting '\"%s\" %s'...\n", exePath, argsStr.raw())); 2286 2290 2287 2291 RTPROCESS pid = NIL_RTPROCESS; … … 2296 2300 SHELLEXECUTEINFO shExecInfo; 2297 2301 2298 shExecInfo.cbSize = sizeof 2302 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); 2299 2303 2300 2304 shExecInfo.fMask = NULL; … … 2307 2311 shExecInfo.hInstApp = NULL; 2308 2312 2309 if (!ShellExecuteEx 2313 if (!ShellExecuteEx(&shExecInfo)) 2310 2314 { 2311 int vrc2 = RTErrConvertFromWin32 2315 int vrc2 = RTErrConvertFromWin32(GetLastError()); 2312 2316 /* hide excessive details in case of a frequent error 2313 2317 * (pressing the Cancel button to close the Run As dialog) */ … … 2325 2329 { 2326 2330 const char *args[] = { exePath, "/Helper", client.name().c_str(), 0 }; 2327 vrc = RTProcCreate 2331 vrc = RTProcCreate(exePath, args, RTENV_DEFAULT, 0, &pid); 2328 2332 if (RT_FAILURE(vrc)) 2329 2333 { … … 2339 2343 { 2340 2344 /* start the user supplied function */ 2341 rc = d->func 2345 rc = d->func(&client, d->progress, d->user, &vrc); 2342 2346 userFuncCalled = true; 2343 2347 } … … 2345 2349 /* send the termination signal to the process anyway */ 2346 2350 { 2347 int vrc2 = client.write 2351 int vrc2 = client.write(SVCHlpMsg::Null); 2348 2352 if (RT_SUCCESS(vrc)) 2349 2353 vrc = vrc2; … … 2363 2367 /* call the user function in the "cleanup only" mode 2364 2368 * to let it free resources passed to in aUser */ 2365 d->func 2366 } 2367 2368 d->progress->notifyComplete 2369 d->func(NULL, NULL, d->user, NULL); 2370 } 2371 2372 d->progress->notifyComplete(rc); 2369 2373 2370 2374 LogFlowFuncLeave(); … … 2383 2387 { 2384 2388 AutoCaller autoCaller(this); 2385 AssertComRCReturn (autoCaller.rc(), (void) 0);2386 2387 AssertReturn (m->threadClientWatcher != NIL_RTTHREAD, (void) 0);2389 AssertComRCReturnVoid(autoCaller.rc()); 2390 2391 AssertReturnVoid(m->threadClientWatcher != NIL_RTTHREAD); 2388 2392 2389 2393 /* sent an update request */ 2390 2394 #if defined(RT_OS_WINDOWS) 2391 ::SetEvent 2395 ::SetEvent(m->updateReq); 2392 2396 #elif defined(RT_OS_OS2) 2393 RTSemEventSignal 2397 RTSemEventSignal(m->updateReq); 2394 2398 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 2395 RTSemEventSignal 2399 RTSemEventSignal(m->updateReq); 2396 2400 #else 2397 2401 # error "Port me!" … … 2403 2407 * This call should be followed by #updateClientWatcher() to take the effect. 2404 2408 */ 2405 void VirtualBox::addProcessToReap 2406 { 2407 AutoCaller autoCaller(this); 2408 AssertComRCReturn (autoCaller.rc(), (void) 0);2409 void VirtualBox::addProcessToReap(RTPROCESS pid) 2410 { 2411 AutoCaller autoCaller(this); 2412 AssertComRCReturnVoid(autoCaller.rc()); 2409 2413 2410 2414 /// @todo (dmik) Win32? 2411 2415 #ifndef RT_OS_WINDOWS 2412 2416 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2413 m->llProcesses.push_back 2417 m->llProcesses.push_back(pid); 2414 2418 #endif 2415 2419 } … … 2420 2424 enum What { DataChanged, StateChanged, Registered }; 2421 2425 2422 MachineEvent 2423 : CallbackEvent (aVB), what (DataChanged), id(aId)2426 MachineEvent(VirtualBox *aVB, const Guid &aId) 2427 : CallbackEvent(aVB), what(DataChanged), id(aId) 2424 2428 {} 2425 2429 2426 MachineEvent 2427 : CallbackEvent (aVB), what (StateChanged), id(aId)2428 , state 2430 MachineEvent(VirtualBox *aVB, const Guid &aId, MachineState_T aState) 2431 : CallbackEvent(aVB), what(StateChanged), id(aId) 2432 , state(aState) 2429 2433 {} 2430 2434 2431 MachineEvent 2432 : CallbackEvent (aVB), what (Registered), id(aId)2433 , registered 2435 MachineEvent(VirtualBox *aVB, const Guid &aId, BOOL aRegistered) 2436 : CallbackEvent(aVB), what(Registered), id(aId) 2437 , registered(aRegistered) 2434 2438 {} 2435 2439 2436 void handleCallback 2440 void handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback) 2437 2441 { 2438 2442 switch (what) 2439 2443 { 2440 2444 case DataChanged: 2441 LogFlow 2442 aCallback->OnMachineDataChange 2445 LogFlow(("OnMachineDataChange: id={%RTuuid}\n", id.ptr())); 2446 aCallback->OnMachineDataChange(id.toUtf16()); 2443 2447 break; 2444 2448 2445 2449 case StateChanged: 2446 LogFlow 2450 LogFlow(("OnMachineStateChange: id={%RTuuid}, state=%d\n", 2447 2451 id.ptr(), state)); 2448 aCallback->OnMachineStateChange 2452 aCallback->OnMachineStateChange(id.toUtf16(), state); 2449 2453 break; 2450 2454 2451 2455 case Registered: 2452 LogFlow 2456 LogFlow(("OnMachineRegistered: id={%RTuuid}, registered=%d\n", 2453 2457 id.ptr(), registered)); 2454 aCallback->OnMachineRegistered 2458 aCallback->OnMachineRegistered(id.toUtf16(), registered); 2455 2459 break; 2456 2460 } … … 2469 2473 void VirtualBox::onMachineStateChange(const Guid &aId, MachineState_T aState) 2470 2474 { 2471 postEvent (new MachineEvent(this, aId, aState));2475 postEvent(new MachineEvent(this, aId, aState)); 2472 2476 } 2473 2477 … … 2477 2481 void VirtualBox::onMachineDataChange(const Guid &aId) 2478 2482 { 2479 postEvent (new MachineEvent(this, aId));2483 postEvent(new MachineEvent(this, aId)); 2480 2484 } 2481 2485 … … 2483 2487 * @note Locks this object for reading. 2484 2488 */ 2485 BOOL VirtualBox::onExtraDataCanChange 2489 BOOL VirtualBox::onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue, 2486 2490 Bstr &aError) 2487 2491 { … … 2503 2507 while ((it != list.end()) && allowChange) 2504 2508 { 2505 HRESULT rc = (*it++)->OnExtraDataCanChange (id, aKey, aValue, 2506 aError.asOutParam(), &allowChange); 2509 HRESULT rc = (*it++)->OnExtraDataCanChange(id, aKey, aValue, 2510 aError.asOutParam(), 2511 &allowChange); 2507 2512 if (FAILED(rc)) 2508 2513 { … … 2523 2528 struct ExtraDataEvent : public VirtualBox::CallbackEvent 2524 2529 { 2525 ExtraDataEvent 2530 ExtraDataEvent(VirtualBox *aVB, const Guid &aMachineId, 2526 2531 IN_BSTR aKey, IN_BSTR aVal) 2527 : CallbackEvent (aVB), machineId(aMachineId)2528 , key (aKey), val(aVal)2532 : CallbackEvent(aVB), machineId(aMachineId) 2533 , key(aKey), val(aVal) 2529 2534 {} 2530 2535 2531 void handleCallback 2532 { 2533 LogFlow 2534 2535 aCallback->OnExtraDataChange 2536 void handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback) 2537 { 2538 LogFlow(("OnExtraDataChange: machineId={%RTuuid}, key='%ls', val='%ls'\n", 2539 machineId.ptr(), key.raw(), val.raw())); 2540 aCallback->OnExtraDataChange(machineId.toUtf16(), key, val); 2536 2541 } 2537 2542 … … 2543 2548 * @note Doesn't lock any object. 2544 2549 */ 2545 void VirtualBox::onExtraDataChange 2546 { 2547 postEvent (new ExtraDataEvent(this, aId, aKey, aValue));2550 void VirtualBox::onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue) 2551 { 2552 postEvent(new ExtraDataEvent(this, aId, aKey, aValue)); 2548 2553 } 2549 2554 … … 2551 2556 * @note Doesn't lock any object. 2552 2557 */ 2553 void VirtualBox::onMachineRegistered 2554 { 2555 postEvent (new MachineEvent(this, aId, aRegistered));2558 void VirtualBox::onMachineRegistered(const Guid &aId, BOOL aRegistered) 2559 { 2560 postEvent(new MachineEvent(this, aId, aRegistered)); 2556 2561 } 2557 2562 … … 2559 2564 struct SessionEvent : public VirtualBox::CallbackEvent 2560 2565 { 2561 SessionEvent 2562 : CallbackEvent (aVB), machineId (aMachineId), sessionState(aState)2566 SessionEvent(VirtualBox *aVB, const Guid &aMachineId, SessionState_T aState) 2567 : CallbackEvent(aVB), machineId(aMachineId), sessionState(aState) 2563 2568 {} 2564 2569 2565 void handleCallback 2566 { 2567 LogFlow 2568 2569 aCallback->OnSessionStateChange 2570 void handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback) 2571 { 2572 LogFlow(("OnSessionStateChange: machineId={%RTuuid}, sessionState=%d\n", 2573 machineId.ptr(), sessionState)); 2574 aCallback->OnSessionStateChange(machineId.toUtf16(), sessionState); 2570 2575 } 2571 2576 … … 2577 2582 * @note Doesn't lock any object. 2578 2583 */ 2579 void VirtualBox::onSessionStateChange 2580 { 2581 postEvent (new SessionEvent(this, aId, aState));2582 } 2583 2584 /** Event for onSnapshotTaken(), onSnapshot Removed() and onSnapshotChange() */2584 void VirtualBox::onSessionStateChange(const Guid &aId, SessionState_T aState) 2585 { 2586 postEvent(new SessionEvent(this, aId, aState)); 2587 } 2588 2589 /** Event for onSnapshotTaken(), onSnapshotDeleted() and onSnapshotChange() */ 2585 2590 struct SnapshotEvent : public VirtualBox::CallbackEvent 2586 2591 { 2587 enum What { Taken, D iscarded, Changed };2588 2589 SnapshotEvent 2592 enum What { Taken, Deleted, Changed }; 2593 2594 SnapshotEvent(VirtualBox *aVB, const Guid &aMachineId, const Guid &aSnapshotId, 2590 2595 What aWhat) 2591 : CallbackEvent 2592 , what 2593 , machineId (aMachineId), snapshotId(aSnapshotId)2596 : CallbackEvent(aVB) 2597 , what(aWhat) 2598 , machineId(aMachineId), snapshotId(aSnapshotId) 2594 2599 {} 2595 2600 2596 void handleCallback 2601 void handleCallback(const ComPtr<IVirtualBoxCallback> &aCallback) 2597 2602 { 2598 2603 Bstr mid = machineId.toUtf16(); … … 2602 2607 { 2603 2608 case Taken: 2604 LogFlow 2609 LogFlow(("OnSnapshotTaken: machineId={%RTuuid}, snapshotId={%RTuuid}\n", 2605 2610 machineId.ptr(), snapshotId.ptr())); 2606 aCallback->OnSnapshotTaken 2611 aCallback->OnSnapshotTaken(mid, sid); 2607 2612 break; 2608 2613 2609 case D iscarded:2610 LogFlow (("OnSnapshotDiscarded: machineId={%RTuuid}, snapshotId={%RTuuid}\n",2614 case Deleted: 2615 LogFlow(("OnSnapshotDeleted: machineId={%RTuuid}, snapshotId={%RTuuid}\n", 2611 2616 machineId.ptr(), snapshotId.ptr())); 2612 aCallback->OnSnapshotD iscarded(mid, sid);2617 aCallback->OnSnapshotDeleted(mid, sid); 2613 2618 break; 2614 2619 2615 2620 case Changed: 2616 LogFlow 2621 LogFlow(("OnSnapshotChange: machineId={%RTuuid}, snapshotId={%RTuuid}\n", 2617 2622 machineId.ptr(), snapshotId.ptr())); 2618 aCallback->OnSnapshotChange 2623 aCallback->OnSnapshotChange(mid, sid); 2619 2624 break; 2620 2625 } … … 2630 2635 * @note Doesn't lock any object. 2631 2636 */ 2632 void VirtualBox::onSnapshotTaken 2637 void VirtualBox::onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId) 2633 2638 { 2634 2639 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, SnapshotEvent::Taken)); … … 2640 2645 void VirtualBox::onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId) 2641 2646 { 2642 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, SnapshotEvent::D iscarded));2647 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, SnapshotEvent::Deleted)); 2643 2648 } 2644 2649 … … 2667 2672 LogFlow(("OnGuestPropertyChange: machineId={%RTuuid}, name='%ls', value='%ls', flags='%ls'\n", 2668 2673 machineId.ptr(), name.raw(), value.raw(), flags.raw())); 2669 aCallback->OnGuestPropertyChange 2674 aCallback->OnGuestPropertyChange(machineId.toUtf16(), name, value, flags); 2670 2675 } 2671 2676 … … 2718 2723 { 2719 2724 AutoCaller autoCaller(this); 2720 AssertComRCReturnVoid 2725 AssertComRCReturnVoid(autoCaller.rc()); 2721 2726 2722 2727 aMachines.clear(); … … 3157 3162 { 3158 3163 AutoCaller autoCaller(this); 3159 AssertComRCReturnVoid 3164 AssertComRCReturnVoid(autoCaller.rc()); 3160 3165 3161 3166 /* no need to lock since mHomeDir is const */ … … 3422 3427 catch (...) 3423 3428 { 3424 rc = VirtualBox::handleUnexpectedExceptions 3429 rc = VirtualBox::handleUnexpectedExceptions(RT_SRC_POS); 3425 3430 } 3426 3431 … … 3568 3573 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 3569 3574 3570 AutoCaller hardDiskCaller 3575 AutoCaller hardDiskCaller(aHardDisk); 3571 3576 AssertComRCReturn(hardDiskCaller.rc(), hardDiskCaller.rc()); 3572 3577 … … 3838 3843 COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE | 3839 3844 COINIT_SPEED_OVER_MEMORY); 3840 AssertComRC 3845 AssertComRC(hrc); 3841 3846 3842 3847 /// @todo (dmik) processes reaping! … … 3913 3918 { 3914 3919 /// @todo handle situations with more than 64 objects 3915 AssertMsgBreak 3916 3920 AssertMsgBreak((1 + cnt) <= MAXIMUM_WAIT_OBJECTS, 3921 ("MAXIMUM_WAIT_OBJECTS reached")); 3917 3922 3918 3923 ComObjPtr<SessionMachine> sm; … … 3926 3931 } 3927 3932 3928 LogFlowFunc 3933 LogFlowFunc(("UPDATE: direct session count = %d\n", cnt)); 3929 3934 3930 3935 /* obtain a new set of spawned machines */ … … 3937 3942 { 3938 3943 /// @todo handle situations with more than 64 objects 3939 AssertMsgBreak 3940 3944 AssertMsgBreak((1 + cnt + cntSpawned) <= MAXIMUM_WAIT_OBJECTS, 3945 ("MAXIMUM_WAIT_OBJECTS reached")); 3941 3946 3942 3947 RTPROCESS pid; … … 3944 3949 { 3945 3950 HANDLE ph = OpenProcess(SYNCHRONIZE, FALSE, pid); 3946 AssertMsg 3947 3951 AssertMsg(ph != NULL, ("OpenProcess (pid=%d) failed with %d\n", 3952 pid, GetLastError())); 3948 3953 if (rc == 0) 3949 3954 { … … 3955 3960 } 3956 3961 3957 LogFlowFunc 3962 LogFlowFunc(("UPDATE: spawned session count = %d\n", cntSpawned)); 3958 3963 3959 3964 // machines lock unwinds here … … 3966 3971 /* close old process handles */ 3967 3972 for (size_t i = 1 + cnt; i < 1 + cnt + cntSpawned; ++ i) 3968 CloseHandle 3973 CloseHandle(handles[i]); 3969 3974 3970 3975 /* release sets of machines if any */ … … 3974 3979 ::CoUninitialize(); 3975 3980 3976 #elif defined 3981 #elif defined(RT_OS_OS2) 3977 3982 3978 3983 /// @todo (dmik) processes reaping! … … 4014 4019 else 4015 4020 { 4016 AssertMsg 4017 4021 AssertMsg(vrc == VERR_TIMEOUT || vrc == VERR_INTERRUPTED, 4022 ("RTSemEventWait returned %Rrc\n", vrc)); 4018 4023 4019 4024 /* are there any mutexes? */ … … 4023 4028 4024 4029 unsigned long semId = 0; 4025 APIRET arc = ::DosWaitMuxWaitSem 4026 4030 APIRET arc = ::DosWaitMuxWaitSem(muxSem, 4031 SEM_IMMEDIATE_RETURN, &semId); 4027 4032 4028 4033 if (arc == NO_ERROR) … … 4035 4040 { 4036 4041 AutoReadLock machineLock(machines[semId] COMMA_LOCKVAL_SRC_POS); 4037 LogFlowFunc 4038 4042 LogFlowFunc(("released mutex: machine='%ls'\n", 4043 machines[semId]->name().raw())); 4039 4044 } 4040 4045 #endif … … 4075 4080 } 4076 4081 else 4077 AssertMsg 4078 4082 AssertMsg(arc == ERROR_INTERRUPT || arc == ERROR_TIMEOUT, 4083 ("DosWaitMuxWaitSem returned %d\n", arc)); 4079 4084 } 4080 4085 … … 4096 4101 /* close the old muxsem */ 4097 4102 if (muxSem != NULLHANDLE) 4098 ::DosCloseMuxWaitSem 4103 ::DosCloseMuxWaitSem(muxSem); 4099 4104 4100 4105 /* obtain a new set of opened machines */ … … 4106 4111 { 4107 4112 /// @todo handle situations with more than 64 objects 4108 AssertMsg 4109 4110 4113 AssertMsg(cnt <= 64 /* according to PMREF */, 4114 ("maximum of 64 mutex semaphores reached (%d)", 4115 cnt)); 4111 4116 4112 4117 ComObjPtr<SessionMachine> sm; 4113 4118 HMTX ipcSem; 4114 if ((*it)->isSessionOpenOrClosing 4119 if ((*it)->isSessionOpenOrClosing(sm, NULL, &ipcSem)) 4115 4120 { 4116 machines.push_back 4117 handles[cnt].hsemCur = (HSEM) 4121 machines.push_back(sm); 4122 handles[cnt].hsemCur = (HSEM)ipcSem; 4118 4123 handles[cnt].ulUser = cnt; 4119 4124 ++ cnt; … … 4121 4126 } 4122 4127 4123 LogFlowFunc 4128 LogFlowFunc(("UPDATE: direct session count = %d\n", cnt)); 4124 4129 4125 4130 if (cnt > 0) 4126 4131 { 4127 4132 /* create a new muxsem */ 4128 APIRET arc = ::DosCreateMuxWaitSem 4129 4130 4131 AssertMsg 4132 4133 APIRET arc = ::DosCreateMuxWaitSem(NULL, &muxSem, cnt, 4134 handles, 4135 DCMW_WAIT_ANY); 4136 AssertMsg(arc == NO_ERROR, 4137 ("DosCreateMuxWaitSem returned %d\n", arc)); 4133 4138 NOREF(arc); 4134 4139 } … … 4144 4149 { 4145 4150 if ((*it)->isSessionSpawning()) 4146 spawnedMachines.push_back 4151 spawnedMachines.push_back(*it); 4147 4152 } 4148 4153 4149 4154 cntSpawned = spawnedMachines.size(); 4150 LogFlowFunc 4155 LogFlowFunc(("UPDATE: spawned session count = %d\n", cntSpawned)); 4151 4156 } 4152 4157 } … … 4158 4163 /* close the muxsem */ 4159 4164 if (muxSem != NULLHANDLE) 4160 ::DosCloseMuxWaitSem 4165 ::DosCloseMuxWaitSem(muxSem); 4161 4166 4162 4167 /* release sets of machines if any */ … … 4248 4253 if (that->m->llProcesses.size()) 4249 4254 { 4250 LogFlowFunc 4251 4255 LogFlowFunc(("UPDATE: child process count = %d\n", 4256 that->m->llProcesses.size())); 4252 4257 VirtualBox::Data::ProcessList::iterator it = that->m->llProcesses.begin(); 4253 4258 while (it != that->m->llProcesses.end()) … … 4258 4263 if (vrc == VINF_SUCCESS) 4259 4264 { 4260 LogFlowFunc (("pid %d (%x) was reaped, " 4261 "status=%d, reason=%d\n", 4262 pid, pid, status.iStatus, 4263 status.enmReason)); 4265 LogFlowFunc(("pid %d (%x) was reaped, status=%d, reason=%d\n", 4266 pid, pid, status.iStatus, 4267 status.enmReason)); 4264 4268 it = that->m->llProcesses.erase(it); 4265 4269 } 4266 4270 else 4267 4271 { 4268 LogFlowFunc 4269 4272 LogFlowFunc(("pid %d (%x) was NOT reaped, vrc=%Rrc\n", 4273 pid, pid, vrc)); 4270 4274 if (vrc != VERR_PROCESS_RUNNING) 4271 4275 { … … 4300 4304 */ 4301 4305 // static 4302 DECLCALLBACK(int) VirtualBox::AsyncEventHandler 4306 DECLCALLBACK(int) VirtualBox::AsyncEventHandler(RTTHREAD thread, void *pvUser) 4303 4307 { 4304 4308 LogFlowFuncEnter(); … … 4311 4315 4312 4316 // return the queue to the one who created this thread 4313 *(static_cast <EventQueue **> 4317 *(static_cast <EventQueue **>(pvUser)) = eventQ; 4314 4318 // signal that we're ready 4315 RTThreadUserSignal 4319 RTThreadUserSignal(thread); 4316 4320 4317 4321 BOOL ok = TRUE; 4318 4322 Event *event = NULL; 4319 4323 4320 while ((ok = eventQ->waitForEvent 4321 eventQ->handleEvent 4324 while ((ok = eventQ->waitForEvent(&event)) && event) 4325 eventQ->handleEvent(event); 4322 4326 4323 4327 AssertReturn(ok, VERR_GENERAL_FAILURE); … … 4348 4352 if (!autoCaller.isOk()) 4349 4353 { 4350 LogWarningFunc (("VirtualBox has been uninitialized (state=%d), " 4351 "the callback event is discarded!\n", 4352 autoCaller.state())); 4354 LogWarningFunc(("VirtualBox has been uninitialized (state=%d), the callback event is discarded!\n", 4355 autoCaller.state())); 4353 4356 /* We don't need mVirtualBox any more, so release it */ 4354 4357 mVirtualBox = NULL; … … 4373 4376 } 4374 4377 4375 //STDMETHODIMP VirtualBox::CreateDHCPServerForInterface 4378 //STDMETHODIMP VirtualBox::CreateDHCPServerForInterface(/*IHostNetworkInterface * aIinterface,*/ IDHCPServer ** aServer) 4376 4379 //{ 4377 4380 // return E_NOTIMPL; 4378 4381 //} 4379 4382 4380 STDMETHODIMP VirtualBox::CreateDHCPServer 4383 STDMETHODIMP VirtualBox::CreateDHCPServer(IN_BSTR aName, IDHCPServer ** aServer) 4381 4384 { 4382 4385 CheckComArgStrNotEmptyOrNull(aName); … … 4388 4391 ComObjPtr<DHCPServer> dhcpServer; 4389 4392 dhcpServer.createObject(); 4390 HRESULT rc = dhcpServer->init 4393 HRESULT rc = dhcpServer->init(this, aName); 4391 4394 if (FAILED(rc)) return rc; 4392 4395 … … 4433 4436 } 4434 4437 4435 STDMETHODIMP VirtualBox::RemoveDHCPServer 4438 STDMETHODIMP VirtualBox::RemoveDHCPServer(IDHCPServer * aServer) 4436 4439 { 4437 4440 CheckComArgNotNull(aServer); … … 4522 4525 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4523 4526 4524 AutoCaller dhcpServerCaller 4527 AutoCaller dhcpServerCaller(aDHCPServer); 4525 4528 AssertComRCReturn(dhcpServerCaller.rc(), dhcpServerCaller.rc()); 4526 4529 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r28193 r28205 568 568 569 569 The next two diagrams demonstrate the process of taking a snapshot of a 570 powered off virtual machine and performing one of the "discard..."571 o perations, respectively.570 powered off virtual machine, restoring the state to that as of a snapshot 571 or deleting a snapshot, respectively. 572 572 573 573 <pre> … … 1249 1249 <interface 1250 1250 name="IVirtualBoxCallback" extends="$unknown" 1251 uuid=" 9a65adf2-3ee6-406b-bca2-2b1fa05f0d0b"1251 uuid="7f6a65b6-ad5d-4a67-8872-0b11cb7ea95c" 1252 1252 wsmap="suppress" 1253 1253 > … … 1417 1417 </method> 1418 1418 1419 <method name="onSnapshotD iscarded">1420 <desc> 1421 Snapshot of the given machine has been d iscarded.1419 <method name="onSnapshotDeleted"> 1420 <desc> 1421 Snapshot of the given machine has been deleted. 1422 1422 1423 1423 <note> … … 1434 1434 <param name="snapshotId" type="uuid" mod="string" dir="in"> 1435 1435 <desc> 1436 ID of the d iscarded snapshot. @c null means the current machine1437 state has been d iscarded (restored from the current snapshot).1436 ID of the deleted snapshot. @c null means the current machine 1437 state has been deleted (restored from the current snapshot). 1438 1438 </desc> 1439 1439 </param> … … 3973 3973 </param> 3974 3974 <param name="id" type="uuid" mod="string" dir="in"> 3975 <desc>UUID of the snapshot to d iscard.</desc>3975 <desc>UUID of the snapshot to delete.</desc> 3976 3976 </param> 3977 3977 <param name="machineState" type="MachineState" dir="out"> … … 4595 4595 <ul> 4596 4596 <li>settings of the machine are changed</li> 4597 <li>the saved state is d iscarded</li>4598 <li>the current snapshot is d iscarded</li>4597 <li>the saved state is deleted</li> 4598 <li>the current snapshot is deleted</li> 4599 4599 <li>an attempt to execute the machine is made</li> 4600 4600 </ul> … … 7134 7134 this snapshot will be merged with the contents of their dependent child 7135 7135 media to keep the medium chain valid (in other words, all changes 7136 represented by media being d iscarded will be propagated to their child7136 represented by media being deleted will be propagated to their child 7137 7137 medium). After that, this snapshot's differencing medium will be 7138 7138 deleted. The parent of this snapshot will become a new parent for all … … 7142 7142 become a new current snapshot. The current machine state is not directly 7143 7143 affected in this case, except that currently attached differencing 7144 media based on media of the d iscarded snapshot will be also merged as7144 media based on media of the deleted snapshot will be also merged as 7145 7145 described above. 7146 7146 … … 7153 7153 7154 7154 <ul> 7155 <li>Child media of all normal media of the d iscarded snapshot7155 <li>Child media of all normal media of the deleted snapshot 7156 7156 must be accessible (see <link to="IMedium::state"/>) for this 7157 7157 operation to succeed. In particular, this means that all virtual 7158 7158 machines, whose media are directly or indirectly based on the 7159 media of d iscarded snapshot, must be powered off.</li>7159 media of deleted snapshot, must be powered off.</li> 7160 7160 7161 7161 <li>You cannot delete the snapshot if a medium attached to it has … … 7174 7174 Merging medium contents can be very time and disk space 7175 7175 consuming, if these media are big in size and have many 7176 children. However, if the snapshot being d iscarded is the last7176 children. However, if the snapshot being deleted is the last 7177 7177 (head) snapshot on the branch, the operation will be rather 7178 7178 quick. … … 7183 7183 </desc> 7184 7184 <param name="id" type="uuid" mod="string" dir="in"> 7185 <desc>UUID of the snapshot to d iscard.</desc>7185 <desc>UUID of the snapshot to delete.</desc> 7186 7186 </param> 7187 7187 <param name="progress" type="IProgress" dir="return"> … … 7213 7213 If the machine state is <link to="MachineState_Saved">Saved</link> 7214 7214 prior to this operation, the saved state file will be implicitly 7215 d iscarded (as if <link to="IConsole::forgetSavedState"/> were7215 deleted (as if <link to="IConsole::forgetSavedState"/> were 7216 7216 called). 7217 7217 </note> … … 8872 8872 to the last snapshot in the chain. In a future version of VirtualBox, 8873 8873 it will be possible to reset a machine's current state to that of an 8874 earlier snapshot without d iscarding the current state so that it will be8874 earlier snapshot without deleting the current state so that it will be 8875 8875 possible to create alternative snapshot paths in a snapshot tree. 8876 8876 -
trunk/src/VBox/Main/include/AutoCaller.h
r27797 r28205 141 141 if (mObj && SUCCEEDED(mRC)) 142 142 release(); 143 else if (!mObj) 144 { 145 /* Fix up the success state when nothing is attached. Otherwise 146 * there are a couple of assertion which would trigger. */ 147 mRC = E_FAIL; 148 } 143 149 mObj = aObj; 144 150 add(); -
trunk/src/VBox/Main/include/Global.h
r27820 r28205 7 7 8 8 /* 9 * Copyright (C) 2008 Sun Microsystems, Inc.9 * Copyright (C) 2008-2010 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 113 113 * Returns @c true if the given machine state is a transient state. This is 114 114 * a recommended way to detect if the VM is performing some potentially 115 * lengthy operation (such as starting, stopping, saving, d iscarding115 * lengthy operation (such as starting, stopping, saving, deleting 116 116 * snapshot, etc.). Note some (but not all) transitional states are also 117 117 * online states (see #IsOnline()). -
trunk/src/VBox/Main/include/Performance.h
r28058 r28205 356 356 SubMetric *mUsed; 357 357 SubMetric *mAvailable; 358 SubMetric *mAllocVMM; 359 SubMetric *mFreeVMM; 358 SubMetric *mAllocVMM; 359 SubMetric *mFreeVMM; 360 360 SubMetric *mBalloonVMM; 361 361 }; -
trunk/src/VBox/Main/include/VirtualBoxCallbackImpl.h
r26782 r28205 1 1 /* 2 * Copyright (C) 2009 Sun Microsystems, Inc.2 * Copyright (C) 2009-2010 Sun Microsystems, Inc. 3 3 * 4 4 * This file is part of VirtualBox Open Source Edition (OSE), as … … 56 56 // public initializers/uninitializers only for internal purposes 57 57 HRESULT init(); 58 void uninit 58 void uninit(bool aFinalRelease); 59 59 60 60 // ILocalOwner methods … … 67 67 BSTR *error, BOOL *changeAllowed); 68 68 STDMETHOD(OnExtraDataChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value); 69 STDMETHOD(OnMediumRegistered) 70 69 STDMETHOD(OnMediumRegistered)(IN_BSTR mediaId, DeviceType_T mediaType, 70 BOOL registered); 71 71 STDMETHOD(OnMachineRegistered)(IN_BSTR machineId, BOOL registered); 72 72 STDMETHOD(OnSessionStateChange)(IN_BSTR machineId, SessionState_T state); 73 STDMETHOD(OnSnapshotTaken) 74 STDMETHOD(OnSnapshotD iscarded)(IN_BSTR aMachineId, IN_BSTR aSnapshotId);75 STDMETHOD(OnSnapshotChange) 73 STDMETHOD(OnSnapshotTaken)(IN_BSTR aMachineId, IN_BSTR aSnapshotId); 74 STDMETHOD(OnSnapshotDeleted)(IN_BSTR aMachineId, IN_BSTR aSnapshotId); 75 STDMETHOD(OnSnapshotChange)(IN_BSTR aMachineId, IN_BSTR aSnapshotId); 76 76 STDMETHOD(OnGuestPropertyChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags); 77 77 … … 83 83 STDMETHOD(OnStateChange)(MachineState_T machineState); 84 84 STDMETHOD(OnAdditionsStateChange)(); 85 STDMETHOD(OnNetworkAdapterChange) 86 STDMETHOD(OnSerialPortChange) 87 STDMETHOD(OnParallelPortChange) 85 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *aNetworkAdapter); 86 STDMETHOD(OnSerialPortChange)(ISerialPort *aSerialPort); 87 STDMETHOD(OnParallelPortChange)(IParallelPort *aParallelPort); 88 88 STDMETHOD(OnVRDPServerChange)(); 89 89 STDMETHOD(OnRemoteDisplayInfoChange)(); 90 90 STDMETHOD(OnUSBControllerChange)(); 91 STDMETHOD(OnUSBDeviceStateChange) 91 STDMETHOD(OnUSBDeviceStateChange)(IUSBDevice *aDevice, BOOL aAttached, 92 92 IVirtualBoxErrorInfo *aError); 93 STDMETHOD(OnSharedFolderChange) 94 STDMETHOD(OnStorageControllerChange) 93 STDMETHOD(OnSharedFolderChange)(Scope_T aScope); 94 STDMETHOD(OnStorageControllerChange)(); 95 95 STDMETHOD(OnMediumChange)(IMediumAttachment *iMediumAttachment); 96 96 STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove); 97 97 STDMETHOD(OnRuntimeError)(BOOL fFatal, IN_BSTR id, IN_BSTR message); 98 98 STDMETHOD(OnCanShowWindow)(BOOL *canShow); 99 STDMETHOD(OnShowWindow) 99 STDMETHOD(OnShowWindow)(ULONG64 *winId); 100 100 101 101 // for VirtualBoxSupportErrorInfoImpl
Note:
See TracChangeset
for help on using the changeset viewer.