Changeset 13606 in vbox
- Timestamp:
- Oct 28, 2008 10:36:13 AM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r12423 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 2009 2011 ///////////////////////////////////////////////////////////////////////////// 2010 2012 2013 DEFINE_EMPTY_CTOR_DTOR (RemoteDisplayInfo) 2014 2011 2015 HRESULT RemoteDisplayInfo::FinalConstruct() 2012 2016 { … … 2016 2020 void RemoteDisplayInfo::FinalRelease() 2017 2021 { 2018 if (isReady()) 2019 uninit (); 2022 uninit (); 2020 2023 } 2021 2024 … … 2028 2031 HRESULT RemoteDisplayInfo::init (Console *aParent) 2029 2032 { 2030 LogFlow Member (("RemoteDisplayInfo::init (%p)\n", aParent));2033 LogFlowThisFunc (("aParent=%p\n", aParent)); 2031 2034 2032 2035 ComAssertRet (aParent, E_INVALIDARG); 2033 2036 2034 AutoWriteLock alock (this);2035 ComAssertRet (!isReady(), E_UNEXPECTED);2036 2037 mParent = aParent; 2038 2039 setReady (true); 2037 /* Enclose the state transition NotReady->InInit->Ready */ 2038 AutoInitSpan autoInitSpan (this); 2039 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 2040 2041 unconst (mParent) = aParent; 2042 2040 2043 return S_OK; 2041 2044 } … … 2047 2050 void RemoteDisplayInfo::uninit() 2048 2051 { 2049 LogFlow Member (("RemoteDisplayInfo::uninit()\n"));2050 2051 AutoWriteLock alock (this);2052 A ssertReturn (isReady(), (void) 0);2053 2054 mParent.setNull();2055 2056 setReady (false);2052 LogFlowThisFunc (("\n")); 2053 2054 /* Enclose the state transition Ready->InUninit->NotReady */ 2055 AutoUninitSpan autoUninitSpan (this); 2056 if (autoUninitSpan.uninitDone()) 2057 return; 2058 2059 unconst (mParent).setNull(); 2057 2060 } 2058 2061 … … 2066 2069 return E_POINTER; \ 2067 2070 \ 2068 AutoWriteLock alock (this); \ 2069 CHECK_READY(); \ 2071 AutoCaller autoCaller (this); \ 2072 CheckComRCReturnRC (autoCaller.rc()); \ 2073 \ 2074 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 2075 AutoWriteLock alock (this); \ 2070 2076 \ 2071 2077 uint32_t value; \ … … 2086 2092 return E_POINTER; \ 2087 2093 \ 2088 AutoWriteLock alock (this); \ 2089 CHECK_READY(); \ 2094 AutoCaller autoCaller (this); \ 2095 CheckComRCReturnRC (autoCaller.rc()); \ 2096 \ 2097 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 2098 AutoWriteLock alock (this); \ 2090 2099 \ 2091 2100 _aType value; \ … … 2106 2115 return E_POINTER; \ 2107 2116 \ 2108 AutoWriteLock alock (this); \ 2109 CHECK_READY(); \ 2117 AutoCaller autoCaller (this); \ 2118 CheckComRCReturnRC (autoCaller.rc()); \ 2119 \ 2120 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 2121 AutoWriteLock alock (this); \ 2110 2122 \ 2111 2123 uint32_t cbOut = 0; \ -
trunk/src/VBox/Main/DisplayImpl.cpp
r12925 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 63 65 ///////////////////////////////////////////////////////////////////////////// 64 66 67 DEFINE_EMPTY_CTOR_DTOR (Display) 68 65 69 HRESULT Display::FinalConstruct() 66 70 { … … 79 83 mcbVbvaPartial = 0; 80 84 81 mParent = NULL;82 85 mpDrv = NULL; 83 86 mpVMMDev = NULL; … … 96 99 void Display::FinalRelease() 97 100 { 98 if (isReady()) 99 uninit(); 101 uninit(); 100 102 } 101 103 … … 110 112 * @param qemuConsoleData address of common console data structure 111 113 */ 112 HRESULT Display::init (Console *parent) 113 { 114 LogFlowFunc (("isReady=%d", isReady())); 115 116 ComAssertRet (parent, E_INVALIDARG); 117 118 AutoWriteLock alock (this); 119 ComAssertRet (!isReady(), E_UNEXPECTED); 120 121 mParent = parent; 114 HRESULT Display::init (Console *aParent) 115 { 116 LogFlowThisFunc (("aParent=%p\n", aParent)); 117 118 ComAssertRet (aParent, E_INVALIDARG); 119 120 /* Enclose the state transition NotReady->InInit->Ready */ 121 AutoInitSpan autoInitSpan (this); 122 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 123 124 unconst (mParent) = aParent; 122 125 123 126 /* reset the event sems */ 124 RTSemEventMultiReset (mUpdateSem);127 RTSemEventMultiReset (mUpdateSem); 125 128 126 129 // by default, we have an internal framebuffer which is … … 157 160 } 158 161 159 mParent->RegisterCallback(this); 160 161 setReady (true); 162 mParent->RegisterCallback (this); 163 164 /* Confirm a successful initialization */ 165 autoInitSpan.setSucceeded(); 166 162 167 return S_OK; 163 168 } … … 169 174 void Display::uninit() 170 175 { 171 LogFlowFunc (("isReady=%d\n", isReady())); 172 173 AutoWriteLock alock (this); 174 AssertReturn (isReady(), (void) 0); 176 LogFlowThisFunc (("\n")); 177 178 /* Enclose the state transition Ready->InUninit->NotReady */ 179 AutoUninitSpan autoUninitSpan (this); 180 if (autoUninitSpan.uninitDone()) 181 return; 175 182 176 183 ULONG ul; 177 184 for (ul = 0; ul < mcMonitors; ul++) 178 {179 185 maFramebuffers[ul].pFramebuffer = NULL; 180 } 181 182 RTSemEventMultiDestroy(mUpdateSem); 186 187 RTSemEventMultiDestroy (mUpdateSem); 183 188 184 189 if (mParent) 185 {186 mParent->UnregisterCallback(this); 187 }190 mParent->UnregisterCallback (this); 191 192 unconst (mParent).setNull(); 188 193 189 194 if (mpDrv) 190 195 mpDrv->pDisplay = NULL; 196 191 197 mpDrv = NULL; 192 198 mpVMMDev = NULL; 193 199 mfVMMDevInited = true; 194 195 setReady (false);196 200 } 197 201 … … 206 210 } 207 211 else 208 {209 212 mfMachineRunning = false; 210 } 213 211 214 return S_OK; 212 215 } … … 1250 1253 return E_POINTER; 1251 1254 1255 AutoCaller autoCaller (this); 1256 CheckComRCReturnRC (autoCaller.rc()); 1257 1252 1258 AutoWriteLock alock (this); 1253 CHECK_READY();1254 1259 1255 1260 CHECK_CONSOLE_DRV (mpDrv); 1256 1261 1257 1262 *width = mpDrv->Connector.cx; 1263 1258 1264 return S_OK; 1259 1265 } … … 1270 1276 return E_POINTER; 1271 1277 1278 AutoCaller autoCaller (this); 1279 CheckComRCReturnRC (autoCaller.rc()); 1280 1272 1281 AutoWriteLock alock (this); 1273 CHECK_READY();1274 1282 1275 1283 CHECK_CONSOLE_DRV (mpDrv); 1276 1284 1277 1285 *height = mpDrv->Connector.cy; 1286 1278 1287 return S_OK; 1279 1288 } … … 1290 1299 return E_INVALIDARG; 1291 1300 1301 AutoCaller autoCaller (this); 1302 CheckComRCReturnRC (autoCaller.rc()); 1303 1292 1304 AutoWriteLock alock (this); 1293 CHECK_READY();1294 1305 1295 1306 CHECK_CONSOLE_DRV (mpDrv); … … 1299 1310 AssertRC(rc); 1300 1311 *bitsPerPixel = cBits; 1312 1301 1313 return S_OK; 1302 1314 } … … 1310 1322 LogFlowFunc (("\n")); 1311 1323 1324 AutoCaller autoCaller (this); 1325 CheckComRCReturnRC (autoCaller.rc()); 1326 1312 1327 AutoWriteLock alock (this); 1313 CHECK_READY();1314 1328 1315 1329 /* … … 1361 1375 return E_POINTER; 1362 1376 1377 AutoCaller autoCaller (this); 1378 CheckComRCReturnRC (autoCaller.rc()); 1379 1363 1380 AutoWriteLock alock (this); 1364 CHECK_READY();1365 1381 1366 1382 /* only allowed for internal framebuffers */ … … 1376 1392 1377 1393 return setError (E_FAIL, 1378 tr ("Framebuffer locking is allowed only for the internal framebuffer"));1394 tr ("Framebuffer locking is allowed only for the internal framebuffer")); 1379 1395 } 1380 1396 1381 1397 STDMETHODIMP Display::UnlockFramebuffer() 1382 1398 { 1399 AutoCaller autoCaller (this); 1400 CheckComRCReturnRC (autoCaller.rc()); 1401 1383 1402 AutoWriteLock alock (this); 1384 CHECK_READY();1385 1403 1386 1404 if (mFramebufferOpened) … … 1394 1412 1395 1413 return setError (E_FAIL, 1396 tr ("Framebuffer locking is allowed only for the internal framebuffer"));1414 tr ("Framebuffer locking is allowed only for the internal framebuffer")); 1397 1415 } 1398 1416 … … 1404 1422 return E_POINTER; 1405 1423 1424 AutoCaller autoCaller (this); 1425 CheckComRCReturnRC (autoCaller.rc()); 1426 1406 1427 AutoWriteLock alock (this); 1407 CHECK_READY();1408 1428 1409 1429 Console::SafeVMPtrQuiet pVM (mParent); … … 1443 1463 return E_POINTER; 1444 1464 1465 AutoCaller autoCaller (this); 1466 CheckComRCReturnRC (autoCaller.rc()); 1467 1445 1468 AutoWriteLock alock (this); 1446 CHECK_READY();1447 1469 1448 1470 Console::SafeVMPtrQuiet pVM (mParent); … … 1482 1504 return E_POINTER; 1483 1505 1506 AutoCaller autoCaller (this); 1507 CheckComRCReturnRC (autoCaller.rc()); 1508 1484 1509 AutoWriteLock alock (this); 1485 CHECK_READY();1486 1510 1487 1511 /* @todo this should be actually done on EMT. */ … … 1501 1525 STDMETHODIMP Display::SetVideoModeHint(ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel, ULONG aDisplay) 1502 1526 { 1527 AutoCaller autoCaller (this); 1528 CheckComRCReturnRC (autoCaller.rc()); 1529 1503 1530 AutoWriteLock alock (this); 1504 CHECK_READY();1505 1531 1506 1532 CHECK_CONSOLE_DRV (mpDrv); … … 1548 1574 STDMETHODIMP Display::SetSeamlessMode (BOOL enabled) 1549 1575 { 1576 AutoCaller autoCaller (this); 1577 CheckComRCReturnRC (autoCaller.rc()); 1578 1550 1579 AutoWriteLock alock (this); 1551 CHECK_READY();1552 1580 1553 1581 /* Have to leave the lock because the pfnRequestSeamlessChange will call EMT. */ … … 1577 1605 return E_INVALIDARG; 1578 1606 1607 AutoCaller autoCaller (this); 1608 CheckComRCReturnRC (autoCaller.rc()); 1609 1579 1610 AutoWriteLock alock (this); 1580 CHECK_READY();1581 1611 1582 1612 CHECK_CONSOLE_DRV (mpDrv); … … 1591 1621 /* 1592 1622 * First try use the graphics device features for making a snapshot. 1593 * This does not support stre atching, is an optional feature (returns not supported).1623 * This does not support stretching, is an optional feature (returns not supported). 1594 1624 * 1595 1625 * Note: It may cause a display resize. Watch out for deadlocks. … … 1612 1642 1613 1643 /* 1614 * If the function returns not supported, or if stre aching is requested,1644 * If the function returns not supported, or if stretching is requested, 1615 1645 * we'll have to do all the work ourselves using the framebuffer data. 1616 1646 */ 1617 1647 if (rcVBox == VERR_NOT_SUPPORTED || rcVBox == VERR_NOT_IMPLEMENTED) 1618 1648 { 1619 /** @todo implement snapshot stre ching and generic snapshot fallback. */1649 /** @todo implement snapshot stretching and generic snapshot fallback. */ 1620 1650 rc = setError (E_NOTIMPL, tr ("This feature is not implemented")); 1621 1651 } … … 1647 1677 return E_INVALIDARG; 1648 1678 1679 AutoCaller autoCaller (this); 1680 CheckComRCReturnRC (autoCaller.rc()); 1681 1649 1682 AutoWriteLock alock (this); 1650 CHECK_READY();1651 1683 1652 1684 CHECK_CONSOLE_DRV (mpDrv); … … 1657 1689 /* 1658 1690 * Again we're lazy and make the graphics device do all the 1659 * dirty conver tion work.1691 * dirty conversion work. 1660 1692 */ 1661 1693 PVMREQ pReq; … … 1704 1736 LogFlowFuncEnter(); 1705 1737 1738 AutoCaller autoCaller (this); 1739 CheckComRCReturnRC (autoCaller.rc()); 1740 1706 1741 AutoWriteLock alock (this); 1707 CHECK_READY();1708 1742 1709 1743 CHECK_CONSOLE_DRV (mpDrv); … … 1750 1784 // (and therefore don't use Display lock at all here to save some 1751 1785 // milliseconds). 1752 CHECK_READY(); 1786 AutoCaller autoCaller (this); 1787 CheckComRCReturnRC (autoCaller.rc()); 1753 1788 1754 1789 /* this is only valid for external framebuffers */ … … 1783 1818 // (and therefore don't use Display lock at all here to save some 1784 1819 // milliseconds). 1785 CHECK_READY(); 1820 AutoCaller autoCaller (this); 1821 CheckComRCReturnRC (autoCaller.rc()); 1786 1822 1787 1823 /* this is only valid for external framebuffers */ … … 1907 1943 AssertReturn (uScreenId < that->mcMonitors, VERR_INVALID_PARAMETER); 1908 1944 1909 /// @todo (r=dmik) AutoCaller 1945 AutoCaller autoCaller (that); 1946 CheckComRCReturnRC (autoCaller.rc()); 1910 1947 1911 1948 AutoWriteLock alock (that); … … 2264 2301 } 2265 2302 2266 /* Get the display information str cuture. */2303 /* Get the display information structure. */ 2267 2304 DISPLAYFBINFO *pFBInfo = &pDrv->pDisplay->maFramebuffers[uScreenId]; 2268 2305 -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r8155 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 23 22 24 #include "HostNetworkInterfaceImpl.h" 25 #include "Logging.h" 23 26 24 27 // constructor / destructor 25 28 ///////////////////////////////////////////////////////////////////////////// 26 29 27 HostNetworkInterface::HostNetworkInterface() 30 DEFINE_EMPTY_CTOR_DTOR (HostNetworkInterface) 31 32 HRESULT HostNetworkInterface::FinalConstruct() 28 33 { 34 return S_OK; 29 35 } 30 36 31 HostNetworkInterface::~HostNetworkInterface()37 void HostNetworkInterface::FinalRelease() 32 38 { 39 uninit (); 33 40 } 34 41 … … 40 47 * 41 48 * @returns COM result indicator 42 * @param interfaceName name of the network interface 49 * @param aInterfaceName name of the network interface 50 * @param aGuid GUID of the host network interface 43 51 */ 44 HRESULT HostNetworkInterface::init (Bstr interfaceName, Guid guid)52 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid) 45 53 { 46 ComAssertRet (interfaceName, E_INVALIDARG);47 ComAssertRet (!guid.isEmpty(), E_INVALIDARG);54 LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n", 55 aInterfaceName.raw(), aGuid.toString().raw())); 48 56 49 AutoWriteLock alock (this); 50 mInterfaceName = interfaceName; 51 mGuid = guid; 52 setReady(true); 57 ComAssertRet (aInterfaceName, E_INVALIDARG); 58 ComAssertRet (!aGuid.isEmpty(), E_INVALIDARG); 59 60 /* Enclose the state transition NotReady->InInit->Ready */ 61 AutoInitSpan autoInitSpan (this); 62 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 63 64 unconst (mInterfaceName) = aInterfaceName; 65 unconst (mGuid) = aGuid; 66 67 /* Confirm a successful initialization */ 68 autoInitSpan.setSucceeded(); 69 53 70 return S_OK; 54 71 } … … 61 78 * 62 79 * @returns COM status code 63 * @param interfaceName address of result pointer80 * @param aInterfaceName address of result pointer 64 81 */ 65 STDMETHODIMP HostNetworkInterface::COMGETTER(Name) (BSTR * interfaceName)82 STDMETHODIMP HostNetworkInterface::COMGETTER(Name) (BSTR *aInterfaceName) 66 83 { 67 if (! interfaceName)84 if (!aInterfaceName) 68 85 return E_POINTER; 69 AutoWriteLock alock (this); 70 CHECK_READY(); 71 mInterfaceName.cloneTo(interfaceName); 86 87 AutoCaller autoCaller (this); 88 CheckComRCReturnRC (autoCaller.rc()); 89 90 mInterfaceName.cloneTo (aInterfaceName); 91 72 92 return S_OK; 73 93 } … … 77 97 * 78 98 * @returns COM status code 79 * @param guid address of result pointer99 * @param aGuid address of result pointer 80 100 */ 81 STDMETHODIMP HostNetworkInterface::COMGETTER(Id) (GUIDPARAMOUT guid)101 STDMETHODIMP HostNetworkInterface::COMGETTER(Id) (GUIDPARAMOUT aGuid) 82 102 { 83 if (! guid)103 if (!aGuid) 84 104 return E_POINTER; 85 AutoWriteLock alock (this); 86 CHECK_READY(); 87 mGuid.cloneTo(guid); 105 106 AutoCaller autoCaller (this); 107 CheckComRCReturnRC (autoCaller.rc()); 108 109 mGuid.cloneTo (aGuid); 110 88 111 return S_OK; 89 112 } 113 -
trunk/src/VBox/Main/KeyboardImpl.cpp
r11661 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 57 59 //////////////////////////////////////////////////////////////////////////////// 58 60 61 DEFINE_EMPTY_CTOR_DTOR (Keyboard) 62 59 63 HRESULT Keyboard::FinalConstruct() 60 64 { 61 mParent = NULL;62 65 mpDrv = NULL; 63 66 mpVMMDev = NULL; … … 68 71 void Keyboard::FinalRelease() 69 72 { 70 if (isReady()) 71 uninit(); 73 uninit(); 72 74 } 73 75 … … 81 83 * @param parent handle of our parent object 82 84 */ 83 HRESULT Keyboard::init (Console *parent) 84 { 85 LogFlow(("Keyboard::init(): isReady=%d\n", isReady())); 86 87 ComAssertRet (parent, E_INVALIDARG); 88 89 AutoWriteLock alock (this); 90 ComAssertRet (!isReady(), E_UNEXPECTED); 91 92 mParent = parent; 93 94 setReady (true); 85 HRESULT Keyboard::init (Console *aParent) 86 { 87 LogFlowThisFunc (("aParent=%p\n", aParent)); 88 89 ComAssertRet (aParent, E_INVALIDARG); 90 91 /* Enclose the state transition NotReady->InInit->Ready */ 92 AutoInitSpan autoInitSpan (this); 93 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 94 95 unconst (mParent) = aParent; 96 97 /* Confirm a successful initialization */ 98 autoInitSpan.setSucceeded(); 99 95 100 return S_OK; 96 101 } … … 102 107 void Keyboard::uninit() 103 108 { 104 LogFlow(("Keyboard::uninit(): isReady=%d\n", isReady())); 105 106 AutoWriteLock alock (this); 107 AssertReturn (isReady(), (void) 0); 109 LogFlowThisFunc (("\n")); 110 111 /* Enclose the state transition Ready->InUninit->NotReady */ 112 AutoUninitSpan autoUninitSpan (this); 113 if (autoUninitSpan.uninitDone()) 114 return; 108 115 109 116 if (mpDrv) 110 117 mpDrv->pKeyboard = NULL; 118 111 119 mpDrv = NULL; 112 120 mpVMMDev = NULL; 113 121 mfVMMDevInited = true; 114 122 115 setReady (false);123 unconst (mParent).setNull(); 116 124 } 117 125 … … 122 130 * @param scancode The scancode to send 123 131 */ 124 STDMETHODIMP Keyboard::PutScancode(LONG scancode) 125 { 132 STDMETHODIMP Keyboard::PutScancode (LONG scancode) 133 { 134 HRESULT rc = S_OK; 135 136 AutoCaller autoCaller (this); 137 CheckComRCReturnRC (autoCaller.rc()); 138 126 139 AutoWriteLock alock (this); 127 CHECK_READY();128 140 129 141 CHECK_CONSOLE_DRV (mpDrv); 130 142 131 int rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)scancode); 132 133 if (VBOX_FAILURE (rcVBox)) 134 return setError (E_FAIL, 135 tr ("Could not send scan code 0x%08X to the virtual keyboard (%Vrc)"), 136 scancode, rcVBox); 137 138 return S_OK; 143 int vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)scancode); 144 145 if (VBOX_FAILURE (vrc)) 146 rc = setError (E_FAIL, tr ("Could not send scan code 0x%08X to the virtual keyboard (%Vrc)"), 147 scancode, vrc); 148 149 return rc; 139 150 } 140 151 … … 149 160 This value can be NULL. 150 161 */ 151 STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn (LONG, scancodes), 152 ULONG *codesStored) 153 { 154 if (ComSafeArrayInIsNull(scancodes)) 162 STDMETHODIMP Keyboard::PutScancodes (ComSafeArrayIn (LONG, scancodes), 163 ULONG *codesStored) 164 { 165 HRESULT rc = S_OK; 166 167 if (ComSafeArrayInIsNull (scancodes)) 155 168 return E_INVALIDARG; 156 169 170 AutoCaller autoCaller (this); 171 CheckComRCReturnRC (autoCaller.rc()); 172 157 173 AutoWriteLock alock (this); 158 CHECK_READY();159 174 160 175 CHECK_CONSOLE_DRV (mpDrv); 161 176 162 com::SafeArray <LONG> keys(ComSafeArrayInArg(scancodes)); 163 int rcVBox = VINF_SUCCESS; 164 165 for (uint32_t i = 0; (i < keys.size()) && VBOX_SUCCESS(rcVBox); i++) 166 { 167 rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]); 168 } 169 170 if (VBOX_FAILURE (rcVBox)) 171 return setError (E_FAIL, 172 tr ("Could not send all scan codes to the virtual keyboard (%Vrc)"), rcVBox); 177 com::SafeArray <LONG> keys (ComSafeArrayInArg (scancodes)); 178 int vrc = VINF_SUCCESS; 179 180 for (uint32_t i = 0; (i < keys.size()) && VBOX_SUCCESS (vrc); i++) 181 vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)keys [i]); 182 183 if (VBOX_FAILURE (vrc)) 184 return setError (E_FAIL, tr ("Could not send all scan codes to the virtual keyboard (%Vrc)"), 185 vrc); 173 186 174 187 /// @todo is it actually possible that not all scancodes can be transmitted? … … 176 189 *codesStored = keys.size(); 177 190 178 return S_OK;191 return rc; 179 192 } 180 193 … … 188 201 STDMETHODIMP Keyboard::PutCAD() 189 202 { 190 static com::SafeArray<LONG> cadSequence (6);191 192 cadSequence [0] = 0x1d; // Ctrl down193 cadSequence [1] = 0x38; // Alt down194 cadSequence [2] = 0x53; // Del down195 cadSequence [3] = 0xd3; // Del up196 cadSequence [4] = 0xb8; // Alt up197 cadSequence [5] = 0x9d; // Ctrl up198 199 return PutScancodes (ComSafeArrayAsInParam (cadSequence), NULL);203 static com::SafeArray<LONG> cadSequence (6); 204 205 cadSequence [0] = 0x1d; // Ctrl down 206 cadSequence [1] = 0x38; // Alt down 207 cadSequence [2] = 0x53; // Del down 208 cadSequence [3] = 0xd3; // Del up 209 cadSequence [4] = 0xb8; // Alt up 210 cadSequence [5] = 0x9d; // Ctrl up 211 212 return PutScancodes (ComSafeArrayAsInParam (cadSequence), NULL); 200 213 } 201 214 … … 212 225 * @param enmInterface The requested interface identification. 213 226 */ 214 DECLCALLBACK(void *) Keyboard::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)215 { 216 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV (pInterface);217 PDRVMAINKEYBOARD pDrv = PDMINS_2_DATA (pDrvIns, PDRVMAINKEYBOARD);227 DECLCALLBACK(void *) Keyboard::drvQueryInterface (PPDMIBASE pInterface, PDMINTERFACE enmInterface) 228 { 229 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV (pInterface); 230 PDRVMAINKEYBOARD pDrv = PDMINS_2_DATA (pDrvIns, PDRVMAINKEYBOARD); 218 231 switch (enmInterface) 219 232 { … … 234 247 * @param pDrvIns The driver instance data. 235 248 */ 236 DECLCALLBACK(void) Keyboard::drvDestruct (PPDMDRVINS pDrvIns)249 DECLCALLBACK(void) Keyboard::drvDestruct (PPDMDRVINS pDrvIns) 237 250 { 238 251 PDRVMAINKEYBOARD pData = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD); … … 246 259 } 247 260 248 DECLCALLBACK(void) keyboardLedStatusChange (PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds)249 { 250 PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD (pInterface);251 pDrv->pKeyboard->getParent()->onKeyboardLedsChange (!!(enmLeds & PDMKEYBLEDS_NUMLOCK),252 !!(enmLeds & PDMKEYBLEDS_CAPSLOCK),253 !!(enmLeds & PDMKEYBLEDS_SCROLLLOCK));261 DECLCALLBACK(void) keyboardLedStatusChange (PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds) 262 { 263 PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD (pInterface); 264 pDrv->pKeyboard->getParent()->onKeyboardLedsChange (!!(enmLeds & PDMKEYBLEDS_NUMLOCK), 265 !!(enmLeds & PDMKEYBLEDS_CAPSLOCK), 266 !!(enmLeds & PDMKEYBLEDS_SCROLLLOCK)); 254 267 } 255 268 … … 264 277 * iInstance it's expected to be used a bit in this function. 265 278 */ 266 DECLCALLBACK(int) Keyboard::drvConstruct (PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)267 { 268 PDRVMAINKEYBOARD pData = PDMINS_2_DATA (pDrvIns, PDRVMAINKEYBOARD);279 DECLCALLBACK(int) Keyboard::drvConstruct (PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) 280 { 281 PDRVMAINKEYBOARD pData = PDMINS_2_DATA (pDrvIns, PDRVMAINKEYBOARD); 269 282 LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance)); 270 283 … … 272 285 * Validate configuration. 273 286 */ 274 if (!CFGMR3AreValuesValid (pCfgHandle, "Object\0"))287 if (!CFGMR3AreValuesValid (pCfgHandle, "Object\0")) 275 288 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 276 289 PPDMIBASE pBaseIgnore; 277 int rc = pDrvIns->pDrvHlp->pfnAttach (pDrvIns, &pBaseIgnore);290 int rc = pDrvIns->pDrvHlp->pfnAttach (pDrvIns, &pBaseIgnore); 278 291 if (rc != VERR_PDM_NO_ATTACHED_DRIVER) 279 292 { 280 AssertMsgFailed (("Configuration error: Not possible to attach anything to this driver!\n"));293 AssertMsgFailed (("Configuration error: Not possible to attach anything to this driver!\n")); 281 294 return VERR_PDM_DRVINS_NO_ATTACH; 282 295 } … … 292 305 * Get the IKeyboardPort interface of the above driver/device. 293 306 */ 294 pData->pUpPort = (PPDMIKEYBOARDPORT)pDrvIns->pUpBase->pfnQueryInterface (pDrvIns->pUpBase, PDMINTERFACE_KEYBOARD_PORT);307 pData->pUpPort = (PPDMIKEYBOARDPORT)pDrvIns->pUpBase->pfnQueryInterface (pDrvIns->pUpBase, PDMINTERFACE_KEYBOARD_PORT); 295 308 if (!pData->pUpPort) 296 309 { 297 AssertMsgFailed (("Configuration error: No keyboard port interface above!\n"));310 AssertMsgFailed (("Configuration error: No keyboard port interface above!\n")); 298 311 return VERR_PDM_MISSING_INTERFACE_ABOVE; 299 312 } … … 303 316 */ 304 317 void *pv; 305 rc = CFGMR3QueryPtr (pCfgHandle, "Object", &pv);306 if (VBOX_FAILURE (rc))307 { 308 AssertMsgFailed (("Configuration error: No/bad \"Object\" value! rc=%Vrc\n", rc));318 rc = CFGMR3QueryPtr (pCfgHandle, "Object", &pv); 319 if (VBOX_FAILURE (rc)) 320 { 321 AssertMsgFailed (("Configuration error: No/bad \"Object\" value! rc=%Vrc\n", rc)); 309 322 return rc; 310 323 } -
trunk/src/VBox/Main/MouseImpl.cpp
r11296 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 52 54 ///////////////////////////////////////////////////////////////////////////// 53 55 56 DEFINE_EMPTY_CTOR_DTOR (Mouse) 57 54 58 HRESULT Mouse::FinalConstruct() 55 59 { 56 mParent = NULL;57 60 mpDrv = NULL; 58 61 return S_OK; … … 61 64 void Mouse::FinalRelease() 62 65 { 63 if (isReady()) 64 uninit(); 66 uninit(); 65 67 } 66 68 … … 76 78 HRESULT Mouse::init (Console *parent) 77 79 { 78 LogFlow(("Mouse::init() : isReady=%d\n", isReady()));80 LogFlow(("Mouse::init()\n")); 79 81 80 82 ComAssertRet (parent, E_INVALIDARG); 81 83 82 AutoWriteLock alock (this); 83 ComAssertRet (!isReady(), E_UNEXPECTED); 84 85 mParent = parent; 84 /* Enclose the state transition NotReady->InInit->Ready */ 85 AutoInitSpan autoInitSpan (this); 86 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 87 88 unconst(mParent) = parent; 86 89 87 90 #ifdef RT_OS_L4 … … 92 95 #endif 93 96 94 setReady (true); 97 /* Confirm a successful initialization */ 98 autoInitSpan.setSucceeded(); 99 95 100 return S_OK; 96 101 } … … 102 107 void Mouse::uninit() 103 108 { 104 LogFlow(("Mouse::uninit(): isReady=%d\n", isReady())); 105 106 AutoWriteLock alock (this); 107 AssertReturn (isReady(), (void) 0); 109 LogFlowThisFunc (("\n")); 110 111 /* Enclose the state transition Ready->InUninit->NotReady */ 112 AutoUninitSpan autoUninitSpan (this); 113 if (autoUninitSpan.uninitDone()) 114 return; 108 115 109 116 if (mpDrv) … … 111 118 mpDrv = NULL; 112 119 113 setReady (false);120 unconst (mParent).setNull(); 114 121 } 115 122 … … 129 136 return E_POINTER; 130 137 138 AutoCaller autoCaller (this); 139 CheckComRCReturnRC (autoCaller.rc()); 140 131 141 AutoWriteLock alock (this); 132 CHECK_READY();133 142 134 143 CHECK_CONSOLE_DRV (mpDrv); … … 141 150 mParent->getVMMDev()->getVMMDevPort()->pfnQueryMouseCapabilities(mParent->getVMMDev()->getVMMDevPort(), &mouseCaps); 142 151 *absoluteSupported = mouseCaps & VMMDEV_MOUSEGUESTWANTSABS; 152 143 153 return S_OK; 144 154 } … … 156 166 return E_POINTER; 157 167 168 AutoCaller autoCaller (this); 169 CheckComRCReturnRC (autoCaller.rc()); 170 158 171 AutoWriteLock alock (this); 159 CHECK_READY();160 172 161 173 CHECK_CONSOLE_DRV (mpDrv); … … 168 180 mParent->getVMMDev()->getVMMDevPort()->pfnQueryMouseCapabilities(mParent->getVMMDev()->getVMMDevPort(), &mouseCaps); 169 181 *needsHostCursor = mouseCaps & VMMDEV_MOUSEGUESTNEEDSHOSTCUR; 182 170 183 return S_OK; 171 184 } … … 185 198 STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG buttonState) 186 199 { 200 HRESULT rc = S_OK; 201 202 AutoCaller autoCaller (this); 203 CheckComRCReturnRC (autoCaller.rc()); 204 187 205 AutoWriteLock alock (this); 188 CHECK_READY();189 206 190 207 CHECK_CONSOLE_DRV (mpDrv); … … 218 235 int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, dx, dy, dz, fButtons); 219 236 if (VBOX_FAILURE (vrc)) 220 return setError (E_FAIL, 221 tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 222 vrc); 223 224 return S_OK; 237 rc = setError (E_FAIL, tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 238 vrc); 239 240 return rc; 225 241 } 226 242 … … 238 254 LONG buttonState) 239 255 { 256 HRESULT rc = S_OK; 257 258 AutoCaller autoCaller (this); 259 CheckComRCReturnRC (autoCaller.rc()); 260 240 261 AutoWriteLock alock (this); 241 CHECK_READY();242 262 243 263 CHECK_CONSOLE_DRV (mpDrv); … … 267 287 ULONG displayWidth; 268 288 ULONG displayHeight; 269 HRESULTrc = pDisplay->COMGETTER(Width)(&displayWidth);289 rc = pDisplay->COMGETTER(Width)(&displayWidth); 270 290 ComAssertComRCRet (rc, rc); 271 291 rc = pDisplay->COMGETTER(Height)(&displayHeight); … … 297 317 fButtons); 298 318 if (VBOX_FAILURE (vrc)) 299 return setError (E_FAIL, 300 tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 301 vrc); 302 } 303 304 return S_OK; 319 rc = setError (E_FAIL, tr ("Could not send the mouse event to the virtual mouse (%Vrc)"), 320 vrc); 321 } 322 323 return rc; 305 324 } 306 325 -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r13580 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 39 41 ///////////////////////////////////////////////////////////////////////////// 40 42 43 DEFINE_EMPTY_CTOR_DTOR (SystemProperties) 44 41 45 HRESULT SystemProperties::FinalConstruct() 42 46 { … … 46 50 void SystemProperties::FinalRelease() 47 51 { 48 if (isReady()) 49 uninit (); 52 uninit (); 50 53 } 51 54 … … 60 63 HRESULT SystemProperties::init (VirtualBox *aParent) 61 64 { 62 LogFlow Member (("SystemProperties::init()\n"));65 LogFlowThisFunc (("aParent=%p\n", aParent)); 63 66 64 67 ComAssertRet (aParent, E_FAIL); 65 68 66 AutoWriteLock alock (this); 67 ComAssertRet (!isReady(), E_UNEXPECTED); 68 69 mParent = aParent; 69 /* Enclose the state transition NotReady->InInit->Ready */ 70 AutoInitSpan autoInitSpan (this); 71 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 72 73 unconst (mParent) = aParent; 70 74 71 75 setDefaultMachineFolder (NULL); … … 105 109 } 106 110 107 setReady (SUCCEEDED (rc)); 111 /* Confirm a successful initialization */ 112 if (SUCCEEDED (rc)) 113 autoInitSpan.setSucceeded(); 108 114 109 115 return rc; … … 116 122 void SystemProperties::uninit() 117 123 { 118 LogFlowMember (("SystemProperties::uninit()\n")); 119 120 AutoWriteLock alock (this); 121 AssertReturn (isReady(), (void) 0); 122 123 setReady (false); 124 LogFlowThisFunc (("\n")); 125 126 /* Enclose the state transition Ready->InUninit->NotReady */ 127 AutoUninitSpan autoUninitSpan (this); 128 if (autoUninitSpan.uninitDone()) 129 return; 130 131 unconst (mParent).setNull(); 124 132 } 125 133 … … 132 140 if (!minRAM) 133 141 return E_POINTER; 134 AutoWriteLock alock (this); 135 CHECK_READY(); 136 142 143 AutoCaller autoCaller (this); 144 CheckComRCReturnRC (autoCaller.rc()); 145 146 /* no need to lock, this is const */ 137 147 *minRAM = SchemaDefs::MinGuestRAM; 138 148 … … 144 154 if (!maxRAM) 145 155 return E_POINTER; 146 AutoWriteLock alock (this); 147 CHECK_READY(); 148 156 157 AutoCaller autoCaller (this); 158 CheckComRCReturnRC (autoCaller.rc()); 159 160 /* no need to lock, this is const */ 149 161 *maxRAM = SchemaDefs::MaxGuestRAM; 150 162 … … 156 168 if (!minVRAM) 157 169 return E_POINTER; 158 AutoWriteLock alock (this); 159 CHECK_READY(); 160 170 171 AutoCaller autoCaller (this); 172 CheckComRCReturnRC (autoCaller.rc()); 173 174 /* no need to lock, this is const */ 161 175 *minVRAM = SchemaDefs::MinGuestVRAM; 162 176 … … 168 182 if (!maxVRAM) 169 183 return E_POINTER; 170 AutoWriteLock alock (this); 171 CHECK_READY(); 172 184 185 AutoCaller autoCaller (this); 186 CheckComRCReturnRC (autoCaller.rc()); 187 188 /* no need to lock, this is const */ 173 189 *maxVRAM = SchemaDefs::MaxGuestVRAM; 174 190 … … 180 196 if (!maxMonitors) 181 197 return E_POINTER; 182 AutoWriteLock alock (this); 183 CHECK_READY(); 184 198 199 AutoCaller autoCaller (this); 200 CheckComRCReturnRC (autoCaller.rc()); 201 202 /* no need to lock, this is const */ 185 203 *maxMonitors = SchemaDefs::MaxGuestMonitors; 186 204 … … 192 210 if (!maxVDISize) 193 211 return E_POINTER; 194 AutoWriteLock alock (this); 195 CHECK_READY(); 212 213 AutoCaller autoCaller (this); 214 CheckComRCReturnRC (autoCaller.rc()); 196 215 197 216 /** The BIOS supports currently 32 bit LBA numbers (implementing the full … … 204 223 * theoretical maximum disk size is 128 PiByte. The user interface cannot 205 224 * cope with this in a reasonable way yet. */ 225 /* no need to lock, this is const */ 206 226 *maxVDISize = 2048 * 1024 - 1; 207 227 … … 213 233 if (!count) 214 234 return E_POINTER; 215 AutoWriteLock alock (this); 216 CHECK_READY(); 217 235 236 AutoCaller autoCaller (this); 237 CheckComRCReturnRC (autoCaller.rc()); 238 239 /* no need to lock, this is const */ 218 240 *count = SchemaDefs::NetworkAdapterCount; 219 241 … … 225 247 if (!count) 226 248 return E_POINTER; 227 AutoWriteLock alock (this); 228 CHECK_READY(); 229 249 250 AutoCaller autoCaller (this); 251 CheckComRCReturnRC (autoCaller.rc()); 252 253 /* no need to lock, this is const */ 230 254 *count = SchemaDefs::SerialPortCount; 231 255 … … 237 261 if (!count) 238 262 return E_POINTER; 239 AutoWriteLock alock (this); 240 CHECK_READY(); 241 263 264 AutoCaller autoCaller (this); 265 CheckComRCReturnRC (autoCaller.rc()); 266 267 /* no need to lock, this is const */ 242 268 *count = SchemaDefs::ParallelPortCount; 243 269 … … 249 275 if (!aMaxBootPosition) 250 276 return E_POINTER; 251 AutoWriteLock alock (this); 252 CHECK_READY(); 253 277 278 AutoCaller autoCaller (this); 279 CheckComRCReturnRC (autoCaller.rc()); 280 281 /* no need to lock, this is const */ 254 282 *aMaxBootPosition = SchemaDefs::MaxBootPosition; 255 283 … … 262 290 return E_POINTER; 263 291 264 AutoWriteLock alock (this); 265 CHECK_READY(); 292 AutoCaller autoCaller (this); 293 CheckComRCReturnRC (autoCaller.rc()); 294 295 AutoReadLock alock (this); 266 296 267 297 mDefaultMachineFolderFull.cloneTo (aDefaultMachineFolder); … … 272 302 STDMETHODIMP SystemProperties::COMSETTER(DefaultMachineFolder) (INPTR BSTR aDefaultMachineFolder) 273 303 { 274 AutoWriteLock alock (this); 275 CHECK_READY(); 304 AutoCaller autoCaller (this); 305 CheckComRCReturnRC (autoCaller.rc()); 306 307 /* VirtualBox::saveSettings() needs a write lock */ 308 AutoMultiWriteLock2 alock (mParent, this); 276 309 277 310 HRESULT rc = setDefaultMachineFolder (aDefaultMachineFolder); 278 if (FAILED (rc)) 279 return rc; 280 281 alock.unlock(); 282 return mParent->saveSettings(); 311 if (SUCCEEDED (rc)) 312 rc = mParent->saveSettings(); 313 314 return rc; 283 315 } 284 316 … … 288 320 return E_POINTER; 289 321 290 AutoWriteLock alock (this); 291 CHECK_READY(); 322 AutoCaller autoCaller (this); 323 CheckComRCReturnRC (autoCaller.rc()); 324 325 AutoReadLock alock (this); 292 326 293 327 mDefaultHardDiskFolderFull.cloneTo (aDefaultHardDiskFolder); … … 298 332 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFolder) (INPTR BSTR aDefaultHardDiskFolder) 299 333 { 300 AutoWriteLock alock (this); 301 CHECK_READY(); 334 AutoCaller autoCaller (this); 335 CheckComRCReturnRC (autoCaller.rc()); 336 337 /* VirtualBox::saveSettings() needs a write lock */ 338 AutoMultiWriteLock2 alock (mParent, this); 302 339 303 340 HRESULT rc = setDefaultHardDiskFolder (aDefaultHardDiskFolder); 304 if (FAILED (rc)) 305 return rc; 306 307 alock.unlock(); 308 return mParent->saveSettings(); 341 if (SUCCEEDED (rc)) 342 rc = mParent->saveSettings(); 343 344 return rc; 309 345 } 310 346 … … 315 351 return E_POINTER; 316 352 317 AutoWriteLock alock (this); 318 CHECK_READY(); 353 AutoCaller autoCaller (this); 354 CheckComRCReturnRC (autoCaller.rc()); 355 356 AutoReadLock alock (this); 319 357 320 358 SafeIfaceArray <IHardDiskFormat> hardDiskFormats (mHardDiskFormats); … … 329 367 return E_POINTER; 330 368 331 AutoWriteLock alock (this); 332 CHECK_READY(); 369 AutoCaller autoCaller (this); 370 CheckComRCReturnRC (autoCaller.rc()); 371 372 AutoReadLock alock (this); 333 373 334 374 mRemoteDisplayAuthLibrary.cloneTo (aRemoteDisplayAuthLibrary); … … 339 379 STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary) (INPTR BSTR aRemoteDisplayAuthLibrary) 340 380 { 341 AutoWriteLock alock (this); 342 CHECK_READY(); 381 AutoCaller autoCaller (this); 382 CheckComRCReturnRC (autoCaller.rc()); 383 384 /* VirtualBox::saveSettings() needs a write lock */ 385 AutoMultiWriteLock2 alock (mParent, this); 343 386 344 387 HRESULT rc = setRemoteDisplayAuthLibrary (aRemoteDisplayAuthLibrary); 345 if (FAILED (rc)) 346 return rc; 347 348 alock.unlock(); 349 return mParent->saveSettings(); 388 if (SUCCEEDED (rc)) 389 rc = mParent->saveSettings(); 390 391 return rc; 350 392 } 351 393 … … 355 397 return E_POINTER; 356 398 357 AutoWriteLock alock (this); 358 CHECK_READY(); 399 AutoCaller autoCaller (this); 400 CheckComRCReturnRC (autoCaller.rc()); 401 402 AutoReadLock alock (this); 359 403 360 404 mWebServiceAuthLibrary.cloneTo (aWebServiceAuthLibrary); … … 365 409 STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary) (INPTR BSTR aWebServiceAuthLibrary) 366 410 { 367 AutoWriteLock alock (this); 368 CHECK_READY(); 411 AutoCaller autoCaller (this); 412 CheckComRCReturnRC (autoCaller.rc()); 413 414 /* VirtualBox::saveSettings() needs a write lock */ 415 AutoMultiWriteLock2 alock (mParent, this); 369 416 370 417 HRESULT rc = setWebServiceAuthLibrary (aWebServiceAuthLibrary); 371 if (FAILED (rc)) 372 return rc; 373 374 alock.unlock(); 375 return mParent->saveSettings(); 418 if (SUCCEEDED (rc)) 419 rc = mParent->saveSettings(); 420 421 return rc; 376 422 } 377 423 … … 381 427 return E_POINTER; 382 428 383 AutoWriteLock alock (this); 384 CHECK_READY(); 429 AutoCaller autoCaller (this); 430 CheckComRCReturnRC (autoCaller.rc()); 431 432 AutoReadLock alock (this); 385 433 386 434 *enabled = mHWVirtExEnabled; … … 391 439 STDMETHODIMP SystemProperties::COMSETTER(HWVirtExEnabled) (BOOL enabled) 392 440 { 393 AutoWriteLock alock (this); 394 CHECK_READY(); 441 AutoCaller autoCaller (this); 442 CheckComRCReturnRC (autoCaller.rc()); 443 444 /* VirtualBox::saveSettings() needs a write lock */ 445 AutoMultiWriteLock2 alock (mParent, this); 395 446 396 447 mHWVirtExEnabled = enabled; 397 448 398 alock.unlock(); 399 return mParent->saveSettings(); 449 HRESULT rc = mParent->saveSettings(); 450 451 return rc; 400 452 } 401 453 … … 405 457 return E_POINTER; 406 458 407 AutoWriteLock alock (this); 408 CHECK_READY(); 459 AutoCaller autoCaller (this); 460 CheckComRCReturnRC (autoCaller.rc()); 461 462 AutoReadLock alock (this); 409 463 410 464 *count = mLogHistoryCount; … … 415 469 STDMETHODIMP SystemProperties::COMSETTER(LogHistoryCount) (ULONG count) 416 470 { 417 AutoWriteLock alock (this); 418 CHECK_READY(); 471 AutoCaller autoCaller (this); 472 CheckComRCReturnRC (autoCaller.rc()); 473 474 /* VirtualBox::saveSettings() needs a write lock */ 475 AutoMultiWriteLock2 alock (mParent, this); 419 476 420 477 mLogHistoryCount = count; 421 478 422 alock.unlock(); 423 return mParent->saveSettings(); 479 HRESULT rc = mParent->saveSettings(); 480 481 return rc; 424 482 } 425 483 … … 431 489 using namespace settings; 432 490 491 AutoCaller autoCaller (this); 492 CheckComRCReturnRC (autoCaller.rc()); 493 433 494 AutoWriteLock alock (this); 434 CHECK_READY();435 495 436 496 AssertReturn (!aGlobal.isNull(), E_FAIL); … … 470 530 using namespace settings; 471 531 472 AutoWriteLock alock (this); 473 CHECK_READY(); 532 AutoCaller autoCaller (this); 533 CheckComRCReturnRC (autoCaller.rc()); 534 535 AutoReadLock alock (this); 474 536 475 537 ComAssertRet (!aGlobal.isNull(), E_FAIL); -
trunk/src/VBox/Main/include/ConsoleImpl.h
r13580 r13606 164 164 */ 165 165 166 Guest *getGuest() { return mGuest; }167 Keyboard *getKeyboard() { return mKeyboard; }168 Mouse *getMouse() { return mMouse; }169 Display *getDisplay() { return mDisplay; }170 MachineDebugger *getMachineDebugger() { return mDebugger; }171 172 const ComPtr <IMachine> &machine() { return mMachine; }166 Guest *getGuest() const { return mGuest; } 167 Keyboard *getKeyboard() const { return mKeyboard; } 168 Mouse *getMouse() const { return mMouse; } 169 Display *getDisplay() const { return mDisplay; } 170 MachineDebugger *getMachineDebugger() const { return mDebugger; } 171 172 const ComPtr <IMachine> &machine() const { return mMachine; } 173 173 174 174 /** Method is called only from ConsoleVRDPServer */ 175 IVRDPServer *getVRDPServer() { return mVRDPServer; }176 177 ConsoleVRDPServer *consoleVRDPServer() { return mConsoleVRDPServer; }175 IVRDPServer *getVRDPServer() const { return mVRDPServer; } 176 177 ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; } 178 178 179 179 HRESULT updateMachineState (MachineState_T aMachineState); -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r12126 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 49 51 bool fClientScrollLock; 50 52 } VRDPInputSynch; 51 #endif /* VBOX_WITH_VRDP */ 53 #endif /* VBOX_WITH_VRDP */ 52 54 53 55 /* Member of Console. Helper class for VRDP server management. Not a COM class. */ … … 66 68 #else 67 69 NOREF(fGuestWantsAbsolute); 68 #endif /* VBOX_WITH_VRDP */ 70 #endif /* VBOX_WITH_VRDP */ 69 71 } 70 72 … … 94 96 NOREF(fCapsLock); 95 97 NOREF(fScrollLock); 96 #endif /* VBOX_WITH_VRDP */ 98 #endif /* VBOX_WITH_VRDP */ 97 99 } 98 100 … … 112 114 void USBBackendCreate (uint32_t u32ClientId, void **ppvIntercept); 113 115 void USBBackendDelete (uint32_t u32ClientId); 114 116 115 117 void *USBBackendRequestPointer (uint32_t u32ClientId, const Guid *pGuid); 116 118 void USBBackendReleasePointer (const Guid *pGuid); 117 119 118 120 /* Private interface for the RemoteUSBBackend destructor. */ 119 121 void usbBackendRemoveFromList (RemoteUSBBackend *pRemoteUSBBackend); 120 122 121 123 /* Private methods for the Remote USB thread. */ 122 124 RemoteUSBBackend *usbBackendGetNext (RemoteUSBBackend *pRemoteUSBBackend); 123 125 124 126 void notifyRemoteUSBThreadRunning (RTTHREAD thread); 125 127 bool isRemoteUSBThreadRunning (void); 126 128 void waitRemoteUSBThreadEvent (unsigned cMillies); 127 129 128 130 void ClipboardCreate (uint32_t u32ClientId); 129 131 void ClipboardDelete (uint32_t u32ClientId); … … 157 159 158 160 static PFNVRDPCREATESERVER mpfnVRDPCreateServer; 159 161 160 162 static VRDPENTRYPOINTS_1 *mpEntryPoints; 161 163 static VRDPCALLBACKS_1 mCallbacks; … … 173 175 static DECLCALLBACK(void) VRDPCallbackInput (void *pvCallback, int type, const void *pvInput, unsigned cbInput); 174 176 static DECLCALLBACK(void) VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId); 175 177 176 178 bool m_fGuestWantsAbsolute; 177 179 int m_mousex; 178 180 int m_mousey; 179 181 180 182 IFramebuffer *maFramebuffers[SchemaDefs::MaxGuestMonitors]; 181 183 182 184 IConsoleCallback *mConsoleCallback; 183 185 … … 189 191 int lockConsoleVRDPServer (void); 190 192 void unlockConsoleVRDPServer (void); 191 193 192 194 int mcClipboardRefs; 193 195 HGCMSVCEXTHANDLE mhClipboard; … … 196 198 static DECLCALLBACK(int) ClipboardCallback (void *pvCallback, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData); 197 199 static DECLCALLBACK(int) ClipboardServiceExtension (void *pvExtension, uint32_t u32Function, void *pvParm, uint32_t cbParms); 198 200 199 201 #ifdef VBOX_WITH_USB 200 202 RemoteUSBBackend *usbBackendFindByUUID (const Guid *pGuid); … … 205 207 RemoteUSBBackend *pHead; 206 208 RemoteUSBBackend *pTail; 207 209 208 210 RTTHREAD thread; 209 211 210 212 bool fThreadRunning; 211 213 212 214 RTSEMEVENT event; 213 215 } USBBackends; … … 231 233 232 234 class ATL_NO_VTABLE RemoteDisplayInfo : 235 public VirtualBoxBaseNEXT, 233 236 public VirtualBoxSupportErrorInfoImpl <RemoteDisplayInfo, IRemoteDisplayInfo>, 234 237 public VirtualBoxSupportTranslation <RemoteDisplayInfo>, 235 public VirtualBoxBase,236 238 public IRemoteDisplayInfo 237 239 { 238 240 public: 241 242 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (RemoteDisplayInfo) 239 243 240 244 DECLARE_NOT_AGGREGATABLE(RemoteDisplayInfo) … … 248 252 249 253 NS_DECL_ISUPPORTS 254 255 DECLARE_EMPTY_CTOR_DTOR (RemoteDisplayInfo) 250 256 251 257 HRESULT FinalConstruct(); … … 279 285 private: 280 286 281 ComObjPtr <Console, ComWeakRef> mParent;287 const ComObjPtr <Console, ComWeakRef> mParent; 282 288 }; 283 289 -
trunk/src/VBox/Main/include/DisplayImpl.h
r11820 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 27 #include "VirtualBoxBase.h" 26 28 #include "SchemaDefs.h" 29 27 30 #include <iprt/semaphore.h> 28 31 #include <VBox/pdmdrv.h> … … 55 58 56 59 volatile uint32_t u32ResizeStatus; 57 60 58 61 /* The Framebuffer has default format and must be updates immediately. */ 59 62 bool fDefaultFormat; 60 63 61 64 struct { 62 65 /* The rectangle that includes all dirty rectangles. */ … … 70 73 71 74 class ATL_NO_VTABLE Display : 75 public VirtualBoxBaseNEXT, 72 76 public IConsoleCallback, 73 77 public VirtualBoxSupportErrorInfoImpl <Display, IDisplay>, 74 78 public VirtualBoxSupportTranslation <Display>, 75 public VirtualBoxBase,76 79 public IDisplay 77 80 { 78 81 79 82 public: 83 84 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Display) 80 85 81 86 DECLARE_NOT_AGGREGATABLE(Display) … … 90 95 NS_DECL_ISUPPORTS 91 96 97 DECLARE_EMPTY_CTOR_DTOR (Display) 98 92 99 HRESULT FinalConstruct(); 93 100 void FinalRelease(); 94 101 95 102 // public initializer/uninitializer for internal purposes only 96 HRESULT init (Console * parent);103 HRESULT init (Console *aParent); 97 104 void uninit(); 98 105 … … 247 254 static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId); 248 255 249 ComObjPtr <Console, ComWeakRef> mParent;256 const ComObjPtr <Console, ComWeakRef> mParent; 250 257 /** Pointer to the associated display driver. */ 251 258 struct DRVMAINDISPLAY *mpDrv; … … 275 282 bool mfVideoAccelVRDP; 276 283 uint32_t mfu32SupportedOrders; 277 284 278 285 int32_t volatile mcVideoAccelVRDPRefs; 279 286 -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r10896 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 29 28 30 class ATL_NO_VTABLE HostNetworkInterface : 31 public VirtualBoxBaseNEXT, 29 32 public VirtualBoxSupportErrorInfoImpl <HostNetworkInterface, IHostNetworkInterface>, 30 33 public VirtualBoxSupportTranslation <HostNetworkInterface>, 31 public VirtualBoxBase,32 34 public IHostNetworkInterface 33 35 { 34 36 public: 35 HostNetworkInterface();36 virtual ~HostNetworkInterface();37 37 38 DECLARE_NOT_AGGREGATABLE(HostNetworkInterface) 38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HostNetworkInterface) 39 40 DECLARE_NOT_AGGREGATABLE (HostNetworkInterface) 39 41 40 42 DECLARE_PROTECT_FINAL_CONSTRUCT() 41 43 42 BEGIN_COM_MAP (HostNetworkInterface)43 COM_INTERFACE_ENTRY (ISupportErrorInfo)44 COM_INTERFACE_ENTRY (IHostNetworkInterface)44 BEGIN_COM_MAP (HostNetworkInterface) 45 COM_INTERFACE_ENTRY (ISupportErrorInfo) 46 COM_INTERFACE_ENTRY (IHostNetworkInterface) 45 47 END_COM_MAP() 46 48 47 49 NS_DECL_ISUPPORTS 50 51 DECLARE_EMPTY_CTOR_DTOR (HostNetworkInterface) 52 53 HRESULT FinalConstruct(); 54 void FinalRelease(); 48 55 49 56 // public initializer/uninitializer for internal purposes only … … 51 58 52 59 // IHostNetworkInterface properties 53 STDMETHOD(COMGETTER(Name)) (BSTR * interfaceName);54 STDMETHOD(COMGETTER(Id)) (GUIDPARAMOUT guid);60 STDMETHOD(COMGETTER(Name)) (BSTR *aInterfaceName); 61 STDMETHOD(COMGETTER(Id)) (GUIDPARAMOUT aGuid); 55 62 56 63 // for VirtualBoxSupportErrorInfoImpl … … 58 65 59 66 private: 60 Bstr mInterfaceName;61 Guid mGuid;67 const Bstr mInterfaceName; 68 const Guid mGuid; 62 69 }; 63 70 -
trunk/src/VBox/Main/include/KeyboardImpl.h
r11661 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 27 #include "VirtualBoxBase.h" 26 28 #include "ConsoleEvents.h" 29 27 30 #include <VBox/pdmdrv.h> 28 31 … … 45 48 46 49 class ATL_NO_VTABLE Keyboard : 50 public VirtualBoxBaseNEXT, 47 51 public VirtualBoxSupportErrorInfoImpl <Keyboard, IKeyboard>, 48 52 public VirtualBoxSupportTranslation <Keyboard>, 49 public VirtualBoxBase,50 53 public IKeyboard 51 54 { 52 55 53 56 public: 57 58 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Keyboard) 54 59 55 60 DECLARE_NOT_AGGREGATABLE(Keyboard) … … 64 69 NS_DECL_ISUPPORTS 65 70 71 DECLARE_EMPTY_CTOR_DTOR (Keyboard) 72 66 73 HRESULT FinalConstruct(); 67 74 void FinalRelease(); 68 75 69 // public methods only for internal purposes70 HRESULT init (Console * parent);76 // public initializer/uninitializer for internal purposes only 77 HRESULT init (Console *aParent); 71 78 void uninit(); 72 79 … … 81 88 static const PDMDRVREG DrvReg; 82 89 83 Console *getParent() 90 Console *getParent() const 84 91 { 85 92 return mParent; … … 92 99 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns); 93 100 94 ComObjPtr <Console, ComWeakRef> mParent;101 const ComObjPtr <Console, ComWeakRef> mParent; 95 102 /** Pointer to the associated keyboard driver. */ 96 103 struct DRVMAINKEYBOARD *mpDrv; -
trunk/src/VBox/Main/include/MouseImpl.h
r8155 r13606 1 /* $Id $ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 48 50 49 51 class ATL_NO_VTABLE Mouse : 52 public VirtualBoxBaseNEXT, 50 53 public VirtualBoxSupportErrorInfoImpl <Mouse, IMouse>, 51 54 public VirtualBoxSupportTranslation <Mouse>, 52 public VirtualBoxBase,53 55 public IMouse 54 56 { 55 57 public: 58 59 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Mouse) 56 60 57 61 DECLARE_NOT_AGGREGATABLE(Mouse) … … 66 70 NS_DECL_ISUPPORTS 67 71 72 DECLARE_EMPTY_CTOR_DTOR (Mouse) 73 68 74 HRESULT FinalConstruct(); 69 75 void FinalRelease(); 70 76 71 // public methods only for internal purposes77 // public initializer/uninitializer for internal purposes only 72 78 HRESULT init(Console *parent); 73 79 void uninit(); … … 94 100 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns); 95 101 96 ComObjPtr <Console, ComWeakRef> mParent;102 const ComObjPtr <Console, ComWeakRef> mParent; 97 103 /** Pointer to the associated mouse driver. */ 98 104 struct DRVMAINMOUSE *mpDrv; -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r13580 r13606 7 7 8 8 /* 9 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 35 35 36 36 class ATL_NO_VTABLE SystemProperties : 37 public VirtualBoxBaseNEXT, 37 38 public VirtualBoxSupportErrorInfoImpl <SystemProperties, ISystemProperties>, 38 39 public VirtualBoxSupportTranslation <SystemProperties>, 39 public VirtualBoxBase,40 40 public ISystemProperties 41 41 { 42 42 public: 43 44 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SystemProperties) 43 45 44 46 DECLARE_NOT_AGGREGATABLE(SystemProperties) … … 52 54 53 55 NS_DECL_ISUPPORTS 56 57 DECLARE_EMPTY_CTOR_DTOR (SystemProperties) 54 58 55 59 HRESULT FinalConstruct(); … … 91 95 92 96 /** Default Machine path (as is, not full). Not thread safe (use object lock). */ 93 const Bstr &defaultMachineFolder() { return mDefaultMachineFolder; }97 const Bstr &defaultMachineFolder() const { return mDefaultMachineFolder; } 94 98 /** Default Machine path (full). Not thread safe (use object lock). */ 95 const Bstr &defaultMachineFolderFull() { return mDefaultMachineFolderFull; }99 const Bstr &defaultMachineFolderFull() const { return mDefaultMachineFolderFull; } 96 100 /** Default hard disk path (as is, not full). Not thread safe (use object lock). */ 97 const Bstr &defaultHardDiskFolder() { return mDefaultHardDiskFolder; }101 const Bstr &defaultHardDiskFolder() const { return mDefaultHardDiskFolder; } 98 102 /** Default hard disk path (full). Not thread safe (use object lock). */ 99 const Bstr &defaultHardDiskFolderFull() { return mDefaultHardDiskFolderFull; }103 const Bstr &defaultHardDiskFolderFull() const { return mDefaultHardDiskFolderFull; } 100 104 101 105 // for VirtualBoxSupportErrorInfoImpl … … 111 115 HRESULT setWebServiceAuthLibrary (const BSTR aPath); 112 116 113 ComObjPtr <VirtualBox, ComWeakRef> mParent;117 const ComObjPtr <VirtualBox, ComWeakRef> mParent; 114 118 115 119 Bstr mDefaultMachineFolder;
Note:
See TracChangeset
for help on using the changeset viewer.