Changeset 32718 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Sep 23, 2010 12:57:52 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 66148
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r32709 r32718 256 256 static HRESULT NewUniqueKey(ComPtr<IMachine> pMachine, const char *pszKeyBase, Utf8Str &rKey) 257 257 { 258 Bstr KeyBase(pszKeyBase); 258 259 Bstr Keys; 259 HRESULT hrc = pMachine->GetExtraData( Bstr(pszKeyBase), Keys.asOutParam());260 HRESULT hrc = pMachine->GetExtraData(KeyBase.raw(), Keys.asOutParam()); 260 261 if (FAILED(hrc)) 261 262 return hrc; … … 265 266 { 266 267 rKey = "1"; 267 return pMachine->SetExtraData( Bstr(pszKeyBase), Bstr("1"));268 return pMachine->SetExtraData(KeyBase.raw(), Bstr(rKey).raw()); 268 269 } 269 270 … … 290 291 rKey = szKey; 291 292 Utf8StrFmt NewKeysUtf8("%s %s", pszKeys, szKey); 292 return pMachine->SetExtraData(Bstr(pszKeyBase), Bstr(NewKeysUtf8)); 293 return pMachine->SetExtraData(KeyBase.raw(), 294 Bstr(NewKeysUtf8).raw()); 293 295 } 294 296 } … … 376 378 static HRESULT SetString(ComPtr<IMachine> pMachine, const char *pszKeyBase, const char *pszKey, const char *pszAttribute, const char *pszValue) 377 379 { 378 HRESULT hrc = pMachine->SetExtraData(Bstr(Utf8StrFmt("%s/%s/%s", pszKeyBase, pszKey, pszAttribute)), Bstr(pszValue)); 380 HRESULT hrc = pMachine->SetExtraData(BstrFmt("%s/%s/%s", pszKeyBase, 381 pszKey, pszAttribute).raw(), 382 Bstr(pszValue).raw()); 379 383 if (FAILED(hrc)) 380 384 RTMsgError("Failed to set '%s/%s/%s' to '%s'! hrc=%#x", … … 432 436 ComPtr<IMachine> machine; 433 437 /* assume it's a UUID */ 434 rc = aVirtualBox->GetMachine(Bstr(argv[0]) , machine.asOutParam());438 rc = aVirtualBox->GetMachine(Bstr(argv[0]).raw(), machine.asOutParam()); 435 439 if (FAILED(rc) || !machine) 436 440 { 437 441 /* must be a name */ 438 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]), machine.asOutParam()), 1); 442 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(), 443 machine.asOutParam()), 1); 439 444 } 440 445 … … 1473 1478 { 1474 1479 ComPtr<IMedium> hardDisk; 1475 CHECK_ERROR(aVirtualBox, OpenMedium(Bstr(filename), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam())); 1480 CHECK_ERROR(aVirtualBox, OpenMedium(Bstr(filename).raw(), 1481 DeviceType_HardDisk, 1482 AccessMode_ReadWrite, 1483 hardDisk.asOutParam())); 1476 1484 } 1477 1485 … … 1890 1898 1891 1899 ComPtr<IMachine> ptrMachine; 1892 HRESULT rc = aVirtualBox->GetMachine(Bstr(argv[0]), ptrMachine.asOutParam()); 1900 HRESULT rc = aVirtualBox->GetMachine(Bstr(argv[0]).raw(), 1901 ptrMachine.asOutParam()); 1893 1902 if (FAILED(rc) || ptrMachine.isNull()) 1894 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]), ptrMachine.asOutParam()), 1); 1903 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(), 1904 ptrMachine.asOutParam()), 1); 1895 1905 1896 1906 CHECK_ERROR_RET(ptrMachine, LockMachine(aSession, LockType_Shared), 1); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r32701 r32718 78 78 if (!Guid(machineuuid).isEmpty()) 79 79 { 80 CHECK_ERROR(a->virtualBox, GetMachine(machineuuid, machine.asOutParam())); 80 CHECK_ERROR(a->virtualBox, GetMachine(machineuuid.raw(), 81 machine.asOutParam())); 81 82 } 82 83 else 83 84 { 84 CHECK_ERROR(a->virtualBox, FindMachine(machineuuid, machine.asOutParam())); 85 CHECK_ERROR(a->virtualBox, FindMachine(machineuuid.raw(), 86 machine.asOutParam())); 85 87 if (SUCCEEDED (rc)) 86 88 machine->COMGETTER(Id)(machineuuid.asOutParam()); … … 329 331 if (a->argv[2]) 330 332 { 331 CHECK_ERROR_RET(adapter, COMSETTER(TraceFile)(Bstr(a->argv[2]) ), 1);333 CHECK_ERROR_RET(adapter, COMSETTER(TraceFile)(Bstr(a->argv[2]).raw()), 1); 332 334 } 333 335 else … … 430 432 CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1); 431 433 if (a->argc == 4) 432 CHECK_ERROR_RET(adapter, COMSETTER(NATNetwork)(Bstr(a->argv[3]) ), 1);434 CHECK_ERROR_RET(adapter, COMSETTER(NATNetwork)(Bstr(a->argv[3]).raw()), 1); 433 435 CHECK_ERROR_RET(adapter, AttachToNAT(), 1); 434 436 } … … 443 445 } 444 446 CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1); 445 CHECK_ERROR_RET(adapter, COMSETTER(HostInterface)(Bstr(a->argv[3]) ), 1);447 CHECK_ERROR_RET(adapter, COMSETTER(HostInterface)(Bstr(a->argv[3]).raw()), 1); 446 448 CHECK_ERROR_RET(adapter, AttachToBridgedInterface(), 1); 447 449 } … … 455 457 } 456 458 CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1); 457 CHECK_ERROR_RET(adapter, COMSETTER(InternalNetwork)(Bstr(a->argv[3]) ), 1);459 CHECK_ERROR_RET(adapter, COMSETTER(InternalNetwork)(Bstr(a->argv[3]).raw()), 1); 458 460 CHECK_ERROR_RET(adapter, AttachToInternalNetwork(), 1); 459 461 } … … 468 470 } 469 471 CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1); 470 CHECK_ERROR_RET(adapter, COMSETTER(HostInterface)(Bstr(a->argv[3]) ), 1);472 CHECK_ERROR_RET(adapter, COMSETTER(HostInterface)(Bstr(a->argv[3]).raw()), 1); 471 473 CHECK_ERROR_RET(adapter, AttachToHostOnlyInterface(), 1); 472 474 } … … 534 536 vrdpports = "0"; 535 537 else 536 vrdpports = a->argv 537 538 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Ports)(vrdpports ));538 vrdpports = a->argv[2]; 539 540 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Ports)(vrdpports.raw())); 539 541 } 540 542 } … … 571 573 bool attach = !strcmp(a->argv[1], "usbattach"); 572 574 573 Bstr usbId = a->argv 575 Bstr usbId = a->argv[2]; 574 576 if (Guid(usbId).isEmpty()) 575 577 { … … 582 584 CHECK_ERROR_BREAK(host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll))); 583 585 ComPtr <IHostUSBDevice> dev; 584 CHECK_ERROR_BREAK(host, FindUSBDeviceByAddress(Bstr(a->argv [2]), dev.asOutParam())); 586 CHECK_ERROR_BREAK(host, FindUSBDeviceByAddress(Bstr(a->argv[2]).raw(), 587 dev.asOutParam())); 585 588 CHECK_ERROR_BREAK(dev, COMGETTER(Id)(usbId.asOutParam())); 586 589 } … … 590 593 CHECK_ERROR_BREAK(console, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll))); 591 594 ComPtr <IUSBDevice> dev; 592 CHECK_ERROR_BREAK(console, FindUSBDeviceByAddress(Bstr(a->argv [2]),593 dev.asOutParam()));595 CHECK_ERROR_BREAK(console, FindUSBDeviceByAddress(Bstr(a->argv[2]).raw(), 596 dev.asOutParam())); 594 597 CHECK_ERROR_BREAK(dev, COMGETTER(Id)(usbId.asOutParam())); 595 598 } … … 597 600 598 601 if (attach) 599 CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId ));602 CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId.raw())); 600 603 else 601 604 { 602 605 ComPtr <IUSBDevice> dev; 603 CHECK_ERROR_BREAK(console, DetachUSBDevice(usbId, dev.asOutParam())); 606 CHECK_ERROR_BREAK(console, DetachUSBDevice(usbId.raw(), 607 dev.asOutParam())); 604 608 } 605 609 } … … 647 651 ComPtr<IGuest> guest; 648 652 CHECK_ERROR_BREAK(console, COMGETTER(Guest)(guest.asOutParam())); 649 CHECK_ERROR_BREAK(guest, SetCredentials(Bstr(a->argv[2]), Bstr(a->argv[3]), Bstr(a->argv[4]), fAllowLocalLogon)); 653 CHECK_ERROR_BREAK(guest, SetCredentials(Bstr(a->argv[2]).raw(), 654 Bstr(a->argv[3]).raw(), 655 Bstr(a->argv[4]).raw(), 656 fAllowLocalLogon)); 650 657 } 651 658 #if 0 /* TODO: review & remove */ … … 836 843 837 844 ComPtr<IProgress> progress; 838 CHECK_ERROR_BREAK(console, Teleport(bstrHostname, uPort, bstrPassword, uMaxDowntime, progress.asOutParam())); 845 CHECK_ERROR_BREAK(console, Teleport(bstrHostname.raw(), uPort, 846 bstrPassword.raw(), 847 uMaxDowntime, 848 progress.asOutParam())); 839 849 840 850 if (cMsTimeout) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r32701 r32718 258 258 259 259 /* check the outcome */ 260 if ( !filename260 if ( filename.isEmpty() 261 261 || size == 0) 262 262 return errorSyntax(USAGE_CREATEHD, "Parameters --filename and --size are required"); … … 277 277 278 278 ComPtr<IMedium> hardDisk; 279 CHECK_ERROR(a->virtualBox, CreateHardDisk(format, filename, hardDisk.asOutParam())); 279 CHECK_ERROR(a->virtualBox, CreateHardDisk(format.raw(), filename.raw(), 280 hardDisk.asOutParam())); 280 281 if (SUCCEEDED(rc) && hardDisk) 281 282 { … … 286 287 if (!comment.isEmpty()) 287 288 { 288 CHECK_ERROR(hardDisk,COMSETTER(Description)(comment ));289 CHECK_ERROR(hardDisk,COMSETTER(Description)(comment.raw())); 289 290 } 290 291 … … 416 417 417 418 /* first guess is that it's a UUID */ 418 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid), DeviceType_HardDisk, hardDisk.asOutParam())); 419 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid).raw(), 420 DeviceType_HardDisk, 421 hardDisk.asOutParam())); 419 422 if (FAILED(rc)) 420 423 return 1; … … 447 450 { 448 451 unknown = true; 449 rc = a->virtualBox->OpenMedium(Bstr(FilenameOrUuid), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam()); 452 rc = a->virtualBox->OpenMedium(Bstr(FilenameOrUuid).raw(), 453 DeviceType_HardDisk, 454 AccessMode_ReadWrite, 455 hardDisk.asOutParam()); 450 456 if (rc == VBOX_E_FILE_ERROR) 451 457 { … … 457 463 return 1; 458 464 } 459 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam())); 465 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs).raw(), 466 DeviceType_HardDisk, 467 AccessMode_ReadWrite, 468 hardDisk.asOutParam())); 460 469 } 461 470 } … … 487 496 { 488 497 unknown = true; 489 rc = a->virtualBox->OpenMedium(Bstr(FilenameOrUuid), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam()); 498 rc = a->virtualBox->OpenMedium(Bstr(FilenameOrUuid).raw(), 499 DeviceType_HardDisk, 500 AccessMode_ReadWrite, 501 hardDisk.asOutParam()); 490 502 if (rc == VBOX_E_FILE_ERROR) 491 503 { … … 497 509 return 1; 498 510 } 499 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam())); 511 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs).raw(), 512 DeviceType_HardDisk, 513 AccessMode_ReadWrite, 514 hardDisk.asOutParam())); 500 515 } 501 516 } … … 633 648 bool fDstUnknown = false; 634 649 635 rc = a->virtualBox->FindMedium(src, DeviceType_HardDisk, srcDisk.asOutParam()); 650 rc = a->virtualBox->FindMedium(src.raw(), DeviceType_HardDisk, 651 srcDisk.asOutParam()); 636 652 /* no? well, then it's an unknown image */ 637 653 if (FAILED (rc)) 638 654 { 639 rc = a->virtualBox->OpenMedium(src, DeviceType_HardDisk, AccessMode_ReadWrite, srcDisk.asOutParam()); 655 rc = a->virtualBox->OpenMedium(src.raw(), DeviceType_HardDisk, 656 AccessMode_ReadWrite, 657 srcDisk.asOutParam()); 640 658 if (rc == VBOX_E_FILE_ERROR) 641 659 { … … 647 665 return 1; 648 666 } 649 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs), DeviceType_HardDisk, AccessMode_ReadWrite, srcDisk.asOutParam())); 650 } 651 if (SUCCEEDED (rc)) 667 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs).raw(), 668 DeviceType_HardDisk, 669 AccessMode_ReadWrite, 670 srcDisk.asOutParam())); 671 } 672 if (SUCCEEDED(rc)) 652 673 fSrcUnknown = true; 653 674 } … … 661 682 if (fExisting) 662 683 { 663 rc = a->virtualBox->FindMedium(dst, DeviceType_HardDisk, dstDisk.asOutParam()); 684 rc = a->virtualBox->FindMedium(dst.raw(), DeviceType_HardDisk, 685 dstDisk.asOutParam()); 664 686 /* no? well, then it's an unknown image */ 665 if (FAILED 687 if (FAILED(rc)) 666 688 { 667 rc = a->virtualBox->OpenMedium(dst, DeviceType_HardDisk, AccessMode_ReadWrite, dstDisk.asOutParam()); 689 rc = a->virtualBox->OpenMedium(dst.raw(), DeviceType_HardDisk, 690 AccessMode_ReadWrite, 691 dstDisk.asOutParam()); 668 692 if (rc == VBOX_E_FILE_ERROR) 669 693 { … … 675 699 return 1; 676 700 } 677 CHECK_ERROR_BREAK(a->virtualBox, OpenMedium(Bstr(szFilenameAbs), DeviceType_HardDisk, AccessMode_ReadWrite, dstDisk.asOutParam())); 701 CHECK_ERROR_BREAK(a->virtualBox, OpenMedium(Bstr(szFilenameAbs).raw(), 702 DeviceType_HardDisk, 703 AccessMode_ReadWrite, 704 dstDisk.asOutParam())); 678 705 } 679 if (SUCCEEDED 706 if (SUCCEEDED(rc)) 680 707 fDstUnknown = true; 681 708 } … … 688 715 CHECK_ERROR_BREAK(dstDisk, RefreshState(&state)); 689 716 } 690 CHECK_ERROR_BREAK(dstDisk, COMGETTER(Format) 717 CHECK_ERROR_BREAK(dstDisk, COMGETTER(Format)(format.asOutParam())); 691 718 } 692 719 else … … 694 721 /* use the format of the source hard disk if unspecified */ 695 722 if (format.isEmpty()) 696 CHECK_ERROR_BREAK(srcDisk, COMGETTER(Format) (format.asOutParam())); 697 CHECK_ERROR_BREAK(a->virtualBox, CreateHardDisk(format, dst, dstDisk.asOutParam())); 723 CHECK_ERROR_BREAK(srcDisk, COMGETTER(Format)(format.asOutParam())); 724 CHECK_ERROR_BREAK(a->virtualBox, CreateHardDisk(format.raw(), 725 dst.raw(), 726 dstDisk.asOutParam())); 698 727 } 699 728 … … 895 924 cbRead = 0; 896 925 cbToRead = cbFile - offFile >= (uint64_t)cbBuffer ? 897 cbBuffer : (size_t) 926 cbBuffer : (size_t)(cbFile - offFile); 898 927 rc = RTFileRead(File, pvBuf, cbToRead, &cbRead); 899 928 if (RT_FAILURE(rc) || !cbRead) … … 1024 1053 1025 1054 /* check for required options */ 1026 if ( !server || !target)1055 if (server.isEmpty() || target.isEmpty()) 1027 1056 return errorSyntax(USAGE_ADDISCSIDISK, "Parameters --server and --target are required"); 1028 1057 … … 1036 1065 if (lun.isEmpty() || lun == "0" || lun == "enc0") 1037 1066 { 1038 CHECK_ERROR_BREAK (a->virtualBox, 1039 CreateHardDisk(Bstr ("iSCSI"), 1040 BstrFmt ("%ls|%ls", server.raw(), target.raw()), 1041 hardDisk.asOutParam())); 1067 CHECK_ERROR_BREAK(a->virtualBox, CreateHardDisk(Bstr("iSCSI").raw(), 1068 BstrFmt("%ls|%ls", 1069 server.raw(), 1070 target.raw()).raw(), 1071 hardDisk.asOutParam())); 1042 1072 } 1043 1073 else 1044 1074 { 1045 CHECK_ERROR_BREAK (a->virtualBox, 1046 CreateHardDisk(Bstr ("iSCSI"), 1047 BstrFmt ("%ls|%ls|%ls", server.raw(), target.raw(), lun.raw()), 1048 hardDisk.asOutParam())); 1075 CHECK_ERROR_BREAK(a->virtualBox, CreateHardDisk(Bstr("iSCSI").raw(), 1076 BstrFmt("%ls|%ls|%ls", 1077 server.raw(), 1078 target.raw(), 1079 lun.raw()).raw(), 1080 hardDisk.asOutParam())); 1049 1081 } 1050 1082 if (FAILED(rc)) break; 1051 1083 1052 1084 if (!port.isEmpty()) 1053 server = BstrFmt 1085 server = BstrFmt("%ls:%ls", server.raw(), port.raw()); 1054 1086 1055 1087 com::SafeArray <BSTR> names; 1056 1088 com::SafeArray <BSTR> values; 1057 1089 1058 Bstr ("TargetAddress").detachTo(names.appendedRaw());1059 server.detachTo 1060 Bstr ("TargetName").detachTo(names.appendedRaw());1061 target.detachTo 1090 Bstr("TargetAddress").detachTo(names.appendedRaw()); 1091 server.detachTo(values.appendedRaw()); 1092 Bstr("TargetName").detachTo(names.appendedRaw()); 1093 target.detachTo(values.appendedRaw()); 1062 1094 1063 1095 if (!lun.isEmpty()) 1064 1096 { 1065 Bstr ("LUN").detachTo(names.appendedRaw());1066 lun.detachTo 1097 Bstr("LUN").detachTo(names.appendedRaw()); 1098 lun.detachTo(values.appendedRaw()); 1067 1099 } 1068 1100 if (!username.isEmpty()) 1069 1101 { 1070 Bstr ("InitiatorUsername").detachTo(names.appendedRaw());1071 username.detachTo 1102 Bstr("InitiatorUsername").detachTo(names.appendedRaw()); 1103 username.detachTo(values.appendedRaw()); 1072 1104 } 1073 1105 if (!password.isEmpty()) 1074 1106 { 1075 Bstr ("InitiatorSecret").detachTo(names.appendedRaw());1076 password.detachTo 1107 Bstr("InitiatorSecret").detachTo(names.appendedRaw()); 1108 password.detachTo(values.appendedRaw()); 1077 1109 } 1078 1110 … … 1081 1113 // value does more harm than good, as the initiator name is supposed 1082 1114 // to identify a particular initiator uniquely. 1083 // Bstr ("InitiatorName").detachTo(names.appendedRaw());1084 // Bstr ("iqn.2008-04.com.sun.virtualbox.initiator").detachTo(values.appendedRaw());1115 // Bstr("InitiatorName").detachTo(names.appendedRaw()); 1116 // Bstr("iqn.2008-04.com.sun.virtualbox.initiator").detachTo(values.appendedRaw()); 1085 1117 1086 1118 /// @todo add --targetName and --targetPassword options … … 1088 1120 if (fIntNet) 1089 1121 { 1090 Bstr ("HostIPStack").detachTo (names.appendedRaw()); 1091 Bstr ("0").detachTo (values.appendedRaw()); 1092 } 1093 1094 CHECK_ERROR_BREAK (hardDisk, 1095 SetProperties (ComSafeArrayAsInParam (names), 1096 ComSafeArrayAsInParam (values))); 1122 Bstr("HostIPStack").detachTo(names.appendedRaw()); 1123 Bstr("0").detachTo(values.appendedRaw()); 1124 } 1125 1126 CHECK_ERROR_BREAK(hardDisk, SetProperties(ComSafeArrayAsInParam(names), 1127 ComSafeArrayAsInParam(values))); 1097 1128 1098 1129 if (DiskType != MediumType_Normal) … … 1161 1192 bool unknown = false; 1162 1193 /* first guess is that it's a UUID */ 1163 rc = a->virtualBox->FindMedium(Bstr(FilenameOrUuid), DeviceType_HardDisk, hardDisk.asOutParam()); 1194 rc = a->virtualBox->FindMedium(Bstr(FilenameOrUuid).raw(), 1195 DeviceType_HardDisk, 1196 hardDisk.asOutParam()); 1164 1197 /* no? well, then it's an unkwnown image */ 1165 if (FAILED (rc)) 1166 { 1167 rc = a->virtualBox->OpenMedium(Bstr(FilenameOrUuid), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam()); 1198 if (FAILED(rc)) 1199 { 1200 rc = a->virtualBox->OpenMedium(Bstr(FilenameOrUuid).raw(), 1201 DeviceType_HardDisk, 1202 AccessMode_ReadWrite, 1203 hardDisk.asOutParam()); 1168 1204 if (rc == VBOX_E_FILE_ERROR) 1169 1205 { … … 1175 1211 return 1; 1176 1212 } 1177 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs), DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam())); 1178 } 1179 if (SUCCEEDED (rc)) 1213 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs).raw(), 1214 DeviceType_HardDisk, 1215 AccessMode_ReadWrite, 1216 hardDisk.asOutParam())); 1217 } 1218 if (SUCCEEDED(rc)) 1180 1219 unknown = true; 1181 1220 } … … 1193 1232 /// @todo NEWMEDIA print the full state value 1194 1233 MediumState_T state; 1195 CHECK_ERROR_BREAK 1234 CHECK_ERROR_BREAK(hardDisk, RefreshState(&state)); 1196 1235 RTPrintf("Accessible: %s\n", state != MediumState_Inaccessible ? "yes" : "no"); 1197 1236 … … 1199 1238 { 1200 1239 Bstr err; 1201 CHECK_ERROR_BREAK 1240 CHECK_ERROR_BREAK(hardDisk, COMGETTER(LastAccessError)(err.asOutParam())); 1202 1241 RTPrintf("Access Error: %lS\n", err.raw()); 1203 1242 } … … 1205 1244 Bstr description; 1206 1245 hardDisk->COMGETTER(Description)(description.asOutParam()); 1207 if ( description)1246 if (!description.isEmpty()) 1208 1247 { 1209 1248 RTPrintf("Description: %lS\n", description.raw()); … … 1218 1257 1219 1258 ComPtr <IMedium> parent; 1220 hardDisk->COMGETTER(Parent) 1259 hardDisk->COMGETTER(Parent)(parent.asOutParam()); 1221 1260 1222 1261 MediumType_T type; … … 1402 1441 1403 1442 ComPtr<IMedium> pMedium; 1404 rc = a->virtualBox->OpenMedium(Bstr(Filename), devType, AccessMode_ReadWrite, pMedium.asOutParam()); 1443 rc = a->virtualBox->OpenMedium(Bstr(Filename).raw(), devType, 1444 AccessMode_ReadWrite, pMedium.asOutParam()); 1405 1445 if (rc == VBOX_E_FILE_ERROR) 1406 1446 { … … 1412 1452 return 1; 1413 1453 } 1414 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs), devType, AccessMode_ReadWrite, pMedium.asOutParam())); 1454 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(szFilenameAbs).raw(), 1455 devType, AccessMode_ReadWrite, 1456 pMedium.asOutParam())); 1415 1457 } 1416 1458 if (SUCCEEDED(rc) && pMedium) … … 1433 1475 Bstr ImageIdStr = BstrFmt("%RTuuid", &ImageId); 1434 1476 Bstr ParentIdStr = BstrFmt("%RTuuid", &ParentId); 1435 CHECK_ERROR(pMedium, SetIDs(fSetImageId, ImageIdStr, fSetParentId, ParentIdStr)); 1477 CHECK_ERROR(pMedium, SetIDs(fSetImageId, ImageIdStr.raw(), 1478 fSetParentId, ParentIdStr.raw())); 1436 1479 } 1437 1480 } … … 1525 1568 1526 1569 if (cmd == CMD_DISK) 1527 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid), DeviceType_HardDisk, medium.asOutParam())); 1570 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid).raw(), 1571 DeviceType_HardDisk, 1572 medium.asOutParam())); 1528 1573 else if (cmd == CMD_DVD) 1529 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid), DeviceType_DVD, medium.asOutParam())); 1574 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid).raw(), 1575 DeviceType_DVD, 1576 medium.asOutParam())); 1530 1577 else if (cmd == CMD_FLOPPY) 1531 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid), DeviceType_Floppy, medium.asOutParam())); 1578 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(FilenameOrUuid).raw(), 1579 DeviceType_Floppy, 1580 medium.asOutParam())); 1532 1581 1533 1582 if (SUCCEEDED(rc) && medium) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r32712 r32718 131 131 Utf8Str Utf8Cmd(a->argv[1]); 132 132 uint32_t uFlags = 0; 133 com::SafeArray <BSTR> args;134 com::SafeArray <BSTR> env;133 com::SafeArray<CBSTR> args; 134 com::SafeArray<CBSTR> env; 135 135 Utf8Str Utf8UserName; 136 136 Utf8Str Utf8Password; … … 143 143 144 144 /* Always use the actual command line as argv[0]. */ 145 args.push_back(Bstr(Utf8Cmd) );145 args.push_back(Bstr(Utf8Cmd).raw()); 146 146 147 147 /* Iterate through all possible commands (if available). */ … … 164 164 { 165 165 for (int j = 0; j < cArgs; j++) 166 args.push_back(Bstr(papszArg[j]) );166 args.push_back(Bstr(papszArg[j]).raw()); 167 167 168 168 RTGetOptArgvFree(papszArg); … … 185 185 { 186 186 for (int j = 0; j < cArgs; j++) 187 env.push_back(Bstr(papszArg[j]) );187 env.push_back(Bstr(papszArg[j]).raw()); 188 188 189 189 RTGetOptArgvFree(papszArg); … … 277 277 ComPtr<IMachine> machine; 278 278 /* assume it's an UUID */ 279 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 279 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 280 machine.asOutParam()); 280 281 if (FAILED(rc) || !machine) 281 282 { 282 283 /* must be a name */ 283 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 284 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 285 machine.asOutParam())); 284 286 } 285 287 … … 317 319 318 320 /* Execute the process. */ 319 rc = guest->ExecuteProcess(Bstr(Utf8Cmd), uFlags, 320 ComSafeArrayAsInParam(args), ComSafeArrayAsInParam(env), 321 Bstr(Utf8UserName), Bstr(Utf8Password), u32TimeoutMS, 321 rc = guest->ExecuteProcess(Bstr(Utf8Cmd).raw(), uFlags, 322 ComSafeArrayAsInParam(args), 323 ComSafeArrayAsInParam(env), 324 Bstr(Utf8UserName).raw(), 325 Bstr(Utf8Password).raw(), u32TimeoutMS, 322 326 &uPID, progress.asOutParam()); 323 327 if (FAILED(rc)) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp
r32712 r32718 89 89 ComPtr<IMachine> machine; 90 90 /* assume it's a UUID */ 91 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 91 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 92 machine.asOutParam()); 92 93 if (FAILED(rc) || !machine) 93 94 { 94 95 /* must be a name */ 95 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 96 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 97 machine.asOutParam())); 96 98 } 97 99 if (machine) … … 106 108 LONG64 i64Timestamp; 107 109 Bstr flags; 108 CHECK_ERROR(machine, GetGuestProperty(Bstr(a->argv[1]), value.asOutParam(), 110 CHECK_ERROR(machine, GetGuestProperty(Bstr(a->argv[1]).raw(), 111 value.asOutParam(), 109 112 &i64Timestamp, flags.asOutParam())); 110 if ( !value)113 if (value.isEmpty()) 111 114 RTPrintf("No value set!\n"); 112 if (value)115 else 113 116 RTPrintf("Value: %lS\n", value.raw()); 114 if ( value&& verbose)117 if (!value.isEmpty() && verbose) 115 118 { 116 119 RTPrintf("Timestamp: %lld\n", i64Timestamp); … … 154 157 ComPtr<IMachine> machine; 155 158 /* assume it's a UUID */ 156 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 159 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 160 machine.asOutParam()); 157 161 if (FAILED(rc) || !machine) 158 162 { 159 163 /* must be a name */ 160 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 164 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 165 machine.asOutParam())); 161 166 } 162 167 if (machine) … … 169 174 170 175 if (!pszValue && !pszFlags) 171 CHECK_ERROR(machine, SetGuestPropertyValue(Bstr(pszName), Bstr(""))); 176 CHECK_ERROR(machine, SetGuestPropertyValue(Bstr(pszName).raw(), 177 Bstr().raw())); 172 178 else if (!pszFlags) 173 CHECK_ERROR(machine, SetGuestPropertyValue(Bstr(pszName), Bstr(pszValue))); 179 CHECK_ERROR(machine, SetGuestPropertyValue(Bstr(pszName).raw(), 180 Bstr(pszValue).raw())); 174 181 else 175 CHECK_ERROR(machine, SetGuestProperty(Bstr(pszName), Bstr(pszValue), Bstr(pszFlags))); 182 CHECK_ERROR(machine, SetGuestProperty(Bstr(pszName).raw(), 183 Bstr(pszValue).raw(), 184 Bstr(pszFlags).raw())); 176 185 177 186 if (SUCCEEDED(rc)) … … 214 223 ComPtr<IMachine> machine; 215 224 /* assume it's a UUID */ 216 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 225 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 226 machine.asOutParam()); 217 227 if (FAILED(rc) || !machine) 218 228 { 219 229 /* must be a name */ 220 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 230 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 231 machine.asOutParam())); 221 232 } 222 233 if (machine) … … 232 243 com::SafeArray<LONG64> timestamps; 233 244 com::SafeArray<BSTR> flags; 234 CHECK_ERROR(machine, EnumerateGuestProperties(Bstr(Utf8Patterns) ,245 CHECK_ERROR(machine, EnumerateGuestProperties(Bstr(Utf8Patterns).raw(), 235 246 ComSafeArrayAsOutParam(names), 236 247 ComSafeArrayAsOutParam(values), … … 270 281 ComPtr<IMachine> machine; 271 282 /* assume it's a UUID */ 272 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 283 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 284 machine.asOutParam()); 273 285 if (FAILED(rc) || !machine) 274 286 { 275 287 /* must be a name */ 276 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 288 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 289 machine.asOutParam())); 277 290 } 278 291 if (!machine) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp
r32701 r32718 234 234 235 235 ComPtr<IHostNetworkInterface> hif; 236 CHECK_ERROR(host, FindHostNetworkInterfaceByName(name, hif.asOutParam())); 236 CHECK_ERROR(host, FindHostNetworkInterfaceByName(name.raw(), 237 hif.asOutParam())); 237 238 238 239 if (FAILED(rc)) … … 248 249 pNetmask = "255.255.255.0"; /* ?? */ 249 250 250 CHECK_ERROR(hif, EnableStaticIpConfig(Bstr(pIp), Bstr(pNetmask))); 251 CHECK_ERROR(hif, EnableStaticIpConfig(Bstr(pIp).raw(), 252 Bstr(pNetmask).raw())); 251 253 } 252 254 else if (pIpv6) … … 265 267 266 268 Bstr ipv6str(pIpv6); 267 CHECK_ERROR(hif, EnableStaticIpConfigV6(ipv6str, (ULONG)uNetmasklengthv6)); 269 CHECK_ERROR(hif, EnableStaticIpConfigV6(ipv6str.raw(), 270 (ULONG)uNetmasklengthv6)); 268 271 } 269 272 else -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r32701 r32718 248 248 pszAbsFilePath = RTPathAbsDup(strOvfFilename.c_str()); 249 249 ComPtr<IProgress> progressRead; 250 CHECK_ERROR_BREAK(pAppliance, Read(Bstr(pszAbsFilePath), progressRead.asOutParam())); 250 CHECK_ERROR_BREAK(pAppliance, Read(Bstr(pszAbsFilePath).raw(), 251 progressRead.asOutParam())); 251 252 RTStrFree(pszAbsFilePath); 252 253 … … 831 832 ComPtr<IMachine> machine; 832 833 /* assume it's a UUID */ 833 rc = a->virtualBox->GetMachine(Bstr(strMachine), machine.asOutParam()); 834 rc = a->virtualBox->GetMachine(Bstr(strMachine).raw(), 835 machine.asOutParam()); 834 836 if (FAILED(rc) || !machine) 835 837 { 836 838 /* must be a name */ 837 CHECK_ERROR_BREAK(a->virtualBox, FindMachine(Bstr(strMachine), machine.asOutParam())); 839 CHECK_ERROR_BREAK(a->virtualBox, FindMachine(Bstr(strMachine).raw(), 840 machine.asOutParam())); 838 841 } 839 842 … … 910 913 { 911 914 if (itD->first == "product") 912 pVSD->AddDescription (VirtualSystemDescriptionType_Product, Bstr(itD->second), Bstr(itD->second)); 915 pVSD->AddDescription(VirtualSystemDescriptionType_Product, 916 Bstr(itD->second).raw(), 917 Bstr(itD->second).raw()); 913 918 else if (itD->first == "producturl") 914 pVSD->AddDescription (VirtualSystemDescriptionType_ProductUrl, Bstr(itD->second), Bstr(itD->second)); 919 pVSD->AddDescription(VirtualSystemDescriptionType_ProductUrl, 920 Bstr(itD->second).raw(), 921 Bstr(itD->second).raw()); 915 922 else if (itD->first == "vendor") 916 pVSD->AddDescription (VirtualSystemDescriptionType_Vendor, Bstr(itD->second), Bstr(itD->second)); 923 pVSD->AddDescription(VirtualSystemDescriptionType_Vendor, 924 Bstr(itD->second).raw(), 925 Bstr(itD->second).raw()); 917 926 else if (itD->first == "vendorurl") 918 pVSD->AddDescription (VirtualSystemDescriptionType_VendorUrl, Bstr(itD->second), Bstr(itD->second)); 927 pVSD->AddDescription(VirtualSystemDescriptionType_VendorUrl, 928 Bstr(itD->second).raw(), 929 Bstr(itD->second).raw()); 919 930 else if (itD->first == "version") 920 pVSD->AddDescription (VirtualSystemDescriptionType_Version, Bstr(itD->second), Bstr(itD->second)); 931 pVSD->AddDescription(VirtualSystemDescriptionType_Version, 932 Bstr(itD->second).raw(), 933 Bstr(itD->second).raw()); 921 934 else if (itD->first == "eula") 922 pVSD->AddDescription (VirtualSystemDescriptionType_License, Bstr(itD->second), Bstr(itD->second)); 935 pVSD->AddDescription(VirtualSystemDescriptionType_License, 936 Bstr(itD->second).raw(), 937 Bstr(itD->second).raw()); 923 938 else if (itD->first == "eulafile") 924 939 { … … 930 945 { 931 946 Bstr bstrContent((char*)pvFile); 932 pVSD->AddDescription(VirtualSystemDescriptionType_License, bstrContent, bstrContent); 947 pVSD->AddDescription(VirtualSystemDescriptionType_License, 948 bstrContent.raw(), 949 bstrContent.raw()); 933 950 RTFileReadAllFree(pvFile, cbFile); 934 951 } … … 955 972 else 956 973 pszAbsFilePath = RTPathAbsDup(strOutputFile.c_str()); 957 CHECK_ERROR_BREAK(pAppliance, Write(Bstr(strOvfFormat), fManifest, Bstr(pszAbsFilePath), progress.asOutParam())); 974 CHECK_ERROR_BREAK(pAppliance, Write(Bstr(strOvfFormat).raw(), 975 fManifest, 976 Bstr(pszAbsFilePath).raw(), 977 progress.asOutParam())); 958 978 RTStrFree(pszAbsFilePath); 959 979 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r32701 r32718 97 97 } 98 98 99 static void makeTimeStr 99 static void makeTimeStr(char *s, int cb, int64_t millies) 100 100 { 101 101 RTTIME t; … … 104 104 RTTimeSpecSetMilli(&ts, millies); 105 105 106 RTTimeExplode 106 RTTimeExplode(&t, &ts); 107 107 108 108 RTStrPrintf(s, cb, "%04d/%02d/%02d %02d:%02d:%02d UTC", … … 119 119 #endif 120 120 121 HRESULT showVMInfo 122 123 124 121 HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox, 122 ComPtr<IMachine> machine, 123 VMINFO_DETAILS details /*= VMINFO_NONE*/, 124 ComPtr<IConsole> console /*= ComPtr <IConsole> ()*/) 125 125 { 126 126 HRESULT rc; … … 195 195 rc = machine->COMGETTER(OSTypeId)(osTypeId.asOutParam()); 196 196 ComPtr<IGuestOSType> osType; 197 rc = virtualBox->GetGuestOSType (osTypeId, osType.asOutParam());197 rc = virtualBox->GetGuestOSType(osTypeId.raw(), osType.asOutParam()); 198 198 Bstr osName; 199 199 rc = osType->COMGETTER(Description)(osName.asOutParam()); … … 592 592 */ 593 593 com::SafeIfaceArray<IStorageController> storageCtls; 594 CHECK_ERROR(machine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam 594 CHECK_ERROR(machine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(storageCtls))); 595 595 for (size_t i = 0; i < storageCtls.size(); ++ i) 596 596 { … … 676 676 for (ULONG k = 0; k < cDevices; ++ k) 677 677 { 678 rc = machine->GetMedium(storageCtlName, i, k, medium.asOutParam()); 678 rc = machine->GetMedium(storageCtlName.raw(), i, k, 679 medium.asOutParam()); 679 680 if (SUCCEEDED(rc) && medium) 680 681 { … … 682 683 ComPtr<IMediumAttachment> mediumAttach; 683 684 684 rc = machine->GetMediumAttachment(storageCtlName, i, k, mediumAttach.asOutParam()); 685 rc = machine->GetMediumAttachment(storageCtlName.raw(), 686 i, k, 687 mediumAttach.asOutParam()); 685 688 if (SUCCEEDED(rc) && mediumAttach) 686 689 mediumAttach->COMGETTER(Passthrough)(&fPassthrough); … … 1292 1295 { 1293 1296 ULONG xRes, yRes, bpp; 1294 rc = display->GetScreenResolution 1297 rc = display->GetScreenResolution(0, &xRes, &yRes, &bpp); 1295 1298 if (rc == E_ACCESSDENIED) 1296 1299 break; /* VM not powered up */ … … 1442 1445 1443 1446 BOOL bActive = FALSE; 1444 CHECK_ERROR_RET (DevPtr, COMGETTER (Active)(&bActive), rc);1447 CHECK_ERROR_RET(DevPtr, COMGETTER(Active)(&bActive), rc); 1445 1448 if (details == VMINFO_MACHINEREADABLE) 1446 1449 RTPrintf("USBFilterActive%zu=\"%s\"\n", index + 1, bActive ? "on" : "off"); … … 1449 1452 1450 1453 Bstr bstr; 1451 CHECK_ERROR_RET (DevPtr, COMGETTER (Name)(bstr.asOutParam()), rc);1454 CHECK_ERROR_RET(DevPtr, COMGETTER(Name)(bstr.asOutParam()), rc); 1452 1455 if (details == VMINFO_MACHINEREADABLE) 1453 1456 RTPrintf("USBFilterName%zu=\"%lS\"\n", index + 1, bstr.raw()); 1454 1457 else 1455 1458 RTPrintf("Name: %lS\n", bstr.raw()); 1456 CHECK_ERROR_RET (DevPtr, COMGETTER (VendorId)(bstr.asOutParam()), rc);1459 CHECK_ERROR_RET(DevPtr, COMGETTER(VendorId)(bstr.asOutParam()), rc); 1457 1460 if (details == VMINFO_MACHINEREADABLE) 1458 1461 RTPrintf("USBFilterVendorId%zu=\"%lS\"\n", index + 1, bstr.raw()); 1459 1462 else 1460 1463 RTPrintf("VendorId: %lS\n", bstr.raw()); 1461 CHECK_ERROR_RET (DevPtr, COMGETTER (ProductId)(bstr.asOutParam()), rc);1464 CHECK_ERROR_RET(DevPtr, COMGETTER(ProductId)(bstr.asOutParam()), rc); 1462 1465 if (details == VMINFO_MACHINEREADABLE) 1463 1466 RTPrintf("USBFilterProductId%zu=\"%lS\"\n", index + 1, bstr.raw()); 1464 1467 else 1465 1468 RTPrintf("ProductId: %lS\n", bstr.raw()); 1466 CHECK_ERROR_RET (DevPtr, COMGETTER (Revision)(bstr.asOutParam()), rc);1469 CHECK_ERROR_RET(DevPtr, COMGETTER(Revision)(bstr.asOutParam()), rc); 1467 1470 if (details == VMINFO_MACHINEREADABLE) 1468 1471 RTPrintf("USBFilterRevision%zu=\"%lS\"\n", index + 1, bstr.raw()); 1469 1472 else 1470 1473 RTPrintf("Revision: %lS\n", bstr.raw()); 1471 CHECK_ERROR_RET (DevPtr, COMGETTER (Manufacturer)(bstr.asOutParam()), rc);1474 CHECK_ERROR_RET(DevPtr, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1472 1475 if (details == VMINFO_MACHINEREADABLE) 1473 1476 RTPrintf("USBFilterManufacturer%zu=\"%lS\"\n", index + 1, bstr.raw()); 1474 1477 else 1475 1478 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1476 CHECK_ERROR_RET (DevPtr, COMGETTER (Product)(bstr.asOutParam()), rc);1479 CHECK_ERROR_RET(DevPtr, COMGETTER(Product)(bstr.asOutParam()), rc); 1477 1480 if (details == VMINFO_MACHINEREADABLE) 1478 1481 RTPrintf("USBFilterProduct%zu=\"%lS\"\n", index + 1, bstr.raw()); 1479 1482 else 1480 1483 RTPrintf("Product: %lS\n", bstr.raw()); 1481 CHECK_ERROR_RET (DevPtr, COMGETTER (Remote)(bstr.asOutParam()), rc);1484 CHECK_ERROR_RET(DevPtr, COMGETTER(Remote)(bstr.asOutParam()), rc); 1482 1485 if (details == VMINFO_MACHINEREADABLE) 1483 1486 RTPrintf("USBFilterRemote%zu=\"%lS\"\n", index + 1, bstr.raw()); 1484 1487 else 1485 1488 RTPrintf("Remote: %lS\n", bstr.raw()); 1486 CHECK_ERROR_RET (DevPtr, COMGETTER (SerialNumber)(bstr.asOutParam()), rc);1489 CHECK_ERROR_RET(DevPtr, COMGETTER(SerialNumber)(bstr.asOutParam()), rc); 1487 1490 if (details == VMINFO_MACHINEREADABLE) 1488 1491 RTPrintf("USBFilterSerialNumber%zu=\"%lS\"\n", index + 1, bstr.raw()); … … 1492 1495 { 1493 1496 ULONG fMaskedIfs; 1494 CHECK_ERROR_RET (DevPtr, COMGETTER (MaskedInterfaces)(&fMaskedIfs), rc);1497 CHECK_ERROR_RET(DevPtr, COMGETTER(MaskedInterfaces)(&fMaskedIfs), rc); 1495 1498 if (fMaskedIfs) 1496 1499 RTPrintf("Masked Interfaces: %#010x\n", fMaskedIfs); … … 1509 1512 1510 1513 SafeIfaceArray <IHostUSBDevice> coll; 1511 CHECK_ERROR_RET (console, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc);1514 CHECK_ERROR_RET(console, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc); 1512 1515 1513 1516 if (coll.size() == 0) … … 1524 1527 /* Query info. */ 1525 1528 Bstr id; 1526 CHECK_ERROR_RET 1529 CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), rc); 1527 1530 USHORT usVendorId; 1528 CHECK_ERROR_RET 1531 CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), rc); 1529 1532 USHORT usProductId; 1530 CHECK_ERROR_RET 1533 CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), rc); 1531 1534 USHORT bcdRevision; 1532 CHECK_ERROR_RET 1535 CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc); 1533 1536 1534 1537 if (details == VMINFO_MACHINEREADABLE) … … 1553 1556 /* optional stuff. */ 1554 1557 Bstr bstr; 1555 CHECK_ERROR_RET 1558 CHECK_ERROR_RET(dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1556 1559 if (!bstr.isEmpty()) 1557 1560 { … … 1561 1564 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1562 1565 } 1563 CHECK_ERROR_RET 1566 CHECK_ERROR_RET(dev, COMGETTER(Product)(bstr.asOutParam()), rc); 1564 1567 if (!bstr.isEmpty()) 1565 1568 { … … 1569 1572 RTPrintf("Product: %lS\n", bstr.raw()); 1570 1573 } 1571 CHECK_ERROR_RET 1574 CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc); 1572 1575 if (!bstr.isEmpty()) 1573 1576 { … … 1577 1580 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1578 1581 } 1579 CHECK_ERROR_RET 1582 CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), rc); 1580 1583 if (!bstr.isEmpty()) 1581 1584 { … … 1595 1598 { 1596 1599 if (details != VMINFO_MACHINEREADABLE) 1597 RTPrintf 1600 RTPrintf("Currently Attached USB Devices:\n\n"); 1598 1601 1599 1602 SafeIfaceArray <IUSBDevice> coll; 1600 CHECK_ERROR_RET (console, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc);1603 CHECK_ERROR_RET(console, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc); 1601 1604 1602 1605 if (coll.size() == 0) … … 1613 1616 /* Query info. */ 1614 1617 Bstr id; 1615 CHECK_ERROR_RET 1618 CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), rc); 1616 1619 USHORT usVendorId; 1617 CHECK_ERROR_RET 1620 CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), rc); 1618 1621 USHORT usProductId; 1619 CHECK_ERROR_RET 1622 CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), rc); 1620 1623 USHORT bcdRevision; 1621 CHECK_ERROR_RET 1624 CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), rc); 1622 1625 1623 1626 if (details == VMINFO_MACHINEREADABLE) … … 1642 1645 /* optional stuff. */ 1643 1646 Bstr bstr; 1644 CHECK_ERROR_RET 1647 CHECK_ERROR_RET(dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1645 1648 if (!bstr.isEmpty()) 1646 1649 { … … 1650 1653 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1651 1654 } 1652 CHECK_ERROR_RET 1655 CHECK_ERROR_RET(dev, COMGETTER(Product)(bstr.asOutParam()), rc); 1653 1656 if (!bstr.isEmpty()) 1654 1657 { … … 1658 1661 RTPrintf("Product: %lS\n", bstr.raw()); 1659 1662 } 1660 CHECK_ERROR_RET 1663 CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc); 1661 1664 if (!bstr.isEmpty()) 1662 1665 { … … 1666 1669 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1667 1670 } 1668 CHECK_ERROR_RET 1671 CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), rc); 1669 1672 if (!bstr.isEmpty()) 1670 1673 { … … 1790 1793 ULONG EncryptionStyle; 1791 1794 1792 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(Active) 1793 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(NumberOfClients) 1794 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BeginTime) 1795 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EndTime) 1796 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesSent) 1797 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesSentTotal) 1798 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesReceived) 1799 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesReceivedTotal) 1800 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(User) (User.asOutParam()), rc);1801 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(Domain) (Domain.asOutParam()), rc);1802 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientName) (ClientName.asOutParam()), rc);1803 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientIP) (ClientIP.asOutParam()), rc);1804 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientVersion) 1805 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EncryptionStyle) 1795 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(Active)(&Active), rc); 1796 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(NumberOfClients)(&NumberOfClients), rc); 1797 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BeginTime)(&BeginTime), rc); 1798 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EndTime)(&EndTime), rc); 1799 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesSent)(&BytesSent), rc); 1800 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesSentTotal)(&BytesSentTotal), rc); 1801 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesReceived)(&BytesReceived), rc); 1802 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(BytesReceivedTotal)(&BytesReceivedTotal), rc); 1803 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(User)(User.asOutParam()), rc); 1804 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(Domain)(Domain.asOutParam()), rc); 1805 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientName)(ClientName.asOutParam()), rc); 1806 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientIP)(ClientIP.asOutParam()), rc); 1807 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(ClientVersion)(&ClientVersion), rc); 1808 CHECK_ERROR_RET(remoteDisplayInfo, COMGETTER(EncryptionStyle)(&EncryptionStyle), rc); 1806 1809 1807 1810 if (details == VMINFO_MACHINEREADABLE) … … 1821 1824 if (Active) 1822 1825 { 1823 makeTimeStr (timestr, sizeof(timestr), BeginTime);1826 makeTimeStr(timestr, sizeof(timestr), BeginTime); 1824 1827 if (details == VMINFO_MACHINEREADABLE) 1825 1828 RTPrintf("VRDPStartTime=\"%s\"\n", timestr); … … 1829 1832 else 1830 1833 { 1831 makeTimeStr (timestr, sizeof(timestr), BeginTime);1834 makeTimeStr(timestr, sizeof(timestr), BeginTime); 1832 1835 if (details == VMINFO_MACHINEREADABLE) 1833 1836 RTPrintf("VRDPLastStartTime=\"%s\"\n", timestr); 1834 1837 else 1835 1838 RTPrintf("Last started: %s\n", timestr); 1836 makeTimeStr (timestr, sizeof(timestr), EndTime);1839 makeTimeStr(timestr, sizeof(timestr), EndTime); 1837 1840 if (details == VMINFO_MACHINEREADABLE) 1838 1841 RTPrintf("VRDPLastEndTime=\"%s\"\n", timestr); … … 1974 1977 */ 1975 1978 ComPtr<ISnapshot> snapshot; 1976 rc = machine->GetSnapshot(Bstr() , snapshot.asOutParam());1979 rc = machine->GetSnapshot(Bstr().raw(), snapshot.asOutParam()); 1977 1980 if (SUCCEEDED(rc) && snapshot) 1978 1981 { … … 2070 2073 if (!Guid(VMNameOrUuid).isEmpty()) 2071 2074 { 2072 CHECK_ERROR(a->virtualBox, GetMachine(uuid, machine.asOutParam())); 2073 } 2074 else 2075 { 2076 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMNameOrUuid), machine.asOutParam())); 2075 CHECK_ERROR(a->virtualBox, GetMachine(uuid.raw(), 2076 machine.asOutParam())); 2077 } 2078 else 2079 { 2080 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMNameOrUuid).raw(), 2081 machine.asOutParam())); 2077 2082 if (SUCCEEDED(rc)) 2078 2083 machine->COMGETTER(Id)(uuid.asOutParam()); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMetrics.cpp
r32701 r32718 111 111 { 112 112 ComPtr <IMachine> machine; 113 rc = aVirtualBox->FindMachine(Bstr(argv[0]), machine.asOutParam()); 113 rc = aVirtualBox->FindMachine(Bstr(argv[0]).raw(), 114 machine.asOutParam()); 114 115 if (SUCCEEDED (rc)) 115 116 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r32701 r32718 70 70 * and the client's interpretation of relative paths. Remove after the API 71 71 * has been redesigned. */ 72 rc = a->virtualBox->OpenMachine(Bstr(a->argv[0]), machine.asOutParam()); 72 rc = a->virtualBox->OpenMachine(Bstr(a->argv[0]).raw(), 73 machine.asOutParam()); 73 74 if (rc == VBOX_E_FILE_ERROR) 74 75 { … … 80 81 return 1; 81 82 } 82 CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(szVMFileAbs), machine.asOutParam())); 83 CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(szVMFileAbs).raw(), 84 machine.asOutParam())); 83 85 } 84 86 else if (FAILED(rc)) 85 CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(a->argv[0]), machine.asOutParam())); 87 CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(a->argv[0]).raw(), 88 machine.asOutParam())); 86 89 if (SUCCEEDED(rc)) 87 90 { … … 148 151 ComPtr<IMachine> machine; 149 152 /* assume it's a UUID */ 150 rc = a->virtualBox->GetMachine( Guid(VMName).toUtf16(), machine.asOutParam());153 rc = a->virtualBox->GetMachine(Bstr(VMName).raw(), machine.asOutParam()); 151 154 if (FAILED(rc) || !machine) 152 155 { 153 156 /* must be a name */ 154 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName), machine.asOutParam())); 157 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName).raw(), 158 machine.asOutParam())); 155 159 } 156 160 if (machine) … … 230 234 231 235 /* check for required options */ 232 if (name )236 if (name.isEmpty()) 233 237 return errorSyntax(USAGE_CREATEVM, "Parameter --name is required"); 234 238 … … 238 242 239 243 CHECK_ERROR_BREAK(a->virtualBox, 240 CreateMachine(name ,241 osTypeId ,242 baseFolder ,243 Guid(id).toUtf16() ,244 CreateMachine(name.raw(), 245 osTypeId.raw(), 246 baseFolder.raw(), 247 Guid(id).toUtf16().raw(), 244 248 FALSE, 245 249 machine.asOutParam())); … … 347 351 ComPtr<IMachine> machine; 348 352 /* assume it's a UUID */ 349 rc = a->virtualBox->GetMachine( Guid(VMName).toUtf16(), machine.asOutParam());353 rc = a->virtualBox->GetMachine(Bstr(VMName).raw(), machine.asOutParam()); 350 354 if (FAILED(rc) || !machine) 351 355 { 352 356 /* must be a name */ 353 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName), machine.asOutParam())); 357 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName).raw(), 358 machine.asOutParam())); 354 359 } 355 360 if (machine) … … 368 373 #endif 369 374 ComPtr<IProgress> progress; 370 CHECK_ERROR_RET(machine, LaunchVMProcess(a->session, sessionType, env, progress.asOutParam()), rc); 375 CHECK_ERROR_RET(machine, LaunchVMProcess(a->session, sessionType.raw(), 376 env.raw(), progress.asOutParam()), rc); 371 377 RTPrintf("Waiting for the VM to power on...\n"); 372 378 CHECK_ERROR_RET(progress, WaitForCompletion(-1), 1); … … 406 412 ComPtr<IMachine> machine; 407 413 /* assume it's a UUID */ 408 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 414 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 415 machine.asOutParam()); 409 416 if (FAILED(rc) || !machine) 410 417 { 411 418 /* must be a name */ 412 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 419 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 420 machine.asOutParam())); 413 421 } 414 422 if (machine) … … 440 448 ComPtr<IMachine> machine; 441 449 /* assume it's a UUID */ 442 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 450 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 451 machine.asOutParam()); 443 452 if (FAILED(rc) || !machine) 444 453 { 445 454 /* must be a name */ 446 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 455 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 456 machine.asOutParam())); 447 457 } 448 458 if (machine) … … 456 466 ComPtr<IConsole> console; 457 467 CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam())); 458 CHECK_ERROR_BREAK(console, AdoptSavedState(Bstr(a->argv[1]) ));468 CHECK_ERROR_BREAK(console, AdoptSavedState(Bstr(a->argv[1]).raw())); 459 469 } while (0); 460 470 CHECK_ERROR_BREAK(a->session, UnlockMachine()); … … 487 497 Bstr bstrKey(aKeys[i]); 488 498 Bstr bstrValue; 489 CHECK_ERROR(a->virtualBox, GetExtraData(bstrKey, bstrValue.asOutParam())); 499 CHECK_ERROR(a->virtualBox, GetExtraData(bstrKey.raw(), 500 bstrValue.asOutParam())); 490 501 491 502 RTPrintf("Key: %lS, Value: %lS\n", bstrKey.raw(), bstrValue.raw()); … … 495 506 { 496 507 Bstr value; 497 CHECK_ERROR(a->virtualBox, GetExtraData(Bstr(a->argv[1]), value.asOutParam())); 508 CHECK_ERROR(a->virtualBox, GetExtraData(Bstr(a->argv[1]).raw(), 509 value.asOutParam())); 498 510 if (!value.isEmpty()) 499 511 RTPrintf("Value: %lS\n", value.raw()); … … 506 518 ComPtr<IMachine> machine; 507 519 /* assume it's a UUID */ 508 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 520 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 521 machine.asOutParam()); 509 522 if (FAILED(rc) || !machine) 510 523 { 511 524 /* must be a name */ 512 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 525 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 526 machine.asOutParam())); 513 527 } 514 528 if (machine) … … 526 540 Bstr bstrKey(aKeys[i]); 527 541 Bstr bstrValue; 528 CHECK_ERROR(machine, GetExtraData(bstrKey, bstrValue.asOutParam())); 542 CHECK_ERROR(machine, GetExtraData(bstrKey.raw(), 543 bstrValue.asOutParam())); 529 544 530 545 RTPrintf("Key: %lS, Value: %lS\n", bstrKey.raw(), bstrValue.raw()); … … 534 549 { 535 550 Bstr value; 536 CHECK_ERROR(machine, GetExtraData(Bstr(a->argv[1]), value.asOutParam())); 551 CHECK_ERROR(machine, GetExtraData(Bstr(a->argv[1]).raw(), 552 value.asOutParam())); 537 553 if (!value.isEmpty()) 538 554 RTPrintf("Value: %lS\n", value.raw()); … … 555 571 if (!strcmp(a->argv[0], "global")) 556 572 { 573 /** @todo passing NULL is deprecated */ 557 574 if (a->argc < 3) 558 CHECK_ERROR(a->virtualBox, SetExtraData(Bstr(a->argv[1]), NULL)); 575 CHECK_ERROR(a->virtualBox, SetExtraData(Bstr(a->argv[1]).raw(), 576 NULL)); 559 577 else if (a->argc == 3) 560 CHECK_ERROR(a->virtualBox, SetExtraData(Bstr(a->argv[1]), Bstr(a->argv[2]))); 578 CHECK_ERROR(a->virtualBox, SetExtraData(Bstr(a->argv[1]).raw(), 579 Bstr(a->argv[2]).raw())); 561 580 else 562 581 return errorSyntax(USAGE_SETEXTRADATA, "Too many parameters"); … … 566 585 ComPtr<IMachine> machine; 567 586 /* assume it's a UUID */ 568 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]), machine.asOutParam()); 587 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 588 machine.asOutParam()); 569 589 if (FAILED(rc) || !machine) 570 590 { 571 591 /* must be a name */ 572 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 592 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 593 machine.asOutParam())); 573 594 } 574 595 if (machine) 575 596 { 597 /** @todo passing NULL is deprecated */ 576 598 if (a->argc < 3) 577 CHECK_ERROR(machine, SetExtraData(Bstr(a->argv[1]), NULL)); 599 CHECK_ERROR(machine, SetExtraData(Bstr(a->argv[1]).raw(), 600 NULL)); 578 601 else if (a->argc == 3) 579 CHECK_ERROR(machine, SetExtraData(Bstr(a->argv[1]), Bstr(a->argv[2]))); 602 CHECK_ERROR(machine, SetExtraData(Bstr(a->argv[1]).raw(), 603 Bstr(a->argv[2]).raw())); 580 604 else 581 605 return errorSyntax(USAGE_SETEXTRADATA, "Too many parameters"); … … 602 626 CHECK_ERROR(systemProperties, COMSETTER(DefaultHardDiskFolder)(NULL)); 603 627 else 604 CHECK_ERROR(systemProperties, COMSETTER(DefaultHardDiskFolder)(Bstr(a->argv[1]) ));628 CHECK_ERROR(systemProperties, COMSETTER(DefaultHardDiskFolder)(Bstr(a->argv[1]).raw())); 605 629 } 606 630 else if (!strcmp(a->argv[0], "machinefolder")) … … 610 634 CHECK_ERROR(systemProperties, COMSETTER(DefaultMachineFolder)(NULL)); 611 635 else 612 CHECK_ERROR(systemProperties, COMSETTER(DefaultMachineFolder)(Bstr(a->argv[1]) ));636 CHECK_ERROR(systemProperties, COMSETTER(DefaultMachineFolder)(Bstr(a->argv[1]).raw())); 613 637 } 614 638 else if (!strcmp(a->argv[0], "vrdpauthlibrary")) … … 618 642 CHECK_ERROR(systemProperties, COMSETTER(RemoteDisplayAuthLibrary)(NULL)); 619 643 else 620 CHECK_ERROR(systemProperties, COMSETTER(RemoteDisplayAuthLibrary)(Bstr(a->argv[1]) ));644 CHECK_ERROR(systemProperties, COMSETTER(RemoteDisplayAuthLibrary)(Bstr(a->argv[1]).raw())); 621 645 } 622 646 else if (!strcmp(a->argv[0], "websrvauthlibrary")) … … 626 650 CHECK_ERROR(systemProperties, COMSETTER(WebServiceAuthLibrary)(NULL)); 627 651 else 628 CHECK_ERROR(systemProperties, COMSETTER(WebServiceAuthLibrary)(Bstr(a->argv[1]) ));652 CHECK_ERROR(systemProperties, COMSETTER(WebServiceAuthLibrary)(Bstr(a->argv[1]).raw())); 629 653 } 630 654 else if (!strcmp(a->argv[0], "loghistorycount")) … … 653 677 ComPtr<IMachine> machine; 654 678 /* assume it's a UUID */ 655 rc = a->virtualBox->GetMachine(Bstr(a->argv[1]), machine.asOutParam()); 679 rc = a->virtualBox->GetMachine(Bstr(a->argv[1]).raw(), 680 machine.asOutParam()); 656 681 if (FAILED(rc) || !machine) 657 682 { 658 683 /* must be a name */ 659 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[1]), machine.asOutParam())); 684 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[1]).raw(), 685 machine.asOutParam())); 660 686 } 661 687 if (!machine) … … 731 757 CHECK_ERROR_RET(a->session, COMGETTER(Console)(console.asOutParam()), 1); 732 758 733 CHECK_ERROR(console, CreateSharedFolder(Bstr(name), Bstr(hostpath), 759 CHECK_ERROR(console, CreateSharedFolder(Bstr(name).raw(), 760 Bstr(hostpath).raw(), 734 761 fWritable, fAutoMount)); 735 762 if (console) … … 745 772 a->session->COMGETTER(Machine)(machine.asOutParam()); 746 773 747 CHECK_ERROR(machine, CreateSharedFolder(Bstr(name), Bstr(hostpath), 774 CHECK_ERROR(machine, CreateSharedFolder(Bstr(name).raw(), 775 Bstr(hostpath).raw(), 748 776 fWritable, fAutoMount)); 749 777 if (SUCCEEDED(rc)) … … 796 824 CHECK_ERROR_RET(a->session, COMGETTER(Console)(console.asOutParam()), 1); 797 825 798 CHECK_ERROR(console, RemoveSharedFolder(Bstr(name) ));826 CHECK_ERROR(console, RemoveSharedFolder(Bstr(name).raw())); 799 827 800 828 if (console) … … 809 837 a->session->COMGETTER(Machine)(machine.asOutParam()); 810 838 811 CHECK_ERROR(machine, RemoveSharedFolder(Bstr(name) ));839 CHECK_ERROR(machine, RemoveSharedFolder(Bstr(name).raw())); 812 840 813 841 /* commit and close the session */ … … 834 862 Bstr uuid(a->argv[0]); 835 863 if (!Guid(a->argv[0]).isEmpty()) 836 CHECK_ERROR(a->virtualBox, GetMachine(uuid, machine.asOutParam())); 864 CHECK_ERROR(a->virtualBox, GetMachine(uuid.raw(), 865 machine.asOutParam())); 837 866 else 838 867 { 839 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 868 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 869 machine.asOutParam())); 840 870 if (SUCCEEDED(rc)) 841 871 machine->COMGETTER(Id)(uuid.asOutParam()); … … 888 918 { 889 919 if (fReset) 890 CHECK_ERROR(debugger, ResetStats(Bstr(pszPattern) ));920 CHECK_ERROR(debugger, ResetStats(Bstr(pszPattern).raw())); 891 921 else 892 922 { 893 923 Bstr stats; 894 CHECK_ERROR(debugger, GetStats(Bstr(pszPattern), fWithDescriptions, stats.asOutParam())); 924 CHECK_ERROR(debugger, GetStats(Bstr(pszPattern).raw(), 925 fWithDescriptions, 926 stats.asOutParam())); 895 927 if (SUCCEEDED(rc)) 896 928 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r32701 r32718 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 308 308 if (!Guid(machineuuid).isEmpty()) 309 309 { 310 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()), 1); 310 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid.raw(), 311 machine.asOutParam()), 1); 311 312 } 312 313 else 313 314 { 314 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1); 315 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 316 machine.asOutParam()), 1); 315 317 machine->COMGETTER(Id)(machineuuid.asOutParam()); 316 318 } … … 333 335 case MODIFYVM_NAME: 334 336 { 335 CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz) ));337 CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw())); 336 338 break; 337 339 } … … 339 341 { 340 342 ComPtr<IGuestOSType> guestOSType; 341 CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz), guestOSType.asOutParam())); 343 CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(), 344 guestOSType.asOutParam())); 342 345 if (SUCCEEDED(rc) && guestOSType) 343 346 { 344 CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz) ));347 CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw())); 345 348 } 346 349 else … … 554 557 case MODIFYVM_BIOSLOGOIMAGEPATH: 555 558 { 556 CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz) ));559 CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw())); 557 560 break; 558 561 } … … 651 654 if (!strcmp(ValueUnion.psz, "none")) 652 655 { 653 machine->DetachDevice(bstrController , u1, u2);656 machine->DetachDevice(bstrController.raw(), u1, u2); 654 657 } 655 658 else 656 659 { 657 660 ComPtr<IMedium> hardDisk; 658 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz), DeviceType_HardDisk, hardDisk.asOutParam()); 661 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 662 DeviceType_HardDisk, 663 hardDisk.asOutParam()); 659 664 if (FAILED(rc)) 660 665 { 661 666 /* open the new hard disk object */ 662 667 CHECK_ERROR(a->virtualBox, 663 OpenMedium(Bstr(ValueUnion.psz) ,668 OpenMedium(Bstr(ValueUnion.psz).raw(), 664 669 DeviceType_HardDisk, 665 670 AccessMode_ReadWrite, … … 668 673 if (hardDisk) 669 674 { 670 CHECK_ERROR(machine, AttachDevice(bstrController, u1, u2, DeviceType_HardDisk, hardDisk)); 675 CHECK_ERROR(machine, AttachDevice(bstrController.raw(), 676 u1, u2, 677 DeviceType_HardDisk, 678 hardDisk)); 671 679 } 672 680 else … … 679 687 { 680 688 ComPtr<IStorageController> storageController; 681 CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller") ,689 CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(), 682 690 storageController.asOutParam())); 683 691 … … 705 713 { 706 714 ComPtr<IStorageController> SataCtl; 707 CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam())); 715 CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(), 716 SataCtl.asOutParam())); 708 717 709 718 if (SUCCEEDED(rc)) … … 715 724 { 716 725 ComPtr<IStorageController> SataCtl; 717 CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam())); 726 CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(), 727 SataCtl.asOutParam())); 718 728 719 729 if (SUCCEEDED(rc) && ValueUnion.u32 > 0) … … 727 737 { 728 738 ComPtr<IStorageController> ctl; 729 CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam())); 739 CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(), 740 StorageBus_SATA, 741 ctl.asOutParam())); 730 742 CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci)); 731 743 } 732 744 else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable")) 733 CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA") ));745 CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw())); 734 746 else 735 747 return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz); … … 741 753 if (!strcmp(ValueUnion.psz, "none")) 742 754 { 743 rc = machine->DetachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0); 755 rc = machine->DetachDevice(Bstr("LsiLogic").raw(), 756 GetOptState.uIndex, 0); 744 757 if (FAILED(rc)) 745 CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0)); 758 CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(), 759 GetOptState.uIndex, 0)); 746 760 } 747 761 else … … 749 763 /* first guess is that it's a UUID */ 750 764 ComPtr<IMedium> hardDisk; 751 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz), DeviceType_HardDisk, hardDisk.asOutParam()); 765 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 766 DeviceType_HardDisk, 767 hardDisk.asOutParam()); 752 768 /* not successful? Then it must be a filename */ 753 769 if (FAILED(rc)) … … 755 771 /* open the new hard disk object */ 756 772 CHECK_ERROR(a->virtualBox, 757 OpenMedium(Bstr(ValueUnion.psz) ,773 OpenMedium(Bstr(ValueUnion.psz).raw(), 758 774 DeviceType_HardDisk, 759 775 AccessMode_ReadWrite, … … 762 778 if (hardDisk) 763 779 { 764 rc = machine->AttachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0, DeviceType_HardDisk, hardDisk); 780 rc = machine->AttachDevice(Bstr("LsiLogic").raw(), 781 GetOptState.uIndex, 0, 782 DeviceType_HardDisk, 783 hardDisk); 765 784 if (FAILED(rc)) 766 785 CHECK_ERROR(machine, 767 AttachDevice(Bstr("BusLogic"), 768 GetOptState.uIndex, 0, 769 DeviceType_HardDisk, hardDisk)); 786 AttachDevice(Bstr("BusLogic").raw(), 787 GetOptState.uIndex, 0, 788 DeviceType_HardDisk, 789 hardDisk)); 770 790 } 771 791 else … … 781 801 if (!RTStrICmp(ValueUnion.psz, "LsiLogic")) 782 802 { 783 rc = machine->RemoveStorageController(Bstr("BusLogic") );803 rc = machine->RemoveStorageController(Bstr("BusLogic").raw()); 784 804 if (FAILED(rc)) 785 CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic") ));805 CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw())); 786 806 787 807 CHECK_ERROR(machine, 788 AddStorageController(Bstr("LsiLogic") ,808 AddStorageController(Bstr("LsiLogic").raw(), 789 809 StorageBus_SCSI, 790 810 ctl.asOutParam())); … … 795 815 else if (!RTStrICmp(ValueUnion.psz, "BusLogic")) 796 816 { 797 rc = machine->RemoveStorageController(Bstr("LsiLogic") );817 rc = machine->RemoveStorageController(Bstr("LsiLogic").raw()); 798 818 if (FAILED(rc)) 799 CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic") ));819 CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw())); 800 820 801 821 CHECK_ERROR(machine, 802 AddStorageController(Bstr("BusLogic") ,822 AddStorageController(Bstr("BusLogic").raw(), 803 823 StorageBus_SCSI, 804 824 ctl.asOutParam())); … … 818 838 ComPtr<IStorageController> ctl; 819 839 820 CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam())); 840 CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(), 841 StorageBus_SCSI, 842 ctl.asOutParam())); 821 843 if (SUCCEEDED(rc)) 822 844 CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic)); … … 824 846 else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable")) 825 847 { 826 rc = machine->RemoveStorageController(Bstr("BusLogic") );848 rc = machine->RemoveStorageController(Bstr("BusLogic").raw()); 827 849 if (FAILED(rc)) 828 CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic") ));850 CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw())); 829 851 } 830 852 break; … … 833 855 case MODIFYVM_DVDPASSTHROUGH: // deprecated 834 856 { 835 CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller"), 1, 0, !strcmp(ValueUnion.psz, "on"))); 857 CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(), 858 1, 0, 859 !strcmp(ValueUnion.psz, "on"))); 836 860 break; 837 861 } … … 852 876 ComPtr<IHost> host; 853 877 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 854 rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5), dvdMedium.asOutParam()); 878 rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(), 879 dvdMedium.asOutParam()); 855 880 if (!dvdMedium) 856 881 { … … 863 888 break; 864 889 } 865 rc = host->FindHostDVDDrive(Bstr(szPathReal), dvdMedium.asOutParam()); 890 rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(), 891 dvdMedium.asOutParam()); 866 892 if (!dvdMedium) 867 893 { … … 875 901 { 876 902 /* first assume it's a UUID */ 877 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz), DeviceType_DVD, dvdMedium.asOutParam()); 903 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 904 DeviceType_DVD, 905 dvdMedium.asOutParam()); 878 906 if (FAILED(rc) || !dvdMedium) 879 907 { … … 881 909 Bstr emptyUUID; 882 910 CHECK_ERROR(a->virtualBox, 883 OpenMedium(Bstr(ValueUnion.psz) ,911 OpenMedium(Bstr(ValueUnion.psz).raw(), 884 912 DeviceType_DVD, 885 913 AccessMode_ReadWrite, … … 893 921 } 894 922 895 /** @todo generalize this, allow arbitrary number of DVD drives896 * and as a consequence multiple attachments and different897 * storage controllers. */898 923 if (dvdMedium) 899 924 dvdMedium->COMGETTER(Id)(uuid.asOutParam()); 900 CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller"), 1, 0, uuid, FALSE /* aForce */)); 925 CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(), 926 1, 0, uuid.raw(), 927 FALSE /* aForce */)); 901 928 break; 902 929 } … … 907 934 ComPtr<IMedium> floppyMedium; 908 935 ComPtr<IMediumAttachment> floppyAttachment; 909 machine->GetMediumAttachment(Bstr("Floppy Controller"), 0, 0, floppyAttachment.asOutParam()); 936 machine->GetMediumAttachment(Bstr("Floppy Controller").raw(), 937 0, 0, floppyAttachment.asOutParam()); 910 938 911 939 /* disable? */ … … 914 942 /* disable the controller */ 915 943 if (floppyAttachment) 916 CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller"), 0, 0)); 944 CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(), 945 0, 0)); 917 946 } 918 947 else … … 920 949 /* enable the controller */ 921 950 if (!floppyAttachment) 922 CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller"), 0, 0, DeviceType_Floppy, NULL)); 951 CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller").raw(), 952 0, 0, 953 DeviceType_Floppy, NULL)); 923 954 924 955 /* unmount? */ … … 933 964 ComPtr<IHost> host; 934 965 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 935 rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5), floppyMedium.asOutParam()); 966 rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(), 967 floppyMedium.asOutParam()); 936 968 if (!floppyMedium) 937 969 { … … 944 976 { 945 977 /* first assume it's a UUID */ 946 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz), DeviceType_Floppy, floppyMedium.asOutParam()); 978 rc = a->virtualBox->FindMedium(Bstr(ValueUnion.psz).raw(), 979 DeviceType_Floppy, 980 floppyMedium.asOutParam()); 947 981 if (FAILED(rc) || !floppyMedium) 948 982 { … … 950 984 Bstr emptyUUID; 951 985 CHECK_ERROR(a->virtualBox, 952 OpenMedium(Bstr(ValueUnion.psz) ,986 OpenMedium(Bstr(ValueUnion.psz).raw(), 953 987 DeviceType_Floppy, 954 988 AccessMode_ReadWrite, … … 962 996 } 963 997 floppyMedium->COMGETTER(Id)(uuid.asOutParam()); 964 CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller"), 0, 0, uuid, FALSE /* aForce */)); 998 CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(), 999 0, 0, uuid.raw(), 1000 FALSE /* aForce */)); 965 1001 } 966 1002 break; … … 974 1010 ASSERT(nic); 975 1011 976 CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz) ));1012 CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw())); 977 1013 break; 978 1014 } … … 1141 1177 ASSERT(nic); 1142 1178 1179 /** @todo NULL string deprecated */ 1143 1180 /* remove it? */ 1144 1181 if (!strcmp(ValueUnion.psz, "none")) … … 1148 1185 else 1149 1186 { 1150 CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz) ));1187 CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz).raw())); 1151 1188 } 1152 1189 break; … … 1160 1197 ASSERT(nic); 1161 1198 1199 /** @todo NULL string deprecated */ 1162 1200 /* remove it? */ 1163 1201 if (!strcmp(ValueUnion.psz, "none")) … … 1167 1205 else 1168 1206 { 1169 CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz) ));1207 CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw())); 1170 1208 } 1171 1209 break; … … 1180 1218 ASSERT(nic); 1181 1219 1220 /** @todo NULL string deprecated */ 1221 /* remove it? */ 1182 1222 if (!strcmp(ValueUnion.psz, "default")) 1183 1223 { … … 1186 1226 else 1187 1227 { 1188 CHECK_ERROR(nic, COMSETTER(VDENetwork)(Bstr(ValueUnion.psz) ));1228 CHECK_ERROR(nic, COMSETTER(VDENetwork)(Bstr(ValueUnion.psz).raw())); 1189 1229 } 1190 1230 break; … … 1205 1245 psz = ""; 1206 1246 1207 CHECK_ERROR(driver, COMSETTER(Network)(Bstr(psz) ));1247 CHECK_ERROR(driver, COMSETTER(Network)(Bstr(psz).raw())); 1208 1248 break; 1209 1249 } … … 1218 1258 1219 1259 CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam())); 1220 CHECK_ERROR(driver, COMSETTER(HostIP)(Bstr(ValueUnion.psz) ));1260 CHECK_ERROR(driver, COMSETTER(HostIP)(Bstr(ValueUnion.psz).raw())); 1221 1261 break; 1222 1262 } … … 1311 1351 break; 1312 1352 } 1313 CHECK_ERROR(driver, AddRedirect(Bstr(strName), proto, Bstr(strHostIp), 1314 RTStrToUInt16(strHostPort), Bstr(strGuestIp), RTStrToUInt16(strGuestPort))); 1353 CHECK_ERROR(driver, AddRedirect(Bstr(strName).raw(), proto, 1354 Bstr(strHostIp).raw(), 1355 RTStrToUInt16(strHostPort), 1356 Bstr(strGuestIp).raw(), 1357 RTStrToUInt16(strGuestPort))); 1315 1358 } 1316 1359 else … … 1321 1364 if (RT_FAILURE(vrc)) 1322 1365 return errorSyntax(USAGE_MODIFYVM, "Not enough parameters"); 1323 CHECK_ERROR(driver, RemoveRedirect(Bstr(ValueUnion.psz) ));1366 CHECK_ERROR(driver, RemoveRedirect(Bstr(ValueUnion.psz).raw())); 1324 1367 } 1325 1368 break; … … 1370 1413 1371 1414 CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam())); 1372 CHECK_ERROR(driver, COMSETTER(TftpPrefix)(Bstr(ValueUnion.psz) ));1415 CHECK_ERROR(driver, COMSETTER(TftpPrefix)(Bstr(ValueUnion.psz).raw())); 1373 1416 break; 1374 1417 } … … 1383 1426 1384 1427 CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam())); 1385 CHECK_ERROR(driver, COMSETTER(TftpBootFile)(Bstr(ValueUnion.psz) ));1428 CHECK_ERROR(driver, COMSETTER(TftpBootFile)(Bstr(ValueUnion.psz).raw())); 1386 1429 break; 1387 1430 } … … 1396 1439 1397 1440 CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam())); 1398 CHECK_ERROR(driver, COMSETTER(TftpNextServer)(Bstr(ValueUnion.psz) ));1441 CHECK_ERROR(driver, COMSETTER(TftpNextServer)(Bstr(ValueUnion.psz).raw())); 1399 1442 break; 1400 1443 } … … 1451 1494 else 1452 1495 { 1453 CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz) ));1496 CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz).raw())); 1454 1497 } 1455 1498 break; … … 1558 1601 GetOptState.pDef->pszLong); 1559 1602 1560 CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz) ));1603 CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw())); 1561 1604 1562 1605 if (!strcmp(pszMode, "server")) … … 1577 1620 else 1578 1621 { 1579 CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz) ));1622 CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw())); 1580 1623 CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice)); 1581 1624 } … … 1765 1808 1766 1809 if (!strcmp(ValueUnion.psz, "default")) 1767 CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr("0") ));1768 else 1769 CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz) ));1810 CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr("0").raw())); 1811 else 1812 CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz).raw())); 1770 1813 break; 1771 1814 } … … 1777 1820 ASSERT(vrdpServer); 1778 1821 1779 CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz) ));1822 CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz).raw())); 1780 1823 break; 1781 1824 } … … 1881 1924 CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL)); 1882 1925 else 1883 CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz) ));1926 CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw())); 1884 1927 break; 1885 1928 } … … 1899 1942 case MODIFYVM_TELEPORTER_ADDRESS: 1900 1943 { 1901 CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz) ));1944 CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw())); 1902 1945 break; 1903 1946 } … … 1905 1948 case MODIFYVM_TELEPORTER_PASSWORD: 1906 1949 { 1907 CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz) ));1950 CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw())); 1908 1951 break; 1909 1952 } … … 1930 1973 case MODIFYVM_FAULT_TOLERANCE_ADDRESS: 1931 1974 { 1932 CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz) ));1975 CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw())); 1933 1976 break; 1934 1977 } … … 1942 1985 case MODIFYVM_FAULT_TOLERANCE_PASSWORD: 1943 1986 { 1944 CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz) ));1987 CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw())); 1945 1988 break; 1946 1989 } … … 1954 1997 case MODIFYVM_HARDWARE_UUID: 1955 1998 { 1956 CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz) ));1999 CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw())); 1957 2000 break; 1958 2001 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
r32701 r32718 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 172 172 // get root snapshot 173 173 ComPtr<ISnapshot> pSnapshot; 174 CHECK_ERROR_BREAK(pMachine, GetSnapshot(Bstr("") , pSnapshot.asOutParam()));174 CHECK_ERROR_BREAK(pMachine, GetSnapshot(Bstr("").raw(), pSnapshot.asOutParam())); 175 175 176 176 // get current snapshot … … 228 228 ComPtr<IMachine> pMachine; 229 229 /* assume it's a UUID */ 230 rc = a->virtualBox->GetMachine(bstrMachine , pMachine.asOutParam());230 rc = a->virtualBox->GetMachine(bstrMachine.raw(), pMachine.asOutParam()); 231 231 if (FAILED(rc) || !pMachine) 232 232 { 233 233 /* must be a name */ 234 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine, pMachine.asOutParam())); 234 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine.raw(), 235 pMachine.asOutParam())); 235 236 } 236 237 if (!pMachine) … … 308 309 309 310 ComPtr<IProgress> progress; 310 CHECK_ERROR_BREAK(console, TakeSnapshot(name, desc, progress.asOutParam())); 311 CHECK_ERROR_BREAK(console, TakeSnapshot(name.raw(), desc.raw(), 312 progress.asOutParam())); 311 313 312 314 rc = showProgress(progress); … … 369 371 // assume it's a UUID 370 372 bstrSnapGuid = a->argv[2]; 371 if (FAILED(pMachine->GetSnapshot(bstrSnapGuid, pSnapshot.asOutParam()))) 373 if (FAILED(pMachine->GetSnapshot(bstrSnapGuid.raw(), 374 pSnapshot.asOutParam()))) 372 375 { 373 376 // then it must be a name 374 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]), pSnapshot.asOutParam())); 377 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]).raw(), 378 pSnapshot.asOutParam())); 375 379 CHECK_ERROR_BREAK(pSnapshot, COMGETTER(Id)(bstrSnapGuid.asOutParam())); 376 380 } … … 379 383 if (fDelete) 380 384 { 381 CHECK_ERROR_BREAK(console, DeleteSnapshot(bstrSnapGuid, pProgress.asOutParam())); 385 CHECK_ERROR_BREAK(console, DeleteSnapshot(bstrSnapGuid.raw(), 386 pProgress.asOutParam())); 382 387 } 383 388 else … … 417 422 { 418 423 /* assume it's a UUID */ 419 rc = pMachine->GetSnapshot(Bstr(a->argv[2]), snapshot.asOutParam()); 424 rc = pMachine->GetSnapshot(Bstr(a->argv[2]).raw(), 425 snapshot.asOutParam()); 420 426 if (FAILED(rc) || !snapshot) 421 427 { 422 428 /* then it must be a name */ 423 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]), snapshot.asOutParam())); 429 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]).raw(), 430 snapshot.asOutParam())); 424 431 } 425 432 } … … 439 446 } 440 447 i++; 441 snapshot->COMSETTER(Name)(Bstr(a->argv[i]) );448 snapshot->COMSETTER(Name)(Bstr(a->argv[i]).raw()); 442 449 } 443 450 else if ( !strcmp(a->argv[i], "--description") … … 452 459 } 453 460 i++; 454 snapshot->COMSETTER(Description)(Bstr(a->argv[i]) );461 snapshot->COMSETTER(Description)(Bstr(a->argv[i]).raw()); 455 462 } 456 463 else … … 476 483 477 484 /* assume it's a UUID */ 478 rc = pMachine->GetSnapshot(Bstr(a->argv[2]), snapshot.asOutParam()); 485 rc = pMachine->GetSnapshot(Bstr(a->argv[2]).raw(), 486 snapshot.asOutParam()); 479 487 if (FAILED(rc) || !snapshot) 480 488 { 481 489 /* then it must be a name */ 482 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]), snapshot.asOutParam())); 490 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]).raw(), 491 snapshot.asOutParam())); 483 492 } 484 493 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r31615 r32718 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 164 164 if (!Guid(machineuuid).isEmpty()) 165 165 { 166 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()), 1); 166 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid.raw(), 167 machine.asOutParam()), 1); 167 168 } 168 169 else 169 170 { 170 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1); 171 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 172 machine.asOutParam()), 1); 171 173 machine->COMGETTER(Id)(machineuuid.asOutParam()); 172 174 } … … 200 202 201 203 /* check if the storage controller is present */ 202 rc = machine->GetStorageControllerByName(Bstr(pszCtl), storageCtl.asOutParam()); 204 rc = machine->GetStorageControllerByName(Bstr(pszCtl).raw(), 205 storageCtl.asOutParam()); 203 206 if (FAILED(rc)) 204 207 { … … 226 229 if (!RTStrICmp(pszMedium, "none")) 227 230 { 228 CHECK_ERROR(machine, DetachDevice(Bstr(pszCtl) , port, device));231 CHECK_ERROR(machine, DetachDevice(Bstr(pszCtl).raw(), port, device)); 229 232 } 230 233 else if (!RTStrICmp(pszMedium, "emptydrive")) … … 234 237 ComPtr<IMediumAttachment> mediumAttachment; 235 238 DeviceType_T deviceType = DeviceType_Null; 236 rc = machine->GetMediumAttachment(Bstr(pszCtl), port, device, mediumAttachment.asOutParam()); 239 rc = machine->GetMediumAttachment(Bstr(pszCtl).raw(), port, device, 240 mediumAttachment.asOutParam()); 237 241 if (SUCCEEDED(rc)) 238 242 { … … 243 247 { 244 248 /* just unmount the floppy/dvd */ 245 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl), port, device, Bstr(""), fForceUnmount)); 249 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl).raw(), port, 250 device, Bstr("").raw(), 251 fForceUnmount)); 246 252 } 247 253 } … … 286 292 287 293 /* attach a empty floppy/dvd drive after removing previous attachment */ 288 machine->DetachDevice(Bstr(pszCtl), port, device); 289 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl), port, device, deviceType, NULL)); 294 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 295 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl).raw(), port, device, 296 deviceType, NULL)); 290 297 } 291 298 } … … 319 326 */ 320 327 ComPtr<IMediumAttachment> mediumAttachement; 321 rc = machine->GetMediumAttachment(Bstr(pszCtl), port, device, mediumAttachement.asOutParam()); 328 rc = machine->GetMediumAttachment(Bstr(pszCtl).raw(), port, 329 device, 330 mediumAttachement.asOutParam()); 322 331 if (SUCCEEDED(rc)) 323 332 { … … 328 337 { 329 338 ComPtr<IMedium> dvdMedium; 330 rc = a->virtualBox->FindMedium(Bstr(pszMedium), DeviceType_DVD, dvdMedium.asOutParam()); 339 rc = a->virtualBox->FindMedium(Bstr(pszMedium).raw(), 340 DeviceType_DVD, 341 dvdMedium.asOutParam()); 331 342 if (dvdMedium) 332 343 /* … … 339 350 { 340 351 ComPtr<IMedium> hardDisk; 341 rc = a->virtualBox->FindMedium(Bstr(pszMedium), DeviceType_HardDisk, hardDisk.asOutParam()); 352 rc = a->virtualBox->FindMedium(Bstr(pszMedium).raw(), 353 DeviceType_HardDisk, 354 hardDisk.asOutParam()); 342 355 if (hardDisk) 343 356 /* … … 402 415 403 416 /* check if there is a dvd drive at the given location, if not attach one */ 404 rc = machine->GetMediumAttachment(Bstr(pszCtl), port, device, mediumAttachement.asOutParam()); 417 rc = machine->GetMediumAttachment(Bstr(pszCtl).raw(), port, 418 device, 419 mediumAttachement.asOutParam()); 405 420 if (SUCCEEDED(rc)) 406 421 { … … 410 425 if (deviceType != DeviceType_DVD) 411 426 { 412 machine->DetachDevice(Bstr(pszCtl), port, device); 413 rc = machine->AttachDevice(Bstr(pszCtl), port, device, DeviceType_DVD, NULL); 427 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 428 rc = machine->AttachDevice(Bstr(pszCtl).raw(), port, 429 device, DeviceType_DVD, NULL); 414 430 } 415 431 } 416 432 else 417 433 { 418 rc = machine->AttachDevice(Bstr(pszCtl), port, device, DeviceType_DVD, NULL); 434 rc = machine->AttachDevice(Bstr(pszCtl).raw(), port, 435 device, DeviceType_DVD, NULL); 419 436 } 420 437 } … … 428 445 ComPtr<IHost> host; 429 446 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 430 rc = host->FindHostDVDDrive(Bstr(pszMedium + 5), dvdMedium.asOutParam()); 447 rc = host->FindHostDVDDrive(Bstr(pszMedium + 5).raw(), 448 dvdMedium.asOutParam()); 431 449 if (!dvdMedium) 432 450 { … … 439 457 break; 440 458 } 441 rc = host->FindHostDVDDrive(Bstr(szPathReal), dvdMedium.asOutParam()); 459 rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(), 460 dvdMedium.asOutParam()); 442 461 if (!dvdMedium) 443 462 { … … 450 469 else 451 470 { 452 rc = a->virtualBox->FindMedium(Bstr(pszMedium), DeviceType_DVD, dvdMedium.asOutParam()); 471 rc = a->virtualBox->FindMedium(Bstr(pszMedium).raw(), 472 DeviceType_DVD, 473 dvdMedium.asOutParam()); 453 474 if (FAILED(rc) || !dvdMedium) 454 475 { … … 456 477 Bstr emptyUUID; 457 478 CHECK_ERROR(a->virtualBox, 458 OpenMedium(Bstr(pszMedium) ,479 OpenMedium(Bstr(pszMedium).raw(), 459 480 DeviceType_DVD, 460 481 AccessMode_ReadWrite, … … 473 494 { 474 495 dvdMedium->COMGETTER(Id)(uuid.asOutParam()); 475 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl), port, device, uuid, fForceUnmount)); 496 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl).raw(), port, 497 device, uuid.raw(), 498 fForceUnmount)); 476 499 } 477 500 } … … 482 505 483 506 /* if there is anything attached at the given location, remove it */ 484 machine->DetachDevice(Bstr(pszCtl) , port, device);507 machine->DetachDevice(Bstr(pszCtl).raw(), port, device); 485 508 486 509 /* first guess is that it's a UUID */ 487 510 ComPtr<IMedium> hardDisk; 488 rc = a->virtualBox->FindMedium(Bstr(pszMedium), DeviceType_HardDisk, hardDisk.asOutParam()); 511 rc = a->virtualBox->FindMedium(Bstr(pszMedium).raw(), 512 DeviceType_HardDisk, 513 hardDisk.asOutParam()); 489 514 490 515 /* not successful? Then it must be a filename */ … … 493 518 /* open the new hard disk object */ 494 519 CHECK_ERROR(a->virtualBox, 495 OpenMedium(Bstr(pszMedium) ,520 OpenMedium(Bstr(pszMedium).raw(), 496 521 DeviceType_HardDisk, 497 522 AccessMode_ReadWrite, … … 501 526 if (hardDisk) 502 527 { 503 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl), port, device, DeviceType_HardDisk, hardDisk)); 528 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl).raw(), port, 529 device, DeviceType_HardDisk, 530 hardDisk)); 504 531 } 505 532 else … … 514 541 ComPtr<IMedium> floppyMedium; 515 542 ComPtr<IMediumAttachment> floppyAttachment; 516 machine->GetMediumAttachment(Bstr(pszCtl), port, device, floppyAttachment.asOutParam()); 543 machine->GetMediumAttachment(Bstr(pszCtl).raw(), port, device, 544 floppyAttachment.asOutParam()); 517 545 518 546 if ( !fRunTime 519 547 && !floppyAttachment) 520 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl), port, device, DeviceType_Floppy, NULL)); 548 CHECK_ERROR(machine, AttachDevice(Bstr(pszCtl).raw(), port, 549 device, DeviceType_Floppy, 550 NULL)); 521 551 522 552 /* host drive? */ … … 526 556 527 557 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 528 rc = host->FindHostFloppyDrive(Bstr(pszMedium + 5), floppyMedium.asOutParam()); 558 rc = host->FindHostFloppyDrive(Bstr(pszMedium + 5).raw(), 559 floppyMedium.asOutParam()); 529 560 if (!floppyMedium) 530 561 { … … 536 567 { 537 568 /* first assume it's a UUID */ 538 rc = a->virtualBox->FindMedium(Bstr(pszMedium), DeviceType_Floppy, floppyMedium.asOutParam()); 569 rc = a->virtualBox->FindMedium(Bstr(pszMedium).raw(), 570 DeviceType_Floppy, 571 floppyMedium.asOutParam()); 539 572 if (FAILED(rc) || !floppyMedium) 540 573 { … … 542 575 Bstr emptyUUID; 543 576 CHECK_ERROR(a->virtualBox, 544 OpenMedium(Bstr(pszMedium) ,577 OpenMedium(Bstr(pszMedium).raw(), 545 578 DeviceType_Floppy, 546 579 AccessMode_ReadWrite, … … 558 591 { 559 592 floppyMedium->COMGETTER(Id)(uuid.asOutParam()); 560 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl), port, device, uuid, fForceUnmount)); 593 CHECK_ERROR(machine, MountMedium(Bstr(pszCtl).raw(), port, 594 device, uuid.raw(), 595 fForceUnmount)); 561 596 } 562 597 } … … 573 608 ComPtr<IMediumAttachment> mattach; 574 609 575 CHECK_ERROR(machine, GetMediumAttachment(Bstr(pszCtl), port, device, mattach.asOutParam())); 610 CHECK_ERROR(machine, GetMediumAttachment(Bstr(pszCtl).raw(), port, 611 device, mattach.asOutParam())); 576 612 577 613 if (SUCCEEDED(rc)) … … 579 615 if (!RTStrICmp(pszPassThrough, "on")) 580 616 { 581 CHECK_ERROR(machine, PassthroughDevice(Bstr(pszCtl), port, device, TRUE)); 617 CHECK_ERROR(machine, PassthroughDevice(Bstr(pszCtl).raw(), 618 port, device, TRUE)); 582 619 } 583 620 else if (!RTStrICmp(pszPassThrough, "off")) 584 621 { 585 CHECK_ERROR(machine, PassthroughDevice(Bstr(pszCtl), port, device, FALSE)); 622 CHECK_ERROR(machine, PassthroughDevice(Bstr(pszCtl).raw(), 623 port, device, FALSE)); 586 624 } 587 625 else … … 716 754 if (!Guid(machineuuid).isEmpty()) 717 755 { 718 CHECK_ERROR_RET(a->virtualBox, GetMachine (machineuuid, machine.asOutParam()), 1); 756 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid.raw(), 757 machine.asOutParam()), 1); 719 758 } 720 759 else 721 760 { 722 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1); 761 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 762 machine.asOutParam()), 1); 723 763 machine->COMGETTER(Id)(machineuuid.asOutParam()); 724 764 } … … 743 783 744 784 CHECK_ERROR(machine, 745 GetMediumAttachmentsOfController(Bstr(pszCtl) ,785 GetMediumAttachmentsOfController(Bstr(pszCtl).raw(), 746 786 ComSafeArrayAsOutParam(mediumAttachments))); 747 787 for (size_t i = 0; i < mediumAttachments.size(); ++ i) … … 753 793 CHECK_ERROR(mediumAttach, COMGETTER(Port)(&port)); 754 794 CHECK_ERROR(mediumAttach, COMGETTER(Device)(&device)); 755 CHECK_ERROR(machine, DetachDevice(Bstr(pszCtl) , port, device));795 CHECK_ERROR(machine, DetachDevice(Bstr(pszCtl).raw(), port, device)); 756 796 } 757 797 758 798 if (SUCCEEDED(rc)) 759 CHECK_ERROR(machine, RemoveStorageController(Bstr(pszCtl) ));799 CHECK_ERROR(machine, RemoveStorageController(Bstr(pszCtl).raw())); 760 800 else 761 801 errorArgument("Can't detach the devices connected to '%s' Controller\n" … … 770 810 if (!RTStrICmp(pszBusType, "ide")) 771 811 { 772 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl), StorageBus_IDE, ctl.asOutParam())); 812 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(), 813 StorageBus_IDE, 814 ctl.asOutParam())); 773 815 } 774 816 else if (!RTStrICmp(pszBusType, "sata")) 775 817 { 776 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl), StorageBus_SATA, ctl.asOutParam())); 818 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(), 819 StorageBus_SATA, 820 ctl.asOutParam())); 777 821 } 778 822 else if (!RTStrICmp(pszBusType, "scsi")) 779 823 { 780 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl), StorageBus_SCSI, ctl.asOutParam())); 824 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(), 825 StorageBus_SCSI, 826 ctl.asOutParam())); 781 827 } 782 828 else if (!RTStrICmp(pszBusType, "floppy")) 783 829 { 784 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl), StorageBus_Floppy, ctl.asOutParam())); 830 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(), 831 StorageBus_Floppy, 832 ctl.asOutParam())); 785 833 } 786 834 else if (!RTStrICmp(pszBusType, "sas")) 787 835 { 788 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl), StorageBus_SAS, ctl.asOutParam())); 836 CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(), 837 StorageBus_SAS, 838 ctl.asOutParam())); 789 839 } 790 840 else … … 800 850 ComPtr<IStorageController> ctl; 801 851 802 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl), ctl.asOutParam())); 852 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl).raw(), 853 ctl.asOutParam())); 803 854 804 855 if (SUCCEEDED(rc)) … … 854 905 ComPtr<IStorageController> ctl; 855 906 856 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl), ctl.asOutParam())); 907 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl).raw(), 908 ctl.asOutParam())); 857 909 858 910 if (SUCCEEDED(rc)) … … 873 925 ComPtr<IStorageController> ctl; 874 926 875 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl), ctl.asOutParam())); 927 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl).raw(), 928 ctl.asOutParam())); 876 929 877 930 if (SUCCEEDED(rc)) … … 891 944 ComPtr<IStorageController> ctl; 892 945 893 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl), ctl.asOutParam())); 946 CHECK_ERROR(machine, GetStorageControllerByName(Bstr(pszCtl).raw(), 947 ctl.asOutParam())); 894 948 895 949 if (SUCCEEDED(rc)) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
r31070 r32718 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 122 122 public: 123 123 124 Nullable() : mIsNull 125 Nullable 126 : mIsNull (aIsNull), mValue(aValue) {}124 Nullable() : mIsNull(true) {} 125 Nullable(const T &aValue, bool aIsNull = false) 126 : mIsNull(aIsNull), mValue(aValue) {} 127 127 128 128 bool isNull() const { return mIsNull; }; 129 void setNull 129 void setNull(bool aIsNull = true) { mIsNull = aIsNull; } 130 130 131 131 operator const T&() const { return mValue; } … … 149 149 struct USBFilter 150 150 { 151 USBFilter 152 : mAction 151 USBFilter() 152 : mAction(USBDeviceFilterAction_Null) 153 153 {} 154 154 … … 168 168 enum Action { Invalid, Add, Modify, Remove }; 169 169 170 USBFilterCmd() : mAction (Invalid), mIndex (0), mGlobal(false) {}170 USBFilterCmd() : mAction(Invalid), mIndex(0), mGlobal(false) {} 171 171 172 172 Action mAction; … … 179 179 }; 180 180 181 int handleUSBFilter 181 int handleUSBFilter(HandlerArg *a) 182 182 { 183 183 HRESULT rc = S_OK; … … 198 198 199 199 /* which index? */ 200 if (VINF_SUCCESS != RTStrToUInt32Full 200 if (VINF_SUCCESS != RTStrToUInt32Full(a->argv[1], 10, &cmd.mIndex)) 201 201 return errorSyntax(USAGE_USBFILTER, "Invalid index '%s'", a->argv[1]); 202 202 … … 234 234 { 235 235 /* assume it's a UUID of a machine */ 236 rc = a->virtualBox->GetMachine(Bstr(a->argv[i]), cmd.mMachine.asOutParam()); 236 rc = a->virtualBox->GetMachine(Bstr(a->argv[i]).raw(), 237 cmd.mMachine.asOutParam()); 237 238 if (FAILED(rc) || !cmd.mMachine) 238 239 { 239 240 /* must be a name */ 240 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]), cmd.mMachine.asOutParam()), 1); 241 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]).raw(), 242 cmd.mMachine.asOutParam()), 1); 241 243 } 242 244 } … … 360 362 && !cmd.mMachine) 361 363 || ( cmd.mGlobal 362 && cmd.mFilter.mRemote)364 && !cmd.mFilter.mRemote.isEmpty()) 363 365 ) 364 366 { … … 388 390 { 389 391 /* assume it's a UUID of a machine */ 390 rc = a->virtualBox->GetMachine(Bstr(a->argv[i]), cmd.mMachine.asOutParam()); 392 rc = a->virtualBox->GetMachine(Bstr(a->argv[i]).raw(), 393 cmd.mMachine.asOutParam()); 391 394 if (FAILED(rc) || !cmd.mMachine) 392 395 { 393 396 /* must be a name */ 394 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]), cmd.mMachine.asOutParam()), 1); 397 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]).raw(), 398 cmd.mMachine.asOutParam()), 1); 395 399 } 396 400 } … … 413 417 ComPtr <IUSBController> ctl; 414 418 if (cmd.mGlobal) 415 CHECK_ERROR_RET (a->virtualBox, COMGETTER(Host)(host.asOutParam()), 1);419 CHECK_ERROR_RET(a->virtualBox, COMGETTER(Host)(host.asOutParam()), 1); 416 420 else 417 421 { … … 431 435 { 432 436 ComPtr <IHostUSBDeviceFilter> flt; 433 CHECK_ERROR_BREAK (host, CreateUSBDeviceFilter (f.mName, flt.asOutParam())); 437 CHECK_ERROR_BREAK(host, CreateUSBDeviceFilter(f.mName.raw(), 438 flt.asOutParam())); 434 439 435 440 if (!f.mActive.isNull()) 436 CHECK_ERROR_BREAK (flt, COMSETTER(Active)(f.mActive));441 CHECK_ERROR_BREAK(flt, COMSETTER(Active)(f.mActive)); 437 442 if (!f.mVendorId.isEmpty()) 438 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));443 CHECK_ERROR_BREAK(flt, COMSETTER(VendorId)(f.mVendorId.raw())); 439 444 if (!f.mProductId.isEmpty()) 440 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));445 CHECK_ERROR_BREAK(flt, COMSETTER(ProductId)(f.mProductId.raw())); 441 446 if (!f.mRevision.isEmpty()) 442 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));447 CHECK_ERROR_BREAK(flt, COMSETTER(Revision)(f.mRevision.raw())); 443 448 if (!f.mManufacturer.isEmpty()) 444 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));449 CHECK_ERROR_BREAK(flt, COMSETTER(Manufacturer)(f.mManufacturer.raw())); 445 450 if (!f.mSerialNumber.isEmpty()) 446 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));451 CHECK_ERROR_BREAK(flt, COMSETTER(SerialNumber)(f.mSerialNumber.raw())); 447 452 if (!f.mMaskedInterfaces.isNull()) 448 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces));453 CHECK_ERROR_BREAK(flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces)); 449 454 450 455 if (f.mAction != USBDeviceFilterAction_Null) 451 CHECK_ERROR_BREAK (flt, COMSETTER(Action)(f.mAction));452 453 CHECK_ERROR_BREAK (host, InsertUSBDeviceFilter(cmd.mIndex, flt));456 CHECK_ERROR_BREAK(flt, COMSETTER(Action)(f.mAction)); 457 458 CHECK_ERROR_BREAK(host, InsertUSBDeviceFilter(cmd.mIndex, flt)); 454 459 } 455 460 else 456 461 { 457 462 ComPtr <IUSBDeviceFilter> flt; 458 CHECK_ERROR_BREAK (ctl, CreateDeviceFilter (f.mName, flt.asOutParam())); 463 CHECK_ERROR_BREAK(ctl, CreateDeviceFilter(f.mName.raw(), 464 flt.asOutParam())); 459 465 460 466 if (!f.mActive.isNull()) 461 CHECK_ERROR_BREAK (flt, COMSETTER(Active)(f.mActive));467 CHECK_ERROR_BREAK(flt, COMSETTER(Active)(f.mActive)); 462 468 if (!f.mVendorId.isEmpty()) 463 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));469 CHECK_ERROR_BREAK(flt, COMSETTER(VendorId)(f.mVendorId.raw())); 464 470 if (!f.mProductId.isEmpty()) 465 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));471 CHECK_ERROR_BREAK(flt, COMSETTER(ProductId)(f.mProductId.raw())); 466 472 if (!f.mRevision.isEmpty()) 467 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));473 CHECK_ERROR_BREAK(flt, COMSETTER(Revision)(f.mRevision.raw())); 468 474 if (!f.mManufacturer.isEmpty()) 469 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));475 CHECK_ERROR_BREAK(flt, COMSETTER(Manufacturer)(f.mManufacturer.raw())); 470 476 if (!f.mRemote.isEmpty()) 471 CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote));477 CHECK_ERROR_BREAK(flt, COMSETTER(Remote)(f.mRemote.raw())); 472 478 if (!f.mSerialNumber.isEmpty()) 473 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));479 CHECK_ERROR_BREAK(flt, COMSETTER(SerialNumber)(f.mSerialNumber.raw())); 474 480 if (!f.mMaskedInterfaces.isNull()) 475 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces));476 477 CHECK_ERROR_BREAK (ctl, InsertDeviceFilter(cmd.mIndex, flt));481 CHECK_ERROR_BREAK(flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces)); 482 483 CHECK_ERROR_BREAK(ctl, InsertDeviceFilter(cmd.mIndex, flt)); 478 484 } 479 485 break; … … 484 490 { 485 491 SafeIfaceArray <IHostUSBDeviceFilter> coll; 486 CHECK_ERROR_BREAK (host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll)));492 CHECK_ERROR_BREAK(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll))); 487 493 488 494 ComPtr <IHostUSBDeviceFilter> flt = coll[cmd.mIndex]; 489 495 490 496 if (!f.mName.isEmpty()) 491 CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName));497 CHECK_ERROR_BREAK(flt, COMSETTER(Name)(f.mName.raw())); 492 498 if (!f.mActive.isNull()) 493 CHECK_ERROR_BREAK (flt, COMSETTER(Active)(f.mActive));499 CHECK_ERROR_BREAK(flt, COMSETTER(Active)(f.mActive)); 494 500 if (!f.mVendorId.isEmpty()) 495 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));501 CHECK_ERROR_BREAK(flt, COMSETTER(VendorId)(f.mVendorId.raw())); 496 502 if (!f.mProductId.isEmpty()) 497 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));503 CHECK_ERROR_BREAK(flt, COMSETTER(ProductId)(f.mProductId.raw())); 498 504 if (!f.mRevision.isEmpty()) 499 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));505 CHECK_ERROR_BREAK(flt, COMSETTER(Revision)(f.mRevision.raw())); 500 506 if (!f.mManufacturer.isEmpty()) 501 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));507 CHECK_ERROR_BREAK(flt, COMSETTER(Manufacturer)(f.mManufacturer.raw())); 502 508 if (!f.mSerialNumber.isEmpty()) 503 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));509 CHECK_ERROR_BREAK(flt, COMSETTER(SerialNumber)(f.mSerialNumber.raw())); 504 510 if (!f.mMaskedInterfaces.isNull()) 505 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces));511 CHECK_ERROR_BREAK(flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces)); 506 512 507 513 if (f.mAction != USBDeviceFilterAction_Null) 508 CHECK_ERROR_BREAK (flt, COMSETTER(Action)(f.mAction));514 CHECK_ERROR_BREAK(flt, COMSETTER(Action)(f.mAction)); 509 515 } 510 516 else 511 517 { 512 518 SafeIfaceArray <IUSBDeviceFilter> coll; 513 CHECK_ERROR_BREAK (ctl, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(coll)));519 CHECK_ERROR_BREAK(ctl, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(coll))); 514 520 515 521 ComPtr <IUSBDeviceFilter> flt = coll[cmd.mIndex]; 516 522 517 523 if (!f.mName.isEmpty()) 518 CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName));524 CHECK_ERROR_BREAK(flt, COMSETTER(Name)(f.mName.raw())); 519 525 if (!f.mActive.isNull()) 520 CHECK_ERROR_BREAK (flt, COMSETTER(Active)(f.mActive));526 CHECK_ERROR_BREAK(flt, COMSETTER(Active)(f.mActive)); 521 527 if (!f.mVendorId.isEmpty()) 522 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId));528 CHECK_ERROR_BREAK(flt, COMSETTER(VendorId)(f.mVendorId.raw())); 523 529 if (!f.mProductId.isEmpty()) 524 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId));530 CHECK_ERROR_BREAK(flt, COMSETTER(ProductId)(f.mProductId.raw())); 525 531 if (!f.mRevision.isEmpty()) 526 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision));532 CHECK_ERROR_BREAK(flt, COMSETTER(Revision)(f.mRevision.raw())); 527 533 if (!f.mManufacturer.isEmpty()) 528 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer));534 CHECK_ERROR_BREAK(flt, COMSETTER(Manufacturer)(f.mManufacturer.raw())); 529 535 if (!f.mRemote.isEmpty()) 530 CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote));536 CHECK_ERROR_BREAK(flt, COMSETTER(Remote)(f.mRemote.raw())); 531 537 if (!f.mSerialNumber.isEmpty()) 532 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber));538 CHECK_ERROR_BREAK(flt, COMSETTER(SerialNumber)(f.mSerialNumber.raw())); 533 539 if (!f.mMaskedInterfaces.isNull()) 534 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces));540 CHECK_ERROR_BREAK(flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces)); 535 541 } 536 542 break; … … 541 547 { 542 548 ComPtr <IHostUSBDeviceFilter> flt; 543 CHECK_ERROR_BREAK (host, RemoveUSBDeviceFilter(cmd.mIndex));549 CHECK_ERROR_BREAK(host, RemoveUSBDeviceFilter(cmd.mIndex)); 544 550 } 545 551 else 546 552 { 547 553 ComPtr <IUSBDeviceFilter> flt; 548 CHECK_ERROR_BREAK (ctl, RemoveDeviceFilter(cmd.mIndex, flt.asOutParam()));554 CHECK_ERROR_BREAK(ctl, RemoveDeviceFilter(cmd.mIndex, flt.asOutParam())); 549 555 } 550 556 break; … … 556 562 if (cmd.mMachine) 557 563 { 558 if (SUCCEEDED 564 if (SUCCEEDED(rc)) 559 565 { 560 566 /* commit the session */ … … 565 571 } 566 572 567 return SUCCEEDED 573 return SUCCEEDED(rc) ? 0 : 1; 568 574 } 569 575 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note:
See TracChangeset
for help on using the changeset viewer.