Changeset 16207 in vbox
- Timestamp:
- Jan 23, 2009 5:49:31 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r15991 r16207 4253 4253 ComPtr<IHost> host; 4254 4254 virtualBox->COMGETTER(Host)(host.asOutParam()); 4255 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces; 4256 host->COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces)); 4257 bool found = false; 4258 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i) 4259 { 4260 Bstr name; 4261 hostNetworkInterfaces[i]->COMGETTER(Name) (name.asOutParam()); 4262 if (name == hostif) 4263 { 4264 found = true; 4265 break; 4266 } 4267 } 4268 if (!found) 4255 ComPtr<IHostNetworkInterface> hostInterface; 4256 if (!SUCCEEDED(host->FindHostNetworkInterfaceByName(hostif, hostInterface.asOutParam()))) 4269 4257 { 4270 4258 return setError (VBOX_E_HOST_ERROR, -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r16170 r16207 1322 1322 1323 1323 # elif defined(RT_OS_WINDOWS) 1324 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces;1325 hrc = host->COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces));1326 if(FAILED(hrc))1327 {1328 LogRel(("NetworkAttachmentType_HostInterface: COMGETTER(NetworkInterfaces) failed, hrc (0x%x)", hrc));1329 H();1330 }1331 1324 ComPtr<IHostNetworkInterface> hostInterface; 1332 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i) 1333 { 1334 Bstr name; 1335 hostNetworkInterfaces[i]->COMGETTER(Name) (name.asOutParam()); 1336 if (name == HifName) 1337 { 1338 hostInterface = hostNetworkInterfaces[i]; 1339 break; 1340 } 1341 } 1342 if (hostInterface.isNull()) 1325 rc = host->FindHostNetworkInterfaceByName(HifName, hostInterface.asOutParam()); 1326 if (!SUCCEEDED(rc)) 1343 1327 { 1344 1328 AssertBreakpoint(); … … 1518 1502 Bstr hostInterfaceName; 1519 1503 hrc = networkAdapter->COMGETTER(HostInterface)(hostInterfaceName.asOutParam()); H(); 1520 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces;1521 hrc = host->COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces)); H();1522 1504 ComPtr<IHostNetworkInterface> hostInterface; 1523 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i) 1524 { 1525 Bstr name; 1526 hostNetworkInterfaces[i]->COMGETTER(Name) (name.asOutParam()); 1527 if (name == hostInterfaceName) 1528 { 1529 hostInterface = hostNetworkInterfaces[i]; 1530 break; 1531 } 1532 } 1533 if (hostInterface.isNull()) 1505 rc = host->FindHostNetworkInterfaceByName(hostInterfaceName, hostInterface.asOutParam()); 1506 if (!SUCCEEDED(rc)) 1534 1507 { 1535 1508 AssertMsgFailed(("Cannot get GUID for host interface '%ls'\n", hostInterfaceName)); -
trunk/src/VBox/Main/HostImpl.cpp
r16198 r16207 1386 1386 /* first check whether an interface with the given name already exists */ 1387 1387 { 1388 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces; 1389 rc = COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces)); 1390 CheckComRCReturnRC (rc); 1391 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i) 1392 { 1393 Bstr name; 1394 hostNetworkInterfaces[i]->COMGETTER(Name) (name.asOutParam()); 1395 if (name == aName) 1396 { 1397 return setError (E_INVALIDARG, 1398 tr ("Host network interface '%ls' already exists"), aName); 1399 } 1400 } 1388 ComPtr <IHostNetworkInterface> iface; 1389 if (SUCCEEDED (FindHostNetworkInterfaceByName (aName, iface.asOutParam()))) 1390 return setError (E_INVALIDARG, 1391 tr ("Host network interface '%ls' already exists"), aName); 1401 1392 } 1402 1393 … … 1454 1445 /* first check whether an interface with the given name already exists */ 1455 1446 { 1456 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces;1457 rc = COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces));1458 CheckComRCReturnRC (rc);1459 1447 ComPtr <IHostNetworkInterface> iface; 1460 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i) 1461 { 1462 Guid guid; 1463 hostNetworkInterfaces[i]->COMGETTER(Id) (guid.asOutParam()); 1464 if (guid == aId) 1465 { 1466 iface = hostNetworkInterfaces[i]; 1467 break; 1468 } 1469 } 1470 if (iface.isNull()) 1448 if (FAILED (FindHostNetworkInterfaceById (aId, iface.asOutParam()))) 1471 1449 return setError (VBOX_E_OBJECT_NOT_FOUND, 1472 1450 tr ("Host network interface with UUID {%RTuuid} does not exist"),
Note:
See TracChangeset
for help on using the changeset viewer.