VirtualBox

Changeset 23873 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 19, 2009 3:10:16 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53646
Message:

VBoxManage: use RTGetOptFetchValue instead of the iNext hack and few renames.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r23807 r23873  
    209209    Bstr name;
    210210    Bstr machineuuid (a->argv[0]);
    211     RTGETOPTUNION pValueUnion;
    212     RTGETOPTSTATE pGetState;
     211    RTGETOPTUNION ValueUnion;
     212    RTGETOPTSTATE GetOptState;
    213213    ComPtr <IMachine> machine;
    214214    ComPtr <IBIOSSettings> biosSettings;
     
    251251    machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
    252252
    253     RTGetOptInit (&pGetState, a->argc, a->argv, g_aModifyVMOptions,
     253    RTGetOptInit (&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
    254254                  RT_ELEMENTS(g_aModifyVMOptions), 1, 0 /* fFlags */);
    255255
    256256    while (   SUCCEEDED (rc)
    257            && (c = RTGetOpt(&pGetState, &pValueUnion)))
     257           && (c = RTGetOpt(&GetOptState, &ValueUnion)))
    258258    {
    259259        switch (c)
     
    261261            case MODIFYVM_NAME:
    262262            {
    263                 if (pValueUnion.psz)
    264                     CHECK_ERROR (machine, COMSETTER(Name)(Bstr(pValueUnion.psz)));
     263                if (ValueUnion.psz)
     264                    CHECK_ERROR (machine, COMSETTER(Name)(Bstr(ValueUnion.psz)));
    265265                break;
    266266            }
    267267            case MODIFYVM_OSTYPE:
    268268            {
    269                 if (pValueUnion.psz)
     269                if (ValueUnion.psz)
    270270                {
    271271                    ComPtr<IGuestOSType> guestOSType;
    272                     CHECK_ERROR (a->virtualBox, GetGuestOSType(Bstr(pValueUnion.psz), guestOSType.asOutParam()));
     272                    CHECK_ERROR (a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz), guestOSType.asOutParam()));
    273273                    if (SUCCEEDED(rc) && guestOSType)
    274274                    {
    275                         CHECK_ERROR (machine, COMSETTER(OSTypeId)(Bstr(pValueUnion.psz)));
    276                     }
    277                     else
    278                     {
    279                         errorArgument("Invalid guest OS type '%s'", Utf8Str(pValueUnion.psz).raw());
     275                        CHECK_ERROR (machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz)));
     276                    }
     277                    else
     278                    {
     279                        errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).raw());
    280280                        rc = E_FAIL;
    281281                    }
     
    286286            case MODIFYVM_MEMORY:
    287287            {
    288                 if (pValueUnion.u32 > 0)
    289                     CHECK_ERROR (machine, COMSETTER(MemorySize)(pValueUnion.u32));
     288                if (ValueUnion.u32 > 0)
     289                    CHECK_ERROR (machine, COMSETTER(MemorySize)(ValueUnion.u32));
    290290                break;
    291291            }
     
    293293            case MODIFYVM_VRAM:
    294294            {
    295                 if (pValueUnion.u32 > 0)
    296                     CHECK_ERROR (machine, COMSETTER(VRAMSize)(pValueUnion.u32));
     295                if (ValueUnion.u32 > 0)
     296                    CHECK_ERROR (machine, COMSETTER(VRAMSize)(ValueUnion.u32));
    297297                break;
    298298            }
     
    300300            case MODIFYVM_FIRMWARE:
    301301            {
    302                 if (pValueUnion.psz)
    303                 {
    304                     if (!strcmp(pValueUnion.psz, "efi"))
     302                if (ValueUnion.psz)
     303                {
     304                    if (!strcmp(ValueUnion.psz, "efi"))
    305305                    {
    306306                        CHECK_ERROR (machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
    307307                    }
    308                     else if (!strcmp(pValueUnion.psz, "bios"))
     308                    else if (!strcmp(ValueUnion.psz, "bios"))
    309309                    {
    310310                        CHECK_ERROR (machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
     
    312312                    else
    313313                    {
    314                         errorArgument("Invalid --firmware argument '%s'", pValueUnion.psz);
     314                        errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
    315315                        rc = E_FAIL;
    316316                    }
     
    321321            case MODIFYVM_ACPI:
    322322            {
    323                 if (pValueUnion.psz)
    324                 {
    325                     if (!strcmp(pValueUnion.psz, "on"))
     323                if (ValueUnion.psz)
     324                {
     325                    if (!strcmp(ValueUnion.psz, "on"))
    326326                    {
    327327                        CHECK_ERROR (biosSettings, COMSETTER(ACPIEnabled)(true));
    328328                    }
    329                     else if (!strcmp(pValueUnion.psz, "off"))
     329                    else if (!strcmp(ValueUnion.psz, "off"))
    330330                    {
    331331                        CHECK_ERROR (biosSettings, COMSETTER(ACPIEnabled)(false));
     
    333333                    else
    334334                    {
    335                         errorArgument("Invalid --acpi argument '%s'", pValueUnion.psz);
     335                        errorArgument("Invalid --acpi argument '%s'", ValueUnion.psz);
    336336                        rc = E_FAIL;
    337337                    }
     
    342342            case MODIFYVM_IOAPIC:
    343343            {
    344                 if (pValueUnion.psz)
    345                 {
    346                     if (!strcmp(pValueUnion.psz, "on"))
     344                if (ValueUnion.psz)
     345                {
     346                    if (!strcmp(ValueUnion.psz, "on"))
    347347                    {
    348348                        CHECK_ERROR (biosSettings, COMSETTER(IOAPICEnabled)(true));
    349349                    }
    350                     else if (!strcmp(pValueUnion.psz, "off"))
     350                    else if (!strcmp(ValueUnion.psz, "off"))
    351351                    {
    352352                        CHECK_ERROR (biosSettings, COMSETTER(IOAPICEnabled)(false));
     
    354354                    else
    355355                    {
    356                         errorArgument("Invalid --ioapic argument '%s'", pValueUnion.psz);
     356                        errorArgument("Invalid --ioapic argument '%s'", ValueUnion.psz);
    357357                        rc = E_FAIL;
    358358                    }
     
    363363            case MODIFYVM_PAE:
    364364            {
    365                 if (pValueUnion.psz)
    366                 {
    367                     if (!strcmp(pValueUnion.psz, "on"))
     365                if (ValueUnion.psz)
     366                {
     367                    if (!strcmp(ValueUnion.psz, "on"))
    368368                    {
    369369                        CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_PAE, true));
    370370                    }
    371                     else if (!strcmp(pValueUnion.psz, "off"))
     371                    else if (!strcmp(ValueUnion.psz, "off"))
    372372                    {
    373373                        CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_PAE, false));
     
    375375                    else
    376376                    {
    377                         errorArgument("Invalid --pae argument '%s'", pValueUnion.psz);
     377                        errorArgument("Invalid --pae argument '%s'", ValueUnion.psz);
    378378                        rc = E_FAIL;
    379379                    }
     
    384384            case MODIFYVM_SYNTHCPU:
    385385            {
    386                 if (pValueUnion.psz)
    387                 {
    388                     if (!strcmp(pValueUnion.psz, "on"))
     386                if (ValueUnion.psz)
     387                {
     388                    if (!strcmp(ValueUnion.psz, "on"))
    389389                    {
    390390                        CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_Synthetic, true));
    391391                    }
    392                     else if (!strcmp(pValueUnion.psz, "off"))
     392                    else if (!strcmp(ValueUnion.psz, "off"))
    393393                    {
    394394                        CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_Synthetic, false));
     
    396396                    else
    397397                    {
    398                         errorArgument("Invalid --synthcpu argument '%s'", pValueUnion.psz);
     398                        errorArgument("Invalid --synthcpu argument '%s'", ValueUnion.psz);
    399399                        rc = E_FAIL;
    400400                    }
     
    405405            case MODIFYVM_HWVIRTEX:
    406406            {
    407                 if (pValueUnion.psz)
    408                 {
    409                     if (!strcmp(pValueUnion.psz, "on"))
     407                if (ValueUnion.psz)
     408                {
     409                    if (!strcmp(ValueUnion.psz, "on"))
    410410                    {
    411411                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, TRUE));
    412412                    }
    413                     else if (!strcmp(pValueUnion.psz, "off"))
     413                    else if (!strcmp(ValueUnion.psz, "off"))
    414414                    {
    415415                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, FALSE));
     
    417417                    else
    418418                    {
    419                         errorArgument("Invalid --hwvirtex argument '%s'", pValueUnion.psz);
     419                        errorArgument("Invalid --hwvirtex argument '%s'", ValueUnion.psz);
    420420                        rc = E_FAIL;
    421421                    }
     
    426426            case MODIFYVM_HWVIRTEXEXCLUSIVE:
    427427            {
    428                 if (pValueUnion.psz)
    429                 {
    430                     if (!strcmp(pValueUnion.psz, "on"))
     428                if (ValueUnion.psz)
     429                {
     430                    if (!strcmp(ValueUnion.psz, "on"))
    431431                    {
    432432                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, TRUE));
    433433                    }
    434                     else if (!strcmp(pValueUnion.psz, "off"))
     434                    else if (!strcmp(ValueUnion.psz, "off"))
    435435                    {
    436436                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, FALSE));
     
    438438                    else
    439439                    {
    440                         errorArgument("Invalid --hwvirtex argument '%s'", pValueUnion.psz);
     440                        errorArgument("Invalid --hwvirtex argument '%s'", ValueUnion.psz);
    441441                        rc = E_FAIL;
    442442                    }
     
    447447            case MODIFYVM_NESTEDPAGING:
    448448            {
    449                 if (pValueUnion.psz)
    450                 {
    451                     if (!strcmp(pValueUnion.psz, "on"))
     449                if (ValueUnion.psz)
     450                {
     451                    if (!strcmp(ValueUnion.psz, "on"))
    452452                    {
    453453                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, TRUE));
    454454                    }
    455                     else if (!strcmp(pValueUnion.psz, "off"))
     455                    else if (!strcmp(ValueUnion.psz, "off"))
    456456                    {
    457457                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, FALSE));
     
    459459                    else
    460460                    {
    461                         errorArgument("Invalid --nestedpaging argument '%s'", pValueUnion.psz);
     461                        errorArgument("Invalid --nestedpaging argument '%s'", ValueUnion.psz);
    462462                        rc = E_FAIL;
    463463                    }
     
    468468            case MODIFYVM_VTXVPID:
    469469            {
    470                 if (pValueUnion.psz)
    471                 {
    472                     if (!strcmp(pValueUnion.psz, "on"))
     470                if (ValueUnion.psz)
     471                {
     472                    if (!strcmp(ValueUnion.psz, "on"))
    473473                    {
    474474                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, TRUE));
    475475                    }
    476                     else if (!strcmp(pValueUnion.psz, "off"))
     476                    else if (!strcmp(ValueUnion.psz, "off"))
    477477                    {
    478478                        CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, FALSE));
     
    480480                    else
    481481                    {
    482                         errorArgument("Invalid --vtxvpid argument '%s'", pValueUnion.psz);
     482                        errorArgument("Invalid --vtxvpid argument '%s'", ValueUnion.psz);
    483483                        rc = E_FAIL;
    484484                    }
     
    489489            case MODIFYVM_CPUS:
    490490            {
    491                 if (pValueUnion.u32 > 0)
    492                     CHECK_ERROR (machine, COMSETTER(CPUCount)(pValueUnion.u32));
     491                if (ValueUnion.u32 > 0)
     492                    CHECK_ERROR (machine, COMSETTER(CPUCount)(ValueUnion.u32));
    493493                break;
    494494            }
     
    496496            case MODIFYVM_MONITORCOUNT:
    497497            {
    498                 if (pValueUnion.u32 > 0)
    499                     CHECK_ERROR (machine, COMSETTER(MonitorCount)(pValueUnion.u32));
     498                if (ValueUnion.u32 > 0)
     499                    CHECK_ERROR (machine, COMSETTER(MonitorCount)(ValueUnion.u32));
    500500                break;
    501501            }
     
    503503            case MODIFYVM_ACCELERATE3D:
    504504            {
    505                 if (pValueUnion.psz)
    506                 {
    507                     if (!strcmp(pValueUnion.psz, "on"))
     505                if (ValueUnion.psz)
     506                {
     507                    if (!strcmp(ValueUnion.psz, "on"))
    508508                    {
    509509                        CHECK_ERROR (machine, COMSETTER(Accelerate3DEnabled)(true));
    510510                    }
    511                     else if (!strcmp(pValueUnion.psz, "off"))
     511                    else if (!strcmp(ValueUnion.psz, "off"))
    512512                    {
    513513                        CHECK_ERROR (machine, COMSETTER(Accelerate3DEnabled)(false));
     
    515515                    else
    516516                    {
    517                         errorArgument("Invalid --accelerate3d argument '%s'", pValueUnion.psz);
     517                        errorArgument("Invalid --accelerate3d argument '%s'", ValueUnion.psz);
    518518                        rc = E_FAIL;
    519519                    }
     
    525525            {
    526526#ifdef VBOX_WITH_VIDEOHWACCEL
    527                 if (pValueUnion.psz)
    528                 {
    529                     if (!strcmp(pValueUnion.psz, "on"))
     527                if (ValueUnion.psz)
     528                {
     529                    if (!strcmp(ValueUnion.psz, "on"))
    530530                    {
    531531                        CHECK_ERROR (machine, COMSETTER(Accelerate2DVideoEnabled)(true));
    532532                    }
    533                     else if (!strcmp(pValueUnion.psz, "off"))
     533                    else if (!strcmp(ValueUnion.psz, "off"))
    534534                    {
    535535                        CHECK_ERROR (machine, COMSETTER(Accelerate2DVideoEnabled)(false));
     
    537537                    else
    538538                    {
    539                         errorArgument("Invalid --accelerate2dvideo argument '%s'", pValueUnion.psz);
     539                        errorArgument("Invalid --accelerate2dvideo argument '%s'", ValueUnion.psz);
    540540                        rc = E_FAIL;
    541541                    }
     
    547547            case MODIFYVM_BIOSLOGOFADEIN:
    548548            {
    549                 if (pValueUnion.psz)
    550                 {
    551                     if (!strcmp(pValueUnion.psz, "on"))
     549                if (ValueUnion.psz)
     550                {
     551                    if (!strcmp(ValueUnion.psz, "on"))
    552552                    {
    553553                        CHECK_ERROR (biosSettings, COMSETTER(LogoFadeIn)(true));
    554554                    }
    555                     else if (!strcmp(pValueUnion.psz, "off"))
     555                    else if (!strcmp(ValueUnion.psz, "off"))
    556556                    {
    557557                        CHECK_ERROR (biosSettings, COMSETTER(LogoFadeIn)(false));
     
    559559                    else
    560560                    {
    561                         errorArgument("Invalid --bioslogofadein argument '%s'", pValueUnion.psz);
     561                        errorArgument("Invalid --bioslogofadein argument '%s'", ValueUnion.psz);
    562562                        rc = E_FAIL;
    563563                    }
     
    568568            case MODIFYVM_BIOSLOGOFADEOUT:
    569569            {
    570                 if (pValueUnion.psz)
    571                 {
    572                     if (!strcmp(pValueUnion.psz, "on"))
     570                if (ValueUnion.psz)
     571                {
     572                    if (!strcmp(ValueUnion.psz, "on"))
    573573                    {
    574574                        CHECK_ERROR (biosSettings, COMSETTER(LogoFadeOut)(true));
    575575                    }
    576                     else if (!strcmp(pValueUnion.psz, "off"))
     576                    else if (!strcmp(ValueUnion.psz, "off"))
    577577                    {
    578578                        CHECK_ERROR (biosSettings, COMSETTER(LogoFadeOut)(false));
     
    580580                    else
    581581                    {
    582                         errorArgument("Invalid --bioslogofadeout argument '%s'", pValueUnion.psz);
     582                        errorArgument("Invalid --bioslogofadeout argument '%s'", ValueUnion.psz);
    583583                        rc = E_FAIL;
    584584                        break;
     
    590590            case MODIFYVM_BIOSLOGODISPLAYTIME:
    591591            {
    592                 if (pValueUnion.u64 > 0)
    593                     CHECK_ERROR (biosSettings, COMSETTER(LogoDisplayTime)(pValueUnion.u64));
     592                if (ValueUnion.u64 > 0)
     593                    CHECK_ERROR (biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u64));
    594594                break;
    595595            }
     
    597597            case MODIFYVM_BIOSLOGOIMAGEPATH:
    598598            {
    599                 if (pValueUnion.psz)
    600                     CHECK_ERROR (biosSettings, COMSETTER(LogoImagePath)(Bstr(pValueUnion.psz)));
     599                if (ValueUnion.psz)
     600                    CHECK_ERROR (biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz)));
    601601                break;
    602602            }
     
    604604            case MODIFYVM_BIOSBOOTMENU:
    605605            {
    606                 if (pValueUnion.psz)
    607                 {
    608                     if (!strcmp(pValueUnion.psz, "disabled"))
     606                if (ValueUnion.psz)
     607                {
     608                    if (!strcmp(ValueUnion.psz, "disabled"))
    609609                        CHECK_ERROR (biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
    610                     else if (!strcmp(pValueUnion.psz, "menuonly"))
     610                    else if (!strcmp(ValueUnion.psz, "menuonly"))
    611611                        CHECK_ERROR (biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
    612                     else if (!strcmp(pValueUnion.psz, "messageandmenu"))
     612                    else if (!strcmp(ValueUnion.psz, "messageandmenu"))
    613613                        CHECK_ERROR (biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
    614614                    else
    615615                    {
    616                         errorArgument("Invalid --biosbootmenu argument '%s'", pValueUnion.psz);
     616                        errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
    617617                        rc = E_FAIL;
    618618                    }
     
    623623            case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
    624624            {
    625                 if (pValueUnion.u64 > 0)
    626                     CHECK_ERROR (biosSettings, COMSETTER(TimeOffset)(pValueUnion.u64));
     625                if (ValueUnion.u64 > 0)
     626                    CHECK_ERROR (biosSettings, COMSETTER(TimeOffset)(ValueUnion.u64));
    627627                break;
    628628            }
     
    630630            case MODIFYVM_BIOSPXEDEBUG:
    631631            {
    632                 if (pValueUnion.psz)
    633                 {
    634                     if (!strcmp(pValueUnion.psz, "on"))
     632                if (ValueUnion.psz)
     633                {
     634                    if (!strcmp(ValueUnion.psz, "on"))
    635635                    {
    636636                        CHECK_ERROR (biosSettings, COMSETTER(PXEDebugEnabled)(true));
    637637                    }
    638                     else if (!strcmp(pValueUnion.psz, "off"))
     638                    else if (!strcmp(ValueUnion.psz, "off"))
    639639                    {
    640640                        CHECK_ERROR (biosSettings, COMSETTER(PXEDebugEnabled)(false));
     
    642642                    else
    643643                    {
    644                         errorArgument("Invalid --biospxedebug argument '%s'", pValueUnion.psz);
     644                        errorArgument("Invalid --biospxedebug argument '%s'", ValueUnion.psz);
    645645                        rc = E_FAIL;
    646646                    }
     
    651651            case MODIFYVM_BOOT:
    652652            {
    653                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > 4))
     653                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4))
    654654                    return errorSyntax(USAGE_MODIFYVM,
    655655                                       "Missing or Invalid boot slot number in '%s'",
    656                                        pGetState.pDef->pszLong);
    657 
    658                 if (!strcmp(pValueUnion.psz, "none"))
    659                 {
    660                     CHECK_ERROR (machine, SetBootOrder (pGetState.uIndex, DeviceType_Null));
    661                 }
    662                 else if (!strcmp(pValueUnion.psz, "floppy"))
    663                 {
    664                     CHECK_ERROR (machine, SetBootOrder (pGetState.uIndex, DeviceType_Floppy));
    665                 }
    666                 else if (!strcmp(pValueUnion.psz, "dvd"))
    667                 {
    668                     CHECK_ERROR (machine, SetBootOrder (pGetState.uIndex, DeviceType_DVD));
    669                 }
    670                 else if (!strcmp(pValueUnion.psz, "disk"))
    671                 {
    672                     CHECK_ERROR (machine, SetBootOrder (pGetState.uIndex, DeviceType_HardDisk));
    673                 }
    674                 else if (!strcmp(pValueUnion.psz, "net"))
    675                 {
    676                     CHECK_ERROR (machine, SetBootOrder (pGetState.uIndex, DeviceType_Network));
     656                                       GetOptState.pDef->pszLong);
     657
     658                if (!strcmp(ValueUnion.psz, "none"))
     659                {
     660                    CHECK_ERROR (machine, SetBootOrder (GetOptState.uIndex, DeviceType_Null));
     661                }
     662                else if (!strcmp(ValueUnion.psz, "floppy"))
     663                {
     664                    CHECK_ERROR (machine, SetBootOrder (GetOptState.uIndex, DeviceType_Floppy));
     665                }
     666                else if (!strcmp(ValueUnion.psz, "dvd"))
     667                {
     668                    CHECK_ERROR (machine, SetBootOrder (GetOptState.uIndex, DeviceType_DVD));
     669                }
     670                else if (!strcmp(ValueUnion.psz, "disk"))
     671                {
     672                    CHECK_ERROR (machine, SetBootOrder (GetOptState.uIndex, DeviceType_HardDisk));
     673                }
     674                else if (!strcmp(ValueUnion.psz, "net"))
     675                {
     676                    CHECK_ERROR (machine, SetBootOrder (GetOptState.uIndex, DeviceType_Network));
    677677                }
    678678                else
    679                     return errorArgument("Invalid boot device '%s'", pValueUnion.psz);
     679                    return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
    680680
    681681                break;
     
    684684            case MODIFYVM_HDA: // deprecated
    685685            {
    686                 if (!strcmp(pValueUnion.psz, "none"))
     686                if (!strcmp(ValueUnion.psz, "none"))
    687687                {
    688688                    machine->DetachDevice(Bstr("IDE Controller"), 0, 0);
     
    691691                {
    692692                    /* first guess is that it's a UUID */
    693                     Bstr uuid(pValueUnion.psz);
     693                    Bstr uuid(ValueUnion.psz);
    694694                    ComPtr<IMedium> hardDisk;
    695695                    rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
     
    697697                    if (!hardDisk)
    698698                    {
    699                         rc = a->virtualBox->FindHardDisk(Bstr(pValueUnion.psz), hardDisk.asOutParam());
     699                        rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
    700700                        if (FAILED(rc))
    701701                        {
    702702                            /* open the new hard disk object */
    703703                            CHECK_ERROR (a->virtualBox,
    704                                          OpenHardDisk(Bstr(pValueUnion.psz),
     704                                         OpenHardDisk(Bstr(ValueUnion.psz),
    705705                                                      AccessMode_ReadWrite, false, Bstr(""),
    706706                                                      false, Bstr(""), hardDisk.asOutParam()));
     
    720720            case MODIFYVM_HDB: // deprecated
    721721            {
    722                 if (!strcmp(pValueUnion.psz, "none"))
     722                if (!strcmp(ValueUnion.psz, "none"))
    723723                {
    724724                    machine->DetachDevice(Bstr("IDE Controller"), 0, 1);
     
    727727                {
    728728                    /* first guess is that it's a UUID */
    729                     Bstr uuid(pValueUnion.psz);
     729                    Bstr uuid(ValueUnion.psz);
    730730                    ComPtr<IMedium> hardDisk;
    731731                    rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
     
    733733                    if (!hardDisk)
    734734                    {
    735                         rc = a->virtualBox->FindHardDisk(Bstr(pValueUnion.psz), hardDisk.asOutParam());
     735                        rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
    736736                        if (FAILED(rc))
    737737                        {
    738738                            /* open the new hard disk object */
    739739                            CHECK_ERROR (a->virtualBox,
    740                                          OpenHardDisk(Bstr(pValueUnion.psz),
     740                                         OpenHardDisk(Bstr(ValueUnion.psz),
    741741                                                      AccessMode_ReadWrite, false, Bstr(""),
    742742                                                      false, Bstr(""), hardDisk.asOutParam()));
     
    756756            case MODIFYVM_HDD: // deprecated
    757757            {
    758                 if (!strcmp(pValueUnion.psz, "none"))
     758                if (!strcmp(ValueUnion.psz, "none"))
    759759                {
    760760                    machine->DetachDevice(Bstr("IDE Controller"), 1, 1);
     
    763763                {
    764764                    /* first guess is that it's a UUID */
    765                     Bstr uuid(pValueUnion.psz);
     765                    Bstr uuid(ValueUnion.psz);
    766766                    ComPtr<IMedium> hardDisk;
    767767                    rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
     
    769769                    if (!hardDisk)
    770770                    {
    771                         rc = a->virtualBox->FindHardDisk(Bstr(pValueUnion.psz), hardDisk.asOutParam());
     771                        rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
    772772                        if (FAILED(rc))
    773773                        {
    774774                            /* open the new hard disk object */
    775775                            CHECK_ERROR (a->virtualBox,
    776                                          OpenHardDisk(Bstr(pValueUnion.psz),
     776                                         OpenHardDisk(Bstr(ValueUnion.psz),
    777777                                                      AccessMode_ReadWrite, false, Bstr(""),
    778778                                                      false, Bstr(""), hardDisk.asOutParam()));
     
    796796                                                                 storageController.asOutParam()));
    797797
    798                 if (!RTStrICmp(pValueUnion.psz, "PIIX3"))
     798                if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
    799799                {
    800800                    CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
    801801                }
    802                 else if (!RTStrICmp(pValueUnion.psz, "PIIX4"))
     802                else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
    803803                {
    804804                    CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
    805805                }
    806                 else if (!RTStrICmp(pValueUnion.psz, "ICH6"))
     806                else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
    807807                {
    808808                    CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
     
    810810                else
    811811                {
    812                     errorArgument("Invalid --idecontroller argument '%s'", pValueUnion.psz);
     812                    errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
    813813                    rc = E_FAIL;
    814814                }
     
    821821                CHECK_ERROR (machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
    822822
    823                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > 4))
     823                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4))
    824824                    return errorSyntax(USAGE_MODIFYVM,
    825825                                       "Missing or Invalid SATA boot slot number in '%s'",
    826                                        pGetState.pDef->pszLong);
    827 
    828                 if ((pValueUnion.u32 < 1) && (pValueUnion.u32 > 30))
     826                                       GetOptState.pDef->pszLong);
     827
     828                if ((ValueUnion.u32 < 1) && (ValueUnion.u32 > 30))
    829829                    return errorSyntax(USAGE_MODIFYVM,
    830830                                       "Missing or Invalid SATA port number in '%s'",
    831                                        pGetState.pDef->pszLong);
     831                                       GetOptState.pDef->pszLong);
    832832
    833833                if (SUCCEEDED(rc))
    834                     CHECK_ERROR(SataCtl, SetIDEEmulationPort(pGetState.uIndex, pValueUnion.u32));
     834                    CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
    835835
    836836                break;
     
    842842                CHECK_ERROR (machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
    843843
    844                 if (SUCCEEDED(rc) && pValueUnion.u32 > 0)
    845                     CHECK_ERROR(SataCtl, COMSETTER(PortCount)(pValueUnion.u32));
     844                if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
     845                    CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
    846846
    847847                break;
     
    850850            case MODIFYVM_SATAPORT: // deprecated
    851851            {
    852                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > 30))
     852                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 30))
    853853                    return errorSyntax(USAGE_MODIFYVM,
    854854                                       "Missing or Invalid SATA port number in '%s'",
    855                                        pGetState.pDef->pszLong);
    856 
    857                 if (!strcmp(pValueUnion.psz, "none"))
    858                 {
    859                     machine->DetachDevice(Bstr("SATA"), pGetState.uIndex, 0);
     855                                       GetOptState.pDef->pszLong);
     856
     857                if (!strcmp(ValueUnion.psz, "none"))
     858                {
     859                    machine->DetachDevice(Bstr("SATA"), GetOptState.uIndex, 0);
    860860                }
    861861                else
    862862                {
    863863                    /* first guess is that it's a UUID */
    864                     Bstr uuid(pValueUnion.psz);
     864                    Bstr uuid(ValueUnion.psz);
    865865                    ComPtr<IMedium> hardDisk;
    866866                    rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
     
    868868                    if (!hardDisk)
    869869                    {
    870                         rc =  a->virtualBox->FindHardDisk(Bstr(pValueUnion.psz), hardDisk.asOutParam());
     870                        rc =  a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
    871871                        if (FAILED(rc))
    872872                        {
    873873                            /* open the new hard disk object */
    874874                            CHECK_ERROR (a->virtualBox,
    875                                          OpenHardDisk(Bstr(pValueUnion.psz), AccessMode_ReadWrite,
     875                                         OpenHardDisk(Bstr(ValueUnion.psz), AccessMode_ReadWrite,
    876876                                                      false, Bstr(""), false,
    877877                                                      Bstr(""), hardDisk.asOutParam()));
     
    882882                        hardDisk->COMGETTER(Id)(uuid.asOutParam());
    883883                        CHECK_ERROR (machine,
    884                                      AttachDevice(Bstr("SATA"), pGetState.uIndex,
     884                                     AttachDevice(Bstr("SATA"), GetOptState.uIndex,
    885885                                                  0, DeviceType_HardDisk, uuid));
    886886                    }
     
    893893            case MODIFYVM_SATA: // deprecated
    894894            {
    895                 if (!strcmp(pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))
     895                if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
    896896                {
    897897                    ComPtr<IStorageController> ctl;
     
    899899                    CHECK_ERROR (ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
    900900                }
    901                 else if (!strcmp(pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))
     901                else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
    902902                    CHECK_ERROR (machine, RemoveStorageController(Bstr("SATA")));
    903903                else
    904                     return errorArgument("Invalid --usb argument '%s'", pValueUnion.psz);
     904                    return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
    905905                break;
    906906            }
     
    908908            case MODIFYVM_SCSIPORT: // deprecated
    909909            {
    910                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > 16))
     910                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 16))
    911911                    return errorSyntax(USAGE_MODIFYVM,
    912912                                       "Missing or Invalid SCSI port number in '%s'",
    913                                        pGetState.pDef->pszLong);
    914 
    915                 if (!strcmp(pValueUnion.psz, "none"))
    916                 {
    917                     rc = machine->DetachDevice(Bstr("LsiLogic"), pGetState.uIndex, 0);
     913                                       GetOptState.pDef->pszLong);
     914
     915                if (!strcmp(ValueUnion.psz, "none"))
     916                {
     917                    rc = machine->DetachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0);
    918918                    if (FAILED(rc))
    919                         CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), pGetState.uIndex, 0));
     919                        CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0));
    920920                }
    921921                else
    922922                {
    923923                    /* first guess is that it's a UUID */
    924                     Bstr uuid(pValueUnion.psz);
     924                    Bstr uuid(ValueUnion.psz);
    925925                    ComPtr<IMedium> hardDisk;
    926926                    rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
     
    928928                    if (!hardDisk)
    929929                    {
    930                         rc = a->virtualBox->FindHardDisk(Bstr(pValueUnion.psz), hardDisk.asOutParam());
     930                        rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
    931931                        if (FAILED(rc))
    932932                        {
    933933                            /* open the new hard disk object */
    934934                            CHECK_ERROR (a->virtualBox,
    935                                          OpenHardDisk(Bstr(pValueUnion.psz),
     935                                         OpenHardDisk(Bstr(ValueUnion.psz),
    936936                                                           AccessMode_ReadWrite, false, Bstr(""),
    937937                                                           false, Bstr(""), hardDisk.asOutParam()));
     
    941941                    {
    942942                        hardDisk->COMGETTER(Id)(uuid.asOutParam());
    943                         rc = machine->AttachDevice(Bstr("LsiLogic"), pGetState.uIndex, 0, DeviceType_HardDisk, uuid);
     943                        rc = machine->AttachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0, DeviceType_HardDisk, uuid);
    944944                        if (FAILED(rc))
    945945                            CHECK_ERROR (machine,
    946946                                         AttachDevice(Bstr("BusLogic"),
    947                                                       pGetState.uIndex, 0,
     947                                                      GetOptState.uIndex, 0,
    948948                                                      DeviceType_HardDisk, uuid));
    949949                    }
     
    958958                ComPtr<IStorageController> ctl;
    959959
    960                 if (!RTStrICmp(pValueUnion.psz, "LsiLogic"))
     960                if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
    961961                {
    962962                    rc = machine->RemoveStorageController(Bstr("BusLogic"));
     
    972972                        CHECK_ERROR (ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
    973973                }
    974                 else if (!RTStrICmp(pValueUnion.psz, "BusLogic"))
     974                else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
    975975                {
    976976                    rc = machine->RemoveStorageController(Bstr("LsiLogic"));
     
    987987                }
    988988                else
    989                     return errorArgument("Invalid --scsitype argument '%s'", pValueUnion.psz);
     989                    return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
    990990                break;
    991991            }
     
    993993            case MODIFYVM_SCSI: // deprecated
    994994            {
    995                 if (!strcmp(pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))
     995                if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
    996996                {
    997997                    ComPtr<IStorageController> ctl;
     
    10011001                        CHECK_ERROR (ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
    10021002                }
    1003                 else if (!strcmp(pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))
     1003                else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
    10041004                {
    10051005                    rc = machine->RemoveStorageController(Bstr("BusLogic"));
     
    10161016                ASSERT(dvdAttachment);
    10171017
    1018                 CHECK_ERROR (dvdAttachment, COMSETTER(Passthrough)(!strcmp(pValueUnion.psz, "on")));
     1018                CHECK_ERROR (dvdAttachment, COMSETTER(Passthrough)(!strcmp(ValueUnion.psz, "on")));
    10191019                break;
    10201020            }
     
    10231023            {
    10241024                ComPtr<IMedium> dvdMedium;
    1025                 Bstr uuid(pValueUnion.psz);
     1025                Bstr uuid(ValueUnion.psz);
    10261026
    10271027                /* unmount? */
    1028                 if (!strcmp(pValueUnion.psz, "none"))
     1028                if (!strcmp(ValueUnion.psz, "none"))
    10291029                {
    10301030                    /* nothing to do, NULL object will cause unmount */
    10311031                }
    10321032                /* host drive? */
    1033                 else if (!strncmp(pValueUnion.psz, "host:", 5))
     1033                else if (!strncmp(ValueUnion.psz, "host:", 5))
    10341034                {
    10351035                    ComPtr<IHost> host;
    10361036                    CHECK_ERROR (a->virtualBox, COMGETTER(Host)(host.asOutParam()));
    1037                     rc = host->FindHostDVDDrive(Bstr(pValueUnion.psz + 5), dvdMedium.asOutParam());
     1037                    rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5), dvdMedium.asOutParam());
    10381038                    if (!dvdMedium)
    10391039                    {
    10401040                        /* 2nd try: try with the real name, important on Linux+libhal */
    10411041                        char szPathReal[RTPATH_MAX];
    1042                         if (RT_FAILURE(RTPathReal(pValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
     1042                        if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
    10431043                        {
    1044                             errorArgument("Invalid host DVD drive name \"%s\"", pValueUnion.psz + 5);
     1044                            errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
    10451045                            rc = E_FAIL;
    10461046                            break;
     
    10491049                        if (!dvdMedium)
    10501050                        {
    1051                             errorArgument("Invalid host DVD drive name \"%s\"", pValueUnion.psz + 5);
     1051                            errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
    10521052                            rc = E_FAIL;
    10531053                            break;
     
    10621062                    {
    10631063                        /* must be a filename, check if it's in the collection */
    1064                         rc = a->virtualBox->FindDVDImage(Bstr(pValueUnion.psz), dvdMedium.asOutParam());
     1064                        rc = a->virtualBox->FindDVDImage(Bstr(ValueUnion.psz), dvdMedium.asOutParam());
    10651065                        /* not registered, do that on the fly */
    10661066                        if (!dvdMedium)
    10671067                        {
    10681068                            Bstr emptyUUID;
    1069                             CHECK_ERROR (a->virtualBox, OpenDVDImage(Bstr(pValueUnion.psz),
     1069                            CHECK_ERROR (a->virtualBox, OpenDVDImage(Bstr(ValueUnion.psz),
    10701070                                         emptyUUID, dvdMedium.asOutParam()));
    10711071                        }
     
    10891089            case MODIFYVM_FLOPPY: // deprecated
    10901090            {
    1091                 Bstr uuid(pValueUnion.psz);
     1091                Bstr uuid(ValueUnion.psz);
    10921092                ComPtr<IMedium> floppyMedium;
    10931093                ComPtr<IMediumAttachment> floppyAttachment;
     
    10951095
    10961096                /* disable? */
    1097                 if (!strcmp(pValueUnion.psz, "disabled"))
     1097                if (!strcmp(ValueUnion.psz, "disabled"))
    10981098                {
    10991099                    /* disable the controller */
     
    11081108
    11091109                    /* unmount? */
    1110                     if (    !strcmp(pValueUnion.psz, "none")
    1111                         ||  !strcmp(pValueUnion.psz, "empty"))   // deprecated
     1110                    if (    !strcmp(ValueUnion.psz, "none")
     1111                        ||  !strcmp(ValueUnion.psz, "empty"))   // deprecated
    11121112                    {
    11131113                        /* nothing to do, NULL object will cause unmount */
    11141114                    }
    11151115                    /* host drive? */
    1116                     else if (!strncmp(pValueUnion.psz, "host:", 5))
     1116                    else if (!strncmp(ValueUnion.psz, "host:", 5))
    11171117                    {
    11181118                        ComPtr<IHost> host;
    11191119                        CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
    1120                         rc = host->FindHostFloppyDrive(Bstr(pValueUnion.psz + 5), floppyMedium.asOutParam());
     1120                        rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5), floppyMedium.asOutParam());
    11211121                        if (!floppyMedium)
    11221122                        {
    1123                             errorArgument("Invalid host floppy drive name \"%s\"", pValueUnion.psz + 5);
     1123                            errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
    11241124                            rc = E_FAIL;
    11251125                            break;
     
    11331133                        {
    11341134                            /* must be a filename, check if it's in the collection */
    1135                             rc = a->virtualBox->FindFloppyImage(Bstr(pValueUnion.psz), floppyMedium.asOutParam());
     1135                            rc = a->virtualBox->FindFloppyImage(Bstr(ValueUnion.psz), floppyMedium.asOutParam());
    11361136                            /* not registered, do that on the fly */
    11371137                            if (!floppyMedium)
     
    11391139                                Bstr emptyUUID;
    11401140                                CHECK_ERROR (a->virtualBox,
    1141                                              OpenFloppyImage(Bstr(pValueUnion.psz),
     1141                                             OpenFloppyImage(Bstr(ValueUnion.psz),
    11421142                                                             emptyUUID,
    11431143                                                             floppyMedium.asOutParam()));
     
    11601160                ComPtr<INetworkAdapter> nic;
    11611161
    1162                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1162                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    11631163                    return errorSyntax(USAGE_MODIFYVM,
    11641164                                       "Missing or Invalid NIC slot number in '%s'",
    1165                                        pGetState.pDef->pszLong);
    1166 
    1167                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1165                                       GetOptState.pDef->pszLong);
     1166
     1167                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    11681168                ASSERT(nic);
    11691169
    1170                 CHECK_ERROR (nic, COMSETTER(TraceFile)(Bstr(pValueUnion.psz)));
     1170                CHECK_ERROR (nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz)));
    11711171                break;
    11721172            }
     
    11761176                ComPtr<INetworkAdapter> nic;
    11771177
    1178                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1178                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    11791179                    return errorSyntax(USAGE_MODIFYVM,
    11801180                                       "Missing or Invalid NIC slot number in '%s'",
    1181                                        pGetState.pDef->pszLong);
    1182 
    1183                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1181                                       GetOptState.pDef->pszLong);
     1182
     1183                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    11841184                ASSERT(nic);
    11851185
    1186                 if (!strcmp(pValueUnion.psz, "on"))
     1186                if (!strcmp(ValueUnion.psz, "on"))
    11871187                {
    11881188                    CHECK_ERROR (nic, COMSETTER(TraceEnabled)(TRUE));
    11891189                }
    1190                 else if (!strcmp(pValueUnion.psz, "off"))
     1190                else if (!strcmp(ValueUnion.psz, "off"))
    11911191                {
    11921192                    CHECK_ERROR (nic, COMSETTER(TraceEnabled)(FALSE));
     
    11941194                else
    11951195                {
    1196                     errorArgument("Invalid --nictrace%lu argument '%s'", pGetState.uIndex, pValueUnion.psz);
     1196                    errorArgument("Invalid --nictrace%lu argument '%s'", GetOptState.uIndex, ValueUnion.psz);
    11971197                    rc = E_FAIL;
    11981198                }
     
    12041204                ComPtr<INetworkAdapter> nic;
    12051205
    1206                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1206                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    12071207                    return errorSyntax(USAGE_MODIFYVM,
    12081208                                       "Missing or Invalid NIC slot number in '%s'",
    1209                                        pGetState.pDef->pszLong);
    1210 
    1211                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1209                                       GetOptState.pDef->pszLong);
     1210
     1211                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    12121212                ASSERT(nic);
    12131213
    1214                 if (!strcmp(pValueUnion.psz, "Am79C970A"))
     1214                if (!strcmp(ValueUnion.psz, "Am79C970A"))
    12151215                {
    12161216                    CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
    12171217                }
    1218                 else if (!strcmp(pValueUnion.psz, "Am79C973"))
     1218                else if (!strcmp(ValueUnion.psz, "Am79C973"))
    12191219                {
    12201220                    CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
    12211221                }
    12221222#ifdef VBOX_WITH_E1000
    1223                 else if (!strcmp(pValueUnion.psz, "82540EM"))
     1223                else if (!strcmp(ValueUnion.psz, "82540EM"))
    12241224                {
    12251225                    CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
    12261226                }
    1227                 else if (!strcmp(pValueUnion.psz, "82543GC"))
     1227                else if (!strcmp(ValueUnion.psz, "82543GC"))
    12281228                {
    12291229                    CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
    12301230                }
    1231                 else if (!strcmp(pValueUnion.psz, "82545EM"))
     1231                else if (!strcmp(ValueUnion.psz, "82545EM"))
    12321232                {
    12331233                    CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
     
    12351235#endif
    12361236#ifdef VBOX_WITH_VIRTIO
    1237                 else if (!strcmp(pValueUnion.psz, "virtio"))
     1237                else if (!strcmp(ValueUnion.psz, "virtio"))
    12381238                {
    12391239                    CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
     
    12421242                else
    12431243                {
    1244                     errorArgument("Invalid NIC type '%s' specified for NIC %lu", pValueUnion.psz, pGetState.uIndex);
     1244                    errorArgument("Invalid NIC type '%s' specified for NIC %lu", ValueUnion.psz, GetOptState.uIndex);
    12451245                    rc = E_FAIL;
    12461246                }
     
    12521252                ComPtr<INetworkAdapter> nic;
    12531253
    1254                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1254                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    12551255                    return errorSyntax(USAGE_MODIFYVM,
    12561256                                       "Missing or Invalid NIC slot number in '%s'",
    1257                                        pGetState.pDef->pszLong);
    1258 
    1259                 if ((pValueUnion.u32 < 1000) && (pValueUnion.u32 > 4000000))
    1260                 {
    1261                     errorArgument("Invalid --nicspeed%lu argument '%u'", pGetState.uIndex, pValueUnion.u32);
     1257                                       GetOptState.pDef->pszLong);
     1258
     1259                if ((ValueUnion.u32 < 1000) && (ValueUnion.u32 > 4000000))
     1260                {
     1261                    errorArgument("Invalid --nicspeed%lu argument '%u'", GetOptState.uIndex, ValueUnion.u32);
    12621262                    rc = E_FAIL;
    12631263                    break;
    12641264                }
    12651265
    1266                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1266                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    12671267                ASSERT(nic);
    12681268
    1269                 CHECK_ERROR (nic, COMSETTER(LineSpeed)(pValueUnion.u32));
     1269                CHECK_ERROR (nic, COMSETTER(LineSpeed)(ValueUnion.u32));
    12701270                break;
    12711271            }
     
    12751275                ComPtr<INetworkAdapter> nic;
    12761276
    1277                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1277                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    12781278                    return errorSyntax(USAGE_MODIFYVM,
    12791279                                       "Missing or Invalid NIC slot number in '%s'",
    1280                                        pGetState.pDef->pszLong);
    1281 
    1282                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1280                                       GetOptState.pDef->pszLong);
     1281
     1282                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    12831283                ASSERT(nic);
    12841284
    1285                 if (!strcmp(pValueUnion.psz, "none"))
     1285                if (!strcmp(ValueUnion.psz, "none"))
    12861286                {
    12871287                    CHECK_ERROR (nic, COMSETTER(Enabled) (FALSE));
    12881288                }
    1289                 else if (!strcmp(pValueUnion.psz, "null"))
     1289                else if (!strcmp(ValueUnion.psz, "null"))
    12901290                {
    12911291                    CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE));
    12921292                    CHECK_ERROR (nic, Detach());
    12931293                }
    1294                 else if (!strcmp(pValueUnion.psz, "nat"))
     1294                else if (!strcmp(ValueUnion.psz, "nat"))
    12951295                {
    12961296                    CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE));
    12971297                    CHECK_ERROR (nic, AttachToNAT());
    12981298                }
    1299                 else if (  !strcmp(pValueUnion.psz, "bridged")
    1300                         || !strcmp(pValueUnion.psz, "hostif")) /* backward compatibility */
     1299                else if (  !strcmp(ValueUnion.psz, "bridged")
     1300                        || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
    13011301                {
    13021302                    CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE));
    13031303                    CHECK_ERROR (nic, AttachToBridgedInterface());
    13041304                }
    1305                 else if (!strcmp(pValueUnion.psz, "intnet"))
     1305                else if (!strcmp(ValueUnion.psz, "intnet"))
    13061306                {
    13071307                    CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE));
     
    13091309                }
    13101310#if defined(VBOX_WITH_NETFLT)
    1311                 else if (!strcmp(pValueUnion.psz, "hostonly"))
     1311                else if (!strcmp(ValueUnion.psz, "hostonly"))
    13121312                {
    13131313
     
    13181318                else
    13191319                {
    1320                     errorArgument("Invalid type '%s' specfied for NIC %lu", pValueUnion.psz, pGetState.uIndex);
     1320                    errorArgument("Invalid type '%s' specfied for NIC %lu", ValueUnion.psz, GetOptState.uIndex);
    13211321                    rc = E_FAIL;
    13221322                }
     
    13281328                ComPtr<INetworkAdapter> nic;
    13291329
    1330                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1330                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    13311331                    return errorSyntax(USAGE_MODIFYVM,
    13321332                                       "Missing or Invalid NIC slot number in '%s'",
    1333                                        pGetState.pDef->pszLong);
    1334 
    1335                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1333                                       GetOptState.pDef->pszLong);
     1334
     1335                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    13361336                ASSERT(nic);
    13371337
    1338                 if (!strcmp(pValueUnion.psz, "on"))
     1338                if (!strcmp(ValueUnion.psz, "on"))
    13391339                {
    13401340                    CHECK_ERROR (nic, COMSETTER(CableConnected)(TRUE));
    13411341                }
    1342                 else if (!strcmp(pValueUnion.psz, "off"))
     1342                else if (!strcmp(ValueUnion.psz, "off"))
    13431343                {
    13441344                    CHECK_ERROR (nic, COMSETTER(CableConnected)(FALSE));
     
    13461346                else
    13471347                {
    1348                     errorArgument("Invalid --cableconnected%lu argument '%s'", pGetState.uIndex, pValueUnion.psz);
     1348                    errorArgument("Invalid --cableconnected%lu argument '%s'", GetOptState.uIndex, ValueUnion.psz);
    13491349                    rc = E_FAIL;
    13501350                }
     
    13571357                ComPtr<INetworkAdapter> nic;
    13581358
    1359                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1359                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    13601360                    return errorSyntax(USAGE_MODIFYVM,
    13611361                                       "Missing or Invalid NIC slot number in '%s'",
    1362                                        pGetState.pDef->pszLong);
    1363 
    1364                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1362                                       GetOptState.pDef->pszLong);
     1363
     1364                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    13651365                ASSERT(nic);
    13661366
    13671367                /* remove it? */
    1368                 if (!strcmp(pValueUnion.psz, "none"))
     1368                if (!strcmp(ValueUnion.psz, "none"))
    13691369                {
    13701370                    CHECK_ERROR (nic, COMSETTER(HostInterface)(NULL));
     
    13721372                else
    13731373                {
    1374                     CHECK_ERROR (nic, COMSETTER(HostInterface)(Bstr(pValueUnion.psz)));
     1374                    CHECK_ERROR (nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz)));
    13751375                }
    13761376                break;
     
    13811381                ComPtr<INetworkAdapter> nic;
    13821382
    1383                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1383                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    13841384                    return errorSyntax(USAGE_MODIFYVM,
    13851385                                       "Missing or Invalid NIC slot number in '%s'",
    1386                                        pGetState.pDef->pszLong);
    1387 
    1388                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1386                                       GetOptState.pDef->pszLong);
     1387
     1388                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    13891389                ASSERT(nic);
    13901390
    13911391                /* remove it? */
    1392                 if (!strcmp(pValueUnion.psz, "none"))
     1392                if (!strcmp(ValueUnion.psz, "none"))
    13931393                {
    13941394                    CHECK_ERROR (nic, COMSETTER(InternalNetwork)(NULL));
     
    13961396                else
    13971397                {
    1398                     CHECK_ERROR (nic, COMSETTER(InternalNetwork)(Bstr(pValueUnion.psz)));
     1398                    CHECK_ERROR (nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz)));
    13991399                }
    14001400                break;
     
    14051405                ComPtr<INetworkAdapter> nic;
    14061406
    1407                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1407                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    14081408                    return errorSyntax(USAGE_MODIFYVM,
    14091409                                       "Missing or Invalid NIC slot number in '%s'",
    1410                                        pGetState.pDef->pszLong);
    1411 
    1412                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1410                                       GetOptState.pDef->pszLong);
     1411
     1412                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    14131413                ASSERT(nic);
    14141414
    1415                 CHECK_ERROR (nic, COMSETTER(NATNetwork)(Bstr(pValueUnion.psz)));
     1415                CHECK_ERROR (nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz)));
    14161416
    14171417                break;
     
    14221422                ComPtr<INetworkAdapter> nic;
    14231423
    1424                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))
     1424                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
    14251425                    return errorSyntax(USAGE_MODIFYVM,
    14261426                                       "Missing or Invalid NIC slot number in '%s'",
    1427                                        pGetState.pDef->pszLong);
    1428 
    1429                 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (pGetState.uIndex - 1, nic.asOutParam()));
     1427                                       GetOptState.pDef->pszLong);
     1428
     1429                CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam()));
    14301430                ASSERT(nic);
    14311431
    14321432                /* generate one? */
    1433                 if (!strcmp(pValueUnion.psz, "auto"))
     1433                if (!strcmp(ValueUnion.psz, "auto"))
    14341434                {
    14351435                    CHECK_ERROR (nic, COMSETTER(MACAddress)(NULL));
     
    14371437                else
    14381438                {
    1439                     CHECK_ERROR (nic, COMSETTER(MACAddress)(Bstr(pValueUnion.psz)));
     1439                    CHECK_ERROR (nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz)));
    14401440                }
    14411441                break;
     
    14471447                char *pszIRQ = NULL;
    14481448
    1449                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > SerialPortCount))
     1449                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount))
    14501450                    return errorSyntax(USAGE_MODIFYVM,
    14511451                                       "Missing or Invalid Serial Port number in '%s'",
    1452                                        pGetState.pDef->pszLong);
    1453 
    1454                 CHECK_ERROR_BREAK (machine, GetSerialPort (pGetState.uIndex - 1, uart.asOutParam()));
     1452                                       GetOptState.pDef->pszLong);
     1453
     1454                CHECK_ERROR_BREAK (machine, GetSerialPort (GetOptState.uIndex - 1, uart.asOutParam()));
    14551455                ASSERT(uart);
    14561456
    1457                 if (!strcmp(pValueUnion.psz, "disconnected"))
     1457                if (!strcmp(ValueUnion.psz, "disconnected"))
    14581458                {
    14591459                    CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_Disconnected));
    14601460                }
    1461                 else if (   !strcmp(pValueUnion.psz, "server")
    1462                          || !strcmp(pValueUnion.psz, "client")
    1463                          || !strcmp(pValueUnion.psz, "file"))
    1464                 {
    1465                     char *pszIRQ = NULL;
    1466 
    1467                     /**
    1468                      * @todo: not the right way to get the second value for
    1469                      * the argument, change this when RTGetOpt can return
    1470                      * multiple values
    1471                      */
    1472                     pszIRQ = pGetState.argv[pGetState.iNext];
    1473                     pGetState.iNext++;
    1474 
    1475                     if (!pszIRQ)
     1461                else if (   !strcmp(ValueUnion.psz, "server")
     1462                         || !strcmp(ValueUnion.psz, "client")
     1463                         || !strcmp(ValueUnion.psz, "file"))
     1464                {
     1465                    const char *pszMode = ValueUnion.psz;
     1466
     1467                    int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
     1468                    if (RT_FAILURE(vrc))
    14761469                        return errorSyntax(USAGE_MODIFYVM,
    14771470                                           "Missing or Invalid argument to '%s'",
    1478                                            pGetState.pDef->pszLong);
    1479 
    1480                     CHECK_ERROR (uart, COMSETTER(Path) (Bstr(pszIRQ)));
    1481 
    1482                     if (!strcmp(pValueUnion.psz, "server"))
     1471                                           GetOptState.pDef->pszLong);
     1472
     1473                    CHECK_ERROR (uart, COMSETTER(Path) (Bstr(ValueUnion.psz)));
     1474
     1475                    if (!strcmp(pszMode, "server"))
    14831476                    {
    14841477                        CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_HostPipe));
    14851478                        CHECK_ERROR (uart, COMSETTER(Server) (TRUE));
    14861479                    }
    1487                     else if (!strcmp(pValueUnion.psz, "client"))
     1480                    else if (!strcmp(pszMode, "client"))
    14881481                    {
    14891482                        CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_HostPipe));
    14901483                        CHECK_ERROR (uart, COMSETTER(Server) (FALSE));
    14911484                    }
    1492                     else if (!strcmp(pValueUnion.psz, "file"))
     1485                    else if (!strcmp(pszMode, "file"))
    14931486                    {
    14941487                        CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_RawFile));
     
    14971490                else
    14981491                {
    1499                     CHECK_ERROR (uart, COMSETTER(Path) (Bstr(pValueUnion.psz)));
     1492                    CHECK_ERROR (uart, COMSETTER(Path) (Bstr(ValueUnion.psz)));
    15001493                    CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_HostDevice));
    15011494                }
     
    15071500                ComPtr<ISerialPort> uart;
    15081501
    1509                 if ((pGetState.uIndex < 1) && (pGetState.uIndex > SerialPortCount))
     1502                if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount))
    15101503                    return errorSyntax(USAGE_MODIFYVM,
    15111504                                       "Missing or Invalid Serial Port number in '%s'",
    1512                                        pGetState.pDef->pszLong);
    1513 
    1514                 CHECK_ERROR_BREAK (machine, GetSerialPort (pGetState.uIndex - 1, uart.asOutParam()));
     1505                                       GetOptState.pDef->pszLong);
     1506
     1507                CHECK_ERROR_BREAK (machine, GetSerialPort (GetOptState.uIndex - 1, uart.asOutParam()));
    15151508                ASSERT(uart);
    15161509
    1517                 if (!strcmp(pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))
     1510                if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
    15181511                    CHECK_ERROR (uart, COMSETTER(Enabled) (FALSE));
    15191512                else
    15201513                {
    1521                     char *pszIRQ = NULL;
     1514                    const char *pszIOBase = ValueUnion.psz;
    15221515                    uint32_t uVal = 0;
    1523                     int vrc;
    1524 
    1525                     /**
    1526                      * @todo: not the right way to get the second value for
    1527                      * the argument, change this when RTGetOpt can return
    1528                      * multiple values
    1529                      */
    1530                     pszIRQ = pGetState.argv[pGetState.iNext];
    1531                     pGetState.iNext++;
    1532 
    1533                     if (!pszIRQ)
     1516
     1517                    int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
     1518                    if (RT_FAILURE(vrc))
    15341519                        return errorSyntax(USAGE_MODIFYVM,
    15351520                                           "Missing or Invalid argument to '%s'",
    1536                                            pGetState.pDef->pszLong);
    1537 
    1538                     vrc = RTStrToUInt32Ex(pszIRQ, NULL, 0, &uVal);
     1521                                           GetOptState.pDef->pszLong);
     1522
     1523                    CHECK_ERROR (uart, COMSETTER(IRQ) (ValueUnion.u32));
     1524
     1525                    vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
    15391526                    if (vrc != VINF_SUCCESS || uVal == 0)
    1540                         return errorArgument("Error parsing UART I/O base '%s'", pszIRQ);
    1541 
    1542                     CHECK_ERROR (uart, COMSETTER(IRQ) (uVal));
    1543 
    1544                     vrc = RTStrToUInt32Ex(pValueUnion.psz, NULL, 0, &uVal);
    1545                     if (vrc != VINF_SUCCESS || uVal == 0)
    1546                         return errorArgument("Error parsing UART I/O base '%s'", pszIRQ);
     1527                        return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
    15471528                    CHECK_ERROR (uart, COMSETTER(IOBase) (uVal));
    15481529
     
    15541535            case MODIFYVM_GUESTSTATISTICSINTERVAL:
    15551536            {
    1556                 if (pValueUnion.u32 > 0)
    1557                     CHECK_ERROR (machine, COMSETTER(StatisticsUpdateInterval)(pValueUnion.u32));
     1537                if (ValueUnion.u32 > 0)
     1538                    CHECK_ERROR (machine, COMSETTER(StatisticsUpdateInterval)(ValueUnion.u32));
    15581539                break;
    15591540            }
     
    15621543            case MODIFYVM_GUESTMEMORYBALLOON:
    15631544            {
    1564                 if (pValueUnion.u32 > 0)
    1565                     CHECK_ERROR (machine, COMSETTER(MemoryBalloonSize)(pValueUnion.u32));
     1545                if (ValueUnion.u32 > 0)
     1546                    CHECK_ERROR (machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
    15661547                break;
    15671548            }
     
    15701551            case MODIFYVM_AUDIOCONTROLLER:
    15711552            {
    1572                 if (pValueUnion.psz)
     1553                if (ValueUnion.psz)
    15731554                {
    15741555                    ComPtr<IAudioAdapter> audioAdapter;
     
    15761557                    ASSERT(audioAdapter);
    15771558
    1578                     if (!strcmp(pValueUnion.psz, "sb16"))
     1559                    if (!strcmp(ValueUnion.psz, "sb16"))
    15791560                        CHECK_ERROR (audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
    1580                     else if (!strcmp(pValueUnion.psz, "ac97"))
     1561                    else if (!strcmp(ValueUnion.psz, "ac97"))
    15811562                        CHECK_ERROR (audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
    15821563                    else
    15831564                    {
    1584                         errorArgument("Invalid --audiocontroller argument '%s'", pValueUnion.psz);
     1565                        errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
    15851566                        rc = E_FAIL;
    15861567                    }
     
    15911572            case MODIFYVM_AUDIO:
    15921573            {
    1593                 if (pValueUnion.psz)
     1574                if (ValueUnion.psz)
    15941575                {
    15951576                    ComPtr<IAudioAdapter> audioAdapter;
     
    15981579
    15991580                    /* disable? */
    1600                     if (!strcmp(pValueUnion.psz, "none"))
     1581                    if (!strcmp(ValueUnion.psz, "none"))
    16011582                    {
    16021583                        CHECK_ERROR (audioAdapter, COMSETTER(Enabled)(false));
    16031584                    }
    1604                     else if (!strcmp(pValueUnion.psz, "null"))
     1585                    else if (!strcmp(ValueUnion.psz, "null"))
    16051586                    {
    16061587                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
     
    16091590#ifdef RT_OS_WINDOWS
    16101591#ifdef VBOX_WITH_WINMM
    1611                     else if (!strcmp(pValueUnion.psz, "winmm"))
     1592                    else if (!strcmp(ValueUnion.psz, "winmm"))
    16121593                    {
    16131594                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
     
    16151596                    }
    16161597#endif
    1617                     else if (!strcmp(pValueUnion.psz, "dsound"))
     1598                    else if (!strcmp(ValueUnion.psz, "dsound"))
    16181599                    {
    16191600                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
     
    16221603#endif /* RT_OS_WINDOWS */
    16231604#ifdef RT_OS_LINUX
    1624                     else if (!strcmp(pValueUnion.psz, "oss"))
     1605                    else if (!strcmp(ValueUnion.psz, "oss"))
    16251606                    {
    16261607                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
     
    16281609                    }
    16291610# ifdef VBOX_WITH_ALSA
    1630                     else if (!strcmp(pValueUnion.psz, "alsa"))
     1611                    else if (!strcmp(ValueUnion.psz, "alsa"))
    16311612                    {
    16321613                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
     
    16351616# endif
    16361617# ifdef VBOX_WITH_PULSE
    1637                     else if (!strcmp(pValueUnion.psz, "pulse"))
     1618                    else if (!strcmp(ValueUnion.psz, "pulse"))
    16381619                    {
    16391620                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
     
    16431624#endif /* !RT_OS_LINUX */
    16441625#ifdef RT_OS_SOLARIS
    1645                     else if (!strcmp(pValueUnion.psz, "solaudio"))
     1626                    else if (!strcmp(ValueUnion.psz, "solaudio"))
    16461627                    {
    16471628                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
     
    16501631
    16511632# ifdef VBOX_WITH_SOLARIS_OSS
    1652                     else if (!strcmp(pValueUnion.psz, "oss"))
     1633                    else if (!strcmp(ValueUnion.psz, "oss"))
    16531634                    {
    16541635                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
     
    16591640#endif /* !RT_OS_SOLARIS */
    16601641#ifdef RT_OS_DARWIN
    1661                     else if (!strcmp(pValueUnion.psz, "coreaudio"))
     1642                    else if (!strcmp(ValueUnion.psz, "coreaudio"))
    16621643                    {
    16631644                        CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
     
    16681649                    else
    16691650                    {
    1670                         errorArgument("Invalid --audio argument '%s'", pValueUnion.psz);
     1651                        errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
    16711652                        rc = E_FAIL;
    16721653                    }
     
    16771658            case MODIFYVM_CLIPBOARD:
    16781659            {
    1679                 if (pValueUnion.psz)
    1680                 {
    1681                     if (!strcmp(pValueUnion.psz, "disabled"))
     1660                if (ValueUnion.psz)
     1661                {
     1662                    if (!strcmp(ValueUnion.psz, "disabled"))
    16821663                    {
    16831664                        CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
    16841665                    }
    1685                     else if (!strcmp(pValueUnion.psz, "hosttoguest"))
     1666                    else if (!strcmp(ValueUnion.psz, "hosttoguest"))
    16861667                    {
    16871668                        CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
    16881669                    }
    1689                     else if (!strcmp(pValueUnion.psz, "guesttohost"))
     1670                    else if (!strcmp(ValueUnion.psz, "guesttohost"))
    16901671                    {
    16911672                        CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
    16921673                    }
    1693                     else if (!strcmp(pValueUnion.psz, "bidirectional"))
     1674                    else if (!strcmp(ValueUnion.psz, "bidirectional"))
    16941675                    {
    16951676                        CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
     
    16971678                    else
    16981679                    {
    1699                         errorArgument("Invalid --clipboard argument '%s'", pValueUnion.psz);
     1680                        errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
    17001681                        rc = E_FAIL;
    17011682                    }
     
    17071688            case MODIFYVM_VRDPPORT:
    17081689            {
    1709                 if (pValueUnion.psz)
     1690                if (ValueUnion.psz)
    17101691                {
    17111692                    ComPtr<IVRDPServer> vrdpServer;
     
    17131694                    ASSERT(vrdpServer);
    17141695
    1715                     if (!strcmp(pValueUnion.psz, "default"))
     1696                    if (!strcmp(ValueUnion.psz, "default"))
    17161697                        CHECK_ERROR (vrdpServer, COMSETTER(Ports)(Bstr("0")));
    17171698                    else
    1718                         CHECK_ERROR (vrdpServer, COMSETTER(Ports)(Bstr(pValueUnion.psz)));
     1699                        CHECK_ERROR (vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz)));
    17191700                }
    17201701                break;
     
    17231704            case MODIFYVM_VRDPADDRESS:
    17241705            {
    1725                 if (pValueUnion.psz)
     1706                if (ValueUnion.psz)
    17261707                {
    17271708                    ComPtr<IVRDPServer> vrdpServer;
     
    17291710                    ASSERT(vrdpServer);
    17301711
    1731                     CHECK_ERROR (vrdpServer, COMSETTER(NetAddress)(Bstr(pValueUnion.psz)));
     1712                    CHECK_ERROR (vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz)));
    17321713                }
    17331714                break;
     
    17361717            case MODIFYVM_VRDPAUTHTYPE:
    17371718            {
    1738                 if (pValueUnion.psz)
     1719                if (ValueUnion.psz)
    17391720                {
    17401721                    ComPtr<IVRDPServer> vrdpServer;
     
    17421723                    ASSERT(vrdpServer);
    17431724
    1744                     if (!strcmp(pValueUnion.psz, "null"))
     1725                    if (!strcmp(ValueUnion.psz, "null"))
    17451726                    {
    17461727                        CHECK_ERROR (vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
    17471728                    }
    1748                     else if (!strcmp(pValueUnion.psz, "external"))
     1729                    else if (!strcmp(ValueUnion.psz, "external"))
    17491730                    {
    17501731                        CHECK_ERROR (vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
    17511732                    }
    1752                     else if (!strcmp(pValueUnion.psz, "guest"))
     1733                    else if (!strcmp(ValueUnion.psz, "guest"))
    17531734                    {
    17541735                        CHECK_ERROR (vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
     
    17561737                    else
    17571738                    {
    1758                         errorArgument("Invalid --vrdpauthtype argument '%s'", pValueUnion.psz);
     1739                        errorArgument("Invalid --vrdpauthtype argument '%s'", ValueUnion.psz);
    17591740                        rc = E_FAIL;
    17601741                    }
     
    17651746            case MODIFYVM_VRDPMULTICON:
    17661747            {
    1767                 if (pValueUnion.psz)
     1748                if (ValueUnion.psz)
    17681749                {
    17691750                    ComPtr<IVRDPServer> vrdpServer;
     
    17711752                    ASSERT(vrdpServer);
    17721753
    1773                     if (!strcmp(pValueUnion.psz, "on"))
     1754                    if (!strcmp(ValueUnion.psz, "on"))
    17741755                    {
    17751756                        CHECK_ERROR (vrdpServer, COMSETTER(AllowMultiConnection)(true));
    17761757                    }
    1777                     else if (!strcmp(pValueUnion.psz, "off"))
     1758                    else if (!strcmp(ValueUnion.psz, "off"))
    17781759                    {
    17791760                        CHECK_ERROR (vrdpServer, COMSETTER(AllowMultiConnection)(false));
     
    17811762                    else
    17821763                    {
    1783                         errorArgument("Invalid --vrdpmulticon argument '%s'", pValueUnion.psz);
     1764                        errorArgument("Invalid --vrdpmulticon argument '%s'", ValueUnion.psz);
    17841765                        rc = E_FAIL;
    17851766                    }
     
    17901771            case MODIFYVM_VRDPREUSECON:
    17911772            {
    1792                 if (pValueUnion.psz)
     1773                if (ValueUnion.psz)
    17931774                {
    17941775                    ComPtr<IVRDPServer> vrdpServer;
     
    17961777                    ASSERT(vrdpServer);
    17971778
    1798                     if (!strcmp(pValueUnion.psz, "on"))
     1779                    if (!strcmp(ValueUnion.psz, "on"))
    17991780                    {
    18001781                        CHECK_ERROR (vrdpServer, COMSETTER(ReuseSingleConnection)(true));
    18011782                    }
    1802                     else if (!strcmp(pValueUnion.psz, "off"))
     1783                    else if (!strcmp(ValueUnion.psz, "off"))
    18031784                    {
    18041785                        CHECK_ERROR (vrdpServer, COMSETTER(ReuseSingleConnection)(false));
     
    18061787                    else
    18071788                    {
    1808                         errorArgument("Invalid --vrdpreusecon argument '%s'", pValueUnion.psz);
     1789                        errorArgument("Invalid --vrdpreusecon argument '%s'", ValueUnion.psz);
    18091790                        rc = E_FAIL;
    18101791                    }
     
    18151796            case MODIFYVM_VRDP:
    18161797            {
    1817                 if (pValueUnion.psz)
     1798                if (ValueUnion.psz)
    18181799                {
    18191800                    ComPtr<IVRDPServer> vrdpServer;
     
    18211802                    ASSERT(vrdpServer);
    18221803
    1823                     if (!strcmp(pValueUnion.psz, "on"))
     1804                    if (!strcmp(ValueUnion.psz, "on"))
    18241805                    {
    18251806                        CHECK_ERROR (vrdpServer, COMSETTER(Enabled)(true));
    18261807                    }
    1827                     else if (!strcmp(pValueUnion.psz, "off"))
     1808                    else if (!strcmp(ValueUnion.psz, "off"))
    18281809                    {
    18291810                        CHECK_ERROR (vrdpServer, COMSETTER(Enabled)(false));
     
    18311812                    else
    18321813                    {
    1833                         errorArgument("Invalid --vrdp argument '%s'", pValueUnion.psz);
     1814                        errorArgument("Invalid --vrdp argument '%s'", ValueUnion.psz);
    18341815                        rc = E_FAIL;
    18351816                    }
     
    18411822            case MODIFYVM_USBEHCI:
    18421823            {
    1843                 if (pValueUnion.psz)
     1824                if (ValueUnion.psz)
    18441825                {
    18451826                    ComPtr<IUSBController> UsbCtl;
     
    18471828                    if (SUCCEEDED(rc))
    18481829                    {
    1849                         if (!strcmp(pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))
     1830                        if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
    18501831                            CHECK_ERROR (UsbCtl, COMSETTER(EnabledEhci)(true));
    1851                         else if (!strcmp(pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))
     1832                        else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
    18521833                            CHECK_ERROR (UsbCtl, COMSETTER(EnabledEhci)(false));
    18531834                        else
    1854                             return errorArgument("Invalid --usbehci argument '%s'", pValueUnion.psz);
     1835                            return errorArgument("Invalid --usbehci argument '%s'", ValueUnion.psz);
    18551836                    }
    18561837                }
     
    18601841            case MODIFYVM_USB:
    18611842            {
    1862                 if (pValueUnion.psz)
     1843                if (ValueUnion.psz)
    18631844                {
    18641845                    ComPtr<IUSBController> UsbCtl;
     
    18661847                    if (SUCCEEDED(rc))
    18671848                    {
    1868                         if (!strcmp(pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))
     1849                        if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
    18691850                            CHECK_ERROR (UsbCtl, COMSETTER(Enabled)(true));
    1870                         else if (!strcmp(pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))
     1851                        else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
    18711852                            CHECK_ERROR (UsbCtl, COMSETTER(Enabled)(false));
    18721853                        else
    1873                             return errorArgument("Invalid --usb argument '%s'", pValueUnion.psz);
     1854                            return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
    18741855                    }
    18751856                }
     
    18791860            case MODIFYVM_SNAPSHOTFOLDER:
    18801861            {
    1881                 if (pValueUnion.psz)
    1882                 {
    1883                     if (!strcmp(pValueUnion.psz, "default"))
     1862                if (ValueUnion.psz)
     1863                {
     1864                    if (!strcmp(ValueUnion.psz, "default"))
    18841865                        CHECK_ERROR (machine, COMSETTER(SnapshotFolder)(NULL));
    18851866                    else
    1886                         CHECK_ERROR (machine, COMSETTER(SnapshotFolder)(Bstr(pValueUnion.psz)));
     1867                        CHECK_ERROR (machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz)));
    18871868                }
    18881869                break;
     
    18911872            case MODIFYVM_TELEPORTER_ENABLED:
    18921873            {
    1893                 if (pValueUnion.psz)
    1894                 {
    1895                     if (!strcmp(pValueUnion.psz, "on"))
     1874                if (ValueUnion.psz)
     1875                {
     1876                    if (!strcmp(ValueUnion.psz, "on"))
    18961877                        CHECK_ERROR (machine, COMSETTER(TeleporterEnabled)(1));
    1897                     else if (!strcmp(pValueUnion.psz, "off"))
     1878                    else if (!strcmp(ValueUnion.psz, "off"))
    18981879                        CHECK_ERROR (machine, COMSETTER(TeleporterEnabled)(0));
    18991880                    else
    1900                         return errorArgument("Invalid --teleporterenabled value '%s'", pValueUnion.psz);
     1881                        return errorArgument("Invalid --teleporterenabled value '%s'", ValueUnion.psz);
    19011882                }
    19021883                break;
     
    19051886            case MODIFYVM_TELEPORTER_PORT:
    19061887            {
    1907                 if (pValueUnion.u32 > 0)
    1908                     CHECK_ERROR(machine, COMSETTER(TeleporterPort)(pValueUnion.u32));
     1888                if (ValueUnion.u32 > 0)
     1889                    CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
    19091890                break;
    19101891            }
     
    19121893            case MODIFYVM_TELEPORTER_ADDRESS:
    19131894            {
    1914                 if (pValueUnion.psz)
    1915                     CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(pValueUnion.psz)));
     1895                if (ValueUnion.psz)
     1896                    CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz)));
    19161897                break;
    19171898            }
     
    19191900            case MODIFYVM_TELEPORTER_PASSWORD:
    19201901            {
    1921                 if (pValueUnion.psz)
    1922                     CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(pValueUnion.psz)));
     1902                if (ValueUnion.psz)
     1903                    CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz)));
    19231904                break;
    19241905            }
     
    19261907            default:
    19271908            {
    1928                 errorGetOpt(USAGE_MODIFYVM, c, &pValueUnion);
     1909                errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
    19291910                rc = E_FAIL;
    19301911                break;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette