Changeset 17679 in vbox
- Timestamp:
- Mar 11, 2009 11:39:18 AM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp
r17549 r17679 54 54 static int handleCreate(HandlerArg *a, int iStart, int *pcProcessed) 55 55 { 56 if (a->argc - iStart < 1)57 return errorSyntax(USAGE_HOSTONLYIFS, "Not enough parameters");56 // if (a->argc - iStart < 1) 57 // return errorSyntax(USAGE_HOSTONLYIFS, "Not enough parameters"); 58 58 59 59 int index = iStart; 60 60 HRESULT rc; 61 Bstr name(a->argv[iStart]);62 index++;61 // Bstr name(a->argv[iStart]); 62 // index++; 63 63 64 64 ComPtr<IHost> host; … … 68 68 ComPtr<IProgress> progress; 69 69 70 CHECK_ERROR(host, CreateHostOnlyNetworkInterface ( name,hif.asOutParam(), progress.asOutParam()));70 CHECK_ERROR(host, CreateHostOnlyNetworkInterface (hif.asOutParam(), progress.asOutParam())); 71 71 72 72 showProgress(progress); … … 87 87 return 1; 88 88 } 89 90 Bstr name; 91 CHECK_ERROR(hif, COMGETTER(Name) (name.asOutParam())); 92 93 RTPrintf("Interface '%lS' was successfully created\n", name.raw()); 89 94 90 95 return 0; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r17631 r17679 300 300 #if defined Q_WS_WIN 301 301 int confirmDeletingHostInterface (const QString &aName, QWidget *aParent = 0); 302 void cannotCreateHostInterface (const CHost &aHost, const QString &aName,302 void cannotCreateHostInterface (const CHost &aHost, 303 303 QWidget *aParent = 0); 304 304 void cannotCreateHostInterface (const CProgress &aProgress, const QString &aName, -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r17640 r17679 1439 1439 1440 1440 void VBoxProblemReporter::cannotCreateHostInterface ( 1441 const CHost &host, const QString &name,QWidget *parent)1441 const CHost &host, QWidget *parent) 1442 1442 { 1443 1443 message (parent ? parent : mainWindowShown(), Error, 1444 tr ("Failed to create the host network interface <b>%1</b>.") 1445 .arg (name), 1444 tr ("Failed to create the host network interface ."), 1446 1445 formatErrorInfo (host)); 1447 1446 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp
r17387 r17679 546 546 } 547 547 548 /* Creating add host interface dialog */549 VBoxAddNIDialog dlg (this, ifaceName.arg (++ ifaceNumber));550 if (dlg.exec() != QDialog::Accepted)551 return;552 QString iName = dlg.getName();553 554 548 /* Create interface */ 555 549 CHost host = vboxGlobal().virtualBox().GetHost(); 556 550 CHostNetworkInterface iFace; 557 CProgress progress = host.CreateHostOnlyNetworkInterface (i Name, iFace);551 CProgress progress = host.CreateHostOnlyNetworkInterface (iFace); 558 552 if (host.isOk()) 559 553 { 554 QString iName = iFace.GetName(); 555 560 556 vboxProblem().showModalProgressDialog (progress, iName, this); 561 557 /* Add&Select newly created interface */ … … 566 562 } 567 563 else 568 vboxProblem().cannotCreateHostInterface (host, iName,this);564 vboxProblem().cannotCreateHostInterface (host, this); 569 565 570 566 emit listChanged(); -
trunk/src/VBox/Main/HostImpl.cpp
r17494 r17679 1316 1316 1317 1317 STDMETHODIMP 1318 Host::CreateHostOnlyNetworkInterface (IN_BSTR aName, 1319 IHostNetworkInterface **aHostNetworkInterface, 1318 Host::CreateHostOnlyNetworkInterface (IHostNetworkInterface **aHostNetworkInterface, 1320 1319 IProgress **aProgress) 1321 1320 { 1322 CheckComArgNotNull(aName);1323 1321 CheckComArgOutPointerValid(aHostNetworkInterface); 1324 1322 CheckComArgOutPointerValid(aProgress); … … 1327 1325 CHECK_READY(); 1328 1326 1329 /* first check whether an interface with the given name already exists */ 1330 { 1331 ComPtr <IHostNetworkInterface> iface; 1332 if (SUCCEEDED (FindHostNetworkInterfaceByName (aName, iface.asOutParam()))) 1333 return setError (E_INVALIDARG, 1334 tr ("Host network interface '%ls' already exists"), aName); 1335 } 1336 1337 int r = NetIfCreateHostOnlyNetworkInterface (mParent, aName, aHostNetworkInterface, aProgress); 1327 int r = NetIfCreateHostOnlyNetworkInterface (mParent, aHostNetworkInterface, aProgress); 1338 1328 if(RT_SUCCESS(r)) 1339 1329 { -
trunk/src/VBox/Main/generic/NetIf-generic.cpp
r17494 r17679 38 38 } 39 39 40 int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVbox, I N_BSTR aName, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress)40 int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVbox, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress) 41 41 { 42 42 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17670 r17679 6609 6609 <interface 6610 6610 name="IHost" extends="$unknown" 6611 uuid=" 378cf146-6cd6-4dbc-bc60-cbd2004d99c5"6611 uuid="651f04ec-b2a6-4008-b979-3a01c0fc72cc" 6612 6612 wsmap="managed" 6613 6613 > … … 6764 6764 </result> 6765 6765 </desc> 6766 <param name="name" type="wstring" dir="in">6767 <desc>6768 Adapter name.6769 </desc>6770 </param>6771 6766 <param name="hostInterface" type="IHostNetworkInterface" dir="out"> 6772 6767 <desc> -
trunk/src/VBox/Main/include/HostImpl.h
r17494 r17679 96 96 #ifdef RT_OS_WINDOWS 97 97 98 STDMETHOD(CreateHostOnlyNetworkInterface) (IN_BSTR aName, 99 IHostNetworkInterface **aHostNetworkInterface, 98 STDMETHOD(CreateHostOnlyNetworkInterface) (IHostNetworkInterface **aHostNetworkInterface, 100 99 IProgress **aProgress); 101 100 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_GUID aId, -
trunk/src/VBox/Main/include/netif.h
r17613 r17679 80 80 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength); 81 81 int NetIfEnableDynamicIpConfig(HostNetworkInterface * pIf); 82 int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVbox, I N_BSTR aName, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress);82 int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVbox, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress); 83 83 int NetIfRemoveHostOnlyNetworkInterface (VirtualBox *pVbox, IN_GUID aId, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress); 84 84 int NetIfGetConfig(HostNetworkInterface * pIf, NETIFINFO *); -
trunk/src/VBox/Main/win/NetIfList-win.cpp
r17650 r17679 64 64 #include <cfgmgr32.h> 65 65 66 #define VBOX_APP_NAME L"VirtualBox" 66 67 67 68 static HRESULT netIfWinCreateIWbemServices(IWbemServices ** ppSvc) … … 861 862 vrc = aClient->write (d->msgCode); 862 863 if (RT_FAILURE (vrc)) break; 863 vrc = aClient->write (Utf8Str (d->name));864 if (RT_FAILURE (vrc)) break;864 // vrc = aClient->write (Utf8Str (d->name)); 865 // if (RT_FAILURE (vrc)) break; 865 866 866 867 /* wait for a reply */ … … 879 880 /* read the GUID */ 880 881 Guid guid; 882 Utf8Str name; 883 vrc = aClient->read (name); 884 if (RT_FAILURE (vrc)) break; 881 885 vrc = aClient->read (guid); 882 886 if (RT_FAILURE (vrc)) break; … … 886 890 /* initialize the object returned to the caller by 887 891 * CreateHostOnlyNetworkInterface() */ 888 rc = d->iface->init ( d->name, guid, HostNetworkInterfaceType_HostOnly);892 rc = d->iface->init (Bstr(name), guid, HostNetworkInterfaceType_HostOnly); 889 893 endLoop = true; 890 894 break; … … 1273 1277 /* static */ 1274 1278 static int createNetworkInterface (SVCHlpClient *aClient, 1275 const Utf8Str &aName,1279 BSTR * pName, 1276 1280 Guid &aGUID, Utf8Str &aErrMsg) 1277 1281 { 1278 1282 LogFlowFuncEnter(); 1279 LogFlowFunc (("Network connection name = '%s'\n", aName.raw()));1283 // LogFlowFunc (("Network connection name = '%s'\n", aName.raw())); 1280 1284 1281 1285 AssertReturn (aClient, VERR_INVALID_POINTER); 1282 AssertReturn (!aName.isNull(), VERR_INVALID_PARAMETER);1286 // AssertReturn (!aName.isNull(), VERR_INVALID_PARAMETER); 1283 1287 1284 1288 int vrc = VINF_SUCCESS; … … 1509 1513 &dwValueType, (LPBYTE) pCfgGuidString, &cbSize); 1510 1514 RegCloseKey (hkey); 1511 1512 ret = RenameConnection (pCfgGuidString, Bstr (aName));1513 if (FAILED (ret))1514 SetErrBreak (("Failed to set interface name (ret=0x%08X, "1515 "pCfgGuidString='%ls', cbSize=%d)",1516 ret, pCfgGuidString, cbSize));1517 1515 } 1518 1516 while (0); … … 1548 1546 LogFlowFunc (("Network connection GUID = {%RTuuid}\n", aGUID.raw())); 1549 1547 Assert (!aGUID.isEmpty()); 1548 1549 INetCfg *pNc; 1550 INetCfgComponent *pMpNcc; 1551 LPWSTR lpszApp; 1552 1553 HRESULT hr = VBoxNetCfgWinQueryINetCfg( FALSE, 1554 VBOX_APP_NAME, 1555 &pNc, 1556 &lpszApp ); 1557 if(hr == S_OK) 1558 { 1559 hr = VBoxNetCfgWinGetComponentByGuid(pNc, 1560 &GUID_DEVCLASS_NET, 1561 aGUID.asOutParam(), 1562 &pMpNcc); 1563 if(hr == S_OK) 1564 { 1565 LPWSTR name; 1566 hr = pMpNcc->GetDisplayName(&name); 1567 if(hr == S_OK) 1568 { 1569 Bstr str(name); 1570 str.detachTo(pName); 1571 1572 CoTaskMemFree (name); 1573 } 1574 1575 VBoxNetCfgWinReleaseRef(pMpNcc); 1576 } 1577 VBoxNetCfgWinReleaseINetCfg(pNc, FALSE); 1578 } 1579 1580 if(hr != S_OK) 1581 { 1582 vrc = VERR_GENERAL_FAILURE; 1583 } 1584 1550 1585 } 1551 1586 … … 1785 1820 LogFlowFunc (("CreateHostOnlyNetworkInterface:\n")); 1786 1821 1787 Utf8Str name;1788 vrc = aClient->read (name);1789 if (RT_FAILURE (vrc)) break;1822 // Utf8Str name; 1823 // vrc = aClient->read (name); 1824 // if (RT_FAILURE (vrc)) break; 1790 1825 1791 1826 Guid guid; 1792 1827 Utf8Str errMsg; 1793 vrc = createNetworkInterface (aClient, name, guid, errMsg); 1828 Bstr name; 1829 vrc = createNetworkInterface (aClient, name.asOutParam(), guid, errMsg); 1794 1830 1795 1831 if (RT_SUCCESS (vrc)) … … 1797 1833 /* write success followed by GUID */ 1798 1834 vrc = aClient->write (SVCHlpMsg::CreateHostOnlyNetworkInterface_OK); 1835 if (RT_FAILURE (vrc)) break; 1836 vrc = aClient->write (Utf8Str (name)); 1799 1837 if (RT_FAILURE (vrc)) break; 1800 1838 vrc = aClient->write (guid); … … 2006 2044 2007 2045 /* end */ 2008 2009 # define VBOX_APP_NAME L"VirtualBox"2010 2046 2011 2047 static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, HostNetworkInterfaceType enmType) … … 2143 2179 } 2144 2180 2145 int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVBox, IN_BSTR aName,2181 int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVBox, 2146 2182 IHostNetworkInterface **aHostNetworkInterface, 2147 2183 IProgress **aProgress) … … 2174 2210 2175 2211 d->msgCode = SVCHlpMsg::CreateHostOnlyNetworkInterface; 2176 d->name = aName;2212 // d->name = aName; 2177 2213 d->iface = iface; 2178 2214
Note:
See TracChangeset
for help on using the changeset viewer.