Changeset 15687 in vbox for trunk/src/VBox
- Timestamp:
- Dec 19, 2008 12:48:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r15602 r15687 558 558 } 559 559 560 if (u64Cmd & USAGE_CREATEHOSTIF && fWin)561 {562 RTPrintf("VBoxManage createhostif <name>\n"563 "\n");564 }565 566 if (u64Cmd & USAGE_REMOVEHOSTIF && fWin)567 {568 RTPrintf("VBoxManage removehostif <uuid>|<name>\n"569 "\n");570 }571 572 560 if (u64Cmd & USAGE_GETEXTRADATA) 573 561 { … … 3605 3593 } 3606 3594 3607 3608 #ifdef RT_OS_WINDOWS3609 static int handleCreateHostIF(int argc, char *argv[],3610 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session)3611 {3612 if (argc != 1)3613 return errorSyntax(USAGE_CREATEHOSTIF, "Incorrect number of parameters");3614 3615 HRESULT rc = S_OK;3616 3617 do3618 {3619 ComPtr<IHost> host;3620 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam()));3621 3622 ComPtr<IHostNetworkInterface> hostif;3623 ComPtr<IProgress> progress;3624 CHECK_ERROR_BREAK(host,3625 CreateHostNetworkInterface(Bstr(argv[0]),3626 hostif.asOutParam(),3627 progress.asOutParam()));3628 3629 showProgress(progress);3630 HRESULT result;3631 CHECK_ERROR_BREAK(progress, COMGETTER(ResultCode)(&result));3632 if (FAILED(result))3633 {3634 com::ProgressErrorInfo info(progress);3635 PRINT_ERROR_INFO(info);3636 rc = result;3637 }3638 }3639 while (0);3640 3641 return SUCCEEDED(rc) ? 0 : 1;3642 }3643 3644 static int handleRemoveHostIF(int argc, char *argv[],3645 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session)3646 {3647 if (argc != 1)3648 return errorSyntax(USAGE_REMOVEHOSTIF, "Incorrect number of parameters");3649 3650 HRESULT rc = S_OK;3651 3652 do3653 {3654 ComPtr<IHost> host;3655 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam()));3656 3657 ComPtr<IHostNetworkInterface> hostif;3658 3659 /* first guess is that it's a UUID */3660 Guid uuid(argv[0]);3661 if (uuid.isEmpty())3662 {3663 /* not a valid UUID, search for it */3664 Bstr strName(argv[0]);3665 com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces;3666 CHECK_ERROR_BREAK(host, COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces)));3667 ComPtr <IHostNetworkInterface> hostif;3668 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)3669 {3670 Bstr name;3671 hostNetworkInterfaces[i]->COMGETTER(Name) (name.asOutParam());3672 if (name == strName)3673 {3674 hostif = hostNetworkInterfaces[i];3675 break;3676 }3677 }3678 if (hostif.isNull())3679 {3680 rc = E_INVALIDARG;3681 break;3682 }3683 CHECK_ERROR_BREAK(hostif, COMGETTER(Id)(uuid.asOutParam()));3684 }3685 3686 ComPtr<IProgress> progress;3687 CHECK_ERROR_BREAK(host,3688 RemoveHostNetworkInterface(uuid,3689 hostif.asOutParam(),3690 progress.asOutParam()));3691 3692 showProgress(progress);3693 HRESULT result;3694 CHECK_ERROR_BREAK(progress, COMGETTER(ResultCode)(&result));3695 if (FAILED(result))3696 {3697 com::ProgressErrorInfo info(progress);3698 PRINT_ERROR_INFO(info);3699 rc = result;3700 }3701 }3702 while (0);3703 3704 return SUCCEEDED(rc) ? 0 : 1;3705 }3706 #endif /* RT_OS_WINDOWS */3707 3708 3595 static int handleGetExtraData(int argc, char *argv[], 3709 3596 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session) … … 4869 4756 { "showhdinfo", handleShowHardDiskInfo }, 4870 4757 { "showvdiinfo", handleShowHardDiskInfo }, /* backward compatiblity */ 4871 #ifdef RT_OS_WINDOWS4872 { "createhostif", handleCreateHostIF },4873 { "removehostif", handleRemoveHostIF },4874 #endif4875 4758 { "getextradata", handleGetExtraData }, 4876 4759 { "setextradata", handleSetExtraData },
Note:
See TracChangeset
for help on using the changeset viewer.