Changeset 23873 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 19, 2009 3:10:16 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53646
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r23807 r23873 209 209 Bstr name; 210 210 Bstr machineuuid (a->argv[0]); 211 RTGETOPTUNION pValueUnion;212 RTGETOPTSTATE pGetState;211 RTGETOPTUNION ValueUnion; 212 RTGETOPTSTATE GetOptState; 213 213 ComPtr <IMachine> machine; 214 214 ComPtr <IBIOSSettings> biosSettings; … … 251 251 machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam()); 252 252 253 RTGetOptInit (& pGetState, a->argc, a->argv, g_aModifyVMOptions,253 RTGetOptInit (&GetOptState, a->argc, a->argv, g_aModifyVMOptions, 254 254 RT_ELEMENTS(g_aModifyVMOptions), 1, 0 /* fFlags */); 255 255 256 256 while ( SUCCEEDED (rc) 257 && (c = RTGetOpt(& pGetState, &pValueUnion)))257 && (c = RTGetOpt(&GetOptState, &ValueUnion))) 258 258 { 259 259 switch (c) … … 261 261 case MODIFYVM_NAME: 262 262 { 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))); 265 265 break; 266 266 } 267 267 case MODIFYVM_OSTYPE: 268 268 { 269 if ( pValueUnion.psz)269 if (ValueUnion.psz) 270 270 { 271 271 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())); 273 273 if (SUCCEEDED(rc) && guestOSType) 274 274 { 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()); 280 280 rc = E_FAIL; 281 281 } … … 286 286 case MODIFYVM_MEMORY: 287 287 { 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)); 290 290 break; 291 291 } … … 293 293 case MODIFYVM_VRAM: 294 294 { 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)); 297 297 break; 298 298 } … … 300 300 case MODIFYVM_FIRMWARE: 301 301 { 302 if ( pValueUnion.psz)303 { 304 if (!strcmp( pValueUnion.psz, "efi"))302 if (ValueUnion.psz) 303 { 304 if (!strcmp(ValueUnion.psz, "efi")) 305 305 { 306 306 CHECK_ERROR (machine, COMSETTER(FirmwareType)(FirmwareType_EFI)); 307 307 } 308 else if (!strcmp( pValueUnion.psz, "bios"))308 else if (!strcmp(ValueUnion.psz, "bios")) 309 309 { 310 310 CHECK_ERROR (machine, COMSETTER(FirmwareType)(FirmwareType_BIOS)); … … 312 312 else 313 313 { 314 errorArgument("Invalid --firmware argument '%s'", pValueUnion.psz);314 errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz); 315 315 rc = E_FAIL; 316 316 } … … 321 321 case MODIFYVM_ACPI: 322 322 { 323 if ( pValueUnion.psz)324 { 325 if (!strcmp( pValueUnion.psz, "on"))323 if (ValueUnion.psz) 324 { 325 if (!strcmp(ValueUnion.psz, "on")) 326 326 { 327 327 CHECK_ERROR (biosSettings, COMSETTER(ACPIEnabled)(true)); 328 328 } 329 else if (!strcmp( pValueUnion.psz, "off"))329 else if (!strcmp(ValueUnion.psz, "off")) 330 330 { 331 331 CHECK_ERROR (biosSettings, COMSETTER(ACPIEnabled)(false)); … … 333 333 else 334 334 { 335 errorArgument("Invalid --acpi argument '%s'", pValueUnion.psz);335 errorArgument("Invalid --acpi argument '%s'", ValueUnion.psz); 336 336 rc = E_FAIL; 337 337 } … … 342 342 case MODIFYVM_IOAPIC: 343 343 { 344 if ( pValueUnion.psz)345 { 346 if (!strcmp( pValueUnion.psz, "on"))344 if (ValueUnion.psz) 345 { 346 if (!strcmp(ValueUnion.psz, "on")) 347 347 { 348 348 CHECK_ERROR (biosSettings, COMSETTER(IOAPICEnabled)(true)); 349 349 } 350 else if (!strcmp( pValueUnion.psz, "off"))350 else if (!strcmp(ValueUnion.psz, "off")) 351 351 { 352 352 CHECK_ERROR (biosSettings, COMSETTER(IOAPICEnabled)(false)); … … 354 354 else 355 355 { 356 errorArgument("Invalid --ioapic argument '%s'", pValueUnion.psz);356 errorArgument("Invalid --ioapic argument '%s'", ValueUnion.psz); 357 357 rc = E_FAIL; 358 358 } … … 363 363 case MODIFYVM_PAE: 364 364 { 365 if ( pValueUnion.psz)366 { 367 if (!strcmp( pValueUnion.psz, "on"))365 if (ValueUnion.psz) 366 { 367 if (!strcmp(ValueUnion.psz, "on")) 368 368 { 369 369 CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_PAE, true)); 370 370 } 371 else if (!strcmp( pValueUnion.psz, "off"))371 else if (!strcmp(ValueUnion.psz, "off")) 372 372 { 373 373 CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_PAE, false)); … … 375 375 else 376 376 { 377 errorArgument("Invalid --pae argument '%s'", pValueUnion.psz);377 errorArgument("Invalid --pae argument '%s'", ValueUnion.psz); 378 378 rc = E_FAIL; 379 379 } … … 384 384 case MODIFYVM_SYNTHCPU: 385 385 { 386 if ( pValueUnion.psz)387 { 388 if (!strcmp( pValueUnion.psz, "on"))386 if (ValueUnion.psz) 387 { 388 if (!strcmp(ValueUnion.psz, "on")) 389 389 { 390 390 CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_Synthetic, true)); 391 391 } 392 else if (!strcmp( pValueUnion.psz, "off"))392 else if (!strcmp(ValueUnion.psz, "off")) 393 393 { 394 394 CHECK_ERROR (machine, SetCpuProperty(CpuPropertyType_Synthetic, false)); … … 396 396 else 397 397 { 398 errorArgument("Invalid --synthcpu argument '%s'", pValueUnion.psz);398 errorArgument("Invalid --synthcpu argument '%s'", ValueUnion.psz); 399 399 rc = E_FAIL; 400 400 } … … 405 405 case MODIFYVM_HWVIRTEX: 406 406 { 407 if ( pValueUnion.psz)408 { 409 if (!strcmp( pValueUnion.psz, "on"))407 if (ValueUnion.psz) 408 { 409 if (!strcmp(ValueUnion.psz, "on")) 410 410 { 411 411 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, TRUE)); 412 412 } 413 else if (!strcmp( pValueUnion.psz, "off"))413 else if (!strcmp(ValueUnion.psz, "off")) 414 414 { 415 415 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, FALSE)); … … 417 417 else 418 418 { 419 errorArgument("Invalid --hwvirtex argument '%s'", pValueUnion.psz);419 errorArgument("Invalid --hwvirtex argument '%s'", ValueUnion.psz); 420 420 rc = E_FAIL; 421 421 } … … 426 426 case MODIFYVM_HWVIRTEXEXCLUSIVE: 427 427 { 428 if ( pValueUnion.psz)429 { 430 if (!strcmp( pValueUnion.psz, "on"))428 if (ValueUnion.psz) 429 { 430 if (!strcmp(ValueUnion.psz, "on")) 431 431 { 432 432 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, TRUE)); 433 433 } 434 else if (!strcmp( pValueUnion.psz, "off"))434 else if (!strcmp(ValueUnion.psz, "off")) 435 435 { 436 436 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, FALSE)); … … 438 438 else 439 439 { 440 errorArgument("Invalid --hwvirtex argument '%s'", pValueUnion.psz);440 errorArgument("Invalid --hwvirtex argument '%s'", ValueUnion.psz); 441 441 rc = E_FAIL; 442 442 } … … 447 447 case MODIFYVM_NESTEDPAGING: 448 448 { 449 if ( pValueUnion.psz)450 { 451 if (!strcmp( pValueUnion.psz, "on"))449 if (ValueUnion.psz) 450 { 451 if (!strcmp(ValueUnion.psz, "on")) 452 452 { 453 453 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, TRUE)); 454 454 } 455 else if (!strcmp( pValueUnion.psz, "off"))455 else if (!strcmp(ValueUnion.psz, "off")) 456 456 { 457 457 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, FALSE)); … … 459 459 else 460 460 { 461 errorArgument("Invalid --nestedpaging argument '%s'", pValueUnion.psz);461 errorArgument("Invalid --nestedpaging argument '%s'", ValueUnion.psz); 462 462 rc = E_FAIL; 463 463 } … … 468 468 case MODIFYVM_VTXVPID: 469 469 { 470 if ( pValueUnion.psz)471 { 472 if (!strcmp( pValueUnion.psz, "on"))470 if (ValueUnion.psz) 471 { 472 if (!strcmp(ValueUnion.psz, "on")) 473 473 { 474 474 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, TRUE)); 475 475 } 476 else if (!strcmp( pValueUnion.psz, "off"))476 else if (!strcmp(ValueUnion.psz, "off")) 477 477 { 478 478 CHECK_ERROR (machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, FALSE)); … … 480 480 else 481 481 { 482 errorArgument("Invalid --vtxvpid argument '%s'", pValueUnion.psz);482 errorArgument("Invalid --vtxvpid argument '%s'", ValueUnion.psz); 483 483 rc = E_FAIL; 484 484 } … … 489 489 case MODIFYVM_CPUS: 490 490 { 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)); 493 493 break; 494 494 } … … 496 496 case MODIFYVM_MONITORCOUNT: 497 497 { 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)); 500 500 break; 501 501 } … … 503 503 case MODIFYVM_ACCELERATE3D: 504 504 { 505 if ( pValueUnion.psz)506 { 507 if (!strcmp( pValueUnion.psz, "on"))505 if (ValueUnion.psz) 506 { 507 if (!strcmp(ValueUnion.psz, "on")) 508 508 { 509 509 CHECK_ERROR (machine, COMSETTER(Accelerate3DEnabled)(true)); 510 510 } 511 else if (!strcmp( pValueUnion.psz, "off"))511 else if (!strcmp(ValueUnion.psz, "off")) 512 512 { 513 513 CHECK_ERROR (machine, COMSETTER(Accelerate3DEnabled)(false)); … … 515 515 else 516 516 { 517 errorArgument("Invalid --accelerate3d argument '%s'", pValueUnion.psz);517 errorArgument("Invalid --accelerate3d argument '%s'", ValueUnion.psz); 518 518 rc = E_FAIL; 519 519 } … … 525 525 { 526 526 #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")) 530 530 { 531 531 CHECK_ERROR (machine, COMSETTER(Accelerate2DVideoEnabled)(true)); 532 532 } 533 else if (!strcmp( pValueUnion.psz, "off"))533 else if (!strcmp(ValueUnion.psz, "off")) 534 534 { 535 535 CHECK_ERROR (machine, COMSETTER(Accelerate2DVideoEnabled)(false)); … … 537 537 else 538 538 { 539 errorArgument("Invalid --accelerate2dvideo argument '%s'", pValueUnion.psz);539 errorArgument("Invalid --accelerate2dvideo argument '%s'", ValueUnion.psz); 540 540 rc = E_FAIL; 541 541 } … … 547 547 case MODIFYVM_BIOSLOGOFADEIN: 548 548 { 549 if ( pValueUnion.psz)550 { 551 if (!strcmp( pValueUnion.psz, "on"))549 if (ValueUnion.psz) 550 { 551 if (!strcmp(ValueUnion.psz, "on")) 552 552 { 553 553 CHECK_ERROR (biosSettings, COMSETTER(LogoFadeIn)(true)); 554 554 } 555 else if (!strcmp( pValueUnion.psz, "off"))555 else if (!strcmp(ValueUnion.psz, "off")) 556 556 { 557 557 CHECK_ERROR (biosSettings, COMSETTER(LogoFadeIn)(false)); … … 559 559 else 560 560 { 561 errorArgument("Invalid --bioslogofadein argument '%s'", pValueUnion.psz);561 errorArgument("Invalid --bioslogofadein argument '%s'", ValueUnion.psz); 562 562 rc = E_FAIL; 563 563 } … … 568 568 case MODIFYVM_BIOSLOGOFADEOUT: 569 569 { 570 if ( pValueUnion.psz)571 { 572 if (!strcmp( pValueUnion.psz, "on"))570 if (ValueUnion.psz) 571 { 572 if (!strcmp(ValueUnion.psz, "on")) 573 573 { 574 574 CHECK_ERROR (biosSettings, COMSETTER(LogoFadeOut)(true)); 575 575 } 576 else if (!strcmp( pValueUnion.psz, "off"))576 else if (!strcmp(ValueUnion.psz, "off")) 577 577 { 578 578 CHECK_ERROR (biosSettings, COMSETTER(LogoFadeOut)(false)); … … 580 580 else 581 581 { 582 errorArgument("Invalid --bioslogofadeout argument '%s'", pValueUnion.psz);582 errorArgument("Invalid --bioslogofadeout argument '%s'", ValueUnion.psz); 583 583 rc = E_FAIL; 584 584 break; … … 590 590 case MODIFYVM_BIOSLOGODISPLAYTIME: 591 591 { 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)); 594 594 break; 595 595 } … … 597 597 case MODIFYVM_BIOSLOGOIMAGEPATH: 598 598 { 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))); 601 601 break; 602 602 } … … 604 604 case MODIFYVM_BIOSBOOTMENU: 605 605 { 606 if ( pValueUnion.psz)607 { 608 if (!strcmp( pValueUnion.psz, "disabled"))606 if (ValueUnion.psz) 607 { 608 if (!strcmp(ValueUnion.psz, "disabled")) 609 609 CHECK_ERROR (biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled)); 610 else if (!strcmp( pValueUnion.psz, "menuonly"))610 else if (!strcmp(ValueUnion.psz, "menuonly")) 611 611 CHECK_ERROR (biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly)); 612 else if (!strcmp( pValueUnion.psz, "messageandmenu"))612 else if (!strcmp(ValueUnion.psz, "messageandmenu")) 613 613 CHECK_ERROR (biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu)); 614 614 else 615 615 { 616 errorArgument("Invalid --biosbootmenu argument '%s'", pValueUnion.psz);616 errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz); 617 617 rc = E_FAIL; 618 618 } … … 623 623 case MODIFYVM_BIOSSYSTEMTIMEOFFSET: 624 624 { 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)); 627 627 break; 628 628 } … … 630 630 case MODIFYVM_BIOSPXEDEBUG: 631 631 { 632 if ( pValueUnion.psz)633 { 634 if (!strcmp( pValueUnion.psz, "on"))632 if (ValueUnion.psz) 633 { 634 if (!strcmp(ValueUnion.psz, "on")) 635 635 { 636 636 CHECK_ERROR (biosSettings, COMSETTER(PXEDebugEnabled)(true)); 637 637 } 638 else if (!strcmp( pValueUnion.psz, "off"))638 else if (!strcmp(ValueUnion.psz, "off")) 639 639 { 640 640 CHECK_ERROR (biosSettings, COMSETTER(PXEDebugEnabled)(false)); … … 642 642 else 643 643 { 644 errorArgument("Invalid --biospxedebug argument '%s'", pValueUnion.psz);644 errorArgument("Invalid --biospxedebug argument '%s'", ValueUnion.psz); 645 645 rc = E_FAIL; 646 646 } … … 651 651 case MODIFYVM_BOOT: 652 652 { 653 if (( pGetState.uIndex < 1) && (pGetState.uIndex > 4))653 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4)) 654 654 return errorSyntax(USAGE_MODIFYVM, 655 655 "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)); 677 677 } 678 678 else 679 return errorArgument("Invalid boot device '%s'", pValueUnion.psz);679 return errorArgument("Invalid boot device '%s'", ValueUnion.psz); 680 680 681 681 break; … … 684 684 case MODIFYVM_HDA: // deprecated 685 685 { 686 if (!strcmp( pValueUnion.psz, "none"))686 if (!strcmp(ValueUnion.psz, "none")) 687 687 { 688 688 machine->DetachDevice(Bstr("IDE Controller"), 0, 0); … … 691 691 { 692 692 /* first guess is that it's a UUID */ 693 Bstr uuid( pValueUnion.psz);693 Bstr uuid(ValueUnion.psz); 694 694 ComPtr<IMedium> hardDisk; 695 695 rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); … … 697 697 if (!hardDisk) 698 698 { 699 rc = a->virtualBox->FindHardDisk(Bstr( pValueUnion.psz), hardDisk.asOutParam());699 rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam()); 700 700 if (FAILED(rc)) 701 701 { 702 702 /* open the new hard disk object */ 703 703 CHECK_ERROR (a->virtualBox, 704 OpenHardDisk(Bstr( pValueUnion.psz),704 OpenHardDisk(Bstr(ValueUnion.psz), 705 705 AccessMode_ReadWrite, false, Bstr(""), 706 706 false, Bstr(""), hardDisk.asOutParam())); … … 720 720 case MODIFYVM_HDB: // deprecated 721 721 { 722 if (!strcmp( pValueUnion.psz, "none"))722 if (!strcmp(ValueUnion.psz, "none")) 723 723 { 724 724 machine->DetachDevice(Bstr("IDE Controller"), 0, 1); … … 727 727 { 728 728 /* first guess is that it's a UUID */ 729 Bstr uuid( pValueUnion.psz);729 Bstr uuid(ValueUnion.psz); 730 730 ComPtr<IMedium> hardDisk; 731 731 rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); … … 733 733 if (!hardDisk) 734 734 { 735 rc = a->virtualBox->FindHardDisk(Bstr( pValueUnion.psz), hardDisk.asOutParam());735 rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam()); 736 736 if (FAILED(rc)) 737 737 { 738 738 /* open the new hard disk object */ 739 739 CHECK_ERROR (a->virtualBox, 740 OpenHardDisk(Bstr( pValueUnion.psz),740 OpenHardDisk(Bstr(ValueUnion.psz), 741 741 AccessMode_ReadWrite, false, Bstr(""), 742 742 false, Bstr(""), hardDisk.asOutParam())); … … 756 756 case MODIFYVM_HDD: // deprecated 757 757 { 758 if (!strcmp( pValueUnion.psz, "none"))758 if (!strcmp(ValueUnion.psz, "none")) 759 759 { 760 760 machine->DetachDevice(Bstr("IDE Controller"), 1, 1); … … 763 763 { 764 764 /* first guess is that it's a UUID */ 765 Bstr uuid( pValueUnion.psz);765 Bstr uuid(ValueUnion.psz); 766 766 ComPtr<IMedium> hardDisk; 767 767 rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); … … 769 769 if (!hardDisk) 770 770 { 771 rc = a->virtualBox->FindHardDisk(Bstr( pValueUnion.psz), hardDisk.asOutParam());771 rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam()); 772 772 if (FAILED(rc)) 773 773 { 774 774 /* open the new hard disk object */ 775 775 CHECK_ERROR (a->virtualBox, 776 OpenHardDisk(Bstr( pValueUnion.psz),776 OpenHardDisk(Bstr(ValueUnion.psz), 777 777 AccessMode_ReadWrite, false, Bstr(""), 778 778 false, Bstr(""), hardDisk.asOutParam())); … … 796 796 storageController.asOutParam())); 797 797 798 if (!RTStrICmp( pValueUnion.psz, "PIIX3"))798 if (!RTStrICmp(ValueUnion.psz, "PIIX3")) 799 799 { 800 800 CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3)); 801 801 } 802 else if (!RTStrICmp( pValueUnion.psz, "PIIX4"))802 else if (!RTStrICmp(ValueUnion.psz, "PIIX4")) 803 803 { 804 804 CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4)); 805 805 } 806 else if (!RTStrICmp( pValueUnion.psz, "ICH6"))806 else if (!RTStrICmp(ValueUnion.psz, "ICH6")) 807 807 { 808 808 CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6)); … … 810 810 else 811 811 { 812 errorArgument("Invalid --idecontroller argument '%s'", pValueUnion.psz);812 errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz); 813 813 rc = E_FAIL; 814 814 } … … 821 821 CHECK_ERROR (machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam())); 822 822 823 if (( pGetState.uIndex < 1) && (pGetState.uIndex > 4))823 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4)) 824 824 return errorSyntax(USAGE_MODIFYVM, 825 825 "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)) 829 829 return errorSyntax(USAGE_MODIFYVM, 830 830 "Missing or Invalid SATA port number in '%s'", 831 pGetState.pDef->pszLong);831 GetOptState.pDef->pszLong); 832 832 833 833 if (SUCCEEDED(rc)) 834 CHECK_ERROR(SataCtl, SetIDEEmulationPort( pGetState.uIndex, pValueUnion.u32));834 CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32)); 835 835 836 836 break; … … 842 842 CHECK_ERROR (machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam())); 843 843 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)); 846 846 847 847 break; … … 850 850 case MODIFYVM_SATAPORT: // deprecated 851 851 { 852 if (( pGetState.uIndex < 1) && (pGetState.uIndex > 30))852 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 30)) 853 853 return errorSyntax(USAGE_MODIFYVM, 854 854 "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); 860 860 } 861 861 else 862 862 { 863 863 /* first guess is that it's a UUID */ 864 Bstr uuid( pValueUnion.psz);864 Bstr uuid(ValueUnion.psz); 865 865 ComPtr<IMedium> hardDisk; 866 866 rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); … … 868 868 if (!hardDisk) 869 869 { 870 rc = a->virtualBox->FindHardDisk(Bstr( pValueUnion.psz), hardDisk.asOutParam());870 rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam()); 871 871 if (FAILED(rc)) 872 872 { 873 873 /* open the new hard disk object */ 874 874 CHECK_ERROR (a->virtualBox, 875 OpenHardDisk(Bstr( pValueUnion.psz), AccessMode_ReadWrite,875 OpenHardDisk(Bstr(ValueUnion.psz), AccessMode_ReadWrite, 876 876 false, Bstr(""), false, 877 877 Bstr(""), hardDisk.asOutParam())); … … 882 882 hardDisk->COMGETTER(Id)(uuid.asOutParam()); 883 883 CHECK_ERROR (machine, 884 AttachDevice(Bstr("SATA"), pGetState.uIndex,884 AttachDevice(Bstr("SATA"), GetOptState.uIndex, 885 885 0, DeviceType_HardDisk, uuid)); 886 886 } … … 893 893 case MODIFYVM_SATA: // deprecated 894 894 { 895 if (!strcmp( pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))895 if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable")) 896 896 { 897 897 ComPtr<IStorageController> ctl; … … 899 899 CHECK_ERROR (ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci)); 900 900 } 901 else if (!strcmp( pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))901 else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable")) 902 902 CHECK_ERROR (machine, RemoveStorageController(Bstr("SATA"))); 903 903 else 904 return errorArgument("Invalid --usb argument '%s'", pValueUnion.psz);904 return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz); 905 905 break; 906 906 } … … 908 908 case MODIFYVM_SCSIPORT: // deprecated 909 909 { 910 if (( pGetState.uIndex < 1) && (pGetState.uIndex > 16))910 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 16)) 911 911 return errorSyntax(USAGE_MODIFYVM, 912 912 "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); 918 918 if (FAILED(rc)) 919 CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), pGetState.uIndex, 0));919 CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0)); 920 920 } 921 921 else 922 922 { 923 923 /* first guess is that it's a UUID */ 924 Bstr uuid( pValueUnion.psz);924 Bstr uuid(ValueUnion.psz); 925 925 ComPtr<IMedium> hardDisk; 926 926 rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); … … 928 928 if (!hardDisk) 929 929 { 930 rc = a->virtualBox->FindHardDisk(Bstr( pValueUnion.psz), hardDisk.asOutParam());930 rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam()); 931 931 if (FAILED(rc)) 932 932 { 933 933 /* open the new hard disk object */ 934 934 CHECK_ERROR (a->virtualBox, 935 OpenHardDisk(Bstr( pValueUnion.psz),935 OpenHardDisk(Bstr(ValueUnion.psz), 936 936 AccessMode_ReadWrite, false, Bstr(""), 937 937 false, Bstr(""), hardDisk.asOutParam())); … … 941 941 { 942 942 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); 944 944 if (FAILED(rc)) 945 945 CHECK_ERROR (machine, 946 946 AttachDevice(Bstr("BusLogic"), 947 pGetState.uIndex, 0,947 GetOptState.uIndex, 0, 948 948 DeviceType_HardDisk, uuid)); 949 949 } … … 958 958 ComPtr<IStorageController> ctl; 959 959 960 if (!RTStrICmp( pValueUnion.psz, "LsiLogic"))960 if (!RTStrICmp(ValueUnion.psz, "LsiLogic")) 961 961 { 962 962 rc = machine->RemoveStorageController(Bstr("BusLogic")); … … 972 972 CHECK_ERROR (ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic)); 973 973 } 974 else if (!RTStrICmp( pValueUnion.psz, "BusLogic"))974 else if (!RTStrICmp(ValueUnion.psz, "BusLogic")) 975 975 { 976 976 rc = machine->RemoveStorageController(Bstr("LsiLogic")); … … 987 987 } 988 988 else 989 return errorArgument("Invalid --scsitype argument '%s'", pValueUnion.psz);989 return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz); 990 990 break; 991 991 } … … 993 993 case MODIFYVM_SCSI: // deprecated 994 994 { 995 if (!strcmp( pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))995 if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable")) 996 996 { 997 997 ComPtr<IStorageController> ctl; … … 1001 1001 CHECK_ERROR (ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic)); 1002 1002 } 1003 else if (!strcmp( pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))1003 else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable")) 1004 1004 { 1005 1005 rc = machine->RemoveStorageController(Bstr("BusLogic")); … … 1016 1016 ASSERT(dvdAttachment); 1017 1017 1018 CHECK_ERROR (dvdAttachment, COMSETTER(Passthrough)(!strcmp( pValueUnion.psz, "on")));1018 CHECK_ERROR (dvdAttachment, COMSETTER(Passthrough)(!strcmp(ValueUnion.psz, "on"))); 1019 1019 break; 1020 1020 } … … 1023 1023 { 1024 1024 ComPtr<IMedium> dvdMedium; 1025 Bstr uuid( pValueUnion.psz);1025 Bstr uuid(ValueUnion.psz); 1026 1026 1027 1027 /* unmount? */ 1028 if (!strcmp( pValueUnion.psz, "none"))1028 if (!strcmp(ValueUnion.psz, "none")) 1029 1029 { 1030 1030 /* nothing to do, NULL object will cause unmount */ 1031 1031 } 1032 1032 /* host drive? */ 1033 else if (!strncmp( pValueUnion.psz, "host:", 5))1033 else if (!strncmp(ValueUnion.psz, "host:", 5)) 1034 1034 { 1035 1035 ComPtr<IHost> host; 1036 1036 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()); 1038 1038 if (!dvdMedium) 1039 1039 { 1040 1040 /* 2nd try: try with the real name, important on Linux+libhal */ 1041 1041 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)))) 1043 1043 { 1044 errorArgument("Invalid host DVD drive name \"%s\"", pValueUnion.psz + 5);1044 errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5); 1045 1045 rc = E_FAIL; 1046 1046 break; … … 1049 1049 if (!dvdMedium) 1050 1050 { 1051 errorArgument("Invalid host DVD drive name \"%s\"", pValueUnion.psz + 5);1051 errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5); 1052 1052 rc = E_FAIL; 1053 1053 break; … … 1062 1062 { 1063 1063 /* 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()); 1065 1065 /* not registered, do that on the fly */ 1066 1066 if (!dvdMedium) 1067 1067 { 1068 1068 Bstr emptyUUID; 1069 CHECK_ERROR (a->virtualBox, OpenDVDImage(Bstr( pValueUnion.psz),1069 CHECK_ERROR (a->virtualBox, OpenDVDImage(Bstr(ValueUnion.psz), 1070 1070 emptyUUID, dvdMedium.asOutParam())); 1071 1071 } … … 1089 1089 case MODIFYVM_FLOPPY: // deprecated 1090 1090 { 1091 Bstr uuid( pValueUnion.psz);1091 Bstr uuid(ValueUnion.psz); 1092 1092 ComPtr<IMedium> floppyMedium; 1093 1093 ComPtr<IMediumAttachment> floppyAttachment; … … 1095 1095 1096 1096 /* disable? */ 1097 if (!strcmp( pValueUnion.psz, "disabled"))1097 if (!strcmp(ValueUnion.psz, "disabled")) 1098 1098 { 1099 1099 /* disable the controller */ … … 1108 1108 1109 1109 /* unmount? */ 1110 if ( !strcmp( pValueUnion.psz, "none")1111 || !strcmp( pValueUnion.psz, "empty")) // deprecated1110 if ( !strcmp(ValueUnion.psz, "none") 1111 || !strcmp(ValueUnion.psz, "empty")) // deprecated 1112 1112 { 1113 1113 /* nothing to do, NULL object will cause unmount */ 1114 1114 } 1115 1115 /* host drive? */ 1116 else if (!strncmp( pValueUnion.psz, "host:", 5))1116 else if (!strncmp(ValueUnion.psz, "host:", 5)) 1117 1117 { 1118 1118 ComPtr<IHost> host; 1119 1119 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()); 1121 1121 if (!floppyMedium) 1122 1122 { 1123 errorArgument("Invalid host floppy drive name \"%s\"", pValueUnion.psz + 5);1123 errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5); 1124 1124 rc = E_FAIL; 1125 1125 break; … … 1133 1133 { 1134 1134 /* 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()); 1136 1136 /* not registered, do that on the fly */ 1137 1137 if (!floppyMedium) … … 1139 1139 Bstr emptyUUID; 1140 1140 CHECK_ERROR (a->virtualBox, 1141 OpenFloppyImage(Bstr( pValueUnion.psz),1141 OpenFloppyImage(Bstr(ValueUnion.psz), 1142 1142 emptyUUID, 1143 1143 floppyMedium.asOutParam())); … … 1160 1160 ComPtr<INetworkAdapter> nic; 1161 1161 1162 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1162 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1163 1163 return errorSyntax(USAGE_MODIFYVM, 1164 1164 "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())); 1168 1168 ASSERT(nic); 1169 1169 1170 CHECK_ERROR (nic, COMSETTER(TraceFile)(Bstr( pValueUnion.psz)));1170 CHECK_ERROR (nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz))); 1171 1171 break; 1172 1172 } … … 1176 1176 ComPtr<INetworkAdapter> nic; 1177 1177 1178 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1178 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1179 1179 return errorSyntax(USAGE_MODIFYVM, 1180 1180 "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())); 1184 1184 ASSERT(nic); 1185 1185 1186 if (!strcmp( pValueUnion.psz, "on"))1186 if (!strcmp(ValueUnion.psz, "on")) 1187 1187 { 1188 1188 CHECK_ERROR (nic, COMSETTER(TraceEnabled)(TRUE)); 1189 1189 } 1190 else if (!strcmp( pValueUnion.psz, "off"))1190 else if (!strcmp(ValueUnion.psz, "off")) 1191 1191 { 1192 1192 CHECK_ERROR (nic, COMSETTER(TraceEnabled)(FALSE)); … … 1194 1194 else 1195 1195 { 1196 errorArgument("Invalid --nictrace%lu argument '%s'", pGetState.uIndex, pValueUnion.psz);1196 errorArgument("Invalid --nictrace%lu argument '%s'", GetOptState.uIndex, ValueUnion.psz); 1197 1197 rc = E_FAIL; 1198 1198 } … … 1204 1204 ComPtr<INetworkAdapter> nic; 1205 1205 1206 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1206 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1207 1207 return errorSyntax(USAGE_MODIFYVM, 1208 1208 "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())); 1212 1212 ASSERT(nic); 1213 1213 1214 if (!strcmp( pValueUnion.psz, "Am79C970A"))1214 if (!strcmp(ValueUnion.psz, "Am79C970A")) 1215 1215 { 1216 1216 CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A)); 1217 1217 } 1218 else if (!strcmp( pValueUnion.psz, "Am79C973"))1218 else if (!strcmp(ValueUnion.psz, "Am79C973")) 1219 1219 { 1220 1220 CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973)); 1221 1221 } 1222 1222 #ifdef VBOX_WITH_E1000 1223 else if (!strcmp( pValueUnion.psz, "82540EM"))1223 else if (!strcmp(ValueUnion.psz, "82540EM")) 1224 1224 { 1225 1225 CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM)); 1226 1226 } 1227 else if (!strcmp( pValueUnion.psz, "82543GC"))1227 else if (!strcmp(ValueUnion.psz, "82543GC")) 1228 1228 { 1229 1229 CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC)); 1230 1230 } 1231 else if (!strcmp( pValueUnion.psz, "82545EM"))1231 else if (!strcmp(ValueUnion.psz, "82545EM")) 1232 1232 { 1233 1233 CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM)); … … 1235 1235 #endif 1236 1236 #ifdef VBOX_WITH_VIRTIO 1237 else if (!strcmp( pValueUnion.psz, "virtio"))1237 else if (!strcmp(ValueUnion.psz, "virtio")) 1238 1238 { 1239 1239 CHECK_ERROR (nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio)); … … 1242 1242 else 1243 1243 { 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); 1245 1245 rc = E_FAIL; 1246 1246 } … … 1252 1252 ComPtr<INetworkAdapter> nic; 1253 1253 1254 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1254 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1255 1255 return errorSyntax(USAGE_MODIFYVM, 1256 1256 "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); 1262 1262 rc = E_FAIL; 1263 1263 break; 1264 1264 } 1265 1265 1266 CHECK_ERROR_BREAK (machine, GetNetworkAdapter ( pGetState.uIndex - 1, nic.asOutParam()));1266 CHECK_ERROR_BREAK (machine, GetNetworkAdapter (GetOptState.uIndex - 1, nic.asOutParam())); 1267 1267 ASSERT(nic); 1268 1268 1269 CHECK_ERROR (nic, COMSETTER(LineSpeed)( pValueUnion.u32));1269 CHECK_ERROR (nic, COMSETTER(LineSpeed)(ValueUnion.u32)); 1270 1270 break; 1271 1271 } … … 1275 1275 ComPtr<INetworkAdapter> nic; 1276 1276 1277 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1277 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1278 1278 return errorSyntax(USAGE_MODIFYVM, 1279 1279 "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())); 1283 1283 ASSERT(nic); 1284 1284 1285 if (!strcmp( pValueUnion.psz, "none"))1285 if (!strcmp(ValueUnion.psz, "none")) 1286 1286 { 1287 1287 CHECK_ERROR (nic, COMSETTER(Enabled) (FALSE)); 1288 1288 } 1289 else if (!strcmp( pValueUnion.psz, "null"))1289 else if (!strcmp(ValueUnion.psz, "null")) 1290 1290 { 1291 1291 CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE)); 1292 1292 CHECK_ERROR (nic, Detach()); 1293 1293 } 1294 else if (!strcmp( pValueUnion.psz, "nat"))1294 else if (!strcmp(ValueUnion.psz, "nat")) 1295 1295 { 1296 1296 CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE)); 1297 1297 CHECK_ERROR (nic, AttachToNAT()); 1298 1298 } 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 */ 1301 1301 { 1302 1302 CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE)); 1303 1303 CHECK_ERROR (nic, AttachToBridgedInterface()); 1304 1304 } 1305 else if (!strcmp( pValueUnion.psz, "intnet"))1305 else if (!strcmp(ValueUnion.psz, "intnet")) 1306 1306 { 1307 1307 CHECK_ERROR (nic, COMSETTER(Enabled) (TRUE)); … … 1309 1309 } 1310 1310 #if defined(VBOX_WITH_NETFLT) 1311 else if (!strcmp( pValueUnion.psz, "hostonly"))1311 else if (!strcmp(ValueUnion.psz, "hostonly")) 1312 1312 { 1313 1313 … … 1318 1318 else 1319 1319 { 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); 1321 1321 rc = E_FAIL; 1322 1322 } … … 1328 1328 ComPtr<INetworkAdapter> nic; 1329 1329 1330 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1330 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1331 1331 return errorSyntax(USAGE_MODIFYVM, 1332 1332 "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())); 1336 1336 ASSERT(nic); 1337 1337 1338 if (!strcmp( pValueUnion.psz, "on"))1338 if (!strcmp(ValueUnion.psz, "on")) 1339 1339 { 1340 1340 CHECK_ERROR (nic, COMSETTER(CableConnected)(TRUE)); 1341 1341 } 1342 else if (!strcmp( pValueUnion.psz, "off"))1342 else if (!strcmp(ValueUnion.psz, "off")) 1343 1343 { 1344 1344 CHECK_ERROR (nic, COMSETTER(CableConnected)(FALSE)); … … 1346 1346 else 1347 1347 { 1348 errorArgument("Invalid --cableconnected%lu argument '%s'", pGetState.uIndex, pValueUnion.psz);1348 errorArgument("Invalid --cableconnected%lu argument '%s'", GetOptState.uIndex, ValueUnion.psz); 1349 1349 rc = E_FAIL; 1350 1350 } … … 1357 1357 ComPtr<INetworkAdapter> nic; 1358 1358 1359 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1359 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1360 1360 return errorSyntax(USAGE_MODIFYVM, 1361 1361 "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())); 1365 1365 ASSERT(nic); 1366 1366 1367 1367 /* remove it? */ 1368 if (!strcmp( pValueUnion.psz, "none"))1368 if (!strcmp(ValueUnion.psz, "none")) 1369 1369 { 1370 1370 CHECK_ERROR (nic, COMSETTER(HostInterface)(NULL)); … … 1372 1372 else 1373 1373 { 1374 CHECK_ERROR (nic, COMSETTER(HostInterface)(Bstr( pValueUnion.psz)));1374 CHECK_ERROR (nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz))); 1375 1375 } 1376 1376 break; … … 1381 1381 ComPtr<INetworkAdapter> nic; 1382 1382 1383 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1383 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1384 1384 return errorSyntax(USAGE_MODIFYVM, 1385 1385 "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())); 1389 1389 ASSERT(nic); 1390 1390 1391 1391 /* remove it? */ 1392 if (!strcmp( pValueUnion.psz, "none"))1392 if (!strcmp(ValueUnion.psz, "none")) 1393 1393 { 1394 1394 CHECK_ERROR (nic, COMSETTER(InternalNetwork)(NULL)); … … 1396 1396 else 1397 1397 { 1398 CHECK_ERROR (nic, COMSETTER(InternalNetwork)(Bstr( pValueUnion.psz)));1398 CHECK_ERROR (nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz))); 1399 1399 } 1400 1400 break; … … 1405 1405 ComPtr<INetworkAdapter> nic; 1406 1406 1407 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1407 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1408 1408 return errorSyntax(USAGE_MODIFYVM, 1409 1409 "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())); 1413 1413 ASSERT(nic); 1414 1414 1415 CHECK_ERROR (nic, COMSETTER(NATNetwork)(Bstr( pValueUnion.psz)));1415 CHECK_ERROR (nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz))); 1416 1416 1417 1417 break; … … 1422 1422 ComPtr<INetworkAdapter> nic; 1423 1423 1424 if (( pGetState.uIndex < 1) && (pGetState.uIndex > NetworkAdapterCount))1424 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount)) 1425 1425 return errorSyntax(USAGE_MODIFYVM, 1426 1426 "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())); 1430 1430 ASSERT(nic); 1431 1431 1432 1432 /* generate one? */ 1433 if (!strcmp( pValueUnion.psz, "auto"))1433 if (!strcmp(ValueUnion.psz, "auto")) 1434 1434 { 1435 1435 CHECK_ERROR (nic, COMSETTER(MACAddress)(NULL)); … … 1437 1437 else 1438 1438 { 1439 CHECK_ERROR (nic, COMSETTER(MACAddress)(Bstr( pValueUnion.psz)));1439 CHECK_ERROR (nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz))); 1440 1440 } 1441 1441 break; … … 1447 1447 char *pszIRQ = NULL; 1448 1448 1449 if (( pGetState.uIndex < 1) && (pGetState.uIndex > SerialPortCount))1449 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount)) 1450 1450 return errorSyntax(USAGE_MODIFYVM, 1451 1451 "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())); 1455 1455 ASSERT(uart); 1456 1456 1457 if (!strcmp( pValueUnion.psz, "disconnected"))1457 if (!strcmp(ValueUnion.psz, "disconnected")) 1458 1458 { 1459 1459 CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_Disconnected)); 1460 1460 } 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)) 1476 1469 return errorSyntax(USAGE_MODIFYVM, 1477 1470 "Missing or Invalid argument to '%s'", 1478 pGetState.pDef->pszLong);1479 1480 CHECK_ERROR (uart, COMSETTER(Path) (Bstr( pszIRQ)));1481 1482 if (!strcmp(p ValueUnion.psz, "server"))1471 GetOptState.pDef->pszLong); 1472 1473 CHECK_ERROR (uart, COMSETTER(Path) (Bstr(ValueUnion.psz))); 1474 1475 if (!strcmp(pszMode, "server")) 1483 1476 { 1484 1477 CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_HostPipe)); 1485 1478 CHECK_ERROR (uart, COMSETTER(Server) (TRUE)); 1486 1479 } 1487 else if (!strcmp(p ValueUnion.psz, "client"))1480 else if (!strcmp(pszMode, "client")) 1488 1481 { 1489 1482 CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_HostPipe)); 1490 1483 CHECK_ERROR (uart, COMSETTER(Server) (FALSE)); 1491 1484 } 1492 else if (!strcmp(p ValueUnion.psz, "file"))1485 else if (!strcmp(pszMode, "file")) 1493 1486 { 1494 1487 CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_RawFile)); … … 1497 1490 else 1498 1491 { 1499 CHECK_ERROR (uart, COMSETTER(Path) (Bstr( pValueUnion.psz)));1492 CHECK_ERROR (uart, COMSETTER(Path) (Bstr(ValueUnion.psz))); 1500 1493 CHECK_ERROR (uart, COMSETTER(HostMode) (PortMode_HostDevice)); 1501 1494 } … … 1507 1500 ComPtr<ISerialPort> uart; 1508 1501 1509 if (( pGetState.uIndex < 1) && (pGetState.uIndex > SerialPortCount))1502 if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount)) 1510 1503 return errorSyntax(USAGE_MODIFYVM, 1511 1504 "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())); 1515 1508 ASSERT(uart); 1516 1509 1517 if (!strcmp( pValueUnion.psz, "off") || !strcmp(pValueUnion.psz, "disable"))1510 if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable")) 1518 1511 CHECK_ERROR (uart, COMSETTER(Enabled) (FALSE)); 1519 1512 else 1520 1513 { 1521 c har *pszIRQ = NULL;1514 const char *pszIOBase = ValueUnion.psz; 1522 1515 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)) 1534 1519 return errorSyntax(USAGE_MODIFYVM, 1535 1520 "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); 1539 1526 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); 1547 1528 CHECK_ERROR (uart, COMSETTER(IOBase) (uVal)); 1548 1529 … … 1554 1535 case MODIFYVM_GUESTSTATISTICSINTERVAL: 1555 1536 { 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)); 1558 1539 break; 1559 1540 } … … 1562 1543 case MODIFYVM_GUESTMEMORYBALLOON: 1563 1544 { 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)); 1566 1547 break; 1567 1548 } … … 1570 1551 case MODIFYVM_AUDIOCONTROLLER: 1571 1552 { 1572 if ( pValueUnion.psz)1553 if (ValueUnion.psz) 1573 1554 { 1574 1555 ComPtr<IAudioAdapter> audioAdapter; … … 1576 1557 ASSERT(audioAdapter); 1577 1558 1578 if (!strcmp( pValueUnion.psz, "sb16"))1559 if (!strcmp(ValueUnion.psz, "sb16")) 1579 1560 CHECK_ERROR (audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16)); 1580 else if (!strcmp( pValueUnion.psz, "ac97"))1561 else if (!strcmp(ValueUnion.psz, "ac97")) 1581 1562 CHECK_ERROR (audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97)); 1582 1563 else 1583 1564 { 1584 errorArgument("Invalid --audiocontroller argument '%s'", pValueUnion.psz);1565 errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz); 1585 1566 rc = E_FAIL; 1586 1567 } … … 1591 1572 case MODIFYVM_AUDIO: 1592 1573 { 1593 if ( pValueUnion.psz)1574 if (ValueUnion.psz) 1594 1575 { 1595 1576 ComPtr<IAudioAdapter> audioAdapter; … … 1598 1579 1599 1580 /* disable? */ 1600 if (!strcmp( pValueUnion.psz, "none"))1581 if (!strcmp(ValueUnion.psz, "none")) 1601 1582 { 1602 1583 CHECK_ERROR (audioAdapter, COMSETTER(Enabled)(false)); 1603 1584 } 1604 else if (!strcmp( pValueUnion.psz, "null"))1585 else if (!strcmp(ValueUnion.psz, "null")) 1605 1586 { 1606 1587 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null)); … … 1609 1590 #ifdef RT_OS_WINDOWS 1610 1591 #ifdef VBOX_WITH_WINMM 1611 else if (!strcmp( pValueUnion.psz, "winmm"))1592 else if (!strcmp(ValueUnion.psz, "winmm")) 1612 1593 { 1613 1594 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM)); … … 1615 1596 } 1616 1597 #endif 1617 else if (!strcmp( pValueUnion.psz, "dsound"))1598 else if (!strcmp(ValueUnion.psz, "dsound")) 1618 1599 { 1619 1600 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound)); … … 1622 1603 #endif /* RT_OS_WINDOWS */ 1623 1604 #ifdef RT_OS_LINUX 1624 else if (!strcmp( pValueUnion.psz, "oss"))1605 else if (!strcmp(ValueUnion.psz, "oss")) 1625 1606 { 1626 1607 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS)); … … 1628 1609 } 1629 1610 # ifdef VBOX_WITH_ALSA 1630 else if (!strcmp( pValueUnion.psz, "alsa"))1611 else if (!strcmp(ValueUnion.psz, "alsa")) 1631 1612 { 1632 1613 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA)); … … 1635 1616 # endif 1636 1617 # ifdef VBOX_WITH_PULSE 1637 else if (!strcmp( pValueUnion.psz, "pulse"))1618 else if (!strcmp(ValueUnion.psz, "pulse")) 1638 1619 { 1639 1620 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse)); … … 1643 1624 #endif /* !RT_OS_LINUX */ 1644 1625 #ifdef RT_OS_SOLARIS 1645 else if (!strcmp( pValueUnion.psz, "solaudio"))1626 else if (!strcmp(ValueUnion.psz, "solaudio")) 1646 1627 { 1647 1628 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio)); … … 1650 1631 1651 1632 # ifdef VBOX_WITH_SOLARIS_OSS 1652 else if (!strcmp( pValueUnion.psz, "oss"))1633 else if (!strcmp(ValueUnion.psz, "oss")) 1653 1634 { 1654 1635 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS)); … … 1659 1640 #endif /* !RT_OS_SOLARIS */ 1660 1641 #ifdef RT_OS_DARWIN 1661 else if (!strcmp( pValueUnion.psz, "coreaudio"))1642 else if (!strcmp(ValueUnion.psz, "coreaudio")) 1662 1643 { 1663 1644 CHECK_ERROR (audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio)); … … 1668 1649 else 1669 1650 { 1670 errorArgument("Invalid --audio argument '%s'", pValueUnion.psz);1651 errorArgument("Invalid --audio argument '%s'", ValueUnion.psz); 1671 1652 rc = E_FAIL; 1672 1653 } … … 1677 1658 case MODIFYVM_CLIPBOARD: 1678 1659 { 1679 if ( pValueUnion.psz)1680 { 1681 if (!strcmp( pValueUnion.psz, "disabled"))1660 if (ValueUnion.psz) 1661 { 1662 if (!strcmp(ValueUnion.psz, "disabled")) 1682 1663 { 1683 1664 CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled)); 1684 1665 } 1685 else if (!strcmp( pValueUnion.psz, "hosttoguest"))1666 else if (!strcmp(ValueUnion.psz, "hosttoguest")) 1686 1667 { 1687 1668 CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest)); 1688 1669 } 1689 else if (!strcmp( pValueUnion.psz, "guesttohost"))1670 else if (!strcmp(ValueUnion.psz, "guesttohost")) 1690 1671 { 1691 1672 CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost)); 1692 1673 } 1693 else if (!strcmp( pValueUnion.psz, "bidirectional"))1674 else if (!strcmp(ValueUnion.psz, "bidirectional")) 1694 1675 { 1695 1676 CHECK_ERROR (machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional)); … … 1697 1678 else 1698 1679 { 1699 errorArgument("Invalid --clipboard argument '%s'", pValueUnion.psz);1680 errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz); 1700 1681 rc = E_FAIL; 1701 1682 } … … 1707 1688 case MODIFYVM_VRDPPORT: 1708 1689 { 1709 if ( pValueUnion.psz)1690 if (ValueUnion.psz) 1710 1691 { 1711 1692 ComPtr<IVRDPServer> vrdpServer; … … 1713 1694 ASSERT(vrdpServer); 1714 1695 1715 if (!strcmp( pValueUnion.psz, "default"))1696 if (!strcmp(ValueUnion.psz, "default")) 1716 1697 CHECK_ERROR (vrdpServer, COMSETTER(Ports)(Bstr("0"))); 1717 1698 else 1718 CHECK_ERROR (vrdpServer, COMSETTER(Ports)(Bstr( pValueUnion.psz)));1699 CHECK_ERROR (vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz))); 1719 1700 } 1720 1701 break; … … 1723 1704 case MODIFYVM_VRDPADDRESS: 1724 1705 { 1725 if ( pValueUnion.psz)1706 if (ValueUnion.psz) 1726 1707 { 1727 1708 ComPtr<IVRDPServer> vrdpServer; … … 1729 1710 ASSERT(vrdpServer); 1730 1711 1731 CHECK_ERROR (vrdpServer, COMSETTER(NetAddress)(Bstr( pValueUnion.psz)));1712 CHECK_ERROR (vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz))); 1732 1713 } 1733 1714 break; … … 1736 1717 case MODIFYVM_VRDPAUTHTYPE: 1737 1718 { 1738 if ( pValueUnion.psz)1719 if (ValueUnion.psz) 1739 1720 { 1740 1721 ComPtr<IVRDPServer> vrdpServer; … … 1742 1723 ASSERT(vrdpServer); 1743 1724 1744 if (!strcmp( pValueUnion.psz, "null"))1725 if (!strcmp(ValueUnion.psz, "null")) 1745 1726 { 1746 1727 CHECK_ERROR (vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null)); 1747 1728 } 1748 else if (!strcmp( pValueUnion.psz, "external"))1729 else if (!strcmp(ValueUnion.psz, "external")) 1749 1730 { 1750 1731 CHECK_ERROR (vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External)); 1751 1732 } 1752 else if (!strcmp( pValueUnion.psz, "guest"))1733 else if (!strcmp(ValueUnion.psz, "guest")) 1753 1734 { 1754 1735 CHECK_ERROR (vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest)); … … 1756 1737 else 1757 1738 { 1758 errorArgument("Invalid --vrdpauthtype argument '%s'", pValueUnion.psz);1739 errorArgument("Invalid --vrdpauthtype argument '%s'", ValueUnion.psz); 1759 1740 rc = E_FAIL; 1760 1741 } … … 1765 1746 case MODIFYVM_VRDPMULTICON: 1766 1747 { 1767 if ( pValueUnion.psz)1748 if (ValueUnion.psz) 1768 1749 { 1769 1750 ComPtr<IVRDPServer> vrdpServer; … … 1771 1752 ASSERT(vrdpServer); 1772 1753 1773 if (!strcmp( pValueUnion.psz, "on"))1754 if (!strcmp(ValueUnion.psz, "on")) 1774 1755 { 1775 1756 CHECK_ERROR (vrdpServer, COMSETTER(AllowMultiConnection)(true)); 1776 1757 } 1777 else if (!strcmp( pValueUnion.psz, "off"))1758 else if (!strcmp(ValueUnion.psz, "off")) 1778 1759 { 1779 1760 CHECK_ERROR (vrdpServer, COMSETTER(AllowMultiConnection)(false)); … … 1781 1762 else 1782 1763 { 1783 errorArgument("Invalid --vrdpmulticon argument '%s'", pValueUnion.psz);1764 errorArgument("Invalid --vrdpmulticon argument '%s'", ValueUnion.psz); 1784 1765 rc = E_FAIL; 1785 1766 } … … 1790 1771 case MODIFYVM_VRDPREUSECON: 1791 1772 { 1792 if ( pValueUnion.psz)1773 if (ValueUnion.psz) 1793 1774 { 1794 1775 ComPtr<IVRDPServer> vrdpServer; … … 1796 1777 ASSERT(vrdpServer); 1797 1778 1798 if (!strcmp( pValueUnion.psz, "on"))1779 if (!strcmp(ValueUnion.psz, "on")) 1799 1780 { 1800 1781 CHECK_ERROR (vrdpServer, COMSETTER(ReuseSingleConnection)(true)); 1801 1782 } 1802 else if (!strcmp( pValueUnion.psz, "off"))1783 else if (!strcmp(ValueUnion.psz, "off")) 1803 1784 { 1804 1785 CHECK_ERROR (vrdpServer, COMSETTER(ReuseSingleConnection)(false)); … … 1806 1787 else 1807 1788 { 1808 errorArgument("Invalid --vrdpreusecon argument '%s'", pValueUnion.psz);1789 errorArgument("Invalid --vrdpreusecon argument '%s'", ValueUnion.psz); 1809 1790 rc = E_FAIL; 1810 1791 } … … 1815 1796 case MODIFYVM_VRDP: 1816 1797 { 1817 if ( pValueUnion.psz)1798 if (ValueUnion.psz) 1818 1799 { 1819 1800 ComPtr<IVRDPServer> vrdpServer; … … 1821 1802 ASSERT(vrdpServer); 1822 1803 1823 if (!strcmp( pValueUnion.psz, "on"))1804 if (!strcmp(ValueUnion.psz, "on")) 1824 1805 { 1825 1806 CHECK_ERROR (vrdpServer, COMSETTER(Enabled)(true)); 1826 1807 } 1827 else if (!strcmp( pValueUnion.psz, "off"))1808 else if (!strcmp(ValueUnion.psz, "off")) 1828 1809 { 1829 1810 CHECK_ERROR (vrdpServer, COMSETTER(Enabled)(false)); … … 1831 1812 else 1832 1813 { 1833 errorArgument("Invalid --vrdp argument '%s'", pValueUnion.psz);1814 errorArgument("Invalid --vrdp argument '%s'", ValueUnion.psz); 1834 1815 rc = E_FAIL; 1835 1816 } … … 1841 1822 case MODIFYVM_USBEHCI: 1842 1823 { 1843 if ( pValueUnion.psz)1824 if (ValueUnion.psz) 1844 1825 { 1845 1826 ComPtr<IUSBController> UsbCtl; … … 1847 1828 if (SUCCEEDED(rc)) 1848 1829 { 1849 if (!strcmp( pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))1830 if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable")) 1850 1831 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")) 1852 1833 CHECK_ERROR (UsbCtl, COMSETTER(EnabledEhci)(false)); 1853 1834 else 1854 return errorArgument("Invalid --usbehci argument '%s'", pValueUnion.psz);1835 return errorArgument("Invalid --usbehci argument '%s'", ValueUnion.psz); 1855 1836 } 1856 1837 } … … 1860 1841 case MODIFYVM_USB: 1861 1842 { 1862 if ( pValueUnion.psz)1843 if (ValueUnion.psz) 1863 1844 { 1864 1845 ComPtr<IUSBController> UsbCtl; … … 1866 1847 if (SUCCEEDED(rc)) 1867 1848 { 1868 if (!strcmp( pValueUnion.psz, "on") || !strcmp(pValueUnion.psz, "enable"))1849 if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable")) 1869 1850 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")) 1871 1852 CHECK_ERROR (UsbCtl, COMSETTER(Enabled)(false)); 1872 1853 else 1873 return errorArgument("Invalid --usb argument '%s'", pValueUnion.psz);1854 return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz); 1874 1855 } 1875 1856 } … … 1879 1860 case MODIFYVM_SNAPSHOTFOLDER: 1880 1861 { 1881 if ( pValueUnion.psz)1882 { 1883 if (!strcmp( pValueUnion.psz, "default"))1862 if (ValueUnion.psz) 1863 { 1864 if (!strcmp(ValueUnion.psz, "default")) 1884 1865 CHECK_ERROR (machine, COMSETTER(SnapshotFolder)(NULL)); 1885 1866 else 1886 CHECK_ERROR (machine, COMSETTER(SnapshotFolder)(Bstr( pValueUnion.psz)));1867 CHECK_ERROR (machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz))); 1887 1868 } 1888 1869 break; … … 1891 1872 case MODIFYVM_TELEPORTER_ENABLED: 1892 1873 { 1893 if ( pValueUnion.psz)1894 { 1895 if (!strcmp( pValueUnion.psz, "on"))1874 if (ValueUnion.psz) 1875 { 1876 if (!strcmp(ValueUnion.psz, "on")) 1896 1877 CHECK_ERROR (machine, COMSETTER(TeleporterEnabled)(1)); 1897 else if (!strcmp( pValueUnion.psz, "off"))1878 else if (!strcmp(ValueUnion.psz, "off")) 1898 1879 CHECK_ERROR (machine, COMSETTER(TeleporterEnabled)(0)); 1899 1880 else 1900 return errorArgument("Invalid --teleporterenabled value '%s'", pValueUnion.psz);1881 return errorArgument("Invalid --teleporterenabled value '%s'", ValueUnion.psz); 1901 1882 } 1902 1883 break; … … 1905 1886 case MODIFYVM_TELEPORTER_PORT: 1906 1887 { 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)); 1909 1890 break; 1910 1891 } … … 1912 1893 case MODIFYVM_TELEPORTER_ADDRESS: 1913 1894 { 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))); 1916 1897 break; 1917 1898 } … … 1919 1900 case MODIFYVM_TELEPORTER_PASSWORD: 1920 1901 { 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))); 1923 1904 break; 1924 1905 } … … 1926 1907 default: 1927 1908 { 1928 errorGetOpt(USAGE_MODIFYVM, c, & pValueUnion);1909 errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion); 1929 1910 rc = E_FAIL; 1930 1911 break;
Note:
See TracChangeset
for help on using the changeset viewer.