~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Main/win/NetIf-win.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
    SVCHlpMsg::Code msgCode;
202
202
    /* for SVCHlpMsg::CreateHostOnlyNetworkInterface */
203
203
    Bstr name;
204
 
    ComObjPtr <HostNetworkInterface> iface;
205
 
    ComObjPtr <VirtualBox> vBox;
 
204
    ComObjPtr<HostNetworkInterface> iface;
 
205
    ComObjPtr<VirtualBox> vBox;
206
206
    /* for SVCHlpMsg::RemoveHostOnlyNetworkInterface */
207
207
    Guid guid;
208
208
 
223
223
    LogFlowFunc (("aClient={%p}, aProgress={%p}, aUser={%p}\n",
224
224
                  aClient, aProgress, aUser));
225
225
 
226
 
    AssertReturn ((aClient == NULL && aProgress == NULL && aVrc == NULL) ||
 
226
    AssertReturn((aClient == NULL && aProgress == NULL && aVrc == NULL) ||
227
227
                  (aClient != NULL && aProgress != NULL && aVrc != NULL),
228
228
                  E_POINTER);
229
 
    AssertReturn (aUser, E_POINTER);
 
229
    AssertReturn(aUser, E_POINTER);
230
230
 
231
231
    std::auto_ptr <NetworkInterfaceHelperClientData>
232
232
        d (static_cast <NetworkInterfaceHelperClientData *> (aUser));
249
249
 
250
250
            /* write message and parameters */
251
251
            vrc = aClient->write (d->msgCode);
252
 
            if (RT_FAILURE (vrc)) break;
 
252
            if (RT_FAILURE(vrc)) break;
253
253
//            vrc = aClient->write (Utf8Str (d->name));
254
 
//            if (RT_FAILURE (vrc)) break;
 
254
//            if (RT_FAILURE(vrc)) break;
255
255
 
256
256
            /* wait for a reply */
257
257
            bool endLoop = false;
260
260
                SVCHlpMsg::Code reply = SVCHlpMsg::Null;
261
261
 
262
262
                vrc = aClient->read (reply);
263
 
                if (RT_FAILURE (vrc)) break;
 
263
                if (RT_FAILURE(vrc)) break;
264
264
 
265
265
                switch (reply)
266
266
                {
270
270
                        Guid guid;
271
271
                        Utf8Str name;
272
272
                        vrc = aClient->read (name);
273
 
                        if (RT_FAILURE (vrc)) break;
 
273
                        if (RT_FAILURE(vrc)) break;
274
274
                        vrc = aClient->read (guid);
275
 
                        if (RT_FAILURE (vrc)) break;
 
275
                        if (RT_FAILURE(vrc)) break;
276
276
 
277
277
                        LogFlowFunc (("Network connection GUID = {%RTuuid}\n", guid.raw()));
278
278
 
295
295
                        /* read the error message */
296
296
                        Utf8Str errMsg;
297
297
                        vrc = aClient->read (errMsg);
298
 
                        if (RT_FAILURE (vrc)) break;
 
298
                        if (RT_FAILURE(vrc)) break;
299
299
 
300
300
                        rc = E_FAIL;//TODO: setError (E_FAIL, errMsg);
301
301
                        endLoop = true;
321
321
 
322
322
            /* write message and parameters */
323
323
            vrc = aClient->write (d->msgCode);
324
 
            if (RT_FAILURE (vrc)) break;
 
324
            if (RT_FAILURE(vrc)) break;
325
325
            vrc = aClient->write (d->guid);
326
 
            if (RT_FAILURE (vrc)) break;
 
326
            if (RT_FAILURE(vrc)) break;
327
327
 
328
328
            /* wait for a reply */
329
329
            bool endLoop = false;
332
332
                SVCHlpMsg::Code reply = SVCHlpMsg::Null;
333
333
 
334
334
                vrc = aClient->read (reply);
335
 
                if (RT_FAILURE (vrc)) break;
 
335
                if (RT_FAILURE(vrc)) break;
336
336
 
337
337
                switch (reply)
338
338
                {
348
348
                        /* read the error message */
349
349
                        Utf8Str errMsg;
350
350
                        vrc = aClient->read (errMsg);
351
 
                        if (RT_FAILURE (vrc)) break;
 
351
                        if (RT_FAILURE(vrc)) break;
352
352
 
353
353
                        rc = E_FAIL; // TODO: setError (E_FAIL, errMsg);
354
354
                        endLoop = true;
374
374
 
375
375
            /* write message and parameters */
376
376
            vrc = aClient->write (d->msgCode);
377
 
            if (RT_FAILURE (vrc)) break;
 
377
            if (RT_FAILURE(vrc)) break;
378
378
            vrc = aClient->write (d->guid);
379
 
            if (RT_FAILURE (vrc)) break;
 
379
            if (RT_FAILURE(vrc)) break;
380
380
 
381
381
            /* wait for a reply */
382
382
            bool endLoop = false;
385
385
                SVCHlpMsg::Code reply = SVCHlpMsg::Null;
386
386
 
387
387
                vrc = aClient->read (reply);
388
 
                if (RT_FAILURE (vrc)) break;
 
388
                if (RT_FAILURE(vrc)) break;
389
389
 
390
390
                switch (reply)
391
391
                {
401
401
                        /* read the error message */
402
402
                        Utf8Str errMsg;
403
403
                        vrc = aClient->read (errMsg);
404
 
                        if (RT_FAILURE (vrc)) break;
 
404
                        if (RT_FAILURE(vrc)) break;
405
405
 
406
406
                        rc = E_FAIL; // TODO: setError (E_FAIL, errMsg);
407
407
                        endLoop = true;
427
427
 
428
428
            /* write message and parameters */
429
429
            vrc = aClient->write (d->msgCode);
430
 
            if (RT_FAILURE (vrc)) break;
 
430
            if (RT_FAILURE(vrc)) break;
431
431
            vrc = aClient->write (d->guid);
432
 
            if (RT_FAILURE (vrc)) break;
 
432
            if (RT_FAILURE(vrc)) break;
433
433
            vrc = aClient->write (d->u.StaticIP.IPAddress);
434
 
            if (RT_FAILURE (vrc)) break;
 
434
            if (RT_FAILURE(vrc)) break;
435
435
            vrc = aClient->write (d->u.StaticIP.IPNetMask);
436
 
            if (RT_FAILURE (vrc)) break;
 
436
            if (RT_FAILURE(vrc)) break;
437
437
 
438
438
            /* wait for a reply */
439
439
            bool endLoop = false;
442
442
                SVCHlpMsg::Code reply = SVCHlpMsg::Null;
443
443
 
444
444
                vrc = aClient->read (reply);
445
 
                if (RT_FAILURE (vrc)) break;
 
445
                if (RT_FAILURE(vrc)) break;
446
446
 
447
447
                switch (reply)
448
448
                {
458
458
                        /* read the error message */
459
459
                        Utf8Str errMsg;
460
460
                        vrc = aClient->read (errMsg);
461
 
                        if (RT_FAILURE (vrc)) break;
 
461
                        if (RT_FAILURE(vrc)) break;
462
462
 
463
463
                        rc = E_FAIL; // TODO: setError (E_FAIL, errMsg);
464
464
                        endLoop = true;
484
484
 
485
485
            /* write message and parameters */
486
486
            vrc = aClient->write (d->msgCode);
487
 
            if (RT_FAILURE (vrc)) break;
 
487
            if (RT_FAILURE(vrc)) break;
488
488
            vrc = aClient->write (d->guid);
489
 
            if (RT_FAILURE (vrc)) break;
 
489
            if (RT_FAILURE(vrc)) break;
490
490
            vrc = aClient->write (Utf8Str(d->u.StaticIPV6.IPV6Address));
491
 
            if (RT_FAILURE (vrc)) break;
 
491
            if (RT_FAILURE(vrc)) break;
492
492
            vrc = aClient->write (d->u.StaticIPV6.IPV6NetMaskLength);
493
 
            if (RT_FAILURE (vrc)) break;
 
493
            if (RT_FAILURE(vrc)) break;
494
494
 
495
495
            /* wait for a reply */
496
496
            bool endLoop = false;
499
499
                SVCHlpMsg::Code reply = SVCHlpMsg::Null;
500
500
 
501
501
                vrc = aClient->read (reply);
502
 
                if (RT_FAILURE (vrc)) break;
 
502
                if (RT_FAILURE(vrc)) break;
503
503
 
504
504
                switch (reply)
505
505
                {
515
515
                        /* read the error message */
516
516
                        Utf8Str errMsg;
517
517
                        vrc = aClient->read (errMsg);
518
 
                        if (RT_FAILURE (vrc)) break;
 
518
                        if (RT_FAILURE(vrc)) break;
519
519
 
520
520
                        rc = E_FAIL; // TODO: setError (E_FAIL, errMsg);
521
521
                        endLoop = true;
541
541
 
542
542
            /* write message and parameters */
543
543
            vrc = aClient->write (d->msgCode);
544
 
            if (RT_FAILURE (vrc)) break;
 
544
            if (RT_FAILURE(vrc)) break;
545
545
            vrc = aClient->write (d->guid);
546
 
            if (RT_FAILURE (vrc)) break;
 
546
            if (RT_FAILURE(vrc)) break;
547
547
 
548
548
            /* wait for a reply */
549
549
            bool endLoop = false;
552
552
                SVCHlpMsg::Code reply = SVCHlpMsg::Null;
553
553
 
554
554
                vrc = aClient->read (reply);
555
 
                if (RT_FAILURE (vrc)) break;
 
555
                if (RT_FAILURE(vrc)) break;
556
556
 
557
557
                switch (reply)
558
558
                {
568
568
                        /* read the error message */
569
569
                        Utf8Str errMsg;
570
570
                        vrc = aClient->read (errMsg);
571
 
                        if (RT_FAILURE (vrc)) break;
 
571
                        if (RT_FAILURE(vrc)) break;
572
572
 
573
573
                        rc = E_FAIL; // TODO: setError (E_FAIL, errMsg);
574
574
                        endLoop = true;
609
609
    LogFlowFuncEnter();
610
610
    LogFlowFunc (("aClient={%p}, aMsgCode=%d\n", aClient, aMsgCode));
611
611
 
612
 
    AssertReturn (aClient, VERR_INVALID_POINTER);
 
612
    AssertReturn(aClient, VERR_INVALID_POINTER);
613
613
 
614
614
    int vrc = VINF_SUCCESS;
615
615
    HRESULT hrc;
622
622
 
623
623
//            Utf8Str name;
624
624
//            vrc = aClient->read (name);
625
 
//            if (RT_FAILURE (vrc)) break;
 
625
//            if (RT_FAILURE(vrc)) break;
626
626
 
627
627
            Guid guid;
628
628
            Utf8Str errMsg;
629
629
            Bstr name;
630
630
            Bstr bstrErr;
631
631
 
632
 
            hrc = VBoxNetCfgWinCreateHostOnlyNetworkInterface (guid.asOutParam(), name.asOutParam(), bstrErr.asOutParam());
 
632
            hrc = VBoxNetCfgWinCreateHostOnlyNetworkInterface (NULL, false, guid.asOutParam(), name.asOutParam(), bstrErr.asOutParam());
633
633
 
634
634
            if (hrc == S_OK)
635
635
            {
645
645
 
646
646
                /* write success followed by GUID */
647
647
                vrc = aClient->write (SVCHlpMsg::CreateHostOnlyNetworkInterface_OK);
648
 
                if (RT_FAILURE (vrc)) break;
 
648
                if (RT_FAILURE(vrc)) break;
649
649
                vrc = aClient->write (Utf8Str (name));
650
 
                if (RT_FAILURE (vrc)) break;
 
650
                if (RT_FAILURE(vrc)) break;
651
651
                vrc = aClient->write (guid);
652
 
                if (RT_FAILURE (vrc)) break;
 
652
                if (RT_FAILURE(vrc)) break;
653
653
            }
654
654
            else
655
655
            {
659
659
                if (errMsg.isEmpty())
660
660
                    errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc);
661
661
                vrc = aClient->write (SVCHlpMsg::Error);
662
 
                if (RT_FAILURE (vrc)) break;
 
662
                if (RT_FAILURE(vrc)) break;
663
663
                vrc = aClient->write (errMsg);
664
 
                if (RT_FAILURE (vrc)) break;
 
664
                if (RT_FAILURE(vrc)) break;
665
665
            }
666
666
 
667
667
            break;
674
674
            Bstr bstrErr;
675
675
 
676
676
            vrc = aClient->read (guid);
677
 
            if (RT_FAILURE (vrc)) break;
 
677
            if (RT_FAILURE(vrc)) break;
678
678
 
679
679
            Utf8Str errMsg;
680
680
            hrc = VBoxNetCfgWinRemoveHostOnlyNetworkInterface ((const GUID*)guid.raw(), bstrErr.asOutParam());
683
683
            {
684
684
                /* write parameter-less success */
685
685
                vrc = aClient->write (SVCHlpMsg::OK);
686
 
                if (RT_FAILURE (vrc)) break;
 
686
                if (RT_FAILURE(vrc)) break;
687
687
            }
688
688
            else
689
689
            {
693
693
                if (errMsg.isEmpty())
694
694
                    errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc);
695
695
                vrc = aClient->write (SVCHlpMsg::Error);
696
 
                if (RT_FAILURE (vrc)) break;
 
696
                if (RT_FAILURE(vrc)) break;
697
697
                vrc = aClient->write (errMsg);
698
 
                if (RT_FAILURE (vrc)) break;
 
698
                if (RT_FAILURE(vrc)) break;
699
699
            }
700
700
 
701
701
            break;
708
708
            Utf8Str ipV6;
709
709
            ULONG maskLengthV6;
710
710
            vrc = aClient->read (guid);
711
 
            if (RT_FAILURE (vrc)) break;
 
711
            if (RT_FAILURE(vrc)) break;
712
712
            vrc = aClient->read (ipV6);
713
 
            if (RT_FAILURE (vrc)) break;
 
713
            if (RT_FAILURE(vrc)) break;
714
714
            vrc = aClient->read (maskLengthV6);
715
 
            if (RT_FAILURE (vrc)) break;
 
715
            if (RT_FAILURE(vrc)) break;
716
716
 
717
717
            Utf8Str errMsg;
718
718
            vrc = VERR_NOT_IMPLEMENTED;
719
719
 
720
 
            if (RT_SUCCESS (vrc))
 
720
            if (RT_SUCCESS(vrc))
721
721
            {
722
722
                /* write success followed by GUID */
723
723
                vrc = aClient->write (SVCHlpMsg::OK);
724
 
                if (RT_FAILURE (vrc)) break;
 
724
                if (RT_FAILURE(vrc)) break;
725
725
            }
726
726
            else
727
727
            {
729
729
                if (errMsg.isEmpty())
730
730
                    errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc);
731
731
                vrc = aClient->write (SVCHlpMsg::Error);
732
 
                if (RT_FAILURE (vrc)) break;
 
732
                if (RT_FAILURE(vrc)) break;
733
733
                vrc = aClient->write (errMsg);
734
 
                if (RT_FAILURE (vrc)) break;
 
734
                if (RT_FAILURE(vrc)) break;
735
735
            }
736
736
 
737
737
            break;
743
743
            Guid guid;
744
744
            ULONG ip, mask;
745
745
            vrc = aClient->read (guid);
746
 
            if (RT_FAILURE (vrc)) break;
 
746
            if (RT_FAILURE(vrc)) break;
747
747
            vrc = aClient->read (ip);
748
 
            if (RT_FAILURE (vrc)) break;
 
748
            if (RT_FAILURE(vrc)) break;
749
749
            vrc = aClient->read (mask);
750
 
            if (RT_FAILURE (vrc)) break;
 
750
            if (RT_FAILURE(vrc)) break;
751
751
 
752
752
            Utf8Str errMsg;
753
753
            hrc = VBoxNetCfgWinEnableStaticIpConfig ((const GUID *)guid.raw(), ip, mask);
756
756
            {
757
757
                /* write success followed by GUID */
758
758
                vrc = aClient->write (SVCHlpMsg::OK);
759
 
                if (RT_FAILURE (vrc)) break;
 
759
                if (RT_FAILURE(vrc)) break;
760
760
            }
761
761
            else
762
762
            {
765
765
                if (errMsg.isEmpty())
766
766
                    errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc);
767
767
                vrc = aClient->write (SVCHlpMsg::Error);
768
 
                if (RT_FAILURE (vrc)) break;
 
768
                if (RT_FAILURE(vrc)) break;
769
769
                vrc = aClient->write (errMsg);
770
 
                if (RT_FAILURE (vrc)) break;
 
770
                if (RT_FAILURE(vrc)) break;
771
771
            }
772
772
 
773
773
            break;
778
778
 
779
779
            Guid guid;
780
780
            vrc = aClient->read (guid);
781
 
            if (RT_FAILURE (vrc)) break;
 
781
            if (RT_FAILURE(vrc)) break;
782
782
 
783
783
            Utf8Str errMsg;
784
784
            hrc = VBoxNetCfgWinEnableDynamicIpConfig ((const GUID *)guid.raw());
787
787
            {
788
788
                /* write success followed by GUID */
789
789
                vrc = aClient->write (SVCHlpMsg::OK);
790
 
                if (RT_FAILURE (vrc)) break;
 
790
                if (RT_FAILURE(vrc)) break;
791
791
            }
792
792
            else
793
793
            {
796
796
                if (errMsg.isEmpty())
797
797
                    errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc);
798
798
                vrc = aClient->write (SVCHlpMsg::Error);
799
 
                if (RT_FAILURE (vrc)) break;
 
799
                if (RT_FAILURE(vrc)) break;
800
800
                vrc = aClient->write (errMsg);
801
 
                if (RT_FAILURE (vrc)) break;
 
801
                if (RT_FAILURE(vrc)) break;
802
802
            }
803
803
 
804
804
            break;
809
809
 
810
810
            Guid guid;
811
811
            vrc = aClient->read (guid);
812
 
            if (RT_FAILURE (vrc)) break;
 
812
            if (RT_FAILURE(vrc)) break;
813
813
 
814
814
            Utf8Str errMsg;
815
815
            hrc = VBoxNetCfgWinDhcpRediscover ((const GUID *)guid.raw());
818
818
            {
819
819
                /* write success followed by GUID */
820
820
                vrc = aClient->write (SVCHlpMsg::OK);
821
 
                if (RT_FAILURE (vrc)) break;
 
821
                if (RT_FAILURE(vrc)) break;
822
822
            }
823
823
            else
824
824
            {
827
827
                if (errMsg.isEmpty())
828
828
                    errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc);
829
829
                vrc = aClient->write (SVCHlpMsg::Error);
830
 
                if (RT_FAILURE (vrc)) break;
 
830
                if (RT_FAILURE(vrc)) break;
831
831
                vrc = aClient->write (errMsg);
832
 
                if (RT_FAILURE (vrc)) break;
 
832
                if (RT_FAILURE(vrc)) break;
833
833
            }
834
834
 
835
835
            break;
858
858
    ZeroMemory (&info, sizeof (OSVERSIONINFOEX));
859
859
    info.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
860
860
    rc = GetVersionEx ((OSVERSIONINFO *) &info);
861
 
    AssertReturn (rc != 0, FALSE);
 
861
    AssertReturn(rc != 0, FALSE);
862
862
 
863
863
    LogFlowFunc (("dwMajorVersion=%d, dwMinorVersion=%d\n",
864
864
                  info.dwMajorVersion, info.dwMinorVersion));
896
896
 
897
897
/* end */
898
898
 
899
 
static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, HostNetworkInterfaceType enmType)
 
899
static int vboxNetWinAddComponent(std::list <ComObjPtr<HostNetworkInterface> > * pPist, INetCfgComponent * pncc, HostNetworkInterfaceType enmType)
900
900
{
901
901
    LPWSTR              lpszName;
902
902
    GUID                IfGuid;
925
925
                Log(("vboxNetWinAddComponent: collectNetIfInfo() -> %Vrc\n", rc));
926
926
            }
927
927
            /* create a new object and add it to the list */
928
 
            ComObjPtr <HostNetworkInterface> iface;
 
928
            ComObjPtr<HostNetworkInterface> iface;
929
929
            iface.createObject();
930
930
            /* remove the curly bracket at the end */
931
 
            if (SUCCEEDED (iface->init (name, enmType, &Info)))
 
931
            if (SUCCEEDED(iface->init (name, enmType, &Info)))
932
932
            {
933
933
                pPist->push_back (iface);
934
934
                rc = VINF_SUCCESS;
947
947
#endif /* VBOX_WITH_NETFLT */
948
948
 
949
949
 
950
 
static int netIfListHostAdapters(std::list <ComObjPtr <HostNetworkInterface> > &list)
 
950
static int netIfListHostAdapters(std::list <ComObjPtr<HostNetworkInterface> > &list)
951
951
{
952
952
#ifndef VBOX_WITH_NETFLT
953
953
    /* VBoxNetAdp is available only when VBOX_WITH_NETFLT is enabled */
1053
1053
    return VERR_NOT_IMPLEMENTED;
1054
1054
#else
1055
1055
    /* create a progress object */
1056
 
    ComObjPtr <Progress> progress;
 
1056
    ComObjPtr<Progress> progress;
1057
1057
    progress.createObject();
1058
1058
 
1059
1059
    ComPtr<IHost> host;
1065
1065
                             FALSE /* aCancelable */);
1066
1066
        if(SUCCEEDED(rc))
1067
1067
        {
1068
 
            CheckComRCReturnRC (rc);
1069
 
            progress.queryInterfaceTo (aProgress);
 
1068
            CheckComRCReturnRC(rc);
 
1069
            progress.queryInterfaceTo(aProgress);
1070
1070
 
1071
1071
            /* create a new uninitialized host interface object */
1072
 
            ComObjPtr <HostNetworkInterface> iface;
 
1072
            ComObjPtr<HostNetworkInterface> iface;
1073
1073
            iface.createObject();
1074
 
            iface.queryInterfaceTo (aHostNetworkInterface);
 
1074
            iface.queryInterfaceTo(aHostNetworkInterface);
1075
1075
 
1076
1076
            /* create the networkInterfaceHelperClient() argument */
1077
1077
            std::auto_ptr <NetworkInterfaceHelperClientData>
1078
1078
                d (new NetworkInterfaceHelperClientData());
1079
 
            AssertReturn (d.get(), E_OUTOFMEMORY);
 
1079
            AssertReturn(d.get(), E_OUTOFMEMORY);
1080
1080
 
1081
1081
            d->msgCode = SVCHlpMsg::CreateHostOnlyNetworkInterface;
1082
1082
//            d->name = aName;
1089
1089
                static_cast <void *> (d.get()),
1090
1090
                progress);
1091
1091
 
1092
 
            if (SUCCEEDED (rc))
 
1092
            if (SUCCEEDED(rc))
1093
1093
            {
1094
1094
                /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
1095
1095
                d.release();
1102
1102
}
1103
1103
 
1104
1104
int NetIfRemoveHostOnlyNetworkInterface (VirtualBox *pVBox, IN_GUID aId,
1105
 
                                  IHostNetworkInterface **aHostNetworkInterface,
1106
 
                                  IProgress **aProgress)
 
1105
                                         IProgress **aProgress)
1107
1106
{
1108
1107
#ifndef VBOX_WITH_NETFLT
1109
1108
    return VERR_NOT_IMPLEMENTED;
1110
1109
#else
1111
1110
    /* create a progress object */
1112
 
    ComObjPtr <Progress> progress;
 
1111
    ComObjPtr<Progress> progress;
1113
1112
    progress.createObject();
1114
1113
    ComPtr<IHost> host;
1115
1114
    HRESULT rc = pVBox->COMGETTER(Host)(host.asOutParam());
1120
1119
                            FALSE /* aCancelable */);
1121
1120
        if(SUCCEEDED(rc))
1122
1121
        {
1123
 
            CheckComRCReturnRC (rc);
1124
 
            progress.queryInterfaceTo (aProgress);
 
1122
            CheckComRCReturnRC(rc);
 
1123
            progress.queryInterfaceTo(aProgress);
1125
1124
 
1126
1125
            /* create the networkInterfaceHelperClient() argument */
1127
1126
            std::auto_ptr <NetworkInterfaceHelperClientData>
1128
1127
                d (new NetworkInterfaceHelperClientData());
1129
 
            AssertReturn (d.get(), E_OUTOFMEMORY);
 
1128
            AssertReturn(d.get(), E_OUTOFMEMORY);
1130
1129
 
1131
1130
            d->msgCode = SVCHlpMsg::RemoveHostOnlyNetworkInterface;
1132
1131
            d->guid = aId;
1137
1136
                static_cast <void *> (d.get()),
1138
1137
                progress);
1139
1138
 
1140
 
            if (SUCCEEDED (rc))
 
1139
            if (SUCCEEDED(rc))
1141
1140
            {
1142
1141
                /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
1143
1142
                d.release();
1164
1163
//        if(SUCCEEDED(rc))
1165
1164
        {
1166
1165
            /* create a progress object */
1167
 
            ComObjPtr <Progress> progress;
 
1166
            ComObjPtr<Progress> progress;
1168
1167
            progress.createObject();
1169
1168
//            ComPtr<IHost> host;
1170
1169
//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
1175
1174
                                    FALSE /* aCancelable */);
1176
1175
                if(SUCCEEDED(rc))
1177
1176
                {
1178
 
                    CheckComRCReturnRC (rc);
1179
 
//                    progress.queryInterfaceTo (aProgress);
 
1177
                    CheckComRCReturnRC(rc);
 
1178
//                    progress.queryInterfaceTo(aProgress);
1180
1179
 
1181
1180
                    /* create the networkInterfaceHelperClient() argument */
1182
1181
                    std::auto_ptr <NetworkInterfaceHelperClientData>
1183
1182
                        d (new NetworkInterfaceHelperClientData());
1184
 
                    AssertReturn (d.get(), E_OUTOFMEMORY);
 
1183
                    AssertReturn(d.get(), E_OUTOFMEMORY);
1185
1184
 
1186
1185
                    d->msgCode = SVCHlpMsg::EnableStaticIpConfig;
1187
1186
                    d->guid = Guid(guid);
1195
1194
                        static_cast <void *> (d.get()),
1196
1195
                        progress);
1197
1196
 
1198
 
                    if (SUCCEEDED (rc))
 
1197
                    if (SUCCEEDED(rc))
1199
1198
                    {
1200
1199
                        /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
1201
1200
                        d.release();
1226
1225
//        if(SUCCEEDED(rc))
1227
1226
        {
1228
1227
            /* create a progress object */
1229
 
            ComObjPtr <Progress> progress;
 
1228
            ComObjPtr<Progress> progress;
1230
1229
            progress.createObject();
1231
1230
//            ComPtr<IHost> host;
1232
1231
//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
1237
1236
                                    FALSE /* aCancelable */);
1238
1237
                if(SUCCEEDED(rc))
1239
1238
                {
1240
 
                    CheckComRCReturnRC (rc);
1241
 
//                    progress.queryInterfaceTo (aProgress);
 
1239
                    CheckComRCReturnRC(rc);
 
1240
//                    progress.queryInterfaceTo(aProgress);
1242
1241
 
1243
1242
                    /* create the networkInterfaceHelperClient() argument */
1244
1243
                    std::auto_ptr <NetworkInterfaceHelperClientData>
1245
1244
                        d (new NetworkInterfaceHelperClientData());
1246
 
                    AssertReturn (d.get(), E_OUTOFMEMORY);
 
1245
                    AssertReturn(d.get(), E_OUTOFMEMORY);
1247
1246
 
1248
1247
                    d->msgCode = SVCHlpMsg::EnableStaticIpConfigV6;
1249
1248
                    d->guid = guid;
1257
1256
                        static_cast <void *> (d.get()),
1258
1257
                        progress);
1259
1258
 
1260
 
                    if (SUCCEEDED (rc))
 
1259
                    if (SUCCEEDED(rc))
1261
1260
                    {
1262
1261
                        /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
1263
1262
                        d.release();
1288
1287
//        if(SUCCEEDED(rc))
1289
1288
        {
1290
1289
            /* create a progress object */
1291
 
            ComObjPtr <Progress> progress;
 
1290
            ComObjPtr<Progress> progress;
1292
1291
            progress.createObject();
1293
1292
//            ComPtr<IHost> host;
1294
1293
//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
1299
1298
                                    FALSE /* aCancelable */);
1300
1299
                if(SUCCEEDED(rc))
1301
1300
                {
1302
 
                    CheckComRCReturnRC (rc);
1303
 
//                    progress.queryInterfaceTo (aProgress);
 
1301
                    CheckComRCReturnRC(rc);
 
1302
//                    progress.queryInterfaceTo(aProgress);
1304
1303
 
1305
1304
                    /* create the networkInterfaceHelperClient() argument */
1306
1305
                    std::auto_ptr <NetworkInterfaceHelperClientData>
1307
1306
                        d (new NetworkInterfaceHelperClientData());
1308
 
                    AssertReturn (d.get(), E_OUTOFMEMORY);
 
1307
                    AssertReturn(d.get(), E_OUTOFMEMORY);
1309
1308
 
1310
1309
                    d->msgCode = SVCHlpMsg::EnableDynamicIpConfig;
1311
1310
                    d->guid = guid;
1317
1316
                        static_cast <void *> (d.get()),
1318
1317
                        progress);
1319
1318
 
1320
 
                    if (SUCCEEDED (rc))
 
1319
                    if (SUCCEEDED(rc))
1321
1320
                    {
1322
1321
                        /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
1323
1322
                        d.release();
1348
1347
//        if(SUCCEEDED(rc))
1349
1348
        {
1350
1349
            /* create a progress object */
1351
 
            ComObjPtr <Progress> progress;
 
1350
            ComObjPtr<Progress> progress;
1352
1351
            progress.createObject();
1353
1352
//            ComPtr<IHost> host;
1354
1353
//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
1359
1358
                                    FALSE /* aCancelable */);
1360
1359
                if(SUCCEEDED(rc))
1361
1360
                {
1362
 
                    CheckComRCReturnRC (rc);
1363
 
//                    progress.queryInterfaceTo (aProgress);
 
1361
                    CheckComRCReturnRC(rc);
 
1362
//                    progress.queryInterfaceTo(aProgress);
1364
1363
 
1365
1364
                    /* create the networkInterfaceHelperClient() argument */
1366
1365
                    std::auto_ptr <NetworkInterfaceHelperClientData>
1367
1366
                        d (new NetworkInterfaceHelperClientData());
1368
 
                    AssertReturn (d.get(), E_OUTOFMEMORY);
 
1367
                    AssertReturn(d.get(), E_OUTOFMEMORY);
1369
1368
 
1370
1369
                    d->msgCode = SVCHlpMsg::DhcpRediscover;
1371
1370
                    d->guid = guid;
1377
1376
                        static_cast <void *> (d.get()),
1378
1377
                        progress);
1379
1378
 
1380
 
                    if (SUCCEEDED (rc))
 
1379
                    if (SUCCEEDED(rc))
1381
1380
                    {
1382
1381
                        /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
1383
1382
                        d.release();
1393
1392
#endif
1394
1393
}
1395
1394
 
1396
 
int NetIfList(std::list <ComObjPtr <HostNetworkInterface> > &list)
 
1395
int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
1397
1396
{
1398
1397
#ifndef VBOX_WITH_NETFLT
1399
1398
    return VERR_NOT_IMPLEMENTED;