- Timestamp:
- Sep 23, 2010 12:57:52 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r31974 r32718 162 162 { 163 163 Bstr value1; 164 hrc = machine->GetExtraData(Bstr("VRDP/DisconnectOnGuestLogout"), value1.asOutParam()); 164 hrc = machine->GetExtraData(Bstr("VRDP/DisconnectOnGuestLogout").raw(), 165 value1.asOutParam()); 165 166 if (SUCCEEDED(hrc) && value1 == "1") 166 167 { … … 798 799 if (id.isEmpty()) 799 800 { 800 rc = virtualBox->FindMachine(Bstr(name) , m.asOutParam());801 rc = virtualBox->FindMachine(Bstr(name).raw(), m.asOutParam()); 801 802 if (FAILED(rc)) 802 803 { … … 812 813 { 813 814 /* Use the GUID. */ 814 rc = virtualBox->GetMachine(id , m.asOutParam());815 rc = virtualBox->GetMachine(id.raw(), m.asOutParam()); 815 816 if (FAILED(rc)) 816 817 { … … 1054 1055 { 1055 1056 Bstr bstr = vrdpPort; 1056 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Ports)(bstr ));1057 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Ports)(bstr.raw())); 1057 1058 } 1058 1059 /* set VRDP address if requested by the user */ 1059 1060 if (vrdpAddress != NULL) 1060 1061 { 1061 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpAddress) ));1062 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpAddress).raw())); 1062 1063 } 1063 1064 /* enable VRDP server (only if currently disabled) */ -
trunk/src/VBox/Frontends/VBoxHeadless/testcase/tstHeadless.cpp
r31070 r32718 115 115 116 116 // find ID by name 117 CHECK_ERROR_BREAK(virtualBox, FindMachine(Bstr(name), m.asOutParam())); 117 CHECK_ERROR_BREAK(virtualBox, FindMachine(Bstr(name).raw(), 118 m.asOutParam())); 118 119 119 120 if (!strcmp(operation, "on")) … … 122 123 RTPrintf ("Opening a new (remote) session...\n"); 123 124 CHECK_ERROR_BREAK (m, 124 LaunchVMProcess(session, Bstr("vrdp") ,125 LaunchVMProcess(session, Bstr("vrdp").raw(), 125 126 NULL, progress.asOutParam())); 126 127 -
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: */ -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r31698 r32718 291 291 Bstr keyString; 292 292 edcev->COMGETTER(Key)(keyString.asOutParam()); 293 if (keyString && keyString== VBOXSDL_SECURELABEL_EXTRADATA)293 if (keyString == VBOXSDL_SECURELABEL_EXTRADATA) 294 294 { 295 295 /* … … 1342 1342 { 1343 1343 Bstr bstrVMName = vmName; 1344 rc = virtualBox->FindMachine(bstrVMName , pMachine.asOutParam());1344 rc = virtualBox->FindMachine(bstrVMName.raw(), pMachine.asOutParam()); 1345 1345 if ((rc == S_OK) && pMachine) 1346 1346 { … … 1413 1413 Bstr hdaFileBstr = hdaFile; 1414 1414 ComPtr<IMedium> hardDisk; 1415 virtualBox->FindMedium(hdaFileBstr, DeviceType_HardDisk, hardDisk.asOutParam()); 1415 virtualBox->FindMedium(hdaFileBstr.raw(), DeviceType_HardDisk, 1416 hardDisk.asOutParam()); 1416 1417 if (!hardDisk) 1417 1418 { 1418 1419 /* we've not found the image */ 1419 1420 RTPrintf("Adding hard disk '%S'...\n", hdaFile); 1420 virtualBox->OpenMedium(hdaFileBstr, DeviceType_HardDisk, AccessMode_ReadWrite, hardDisk.asOutParam()); 1421 virtualBox->OpenMedium(hdaFileBstr.raw(), DeviceType_HardDisk, 1422 AccessMode_ReadWrite, hardDisk.asOutParam()); 1421 1423 } 1422 1424 /* do we have the right image now? */ … … 1450 1452 { 1451 1453 CHECK_ERROR(storageCtl, COMGETTER(Name)(storageCtlName.asOutParam())); 1452 gMachine->DetachDevice(storageCtlName , 0, 0);1454 gMachine->DetachDevice(storageCtlName.raw(), 0, 0); 1453 1455 } 1454 1456 else 1455 1457 { 1456 1458 storageCtlName = "IDE Controller"; 1457 CHECK_ERROR(gMachine, AddStorageController(storageCtlName ,1458 1459 1459 CHECK_ERROR(gMachine, AddStorageController(storageCtlName.raw(), 1460 StorageBus_IDE, 1461 storageCtl.asOutParam())); 1460 1462 } 1461 1463 } 1462 1464 1463 gMachine->AttachDevice(storageCtlName, 0, 0, DeviceType_HardDisk, hardDisk); 1465 gMachine->AttachDevice(storageCtlName.raw(), 0, 0, 1466 DeviceType_HardDisk, hardDisk); 1464 1467 /// @todo why is this attachment saved? 1465 1468 } … … 1491 1494 ComPtr <IHost> host; 1492 1495 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam())); 1493 rc = host->FindHostFloppyDrive(medium, floppyMedium.asOutParam()); 1496 rc = host->FindHostFloppyDrive(medium.raw(), 1497 floppyMedium.asOutParam()); 1494 1498 if (FAILED(rc)) 1495 1499 { 1496 1500 /* try to find an existing one */ 1497 rc = virtualBox->FindMedium(medium, DeviceType_Floppy, floppyMedium.asOutParam()); 1501 rc = virtualBox->FindMedium(medium.raw(), DeviceType_Floppy, 1502 floppyMedium.asOutParam()); 1498 1503 if (FAILED(rc)) 1499 1504 { … … 1501 1506 RTPrintf("Adding floppy image '%S'...\n", fdaFile); 1502 1507 CHECK_ERROR_BREAK(virtualBox, 1503 OpenMedium(medium, DeviceType_Floppy, AccessMode_ReadWrite, floppyMedium.asOutParam())); 1508 OpenMedium(medium.raw(), 1509 DeviceType_Floppy, 1510 AccessMode_ReadWrite, 1511 floppyMedium.asOutParam())); 1504 1512 } 1505 1513 } … … 1534 1542 1535 1543 CHECK_ERROR(storageCtl, COMGETTER(Name)(storageCtlName.asOutParam())); 1536 rc = gMachine->GetMediumAttachment(storageCtlName, 0, 0, floppyAttachment.asOutParam()); 1544 rc = gMachine->GetMediumAttachment(storageCtlName.raw(), 0, 0, 1545 floppyAttachment.asOutParam()); 1537 1546 if (FAILED(rc)) 1538 CHECK_ERROR(gMachine, AttachDevice(storageCtlName , 0, 0,1547 CHECK_ERROR(gMachine, AttachDevice(storageCtlName.raw(), 0, 0, 1539 1548 DeviceType_Floppy, NULL)); 1540 1549 } … … 1542 1551 { 1543 1552 storageCtlName = "Floppy Controller"; 1544 CHECK_ERROR(gMachine, AddStorageController(storageCtlName ,1553 CHECK_ERROR(gMachine, AddStorageController(storageCtlName.raw(), 1545 1554 StorageBus_Floppy, 1546 1555 storageCtl.asOutParam())); 1547 CHECK_ERROR(gMachine, AttachDevice(storageCtlName , 0, 0,1556 CHECK_ERROR(gMachine, AttachDevice(storageCtlName.raw(), 0, 0, 1548 1557 DeviceType_Floppy, NULL)); 1549 1558 } 1550 1559 } 1551 1560 1552 CHECK_ERROR(gMachine, MountMedium(storageCtlName, 0, 0, id, FALSE /* aForce */)); 1561 CHECK_ERROR(gMachine, MountMedium(storageCtlName.raw(), 0, 0, id.raw(), 1562 FALSE /* aForce */)); 1553 1563 } 1554 1564 while (0); … … 1576 1586 ComPtr <IHost> host; 1577 1587 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam())); 1578 rc = host->FindHostDVDDrive(medium ,dvdMedium.asOutParam());1588 rc = host->FindHostDVDDrive(medium.raw(), dvdMedium.asOutParam()); 1579 1589 if (FAILED(rc)) 1580 1590 { 1581 1591 /* try to find an existing one */ 1582 rc = virtualBox->FindMedium(medium, DeviceType_DVD, dvdMedium.asOutParam()); 1592 rc = virtualBox->FindMedium(medium.raw(), DeviceType_DVD, 1593 dvdMedium.asOutParam()); 1583 1594 if (FAILED(rc)) 1584 1595 { 1585 1596 /* try to add to the list */ 1586 1597 RTPrintf("Adding ISO image '%S'...\n", cdromFile); 1587 CHECK_ERROR_BREAK(virtualBox, OpenMedium(medium, DeviceType_DVD, AccessMode_ReadWrite, dvdMedium.asOutParam())); 1598 CHECK_ERROR_BREAK(virtualBox, OpenMedium(medium.raw(), 1599 DeviceType_DVD, 1600 AccessMode_ReadWrite, 1601 dvdMedium.asOutParam())); 1588 1602 } 1589 1603 } … … 1618 1632 1619 1633 CHECK_ERROR(storageCtl, COMGETTER(Name)(storageCtlName.asOutParam())); 1620 gMachine->DetachDevice(storageCtlName , 1, 0);1621 CHECK_ERROR(gMachine, AttachDevice(storageCtlName , 1, 0,1634 gMachine->DetachDevice(storageCtlName.raw(), 1, 0); 1635 CHECK_ERROR(gMachine, AttachDevice(storageCtlName.raw(), 1, 0, 1622 1636 DeviceType_DVD, NULL)); 1623 1637 } … … 1625 1639 { 1626 1640 storageCtlName = "IDE Controller"; 1627 CHECK_ERROR(gMachine, AddStorageController(storageCtlName ,1641 CHECK_ERROR(gMachine, AddStorageController(storageCtlName.raw(), 1628 1642 StorageBus_IDE, 1629 1643 storageCtl.asOutParam())); 1630 CHECK_ERROR(gMachine, AttachDevice(storageCtlName , 1, 0,1644 CHECK_ERROR(gMachine, AttachDevice(storageCtlName.raw(), 1, 0, 1631 1645 DeviceType_DVD, NULL)); 1632 1646 } 1633 1647 } 1634 1648 1635 CHECK_ERROR(gMachine, MountMedium(storageCtlName, 1, 0, id, FALSE /*aForce */)); 1649 CHECK_ERROR(gMachine, MountMedium(storageCtlName.raw(), 1, 0, id.raw(), 1650 FALSE /*aForce */)); 1636 1651 } 1637 1652 while (0); … … 1799 1814 Bstr key = VBOXSDL_SECURELABEL_EXTRADATA; 1800 1815 Bstr label; 1801 gMachine->GetExtraData(key , label.asOutParam());1816 gMachine->GetExtraData(key.raw(), label.asOutParam()); 1802 1817 Utf8Str labelUtf8 = label; 1803 1818 /* … … 1874 1889 { 1875 1890 Bstr bstr = portVRDP; 1876 rc = gVrdpServer->COMSETTER(Ports)(bstr );1891 rc = gVrdpServer->COMSETTER(Ports)(bstr.raw()); 1877 1892 if (rc != S_OK) 1878 1893 { … … 2626 2641 Bstr key = VBOXSDL_SECURELABEL_EXTRADATA; 2627 2642 Bstr label; 2628 gMachine->GetExtraData(key , label.asOutParam());2643 gMachine->GetExtraData(key.raw(), label.asOutParam()); 2629 2644 Utf8Str labelUtf8 = label; 2630 2645 /* … … 4025 4040 4026 4041 RTStrPrintf(szTitle, sizeof(szTitle), "%s - " VBOX_PRODUCT, 4027 name? Utf8Str(name).c_str() : "<noname>");4042 !name.isEmpty() ? Utf8Str(name).c_str() : "<noname>"); 4028 4043 4029 4044 /* which mode are we in? */ … … 4634 4649 gProgress = NULL; 4635 4650 HRESULT rc; 4636 CHECK_ERROR(gConsole, TakeSnapshot(Bstr(pszSnapshotName), Bstr("Taken by VBoxSDL"), 4651 CHECK_ERROR(gConsole, TakeSnapshot(Bstr(pszSnapshotName).raw(), 4652 Bstr("Taken by VBoxSDL").raw(), 4637 4653 gProgress.asOutParam())); 4638 4654 if (FAILED(rc)) -
trunk/src/VBox/Main/ApplianceImpl.cpp
r32448 r32718 591 591 int i = 1; 592 592 /* @todo: Maybe too cost-intensive; try to find a lighter way */ 593 while (mVirtualBox->FindMachine(Bstr(tmpName) , &machine) != VBOX_E_OBJECT_NOT_FOUND)593 while (mVirtualBox->FindMachine(Bstr(tmpName).raw(), &machine) != VBOX_E_OBJECT_NOT_FOUND) 594 594 { 595 595 RTStrFree(tmpName); … … 612 612 /* @todo: Maybe too cost-intensive; try to find a lighter way */ 613 613 while ( RTPathExists(tmpName) 614 || mVirtualBox->FindMedium(Bstr(tmpName) , DeviceType_HardDisk, &harddisk) != VBOX_E_OBJECT_NOT_FOUND614 || mVirtualBox->FindMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, &harddisk) != VBOX_E_OBJECT_NOT_FOUND 615 615 ) 616 616 { … … 694 694 rc = pProgressAsync->COMGETTER(OperationWeight(¤tWeight)); 695 695 if (FAILED(rc)) throw rc; 696 rc = pProgressThis->SetNextOperation(bstr , currentWeight);696 rc = pProgressThis->SetNextOperation(bstr.raw(), currentWeight); 697 697 if (FAILED(rc)) throw rc; 698 698 ++cOp; … … 903 903 904 904 rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 905 bstrDescription ,905 bstrDescription.raw(), 906 906 TRUE /* aCancelable */, 907 907 cOperations, // ULONG cOperations, 908 908 ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight, 909 bstrDescription , // CBSTR bstrFirstOperationDescription,909 bstrDescription.raw(), // CBSTR bstrFirstOperationDescription, 910 910 m->ulWeightForXmlOperation); // ULONG ulFirstOperationWeight, 911 911 return rc; -
trunk/src/VBox/Main/ApplianceImplExport.cpp
r32448 r32718 289 289 if (FAILED(rc)) throw rc; 290 290 291 rc = GetStorageControllerByName(controllerName , ctl.asOutParam());291 rc = GetStorageControllerByName(controllerName.raw(), ctl.asOutParam()); 292 292 if (FAILED(rc)) throw rc; 293 293 … … 1502 1502 1503 1503 Log(("Finding source disk \"%ls\"\n", bstrSrcFilePath.raw())); 1504 rc = mVirtualBox->FindMedium(bstrSrcFilePath , DeviceType_HardDisk, pSourceDisk.asOutParam());1504 rc = mVirtualBox->FindMedium(bstrSrcFilePath.raw(), DeviceType_HardDisk, pSourceDisk.asOutParam()); 1505 1505 if (FAILED(rc)) throw rc; 1506 1506 … … 1523 1523 // create a new hard disk interface for the destination disk image 1524 1524 Log(("Creating target disk \"%s\"\n", strTargetFilePath.c_str())); 1525 rc = mVirtualBox->CreateHardDisk(bstrSrcFormat ,1526 Bstr(strTargetFilePath) ,1525 rc = mVirtualBox->CreateHardDisk(bstrSrcFormat.raw(), 1526 Bstr(strTargetFilePath).raw(), 1527 1527 pTargetDisk.asOutParam()); 1528 1528 if (FAILED(rc)) throw rc; … … 1537 1537 1538 1538 // advance to the next operation 1539 pTask->pProgress->SetNextOperation(BstrFmt(tr("Exporting to disk image '%s'"), RTPathFilename(strTargetFilePath.c_str())) ,1539 pTask->pProgress->SetNextOperation(BstrFmt(tr("Exporting to disk image '%s'"), RTPathFilename(strTargetFilePath.c_str())).raw(), 1540 1540 pDiskEntry->ulSizeMB); // operation's weight, as set up with the IProgress originally); 1541 1541 … … 1623 1623 Utf8Str strMfFile = manifestFileName(pTask->locInfo.strPath.c_str()); 1624 1624 const char *pcszManifestFileOnly = RTPathFilename(strMfFile.c_str()); 1625 pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), pcszManifestFileOnly) ,1625 pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), pcszManifestFileOnly).raw(), 1626 1626 m->ulWeightForManifestOperation); // operation's weight, as set up with the IProgress originally); 1627 1627 … … 1767 1767 for (list<Utf8Str>::const_iterator it1 = filesList.begin(); it1 != filesList.end(); ++it1, ++i) 1768 1768 paFiles[i] = (*it1).c_str(); 1769 pTask->pProgress->SetNextOperation(BstrFmt(tr("Packing into '%s'"), RTPathFilename(pTask->locInfo.strPath.c_str())) , ulWeight);1769 pTask->pProgress->SetNextOperation(BstrFmt(tr("Packing into '%s'"), RTPathFilename(pTask->locInfo.strPath.c_str())).raw(), ulWeight); 1770 1770 /* Create the tar file out of our file list. */ 1771 1771 vrc = RTTarCreate(pTask->locInfo.strPath.c_str(), paFiles, filesList.size(), pTask->updateProgress, &pTask); … … 1930 1930 char *pszFilename = RTPathFilename(s.first.c_str()); 1931 1931 /* Advance to the next operation */ 1932 pTask->pProgress->SetNextOperation(BstrFmt(tr("Uploading file '%s'"), pszFilename) , s.second);1932 pTask->pProgress->SetNextOperation(BstrFmt(tr("Uploading file '%s'"), pszFilename).raw(), s.second); 1933 1933 vrc = RTS3PutKey(hS3, bucket.c_str(), pszFilename, s.first.c_str()); 1934 1934 if (RT_FAILURE(vrc)) -
trunk/src/VBox/Main/ApplianceImplImport.cpp
r32571 r32718 235 235 /* Now that we know the OS type, get our internal defaults based on that. */ 236 236 ComPtr<IGuestOSType> pGuestOSType; 237 rc = mVirtualBox->GetGuestOSType(Bstr(strOsTypeVBox) , pGuestOSType.asOutParam());237 rc = mVirtualBox->GetGuestOSType(Bstr(strOsTypeVBox).raw(), pGuestOSType.asOutParam()); 238 238 if (FAILED(rc)) throw rc; 239 239 … … 625 625 /* 1 operation only */ 626 626 rc = aProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 627 bstrDesc ,627 bstrDesc.raw(), 628 628 TRUE /* aCancelable */); 629 629 else 630 630 /* 4/5 is downloading, 1/5 is reading */ 631 631 rc = aProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 632 bstrDesc ,632 bstrDesc.raw(), 633 633 TRUE /* aCancelable */, 634 634 2, // ULONG cOperations, 635 635 5, // ULONG ulTotalOperationsWeight, 636 636 BstrFmt(tr("Download appliance '%s'"), 637 aLocInfo.strPath.c_str()) , // CBSTR bstrFirstOperationDescription,637 aLocInfo.strPath.c_str()).raw(), // CBSTR bstrFirstOperationDescription, 638 638 4); // ULONG ulFirstOperationWeight, 639 639 if (FAILED(rc)) throw rc; … … 859 859 hS3 = NIL_RTS3; 860 860 861 pTask->pProgress->SetNextOperation(Bstr(tr("Reading")) , 1);861 pTask->pProgress->SetNextOperation(Bstr(tr("Reading")).raw(), 1); 862 862 863 863 /* Prepare the temporary reading of the OVF */ … … 1083 1083 { 1084 1084 const char *pcszManifestFileOnly = RTPathFilename(strManifestFile.c_str()); 1085 pProgress->SetNextOperation(BstrFmt(tr("Verifying manifest file '%s'"), pcszManifestFileOnly) ,1085 pProgress->SetNextOperation(BstrFmt(tr("Verifying manifest file '%s'"), pcszManifestFileOnly).raw(), 1086 1086 m->ulWeightForManifestOperation); // operation's weight, as set up with the IProgress originally 1087 1087 … … 1329 1329 Bstr bstrGuid = guid.toUtf16(); 1330 1330 ComPtr<IMachine> failedMachine; 1331 HRESULT rc2 = mVirtualBox->GetMachine(bstrGuid , failedMachine.asOutParam());1331 HRESULT rc2 = mVirtualBox->GetMachine(bstrGuid.raw(), failedMachine.asOutParam()); 1332 1332 if (SUCCEEDED(rc2)) 1333 1333 { … … 1428 1428 paFiles[i] = RTPathFilename((*it1).first.c_str()); 1429 1429 if (!pTask->pProgress.isNull()) 1430 pTask->pProgress->SetNextOperation(BstrFmt(tr("Unpacking file '%s'"), RTPathFilename(pTask->locInfo.strPath.c_str())) , ulWeight);1430 pTask->pProgress->SetNextOperation(BstrFmt(tr("Unpacking file '%s'"), RTPathFilename(pTask->locInfo.strPath.c_str())).raw(), ulWeight); 1431 1431 vrc = RTTarExtractFiles(pTask->locInfo.strPath.c_str(), pszTmpDir, paFiles, filesList.size(), pTask->updateProgress, &pTask); 1432 1432 if (RT_FAILURE(vrc)) … … 1551 1551 srcFormat = L"VMDK"; 1552 1552 // create an empty hard disk 1553 rc = mVirtualBox->CreateHardDisk(srcFormat ,1554 Bstr(strTargetPath) ,1553 rc = mVirtualBox->CreateHardDisk(srcFormat.raw(), 1554 Bstr(strTargetPath).raw(), 1555 1555 pTargetHD.asOutParam()); 1556 1556 if (FAILED(rc)) throw rc; … … 1561 1561 1562 1562 // advance to the next operation 1563 stack.pProgress->SetNextOperation(BstrFmt(tr("Creating disk image '%s'"), strTargetPath.c_str()) ,1563 stack.pProgress->SetNextOperation(BstrFmt(tr("Creating disk image '%s'"), strTargetPath.c_str()).raw(), 1564 1564 di.ulSuggestedSizeMB); // operation's weight, as set up with the IProgress originally 1565 1565 } … … 1579 1579 1580 1580 // First open the existing disk image 1581 rc = mVirtualBox->OpenMedium(Bstr(strSrcFilePath) ,1581 rc = mVirtualBox->OpenMedium(Bstr(strSrcFilePath).raw(), 1582 1582 DeviceType_HardDisk, 1583 1583 AccessMode_ReadOnly, … … 1591 1591 if (FAILED(rc)) throw rc; 1592 1592 /* Create a new hard disk interface for the destination disk image */ 1593 rc = mVirtualBox->CreateHardDisk(srcFormat ,1594 Bstr(strTargetPath) ,1593 rc = mVirtualBox->CreateHardDisk(srcFormat.raw(), 1594 Bstr(strTargetPath).raw(), 1595 1595 pTargetHD.asOutParam()); 1596 1596 if (FAILED(rc)) throw rc; … … 1600 1600 1601 1601 /* Advance to the next operation */ 1602 stack.pProgress->SetNextOperation(BstrFmt(tr("Importing virtual disk image '%s'"), RTPathFilename(strSrcFilePath.c_str())) ,1602 stack.pProgress->SetNextOperation(BstrFmt(tr("Importing virtual disk image '%s'"), RTPathFilename(strSrcFilePath.c_str())).raw(), 1603 1603 di.ulSuggestedSizeMB); // operation's weight, as set up with the IProgress originally); 1604 1604 } … … 1648 1648 // can use recommended defaults for the new machine where OVF doesen't provice any 1649 1649 ComPtr<IGuestOSType> osType; 1650 rc = mVirtualBox->GetGuestOSType(Bstr(stack.strOsTypeVBox) , osType.asOutParam());1650 rc = mVirtualBox->GetGuestOSType(Bstr(stack.strOsTypeVBox).raw(), osType.asOutParam()); 1651 1651 if (FAILED(rc)) throw rc; 1652 1652 1653 1653 /* Create the machine */ 1654 rc = mVirtualBox->CreateMachine(Bstr(stack.strNameVBox) ,1655 Bstr(stack.strOsTypeVBox) ,1654 rc = mVirtualBox->CreateMachine(Bstr(stack.strNameVBox).raw(), 1655 Bstr(stack.strOsTypeVBox).raw(), 1656 1656 NULL, 1657 1657 NULL, … … 1663 1663 if (!stack.strDescription.isEmpty()) 1664 1664 { 1665 rc = pNewMachine->COMSETTER(Description)(Bstr(stack.strDescription) );1665 rc = pNewMachine->COMSETTER(Description)(Bstr(stack.strDescription).raw()); 1666 1666 if (FAILED(rc)) throw rc; 1667 1667 } … … 1799 1799 if (FAILED(rc)) throw rc; 1800 1800 /* Set the interface name to attach to */ 1801 pNetworkAdapter->COMSETTER(HostInterface)(name );1801 pNetworkAdapter->COMSETTER(HostInterface)(name.raw()); 1802 1802 if (FAILED(rc)) throw rc; 1803 1803 break; … … 1832 1832 if (FAILED(rc)) throw rc; 1833 1833 /* Set the interface name to attach to */ 1834 pNetworkAdapter->COMSETTER(HostInterface)(name );1834 pNetworkAdapter->COMSETTER(HostInterface)(name.raw()); 1835 1835 if (FAILED(rc)) throw rc; 1836 1836 break; … … 1853 1853 // one or two IDE controllers present in OVF: add one VirtualBox controller 1854 1854 ComPtr<IStorageController> pController; 1855 rc = pNewMachine->AddStorageController(Bstr("IDE Controller") , StorageBus_IDE, pController.asOutParam());1855 rc = pNewMachine->AddStorageController(Bstr("IDE Controller").raw(), StorageBus_IDE, pController.asOutParam()); 1856 1856 if (FAILED(rc)) throw rc; 1857 1857 … … 1881 1881 if (hdcVBox == "AHCI") 1882 1882 { 1883 rc = pNewMachine->AddStorageController(Bstr("SATA Controller") , StorageBus_SATA, pController.asOutParam());1883 rc = pNewMachine->AddStorageController(Bstr("SATA Controller").raw(), StorageBus_SATA, pController.asOutParam()); 1884 1884 if (FAILED(rc)) throw rc; 1885 1885 } … … 1918 1918 hdcVBox.c_str()); 1919 1919 1920 rc = pNewMachine->AddStorageController(bstrName , busType, pController.asOutParam());1920 rc = pNewMachine->AddStorageController(bstrName.raw(), busType, pController.asOutParam()); 1921 1921 if (FAILED(rc)) throw rc; 1922 1922 rc = pController->COMSETTER(ControllerType)(controllerType); … … 1932 1932 { 1933 1933 ComPtr<IStorageController> pController; 1934 rc = pNewMachine->AddStorageController(Bstr(L"SAS Controller") , StorageBus_SAS, pController.asOutParam());1934 rc = pNewMachine->AddStorageController(Bstr(L"SAS Controller").raw(), StorageBus_SAS, pController.asOutParam()); 1935 1935 if (FAILED(rc)) throw rc; 1936 1936 rc = pController->COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas); … … 1977 1977 { 1978 1978 ComPtr<IStorageController> pController; 1979 rc = sMachine->AddStorageController(Bstr("Floppy Controller") , StorageBus_Floppy, pController.asOutParam());1979 rc = sMachine->AddStorageController(Bstr("Floppy Controller").raw(), StorageBus_Floppy, pController.asOutParam()); 1980 1980 if (FAILED(rc)) throw rc; 1981 1981 … … 1993 1993 Log(("Attaching floppy\n")); 1994 1994 1995 rc = sMachine->AttachDevice(mhda.controllerType ,1995 rc = sMachine->AttachDevice(mhda.controllerType.raw(), 1996 1996 mhda.lControllerPort, 1997 1997 mhda.lDevice, … … 2041 2041 Log(("Attaching CD-ROM to port %d on device %d\n", mhda.lControllerPort, mhda.lDevice)); 2042 2042 2043 rc = sMachine->AttachDevice(mhda.controllerType ,2043 rc = sMachine->AttachDevice(mhda.controllerType.raw(), 2044 2044 mhda.lControllerPort, 2045 2045 mhda.lDevice, … … 2130 2130 Log(("Attaching disk %s to port %d on device %d\n", vsdeHD->strVboxCurrent.c_str(), mhda.lControllerPort, mhda.lDevice)); 2131 2131 2132 rc = sMachine->AttachDevice(mhda.controllerType , // wstring name2132 rc = sMachine->AttachDevice(mhda.controllerType.raw(), // wstring name 2133 2133 mhda.lControllerPort, // long controllerPort 2134 2134 mhda.lDevice, // long device … … 2439 2439 /* Advance to the next operation */ 2440 2440 if (!pTask->pProgress.isNull()) 2441 pTask->pProgress->SetNextOperation(BstrFmt(tr("Downloading file '%s'"), pszFilename) , s.second);2441 pTask->pProgress->SetNextOperation(BstrFmt(tr("Downloading file '%s'"), pszFilename).raw(), s.second); 2442 2442 2443 2443 vrc = RTS3GetKey(hS3, bucket.c_str(), pszFilename, strSrcFile.c_str()); … … 2469 2469 char *pszFilename = RTPathFilename(strManifestFile.c_str()); 2470 2470 if (!pTask->pProgress.isNull()) 2471 pTask->pProgress->SetNextOperation(BstrFmt(tr("Downloading file '%s'"), pszFilename) , 1);2471 pTask->pProgress->SetNextOperation(BstrFmt(tr("Downloading file '%s'"), pszFilename).raw(), 1); 2472 2472 2473 2473 /* Try to download it. If the error is VERR_S3_NOT_FOUND, it isn't fatal. */ … … 2496 2496 hS3 = NIL_RTS3; 2497 2497 2498 pTask->pProgress->SetNextOperation(BstrFmt(tr("Importing appliance")) , m->ulWeightForXmlOperation);2498 pTask->pProgress->SetNextOperation(BstrFmt(tr("Importing appliance")).raw(), m->ulWeightForXmlOperation); 2499 2499 2500 2500 ComObjPtr<Progress> progress; -
trunk/src/VBox/Main/ConsoleImpl.cpp
r32403 r32718 611 611 { 612 612 Bstr value; 613 HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableGuestPropertiesVRDP"), value.asOutParam()); 613 HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableGuestPropertiesVRDP").raw(), 614 value.asOutParam()); 614 615 if (hrc == S_OK) 615 616 { … … 631 632 int rc; 632 633 char *pszPropertyName; 634 Bstr bstrReadOnlyGuest(L"RDONLYGUEST"); 633 635 634 636 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%u/Name", u32ClientId); … … 638 640 mRemoteDisplayInfo->COMGETTER(ClientName)(clientName.asOutParam()); 639 641 640 mMachine->SetGuestProperty(Bstr(pszPropertyName), clientName, Bstr("RDONLYGUEST")); 642 mMachine->SetGuestProperty(Bstr(pszPropertyName).raw(), 643 clientName.raw(), 644 bstrReadOnlyGuest.raw()); 641 645 RTStrFree(pszPropertyName); 642 646 } … … 645 649 if (RT_SUCCESS(rc)) 646 650 { 647 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(pszUser), Bstr("RDONLYGUEST")); 651 mMachine->SetGuestProperty(Bstr(pszPropertyName).raw(), 652 Bstr(pszUser).raw(), 653 bstrReadOnlyGuest.raw()); 648 654 RTStrFree(pszPropertyName); 649 655 } … … 652 658 if (RT_SUCCESS(rc)) 653 659 { 654 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(pszDomain), Bstr("RDONLYGUEST")); 660 mMachine->SetGuestProperty(Bstr(pszPropertyName).raw(), 661 Bstr(pszDomain).raw(), 662 bstrReadOnlyGuest.raw()); 655 663 RTStrFree(pszPropertyName); 656 664 } … … 660 668 if (RT_SUCCESS(rc)) 661 669 { 662 mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastConnectedClient"), Bstr(pszClientId), Bstr("RDONLYGUEST")); 670 mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastConnectedClient").raw(), 671 Bstr(pszClientId).raw(), 672 bstrReadOnlyGuest.raw()); 663 673 RTStrFree(pszClientId); 664 674 } … … 680 690 if (RT_SUCCESS(rc)) 681 691 { 682 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), bstrReadOnlyGuest); 692 mMachine->SetGuestProperty(Bstr(pszPropertyName).raw(), Bstr("").raw(), 693 bstrReadOnlyGuest.raw()); 683 694 RTStrFree(pszPropertyName); 684 695 } … … 687 698 if (RT_SUCCESS(rc)) 688 699 { 689 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), bstrReadOnlyGuest); 700 mMachine->SetGuestProperty(Bstr(pszPropertyName).raw(), Bstr("").raw(), 701 bstrReadOnlyGuest.raw()); 690 702 RTStrFree(pszPropertyName); 691 703 } … … 694 706 if (RT_SUCCESS(rc)) 695 707 { 696 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), bstrReadOnlyGuest); 708 mMachine->SetGuestProperty(Bstr(pszPropertyName).raw(), Bstr("").raw(), 709 bstrReadOnlyGuest.raw()); 697 710 RTStrFree(pszPropertyName); 698 711 } … … 702 715 if (RT_SUCCESS(rc)) 703 716 { 704 mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId), bstrReadOnlyGuest); 717 mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient").raw(), 718 Bstr(pszClientId).raw(), 719 bstrReadOnlyGuest.raw()); 705 720 RTStrFree(pszClientId); 706 721 } … … 908 923 909 924 Bstr value; 910 hrc = mMachine->GetExtraData(Bstr("VRDP/ProvideGuestCredentials"), value.asOutParam()); 925 hrc = mMachine->GetExtraData(Bstr("VRDP/ProvideGuestCredentials").raw(), 926 value.asOutParam()); 911 927 if (SUCCEEDED(hrc) && value == "1") 912 928 { … … 916 932 Bstr flags; 917 933 918 hrc = getGuestProperty(Bstr("/VirtualBox/GuestInfo/OS/NoLoggedInUsers") ,934 hrc = getGuestProperty(Bstr("/VirtualBox/GuestInfo/OS/NoLoggedInUsers").raw(), 919 935 noLoggedInUsersValue.asOutParam(), &ul64Timestamp, flags.asOutParam()); 920 936 … … 1296 1312 ComObjPtr<SharedFolder> sharedFolder; 1297 1313 sharedFolder.createObject(); 1298 HRESULT rc = sharedFolder->init(this, name, hostPath, writable, autoMount); 1314 HRESULT rc = sharedFolder->init(this, name.raw(), hostPath.raw(), 1315 writable, autoMount); 1299 1316 AssertComRCReturn(rc, VERR_INTERNAL_ERROR); 1300 1317 … … 1332 1349 Bstr flags(pCBData->pcszFlags); 1333 1350 ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension); 1334 HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name ,1335 value ,1351 HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name.raw(), 1352 value.raw(), 1336 1353 pCBData->u64Timestamp, 1337 flags );1354 flags.raw()); 1338 1355 if (SUCCEEDED(hrc)) 1339 1356 rc = VINF_SUCCESS; … … 1717 1734 progress.createObject(); 1718 1735 progress->init(static_cast<IConsole *>(this), 1719 Bstr(tr("Stopping virtual machine")) ,1736 Bstr(tr("Stopping virtual machine")).raw(), 1720 1737 FALSE /* aCancelable */); 1721 1738 … … 2297 2314 progress.createObject(); 2298 2315 progress->init(static_cast<IConsole *>(this), 2299 Bstr(tr("Saving the execution state of the virtual machine")) ,2316 Bstr(tr("Saving the execution state of the virtual machine")).raw(), 2300 2317 FALSE /* aCancelable */); 2301 2318 … … 2897 2914 pProgress.createObject(); 2898 2915 rc = pProgress->init(static_cast<IConsole*>(this), 2899 Bstr(tr("Taking a snapshot of the virtual machine")) ,2916 Bstr(tr("Taking a snapshot of the virtual machine")).raw(), 2900 2917 mMachineState == MachineState_Running /* aCancelable */, 2901 2918 cOperations, 2902 2919 ulTotalOperationsWeight, 2903 Bstr(tr("Setting up snapshot operation")) , // first sub-op description2920 Bstr(tr("Setting up snapshot operation")).raw(), // first sub-op description 2904 2921 1); // ulFirstOperationWeight 2905 2922 … … 5217 5234 rc = mMachine->COMGETTER(StateFilePath)(savedStateFile.asOutParam()); 5218 5235 if (FAILED(rc)) return rc; 5219 ComAssertRet(! !savedStateFile, E_FAIL);5236 ComAssertRet(!savedStateFile.isEmpty(), E_FAIL); 5220 5237 int vrc = SSMR3ValidateFile(Utf8Str(savedStateFile).c_str(), false /* fChecksumIt */); 5221 5238 if (RT_FAILURE(vrc)) … … 5258 5275 || (!fTeleporterEnabled && !fFaultToleranceSyncEnabled)) 5259 5276 rc = powerupProgress->init(static_cast<IConsole *>(this), 5260 progressDesc ,5277 progressDesc.raw(), 5261 5278 FALSE /* aCancelable */); 5262 5279 else 5263 5280 if (fTeleporterEnabled) 5264 5281 rc = powerupProgress->init(static_cast<IConsole *>(this), 5265 progressDesc ,5282 progressDesc.raw(), 5266 5283 TRUE /* aCancelable */, 5267 5284 3 /* cOperations */, 5268 5285 10 /* ulTotalOperationsWeight */, 5269 Bstr(tr("Teleporting virtual machine")) ,5286 Bstr(tr("Teleporting virtual machine")).raw(), 5270 5287 1 /* ulFirstOperationWeight */, 5271 5288 NULL); … … 5273 5290 if (fFaultToleranceSyncEnabled) 5274 5291 rc = powerupProgress->init(static_cast<IConsole *>(this), 5275 progressDesc ,5292 progressDesc.raw(), 5276 5293 TRUE /* aCancelable */, 5277 5294 3 /* cOperations */, 5278 5295 10 /* ulTotalOperationsWeight */, 5279 Bstr(tr("Fault Tolerance syncing of remote virtual machine")) ,5296 Bstr(tr("Fault Tolerance syncing of remote virtual machine")).raw(), 5280 5297 1 /* ulFirstOperationWeight */, 5281 5298 NULL); … … 5449 5466 progresses.push_back(ComPtr<IProgress> (powerupProgress)); 5450 5467 rc = progress->init(static_cast<IConsole *>(this), 5451 progressDesc , progresses.begin(),5468 progressDesc.raw(), progresses.begin(), 5452 5469 progresses.end()); 5453 5470 AssertComRCReturnRC(rc); … … 5943 5960 mGlobalSharedFolders.find(name) != 5944 5961 mGlobalSharedFolders.end()) 5945 rc = removeSharedFolder(name );5962 rc = removeSharedFolder(name.raw()); 5946 5963 /* create the new machine folder */ 5947 rc = createSharedFolder(name, SharedFolderData(hostPath, writable, autoMount)); 5964 rc = createSharedFolder(name.raw(), 5965 SharedFolderData(hostPath, 5966 writable, 5967 autoMount)); 5948 5968 } 5949 5969 } … … 5970 5990 { 5971 5991 /* remove the outdated machine folder */ 5972 rc = removeSharedFolder(it->first );5992 rc = removeSharedFolder(it->first.raw()); 5973 5993 /* create the global folder if there is any */ 5974 5994 SharedFolderDataMap::const_iterator git = 5975 5995 mGlobalSharedFolders.find(it->first); 5976 5996 if (git != mGlobalSharedFolders.end()) 5977 rc = createSharedFolder(git->first , git->second);5997 rc = createSharedFolder(git->first.raw(), git->second); 5978 5998 } 5979 5999 } … … 6027 6047 { 6028 6048 ComAssertRet(aName && *aName, E_FAIL); 6029 ComAssertRet( aData.mHostPath, E_FAIL);6049 ComAssertRet(!aData.mHostPath.isEmpty(), E_FAIL); 6030 6050 6031 6051 /* sanity checks */ … … 6039 6059 Log(("Adding shared folder '%ls' -> '%ls'\n", aName, aData.mHostPath.raw())); 6040 6060 6041 cbString = (RTUtf16Len(aData.mHostPath ) + 1) * sizeof(RTUTF16);6061 cbString = (RTUtf16Len(aData.mHostPath.raw()) + 1) * sizeof(RTUTF16); 6042 6062 if (cbString >= UINT16_MAX) 6043 6063 return setError(E_INVALIDARG, tr("The name is too long")); 6044 6064 pFolderName = (SHFLSTRING *) RTMemAllocZ(sizeof(SHFLSTRING) + cbString); 6045 6065 Assert(pFolderName); 6046 memcpy(pFolderName->String.ucs2, aData.mHostPath , cbString);6066 memcpy(pFolderName->String.ucs2, aData.mHostPath.raw(), cbString); 6047 6067 6048 6068 pFolderName->u16Size = (uint16_t)cbString; … … 7052 7072 fFatal, pszErrorId, message.c_str())); 7053 7073 7054 that->onRuntimeError(BOOL(fFatal), Bstr(pszErrorId), Bstr(message)); 7074 that->onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), 7075 Bstr(message).raw()); 7055 7076 7056 7077 LogFlowFuncLeave(); … … 7271 7292 Bstr uuid; 7272 7293 device->COMGETTER(Id)(uuid.asOutParam()); 7273 onUSBDeviceDetach(uuid , NULL);7294 onUSBDeviceDetach(uuid.raw(), NULL); 7274 7295 } 7275 7296 … … 7485 7506 ++ it) 7486 7507 { 7487 rc = console->createSharedFolder((*it).first, (*it).second); 7508 rc = console->createSharedFolder((*it).first.raw(), 7509 (*it).second); 7488 7510 if (FAILED(rc)) break; 7489 7511 } … … 7843 7865 */ 7844 7866 rc = that->mControl->BeginTakingSnapshot(that, 7845 pTask->bstrName ,7846 pTask->bstrDescription ,7867 pTask->bstrName.raw(), 7868 pTask->bstrDescription.raw(), 7847 7869 pTask->mProgress, 7848 7870 pTask->fTakingSnapshotOnline, … … 7873 7895 Utf8Str strSavedStateFile(pTask->bstrSavedStateFile); 7874 7896 7875 pTask->mProgress->SetNextOperation(Bstr(tr("Saving the machine state")) ,7897 pTask->mProgress->SetNextOperation(Bstr(tr("Saving the machine state")).raw(), 7876 7898 pTask->ulMemSize); // operation weight, same as computed when setting up progress object 7877 7899 pTask->mProgress->setCancelCallback(takesnapshotProgressCancelCallback, that->mpVM); … … 7899 7921 LogFlowFunc(("Reattaching new differencing hard disks...\n")); 7900 7922 7901 pTask->mProgress->SetNextOperation(Bstr(tr("Reconfiguring medium attachments")) ,7923 pTask->mProgress->SetNextOperation(Bstr(tr("Reconfiguring medium attachments")).raw(), 7902 7924 1); // operation weight, same as computed when setting up progress object 7903 7925 … … 7927 7949 throw rc; 7928 7950 7929 rc = that->mMachine->GetStorageControllerByName(controllerName, controller.asOutParam()); 7951 rc = that->mMachine->GetStorageControllerByName(controllerName.raw(), 7952 controller.asOutParam()); 7930 7953 if (FAILED(rc)) 7931 7954 throw rc; -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r32672 r32718 231 231 Bstr aFilePath, empty; 232 232 233 rc = vbox->CheckFirmwarePresent(aFirmwareType, empty ,233 rc = vbox->CheckFirmwarePresent(aFirmwareType, empty.raw(), 234 234 empty.asOutParam(), aFilePath.asOutParam(), &fPresent); 235 235 if (RT_FAILURE(rc)) … … 251 251 * The extra data takes precedence (if non-zero). 252 252 */ 253 HRESULT hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/SmcDeviceKey"), aKey); 253 HRESULT hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/SmcDeviceKey").raw(), 254 aKey); 254 255 if (FAILED(hrc)) 255 256 return Global::vboxStatusCodeFromCOM(hrc); … … 555 556 556 557 ComPtr<IGuestOSType> guestOSType; 557 hrc = virtualBox->GetGuestOSType(osTypeId , guestOSType.asOutParam());H();558 hrc = virtualBox->GetGuestOSType(osTypeId.raw(), guestOSType.asOutParam()); H(); 558 559 559 560 Bstr guestTypeFamilyId; … … 659 660 - With more than one virtual CPU, raw-mode isn't a fallback option. */ 660 661 fHwVirtExtForced = fHWVirtExEnabled 661 && ( cbRam > (_4G - cbRamHole)662 && ( cbRam + cbRamHole > _4G 662 663 || cCpus > 1); 663 664 # endif … … 1046 1047 Bstr logoImagePath; 1047 1048 hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam()); H(); 1048 InsertConfigString(pCfg, "LogoFile", Utf8Str( logoImagePath? logoImagePath : "") );1049 InsertConfigString(pCfg, "LogoFile", Utf8Str(!logoImagePath.isEmpty() ? logoImagePath : "") ); 1049 1050 1050 1051 /* … … 1068 1069 char szExtraDataKey[sizeof("CustomVideoModeXX")]; 1069 1070 RTStrPrintf(szExtraDataKey, sizeof(szExtraDataKey), "CustomVideoMode%u", iMode); 1070 hrc = pMachine->GetExtraData(Bstr(szExtraDataKey) , bstr.asOutParam());H();1071 hrc = pMachine->GetExtraData(Bstr(szExtraDataKey).raw(), bstr.asOutParam()); H(); 1071 1072 if (bstr.isEmpty()) 1072 1073 break; … … 1189 1190 /* Get boot args */ 1190 1191 Bstr bootArgs; 1191 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiBootArgs") , bootArgs.asOutParam()); H();1192 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiBootArgs").raw(), bootArgs.asOutParam()); H(); 1192 1193 1193 1194 /* Get device props */ 1194 1195 Bstr deviceProps; 1195 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiDeviceProps") , deviceProps.asOutParam()); H();1196 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiDeviceProps").raw(), deviceProps.asOutParam()); H(); 1196 1197 /* Get GOP mode settings */ 1197 1198 uint32_t u32GopMode = UINT32_MAX; 1198 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiGopMode") , bstr.asOutParam()); H();1199 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiGopMode").raw(), bstr.asOutParam()); H(); 1199 1200 if (!bstr.isEmpty()) 1200 1201 u32GopMode = Utf8Str(bstr).toUInt32(); … … 1202 1203 /* UGA mode settings */ 1203 1204 uint32_t u32UgaHorisontal = 0; 1204 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaHorizontalResolution") , bstr.asOutParam()); H();1205 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaHorizontalResolution").raw(), bstr.asOutParam()); H(); 1205 1206 if (!bstr.isEmpty()) 1206 1207 u32UgaHorisontal = Utf8Str(bstr).toUInt32(); 1207 1208 1208 1209 uint32_t u32UgaVertical = 0; 1209 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaVerticalResolution") , bstr.asOutParam()); H();1210 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/EfiUgaVerticalResolution").raw(), bstr.asOutParam()); H(); 1210 1211 if (!bstr.isEmpty()) 1211 1212 u32UgaVertical = Utf8Str(bstr).toUInt32(); … … 1446 1447 /* Attach the media to the storage controllers. */ 1447 1448 com::SafeIfaceArray<IMediumAttachment> atts; 1448 hrc = pMachine->GetMediumAttachmentsOfController(controllerName ,1449 hrc = pMachine->GetMediumAttachmentsOfController(controllerName.raw(), 1449 1450 ComSafeArrayAsOutParam(atts)); H(); 1450 1451 … … 1452 1453 { 1453 1454 rc = pConsole->configMediumAttachment(pCtlInst, 1454 pszCtrlDev,1455 ulInstance,1456 enmBus,1457 fUseHostIOCache,1458 false /* fSetupMerge */,1459 0 /* uMergeSource */,1460 0 /* uMergeTarget */,1461 atts[j],1462 pConsole->mMachineState,1463 NULL /* phrc */,1464 false /* fAttachDetach */,1465 false /* fForceUnmount */,1466 pVM,1467 paLedDevType);1455 pszCtrlDev, 1456 ulInstance, 1457 enmBus, 1458 fUseHostIOCache, 1459 false /* fSetupMerge */, 1460 0 /* uMergeSource */, 1461 0 /* uMergeTarget */, 1462 atts[j], 1463 pConsole->mMachineState, 1464 NULL /* phrc */, 1465 false /* fAttachDetach */, 1466 false /* fForceUnmount */, 1467 pVM, 1468 paLedDevType); 1468 1469 if (RT_FAILURE(rc)) 1469 1470 return rc; … … 1609 1610 Bstr macAddr; 1610 1611 hrc = networkAdapter->COMGETTER(MACAddress)(macAddr.asOutParam()); H(); 1611 Assert( macAddr);1612 Assert(!macAddr.isEmpty()); 1612 1613 Utf8Str macAddrUtf8 = macAddr; 1613 1614 char *macStr = (char*)macAddrUtf8.c_str(); … … 1793 1794 hrc = pMachine->COMGETTER(HardwareVersion)(hwVersion.asOutParam()); H(); 1794 1795 InsertConfigInteger(pCfg, "RamSize", cbRam); 1795 if (hwVersion.compare(Bstr("1") ) == 0) /* <= 2.0.x */1796 if (hwVersion.compare(Bstr("1").raw()) == 0) /* <= 2.0.x */ 1796 1797 InsertConfigInteger(pCfg, "HeapEnabled", 0); 1797 1798 Bstr snapshotFolder; … … 2386 2387 if (i2 < cGlobalValues) 2387 2388 // this is still one of the global values: 2388 hrc = virtualBox->GetExtraData(Bstr(strKey), bstrExtraDataValue.asOutParam()); 2389 hrc = virtualBox->GetExtraData(Bstr(strKey).raw(), 2390 bstrExtraDataValue.asOutParam()); 2389 2391 else 2390 hrc = pMachine->GetExtraData(Bstr(strKey), bstrExtraDataValue.asOutParam()); 2392 hrc = pMachine->GetExtraData(Bstr(strKey).raw(), 2393 bstrExtraDataValue.asOutParam()); 2391 2394 if (FAILED(hrc)) 2392 2395 LogRel(("Warning: Cannot get extra data key %s, rc = %Rrc\n", strKey.c_str(), hrc)); … … 3864 3867 const char *pszHifName = HifNameUtf8.c_str(); 3865 3868 ComPtr<IHostNetworkInterface> hostInterface; 3866 rc = host->FindHostNetworkInterfaceByName(HifName, hostInterface.asOutParam()); 3869 rc = host->FindHostNetworkInterfaceByName(HifName.raw(), 3870 hostInterface.asOutParam()); 3867 3871 if (!SUCCEEDED(rc)) 3868 3872 { … … 4005 4009 Bstr tmpAddr, tmpMask; 4006 4010 4007 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPAddress", pszHifName), tmpAddr.asOutParam()); 4011 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPAddress", 4012 pszHifName).raw(), 4013 tmpAddr.asOutParam()); 4008 4014 if (SUCCEEDED(hrc) && !tmpAddr.isEmpty()) 4009 4015 { 4010 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPNetMask", pszHifName), tmpMask.asOutParam()); 4016 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPNetMask", 4017 pszHifName).raw(), 4018 tmpMask.asOutParam()); 4011 4019 if (SUCCEEDED(hrc) && !tmpMask.isEmpty()) 4012 hrc = hostInterface->EnableStaticIpConfig(tmpAddr, tmpMask); 4020 hrc = hostInterface->EnableStaticIpConfig(tmpAddr.raw(), 4021 tmpMask.raw()); 4013 4022 else 4014 hrc = hostInterface->EnableStaticIpConfig(tmpAddr ,4015 Bstr(VBOXNET_IPV4MASK_DEFAULT));4023 hrc = hostInterface->EnableStaticIpConfig(tmpAddr.raw(), 4024 Bstr(VBOXNET_IPV4MASK_DEFAULT).raw()); 4016 4025 } 4017 4026 else 4018 4027 { 4019 4028 /* Grab the IP number from the 'vboxnetX' instance number (see netif.h) */ 4020 hrc = hostInterface->EnableStaticIpConfig(getDefaultIPv4Address(Bstr(pszHifName)) ,4021 Bstr(VBOXNET_IPV4MASK_DEFAULT));4029 hrc = hostInterface->EnableStaticIpConfig(getDefaultIPv4Address(Bstr(pszHifName)).raw(), 4030 Bstr(VBOXNET_IPV4MASK_DEFAULT).raw()); 4022 4031 } 4023 4032 4024 4033 ComAssertComRC(hrc); /** @todo r=bird: Why this isn't fatal? (H()) */ 4025 4034 4026 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPV6Address", pszHifName), tmpAddr.asOutParam()); 4035 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPV6Address", 4036 pszHifName).raw(), 4037 tmpAddr.asOutParam()); 4027 4038 if (SUCCEEDED(hrc)) 4028 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPV6NetMask", pszHifName), tmpMask.asOutParam()); 4039 hrc = virtualBox->GetExtraData(BstrFmt("HostOnly/%s/IPV6NetMask", pszHifName).raw(), 4040 tmpMask.asOutParam()); 4029 4041 if (SUCCEEDED(hrc) && !tmpAddr.isEmpty() && !tmpMask.isEmpty()) 4030 4042 { 4031 hrc = hostInterface->EnableStaticIpConfigV6(tmpAddr, Utf8Str(tmpMask).toUInt32()); 4043 hrc = hostInterface->EnableStaticIpConfigV6(tmpAddr.raw(), 4044 Utf8Str(tmpMask).toUInt32()); 4032 4045 ComAssertComRC(hrc); /** @todo r=bird: Why this isn't fatal? (H()) */ 4033 4046 } … … 4097 4110 */ 4098 4111 ComPtr<IDHCPServer> dhcpServer; 4099 hrc = virtualBox->FindDHCPServerByNetworkName(networkName, dhcpServer.asOutParam()); 4112 hrc = virtualBox->FindDHCPServerByNetworkName(networkName.raw(), 4113 dhcpServer.asOutParam()); 4100 4114 if (SUCCEEDED(hrc)) 4101 4115 { … … 4110 4124 4111 4125 if (fEnabled) 4112 hrc = dhcpServer->Start(networkName, trunkName, trunkType); 4126 hrc = dhcpServer->Start(networkName.raw(), 4127 trunkName.raw(), 4128 trunkType.raw()); 4113 4129 } 4114 4130 else -
trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
r31256 r32718 956 956 HRESULT hrc = ptrProgress.createObject(); 957 957 if (FAILED(hrc)) return hrc; 958 hrc = ptrProgress->init(static_cast<IConsole *>(this), Bstr(tr("Teleporter")), TRUE /*aCancelable*/); 958 hrc = ptrProgress->init(static_cast<IConsole *>(this), 959 Bstr(tr("Teleporter")).raw(), 960 TRUE /*aCancelable*/); 959 961 if (FAILED(hrc)) return hrc; 960 962 … … 1093 1095 { 1094 1096 LogRel(("Teleporter: Waiting for incoming VM...\n")); 1095 hrc = pProgress->SetNextOperation(Bstr(tr("Waiting for incoming VM")) , 1);1097 hrc = pProgress->SetNextOperation(Bstr(tr("Waiting for incoming VM")).raw(), 1); 1096 1098 if (SUCCEEDED(hrc)) 1097 1099 { … … 1282 1284 { 1283 1285 LogRel(("Teleporter: Incoming VM from %RTnaddr!\n", &Addr)); 1284 hrc = pState->mptrProgress->SetNextOperation(BstrFmt(tr("Teleporting VM from %RTnaddr"), &Addr) , 8);1286 hrc = pState->mptrProgress->SetNextOperation(BstrFmt(tr("Teleporting VM from %RTnaddr"), &Addr).raw(), 8); 1285 1287 } 1286 1288 else 1287 1289 { 1288 1290 LogRel(("Teleporter: Incoming VM!\n")); 1289 hrc = pState->mptrProgress->SetNextOperation(Bstr(tr("Teleporting VM")) , 8);1291 hrc = pState->mptrProgress->SetNextOperation(Bstr(tr("Teleporting VM")).raw(), 8); 1290 1292 } 1291 1293 AssertMsg(SUCCEEDED(hrc) || hrc == E_FAIL, ("%Rhrc\n", hrc)); -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r32431 r32718 391 391 if (m_server) 392 392 { 393 com::SafeArray <BYTE> aShape(ComSafeArrayInArg 393 com::SafeArray <BYTE> aShape(ComSafeArrayInArg(inShape)); 394 394 if (aShape.size() == 0) 395 395 { … … 665 665 com::Utf8Str portRange = bstr; 666 666 667 size_t cbPortRange = portRange.length 667 size_t cbPortRange = portRange.length() + 1; 668 668 669 669 if (cbPortRange >= 0x10000) … … 731 731 732 732 com::Bstr bstr; 733 HRESULT hrc = server->mConsole->machine ()->GetExtraData(Bstr("VRDP/SunFlsh"), bstr.asOutParam()); 733 HRESULT hrc = server->mConsole->machine()->GetExtraData(Bstr("VRDP/SunFlsh").raw(), 734 bstr.asOutParam()); 734 735 if (hrc == S_OK && !bstr.isEmpty()) 735 736 { … … 792 793 ) 793 794 { 794 HRESULT hrc = server->mConsole->machine ()->GetExtraData(com::Bstr(extraData), bstrValue.asOutParam()); 795 HRESULT hrc = server->mConsole->machine()->GetExtraData(com::Bstr(extraData).raw(), 796 bstrValue.asOutParam()); 795 797 if (hrc == S_OK && !bstrValue.isEmpty()) 796 798 { … … 856 858 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 857 859 858 return server->mConsole->VRDPClientLogon 859 } 860 861 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect 860 return server->mConsole->VRDPClientLogon(u32ClientId, pszUser, pszPassword, pszDomain); 861 } 862 863 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect(void *pvCallback, uint32_t u32ClientId) 862 864 { 863 865 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 864 866 865 server->mConsole->VRDPClientConnect 866 } 867 868 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect 867 server->mConsole->VRDPClientConnect(u32ClientId); 868 } 869 870 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect(void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted) 869 871 { 870 872 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 871 873 872 server->mConsole->VRDPClientDisconnect 873 } 874 875 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackIntercept 874 server->mConsole->VRDPClientDisconnect(u32ClientId, fu32Intercepted); 875 } 876 877 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackIntercept(void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept) 876 878 { 877 879 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); … … 885 887 case VRDP_CLIENT_INTERCEPT_AUDIO: 886 888 { 887 server->mConsole->VRDPInterceptAudio 889 server->mConsole->VRDPInterceptAudio(u32ClientId); 888 890 if (ppvIntercept) 889 891 { … … 895 897 case VRDP_CLIENT_INTERCEPT_USB: 896 898 { 897 server->mConsole->VRDPInterceptUSB 899 server->mConsole->VRDPInterceptUSB(u32ClientId, ppvIntercept); 898 900 rc = VINF_SUCCESS; 899 901 } break; … … 901 903 case VRDP_CLIENT_INTERCEPT_CLIPBOARD: 902 904 { 903 server->mConsole->VRDPInterceptClipboard 905 server->mConsole->VRDPInterceptClipboard(u32ClientId); 904 906 if (ppvIntercept) 905 907 { … … 916 918 } 917 919 918 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackUSB 920 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackUSB(void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint8_t u8Code, const void *pvRet, uint32_t cbRet) 919 921 { 920 922 #ifdef VBOX_WITH_USB 921 return USBClientResponseCallback 923 return USBClientResponseCallback(pvIntercept, u32ClientId, u8Code, pvRet, cbRet); 922 924 #else 923 925 return VERR_NOT_SUPPORTED; … … 925 927 } 926 928 927 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClipboard 928 { 929 return ClipboardCallback 930 } 931 932 DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery 929 DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClipboard(void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData) 930 { 931 return ClipboardCallback(pvIntercept, u32ClientId, u32Function, u32Format, pvData, cbData); 932 } 933 934 DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery(void *pvCallback, unsigned uScreenId, VRDPFRAMEBUFFERINFO *pInfo) 933 935 { 934 936 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); … … 940 942 LONG yOrigin = 0; 941 943 942 server->mConsole->getDisplay ()->GetFramebuffer(uScreenId, &pfb, &xOrigin, &yOrigin);944 server->mConsole->getDisplay()->GetFramebuffer(uScreenId, &pfb, &xOrigin, &yOrigin); 943 945 944 946 if (pfb) … … 948 950 /* Query framebuffer parameters. */ 949 951 ULONG lineSize = 0; 950 pfb->COMGETTER(BytesPerLine) 952 pfb->COMGETTER(BytesPerLine)(&lineSize); 951 953 952 954 ULONG bitsPerPixel = 0; 953 pfb->COMGETTER(BitsPerPixel) 955 pfb->COMGETTER(BitsPerPixel)(&bitsPerPixel); 954 956 955 957 BYTE *address = NULL; 956 pfb->COMGETTER(Address) 958 pfb->COMGETTER(Address)(&address); 957 959 958 960 ULONG height = 0; 959 pfb->COMGETTER(Height) 961 pfb->COMGETTER(Height)(&height); 960 962 961 963 ULONG width = 0; 962 pfb->COMGETTER(Width) 964 pfb->COMGETTER(Width)(&width); 963 965 964 966 /* Now fill the information as requested by the caller. */ … … 971 973 pInfo->cbLine = lineSize; 972 974 973 pfb->Unlock 975 pfb->Unlock(); 974 976 975 977 fAvailable = true; … … 978 980 if (server->maFramebuffers[uScreenId]) 979 981 { 980 server->maFramebuffers[uScreenId]->Release 982 server->maFramebuffers[uScreenId]->Release(); 981 983 } 982 984 server->maFramebuffers[uScreenId] = pfb; … … 985 987 } 986 988 987 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock 989 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock(void *pvCallback, unsigned uScreenId) 988 990 { 989 991 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); … … 991 993 if (server->maFramebuffers[uScreenId]) 992 994 { 993 server->maFramebuffers[uScreenId]->Lock 994 } 995 } 996 997 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock 995 server->maFramebuffers[uScreenId]->Lock(); 996 } 997 } 998 999 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock(void *pvCallback, unsigned uScreenId) 998 1000 { 999 1001 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); … … 1001 1003 if (server->maFramebuffers[uScreenId]) 1002 1004 { 1003 server->maFramebuffers[uScreenId]->Unlock 1004 } 1005 } 1006 1007 static void fixKbdLockStatus 1005 server->maFramebuffers[uScreenId]->Unlock(); 1006 } 1007 } 1008 1009 static void fixKbdLockStatus(VRDPInputSynch *pInputSynch, IKeyboard *pKeyboard) 1008 1010 { 1009 1011 if ( pInputSynch->cGuestNumLockAdaptions … … 1023 1025 } 1024 1026 1025 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput 1027 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput(void *pvCallback, int type, const void *pvInput, unsigned cbInput) 1026 1028 { 1027 1029 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); … … 1032 1034 case VRDP_INPUT_SCANCODE: 1033 1035 { 1034 if (cbInput == sizeof 1035 { 1036 IKeyboard *pKeyboard = pConsole->getKeyboard 1036 if (cbInput == sizeof(VRDPINPUTSCANCODE)) 1037 { 1038 IKeyboard *pKeyboard = pConsole->getKeyboard(); 1037 1039 1038 1040 const VRDPINPUTSCANCODE *pInputScancode = (VRDPINPUTSCANCODE *)pvInput; … … 1054 1056 { 1055 1057 /* Key pressed. */ 1056 fixKbdLockStatus 1058 fixKbdLockStatus(&server->m_InputSynch, pKeyboard); 1057 1059 } 1058 1060 … … 1063 1065 case VRDP_INPUT_POINT: 1064 1066 { 1065 if (cbInput == sizeof 1067 if (cbInput == sizeof(VRDPINPUTPOINT)) 1066 1068 { 1067 1069 const VRDPINPUTPOINT *pInputPoint = (VRDPINPUTPOINT *)pvInput; … … 1095 1097 if (server->m_fGuestWantsAbsolute) 1096 1098 { 1097 pConsole->getMouse()->PutMouseEventAbsolute 1099 pConsole->getMouse()->PutMouseEventAbsolute(pInputPoint->x + 1, pInputPoint->y + 1, iWheel, 0 /* Horizontal wheel */, mouseButtons); 1098 1100 } else 1099 1101 { 1100 pConsole->getMouse()->PutMouseEvent 1102 pConsole->getMouse()->PutMouseEvent(pInputPoint->x - server->m_mousex, 1101 1103 pInputPoint->y - server->m_mousey, 1102 1104 iWheel, 0 /* Horizontal wheel */, mouseButtons); … … 1109 1111 case VRDP_INPUT_CAD: 1110 1112 { 1111 pConsole->getKeyboard 1113 pConsole->getKeyboard()->PutCAD(); 1112 1114 } break; 1113 1115 … … 1119 1121 case VRDP_INPUT_SYNCH: 1120 1122 { 1121 if (cbInput == sizeof 1122 { 1123 IKeyboard *pKeyboard = pConsole->getKeyboard 1123 if (cbInput == sizeof(VRDPINPUTSYNCH)) 1124 { 1125 IKeyboard *pKeyboard = pConsole->getKeyboard(); 1124 1126 1125 1127 const VRDPINPUTSYNCH *pInputSynch = (VRDPINPUTSYNCH *)pvInput; … … 1143 1145 } 1144 1146 1145 fixKbdLockStatus 1147 fixKbdLockStatus(&server->m_InputSynch, pKeyboard); 1146 1148 } 1147 1149 } break; … … 1152 1154 } 1153 1155 1154 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint 1156 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint(void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId) 1155 1157 { 1156 1158 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); … … 1160 1162 #endif /* VBOX_WITH_VRDP */ 1161 1163 1162 ConsoleVRDPServer::ConsoleVRDPServer 1164 ConsoleVRDPServer::ConsoleVRDPServer(Console *console) 1163 1165 { 1164 1166 mConsole = console; … … 1197 1199 m_InputSynch.fClientScrollLock = false; 1198 1200 1199 memset (maFramebuffers, 0, sizeof(maFramebuffers));1201 memset(maFramebuffers, 0, sizeof(maFramebuffers)); 1200 1202 1201 1203 { … … 1217 1219 } 1218 1220 1219 ConsoleVRDPServer::~ConsoleVRDPServer 1220 { 1221 Stop 1221 ConsoleVRDPServer::~ConsoleVRDPServer() 1222 { 1223 Stop(); 1222 1224 1223 1225 #ifdef VBOX_WITH_VRDP … … 1236 1238 if (maFramebuffers[i]) 1237 1239 { 1238 maFramebuffers[i]->Release 1240 maFramebuffers[i]->Release(); 1239 1241 maFramebuffers[i] = NULL; 1240 1242 } … … 1242 1244 #endif /* VBOX_WITH_VRDP */ 1243 1245 1244 if (RTCritSectIsInitialized 1245 { 1246 RTCritSectDelete 1247 memset (&mCritSect, 0, sizeof(mCritSect));1248 } 1249 } 1250 1251 int ConsoleVRDPServer::Launch 1246 if (RTCritSectIsInitialized(&mCritSect)) 1247 { 1248 RTCritSectDelete(&mCritSect); 1249 memset(&mCritSect, 0, sizeof(mCritSect)); 1250 } 1251 } 1252 1253 int ConsoleVRDPServer::Launch(void) 1252 1254 { 1253 1255 LogFlowThisFunc(("\n")); 1254 1256 #ifdef VBOX_WITH_VRDP 1255 1257 int rc = VINF_SUCCESS; 1256 IVRDPServer *vrdpserver = mConsole->getVRDPServer 1258 IVRDPServer *vrdpserver = mConsole->getVRDPServer(); 1257 1259 Assert(vrdpserver); 1258 1260 BOOL vrdpEnabled = FALSE; 1259 1261 1260 HRESULT rc2 = vrdpserver->COMGETTER(Enabled) 1262 HRESULT rc2 = vrdpserver->COMGETTER(Enabled)(&vrdpEnabled); 1261 1263 AssertComRC(rc2); 1262 1264 1263 1265 if (SUCCEEDED(rc2) && vrdpEnabled) 1264 1266 { 1265 if (loadVRDPLibrary 1266 { 1267 rc = mpfnVRDPCreateServer 1267 if (loadVRDPLibrary()) 1268 { 1269 rc = mpfnVRDPCreateServer(&mCallbacks.header, this, (VRDPINTERFACEHDR **)&mpEntryPoints, &mhServer); 1268 1270 1269 1271 if (RT_SUCCESS(rc)) 1270 1272 { 1271 1273 #ifdef VBOX_WITH_USB 1272 remoteUSBThreadStart 1274 remoteUSBThreadStart(); 1273 1275 #endif /* VBOX_WITH_USB */ 1274 1276 } … … 1289 1291 } 1290 1292 1291 void ConsoleVRDPServer::EnableConnections 1293 void ConsoleVRDPServer::EnableConnections(void) 1292 1294 { 1293 1295 #ifdef VBOX_WITH_VRDP 1294 1296 if (mpEntryPoints && mhServer) 1295 1297 { 1296 mpEntryPoints->VRDPEnableConnections 1298 mpEntryPoints->VRDPEnableConnections(mhServer, true); 1297 1299 } 1298 1300 #endif /* VBOX_WITH_VRDP */ 1299 1301 } 1300 1302 1301 void ConsoleVRDPServer::DisconnectClient 1303 void ConsoleVRDPServer::DisconnectClient(uint32_t u32ClientId, bool fReconnect) 1302 1304 { 1303 1305 #ifdef VBOX_WITH_VRDP 1304 1306 if (mpEntryPoints && mhServer) 1305 1307 { 1306 mpEntryPoints->VRDPDisconnect 1308 mpEntryPoints->VRDPDisconnect(mhServer, u32ClientId, fReconnect); 1307 1309 } 1308 1310 #endif /* VBOX_WITH_VRDP */ 1309 1311 } 1310 1312 1311 void ConsoleVRDPServer::MousePointerUpdate 1313 void ConsoleVRDPServer::MousePointerUpdate(const VRDPCOLORPOINTER *pPointer) 1312 1314 { 1313 1315 #ifdef VBOX_WITH_VRDP 1314 1316 if (mpEntryPoints && mhServer) 1315 1317 { 1316 mpEntryPoints->VRDPColorPointer 1318 mpEntryPoints->VRDPColorPointer(mhServer, pPointer); 1317 1319 } 1318 1320 #endif /* VBOX_WITH_VRDP */ 1319 1321 } 1320 1322 1321 void ConsoleVRDPServer::MousePointerHide 1323 void ConsoleVRDPServer::MousePointerHide(void) 1322 1324 { 1323 1325 #ifdef VBOX_WITH_VRDP 1324 1326 if (mpEntryPoints && mhServer) 1325 1327 { 1326 mpEntryPoints->VRDPHidePointer 1328 mpEntryPoints->VRDPHidePointer(mhServer); 1327 1329 } 1328 1330 #endif /* VBOX_WITH_VRDP */ 1329 1331 } 1330 1332 1331 void ConsoleVRDPServer::Stop 1333 void ConsoleVRDPServer::Stop(void) 1332 1334 { 1333 1335 Assert(VALID_PTR(this)); /** @todo r=bird: there are(/was) some odd cases where this buster was invalid on … … 1343 1345 if (mpEntryPoints && hServer) 1344 1346 { 1345 mpEntryPoints->VRDPDestroy 1347 mpEntryPoints->VRDPDestroy(hServer); 1346 1348 } 1347 1349 } … … 1349 1351 1350 1352 #ifdef VBOX_WITH_USB 1351 remoteUSBThreadStop 1353 remoteUSBThreadStop(); 1352 1354 #endif /* VBOX_WITH_USB */ 1353 1355 … … 1379 1381 1380 1382 #ifdef VBOX_WITH_USB 1381 static DECLCALLBACK(int) threadRemoteUSB 1383 static DECLCALLBACK(int) threadRemoteUSB(RTTHREAD self, void *pvUser) 1382 1384 { 1383 1385 ConsoleVRDPServer *pOwner = (ConsoleVRDPServer *)pvUser; … … 1385 1387 LogFlow(("Console::threadRemoteUSB: start. owner = %p.\n", pOwner)); 1386 1388 1387 pOwner->notifyRemoteUSBThreadRunning 1388 1389 while (pOwner->isRemoteUSBThreadRunning 1389 pOwner->notifyRemoteUSBThreadRunning(self); 1390 1391 while (pOwner->isRemoteUSBThreadRunning()) 1390 1392 { 1391 1393 RemoteUSBBackend *pRemoteUSBBackend = NULL; 1392 1394 1393 while ((pRemoteUSBBackend = pOwner->usbBackendGetNext 1394 { 1395 pRemoteUSBBackend->PollRemoteDevices 1396 } 1397 1398 pOwner->waitRemoteUSBThreadEvent 1395 while ((pRemoteUSBBackend = pOwner->usbBackendGetNext(pRemoteUSBBackend)) != NULL) 1396 { 1397 pRemoteUSBBackend->PollRemoteDevices(); 1398 } 1399 1400 pOwner->waitRemoteUSBThreadEvent(VRDP_DEVICE_LIST_PERIOD_MS); 1399 1401 1400 1402 LogFlow(("Console::threadRemoteUSB: iteration. owner = %p.\n", pOwner)); … … 1404 1406 } 1405 1407 1406 void ConsoleVRDPServer::notifyRemoteUSBThreadRunning 1408 void ConsoleVRDPServer::notifyRemoteUSBThreadRunning(RTTHREAD thread) 1407 1409 { 1408 1410 mUSBBackends.thread = thread; 1409 1411 mUSBBackends.fThreadRunning = true; 1410 int rc = RTThreadUserSignal 1412 int rc = RTThreadUserSignal(thread); 1411 1413 AssertRC(rc); 1412 1414 } 1413 1415 1414 bool ConsoleVRDPServer::isRemoteUSBThreadRunning 1416 bool ConsoleVRDPServer::isRemoteUSBThreadRunning(void) 1415 1417 { 1416 1418 return mUSBBackends.fThreadRunning; 1417 1419 } 1418 1420 1419 void ConsoleVRDPServer::waitRemoteUSBThreadEvent 1420 { 1421 int rc = RTSemEventWait 1422 Assert 1421 void ConsoleVRDPServer::waitRemoteUSBThreadEvent(RTMSINTERVAL cMillies) 1422 { 1423 int rc = RTSemEventWait(mUSBBackends.event, cMillies); 1424 Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); 1423 1425 NOREF(rc); 1424 1426 } 1425 1427 1426 void ConsoleVRDPServer::remoteUSBThreadStart 1427 { 1428 int rc = RTSemEventCreate 1428 void ConsoleVRDPServer::remoteUSBThreadStart(void) 1429 { 1430 int rc = RTSemEventCreate(&mUSBBackends.event); 1429 1431 1430 1432 if (RT_FAILURE(rc)) 1431 1433 { 1432 AssertFailed 1434 AssertFailed(); 1433 1435 mUSBBackends.event = 0; 1434 1436 } … … 1436 1438 if (RT_SUCCESS(rc)) 1437 1439 { 1438 rc = RTThreadCreate 1440 rc = RTThreadCreate(&mUSBBackends.thread, threadRemoteUSB, this, 65536, 1439 1441 RTTHREADTYPE_VRDP_IO, RTTHREADFLAGS_WAITABLE, "remote usb"); 1440 1442 } … … 1448 1450 { 1449 1451 /* Wait until the thread is ready. */ 1450 rc = RTThreadUserWait 1452 rc = RTThreadUserWait(mUSBBackends.thread, 60000); 1451 1453 AssertRC(rc); 1452 1454 Assert (mUSBBackends.fThreadRunning || RT_FAILURE(rc)); … … 1454 1456 } 1455 1457 1456 void ConsoleVRDPServer::remoteUSBThreadStop 1458 void ConsoleVRDPServer::remoteUSBThreadStop(void) 1457 1459 { 1458 1460 mUSBBackends.fThreadRunning = false; … … 1462 1464 Assert (mUSBBackends.event != 0); 1463 1465 1464 RTSemEventSignal 1465 1466 int rc = RTThreadWait 1466 RTSemEventSignal(mUSBBackends.event); 1467 1468 int rc = RTThreadWait(mUSBBackends.thread, 60000, NULL); 1467 1469 AssertRC(rc); 1468 1470 … … 1472 1474 if (mUSBBackends.event) 1473 1475 { 1474 RTSemEventDestroy 1476 RTSemEventDestroy(mUSBBackends.event); 1475 1477 mUSBBackends.event = 0; 1476 1478 } … … 1478 1480 #endif /* VBOX_WITH_USB */ 1479 1481 1480 VRDPAuthResult ConsoleVRDPServer::Authenticate 1482 VRDPAuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, VRDPAuthGuestJudgement guestJudgement, 1481 1483 const char *pszUser, const char *pszPassword, const char *pszDomain, 1482 1484 uint32_t u32ClientId) … … 1484 1486 VRDPAUTHUUID rawuuid; 1485 1487 1486 memcpy (rawuuid, ((Guid &)uuid).ptr (), sizeof(rawuuid));1488 memcpy(rawuuid, ((Guid &)uuid).ptr(), sizeof(rawuuid)); 1487 1489 1488 1490 LogFlow(("ConsoleVRDPServer::Authenticate: uuid = %RTuuid, guestJudgement = %d, pszUser = %s, pszPassword = %s, pszDomain = %s, u32ClientId = %d\n", … … 1575 1577 } 1576 1578 1577 Assert 1579 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2)); 1578 1580 1579 1581 VRDPAuthResult result = mpfnAuthEntry2? 1580 mpfnAuthEntry2 1581 mpfnAuthEntry 1582 mpfnAuthEntry2(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain, true, u32ClientId): 1583 mpfnAuthEntry(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain); 1582 1584 1583 1585 switch (result) … … 1602 1604 } 1603 1605 1604 void ConsoleVRDPServer::AuthDisconnect 1606 void ConsoleVRDPServer::AuthDisconnect(const Guid &uuid, uint32_t u32ClientId) 1605 1607 { 1606 1608 VRDPAUTHUUID rawuuid; 1607 1609 1608 memcpy (rawuuid, ((Guid &)uuid).ptr (), sizeof(rawuuid));1610 memcpy(rawuuid, ((Guid &)uuid).ptr(), sizeof(rawuuid)); 1609 1611 1610 1612 LogFlow(("ConsoleVRDPServer::AuthDisconnect: uuid = %RTuuid, u32ClientId = %d\n", 1611 1613 rawuuid, u32ClientId)); 1612 1614 1613 Assert 1615 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2)); 1614 1616 1615 1617 if (mpfnAuthEntry2) 1616 mpfnAuthEntry2 1617 } 1618 1619 int ConsoleVRDPServer::lockConsoleVRDPServer 1620 { 1621 int rc = RTCritSectEnter 1618 mpfnAuthEntry2(&rawuuid, VRDPAuthGuestNotAsked, NULL, NULL, NULL, false, u32ClientId); 1619 } 1620 1621 int ConsoleVRDPServer::lockConsoleVRDPServer(void) 1622 { 1623 int rc = RTCritSectEnter(&mCritSect); 1622 1624 AssertRC(rc); 1623 1625 return rc; 1624 1626 } 1625 1627 1626 void ConsoleVRDPServer::unlockConsoleVRDPServer 1627 { 1628 RTCritSectLeave 1629 } 1630 1631 DECLCALLBACK(int) ConsoleVRDPServer::ClipboardCallback 1632 1633 1634 1635 1636 1628 void ConsoleVRDPServer::unlockConsoleVRDPServer(void) 1629 { 1630 RTCritSectLeave(&mCritSect); 1631 } 1632 1633 DECLCALLBACK(int) ConsoleVRDPServer::ClipboardCallback(void *pvCallback, 1634 uint32_t u32ClientId, 1635 uint32_t u32Function, 1636 uint32_t u32Format, 1637 const void *pvData, 1638 uint32_t cbData) 1637 1639 { 1638 1640 LogFlowFunc(("pvCallback = %p, u32ClientId = %d, u32Function = %d, u32Format = 0x%08X, pvData = %p, cbData = %d\n", … … 1651 1653 if (pServer->mpfnClipboardCallback) 1652 1654 { 1653 pServer->mpfnClipboardCallback 1654 1655 1656 1655 pServer->mpfnClipboardCallback(VBOX_CLIPBOARD_EXT_FN_FORMAT_ANNOUNCE, 1656 u32Format, 1657 (void *)pvData, 1658 cbData); 1657 1659 } 1658 1660 } break; … … 1662 1664 if (pServer->mpfnClipboardCallback) 1663 1665 { 1664 pServer->mpfnClipboardCallback 1665 1666 1667 1666 pServer->mpfnClipboardCallback(VBOX_CLIPBOARD_EXT_FN_DATA_READ, 1667 u32Format, 1668 (void *)pvData, 1669 cbData); 1668 1670 } 1669 1671 } break; … … 1676 1678 } 1677 1679 1678 DECLCALLBACK(int) ConsoleVRDPServer::ClipboardServiceExtension 1679 1680 1681 1680 DECLCALLBACK(int) ConsoleVRDPServer::ClipboardServiceExtension(void *pvExtension, 1681 uint32_t u32Function, 1682 void *pvParms, 1683 uint32_t cbParms) 1682 1684 { 1683 1685 LogFlowFunc(("pvExtension = %p, u32Function = %d, pvParms = %p, cbParms = %d\n", … … 1703 1705 if (mpEntryPoints && pServer->mhServer) 1704 1706 { 1705 mpEntryPoints->VRDPClipboard 1706 1707 1708 1709 1710 1707 mpEntryPoints->VRDPClipboard(pServer->mhServer, 1708 VRDP_CLIPBOARD_FUNCTION_FORMAT_ANNOUNCE, 1709 pParms->u32Format, 1710 NULL, 1711 0, 1712 NULL); 1711 1713 } 1712 1714 } break; … … 1720 1722 if (mpEntryPoints && pServer->mhServer) 1721 1723 { 1722 mpEntryPoints->VRDPClipboard 1723 1724 1725 1726 1727 1724 mpEntryPoints->VRDPClipboard(pServer->mhServer, 1725 VRDP_CLIPBOARD_FUNCTION_DATA_READ, 1726 pParms->u32Format, 1727 pParms->u.pvData, 1728 pParms->cbData, 1729 &pParms->cbData); 1728 1730 } 1729 1731 } break; … … 1733 1735 if (mpEntryPoints && pServer->mhServer) 1734 1736 { 1735 mpEntryPoints->VRDPClipboard 1736 1737 1738 1739 1740 1737 mpEntryPoints->VRDPClipboard(pServer->mhServer, 1738 VRDP_CLIPBOARD_FUNCTION_DATA_WRITE, 1739 pParms->u32Format, 1740 pParms->u.pvData, 1741 pParms->cbData, 1742 NULL); 1741 1743 } 1742 1744 } break; … … 1750 1752 } 1751 1753 1752 void ConsoleVRDPServer::ClipboardCreate 1753 { 1754 int rc = lockConsoleVRDPServer 1754 void ConsoleVRDPServer::ClipboardCreate(uint32_t u32ClientId) 1755 { 1756 int rc = lockConsoleVRDPServer(); 1755 1757 1756 1758 if (RT_SUCCESS(rc)) … … 1758 1760 if (mcClipboardRefs == 0) 1759 1761 { 1760 rc = HGCMHostRegisterServiceExtension 1762 rc = HGCMHostRegisterServiceExtension(&mhClipboard, "VBoxSharedClipboard", ClipboardServiceExtension, this); 1761 1763 1762 1764 if (RT_SUCCESS(rc)) … … 1766 1768 } 1767 1769 1768 unlockConsoleVRDPServer 1769 } 1770 } 1771 1772 void ConsoleVRDPServer::ClipboardDelete 1773 { 1774 int rc = lockConsoleVRDPServer 1770 unlockConsoleVRDPServer(); 1771 } 1772 } 1773 1774 void ConsoleVRDPServer::ClipboardDelete(uint32_t u32ClientId) 1775 { 1776 int rc = lockConsoleVRDPServer(); 1775 1777 1776 1778 if (RT_SUCCESS(rc)) … … 1780 1782 if (mcClipboardRefs == 0) 1781 1783 { 1782 HGCMHostUnregisterServiceExtension 1783 } 1784 1785 unlockConsoleVRDPServer 1784 HGCMHostUnregisterServiceExtension(mhClipboard); 1785 } 1786 1787 unlockConsoleVRDPServer(); 1786 1788 } 1787 1789 } … … 1790 1792 * The ConsoleVRDPServer keeps a list of created backend instances. 1791 1793 */ 1792 void ConsoleVRDPServer::USBBackendCreate 1794 void ConsoleVRDPServer::USBBackendCreate(uint32_t u32ClientId, void **ppvIntercept) 1793 1795 { 1794 1796 #ifdef VBOX_WITH_USB … … 1796 1798 1797 1799 /* Create a new instance of the USB backend for the new client. */ 1798 RemoteUSBBackend *pRemoteUSBBackend = new RemoteUSBBackend 1800 RemoteUSBBackend *pRemoteUSBBackend = new RemoteUSBBackend(mConsole, this, u32ClientId); 1799 1801 1800 1802 if (pRemoteUSBBackend) 1801 1803 { 1802 pRemoteUSBBackend->AddRef 1804 pRemoteUSBBackend->AddRef(); /* 'Release' called in USBBackendDelete. */ 1803 1805 1804 1806 /* Append the new instance in the list. */ 1805 int rc = lockConsoleVRDPServer 1807 int rc = lockConsoleVRDPServer(); 1806 1808 1807 1809 if (RT_SUCCESS(rc)) … … 1819 1821 mUSBBackends.pHead = pRemoteUSBBackend; 1820 1822 1821 unlockConsoleVRDPServer 1823 unlockConsoleVRDPServer(); 1822 1824 1823 1825 if (ppvIntercept) … … 1829 1831 if (RT_FAILURE(rc)) 1830 1832 { 1831 pRemoteUSBBackend->Release 1833 pRemoteUSBBackend->Release(); 1832 1834 } 1833 1835 } … … 1835 1837 } 1836 1838 1837 void ConsoleVRDPServer::USBBackendDelete 1839 void ConsoleVRDPServer::USBBackendDelete(uint32_t u32ClientId) 1838 1840 { 1839 1841 #ifdef VBOX_WITH_USB … … 1843 1845 1844 1846 /* Find the instance. */ 1845 int rc = lockConsoleVRDPServer 1847 int rc = lockConsoleVRDPServer(); 1846 1848 1847 1849 if (RT_SUCCESS(rc)) 1848 1850 { 1849 pRemoteUSBBackend = usbBackendFind 1851 pRemoteUSBBackend = usbBackendFind(u32ClientId); 1850 1852 1851 1853 if (pRemoteUSBBackend) 1852 1854 { 1853 1855 /* Notify that it will be deleted. */ 1854 pRemoteUSBBackend->NotifyDelete 1855 } 1856 1857 unlockConsoleVRDPServer 1856 pRemoteUSBBackend->NotifyDelete(); 1857 } 1858 1859 unlockConsoleVRDPServer(); 1858 1860 } 1859 1861 … … 1861 1863 { 1862 1864 /* Here the instance has been excluded from the list and can be dereferenced. */ 1863 pRemoteUSBBackend->Release 1865 pRemoteUSBBackend->Release(); 1864 1866 } 1865 1867 #endif 1866 1868 } 1867 1869 1868 void *ConsoleVRDPServer::USBBackendRequestPointer 1870 void *ConsoleVRDPServer::USBBackendRequestPointer(uint32_t u32ClientId, const Guid *pGuid) 1869 1871 { 1870 1872 #ifdef VBOX_WITH_USB … … 1872 1874 1873 1875 /* Find the instance. */ 1874 int rc = lockConsoleVRDPServer 1876 int rc = lockConsoleVRDPServer(); 1875 1877 1876 1878 if (RT_SUCCESS(rc)) 1877 1879 { 1878 pRemoteUSBBackend = usbBackendFind 1880 pRemoteUSBBackend = usbBackendFind(u32ClientId); 1879 1881 1880 1882 if (pRemoteUSBBackend) 1881 1883 { 1882 1884 /* Inform the backend instance that it is referenced by the Guid. */ 1883 bool fAdded = pRemoteUSBBackend->addUUID 1885 bool fAdded = pRemoteUSBBackend->addUUID(pGuid); 1884 1886 1885 1887 if (fAdded) 1886 1888 { 1887 1889 /* Reference the instance because its pointer is being taken. */ 1888 pRemoteUSBBackend->AddRef 1890 pRemoteUSBBackend->AddRef(); /* 'Release' is called in USBBackendReleasePointer. */ 1889 1891 } 1890 1892 else … … 1894 1896 } 1895 1897 1896 unlockConsoleVRDPServer 1898 unlockConsoleVRDPServer(); 1897 1899 } 1898 1900 1899 1901 if (pRemoteUSBBackend) 1900 1902 { 1901 return pRemoteUSBBackend->GetBackendCallbackPointer 1903 return pRemoteUSBBackend->GetBackendCallbackPointer(); 1902 1904 } 1903 1905 … … 1906 1908 } 1907 1909 1908 void ConsoleVRDPServer::USBBackendReleasePointer 1910 void ConsoleVRDPServer::USBBackendReleasePointer(const Guid *pGuid) 1909 1911 { 1910 1912 #ifdef VBOX_WITH_USB … … 1912 1914 1913 1915 /* Find the instance. */ 1914 int rc = lockConsoleVRDPServer 1916 int rc = lockConsoleVRDPServer(); 1915 1917 1916 1918 if (RT_SUCCESS(rc)) 1917 1919 { 1918 pRemoteUSBBackend = usbBackendFindByUUID 1920 pRemoteUSBBackend = usbBackendFindByUUID(pGuid); 1919 1921 1920 1922 if (pRemoteUSBBackend) 1921 1923 { 1922 pRemoteUSBBackend->removeUUID 1923 } 1924 1925 unlockConsoleVRDPServer 1924 pRemoteUSBBackend->removeUUID(pGuid); 1925 } 1926 1927 unlockConsoleVRDPServer(); 1926 1928 1927 1929 if (pRemoteUSBBackend) 1928 1930 { 1929 pRemoteUSBBackend->Release 1931 pRemoteUSBBackend->Release(); 1930 1932 } 1931 1933 } … … 1933 1935 } 1934 1936 1935 RemoteUSBBackend *ConsoleVRDPServer::usbBackendGetNext 1937 RemoteUSBBackend *ConsoleVRDPServer::usbBackendGetNext(RemoteUSBBackend *pRemoteUSBBackend) 1936 1938 { 1937 1939 LogFlow(("ConsoleVRDPServer::usbBackendGetNext: pBackend = %p\n", pRemoteUSBBackend)); … … 1940 1942 #ifdef VBOX_WITH_USB 1941 1943 1942 int rc = lockConsoleVRDPServer 1944 int rc = lockConsoleVRDPServer(); 1943 1945 1944 1946 if (RT_SUCCESS(rc)) … … 1957 1959 if (pNextRemoteUSBBackend) 1958 1960 { 1959 pNextRemoteUSBBackend->AddRef 1960 } 1961 1962 unlockConsoleVRDPServer 1961 pNextRemoteUSBBackend->AddRef(); 1962 } 1963 1964 unlockConsoleVRDPServer(); 1963 1965 1964 1966 if (pRemoteUSBBackend) 1965 1967 { 1966 pRemoteUSBBackend->Release 1968 pRemoteUSBBackend->Release(); 1967 1969 } 1968 1970 } … … 1974 1976 #ifdef VBOX_WITH_USB 1975 1977 /* Internal method. Called under the ConsoleVRDPServerLock. */ 1976 RemoteUSBBackend *ConsoleVRDPServer::usbBackendFind 1978 RemoteUSBBackend *ConsoleVRDPServer::usbBackendFind(uint32_t u32ClientId) 1977 1979 { 1978 1980 RemoteUSBBackend *pRemoteUSBBackend = mUSBBackends.pHead; … … 1980 1982 while (pRemoteUSBBackend) 1981 1983 { 1982 if (pRemoteUSBBackend->ClientId 1984 if (pRemoteUSBBackend->ClientId() == u32ClientId) 1983 1985 { 1984 1986 break; … … 1992 1994 1993 1995 /* Internal method. Called under the ConsoleVRDPServerLock. */ 1994 RemoteUSBBackend *ConsoleVRDPServer::usbBackendFindByUUID 1996 RemoteUSBBackend *ConsoleVRDPServer::usbBackendFindByUUID(const Guid *pGuid) 1995 1997 { 1996 1998 RemoteUSBBackend *pRemoteUSBBackend = mUSBBackends.pHead; … … 1998 2000 while (pRemoteUSBBackend) 1999 2001 { 2000 if (pRemoteUSBBackend->findUUID 2002 if (pRemoteUSBBackend->findUUID(pGuid)) 2001 2003 { 2002 2004 break; … … 2011 2013 2012 2014 /* Internal method. Called by the backend destructor. */ 2013 void ConsoleVRDPServer::usbBackendRemoveFromList 2015 void ConsoleVRDPServer::usbBackendRemoveFromList(RemoteUSBBackend *pRemoteUSBBackend) 2014 2016 { 2015 2017 #ifdef VBOX_WITH_USB 2016 int rc = lockConsoleVRDPServer 2018 int rc = lockConsoleVRDPServer(); 2017 2019 AssertRC(rc); 2018 2020 … … 2038 2040 pRemoteUSBBackend->pNext = pRemoteUSBBackend->pPrev = NULL; 2039 2041 2040 unlockConsoleVRDPServer 2042 unlockConsoleVRDPServer(); 2041 2043 #endif 2042 2044 } 2043 2045 2044 2046 2045 void ConsoleVRDPServer::SendUpdate 2047 void ConsoleVRDPServer::SendUpdate(unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate) const 2046 2048 { 2047 2049 #ifdef VBOX_WITH_VRDP 2048 2050 if (mpEntryPoints && mhServer) 2049 2051 { 2050 mpEntryPoints->VRDPUpdate 2052 mpEntryPoints->VRDPUpdate(mhServer, uScreenId, pvUpdate, cbUpdate); 2051 2053 } 2052 2054 #endif 2053 2055 } 2054 2056 2055 void ConsoleVRDPServer::SendResize 2057 void ConsoleVRDPServer::SendResize(void) const 2056 2058 { 2057 2059 #ifdef VBOX_WITH_VRDP 2058 2060 if (mpEntryPoints && mhServer) 2059 2061 { 2060 mpEntryPoints->VRDPResize 2062 mpEntryPoints->VRDPResize(mhServer); 2061 2063 } 2062 2064 #endif 2063 2065 } 2064 2066 2065 void ConsoleVRDPServer::SendUpdateBitmap 2067 void ConsoleVRDPServer::SendUpdateBitmap(unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const 2066 2068 { 2067 2069 #ifdef VBOX_WITH_VRDP … … 2073 2075 if (mpEntryPoints && mhServer) 2074 2076 { 2075 mpEntryPoints->VRDPUpdate (mhServer, uScreenId, &update, sizeof(update));2077 mpEntryPoints->VRDPUpdate(mhServer, uScreenId, &update, sizeof(update)); 2076 2078 } 2077 2079 #endif 2078 2080 } 2079 2081 2080 void ConsoleVRDPServer::SendAudioSamples 2082 void ConsoleVRDPServer::SendAudioSamples(void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format) const 2081 2083 { 2082 2084 #ifdef VBOX_WITH_VRDP 2083 2085 if (mpEntryPoints && mhServer) 2084 2086 { 2085 mpEntryPoints->VRDPAudioSamples 2087 mpEntryPoints->VRDPAudioSamples(mhServer, pvSamples, cSamples, format); 2086 2088 } 2087 2089 #endif 2088 2090 } 2089 2091 2090 void ConsoleVRDPServer::SendAudioVolume 2092 void ConsoleVRDPServer::SendAudioVolume(uint16_t left, uint16_t right) const 2091 2093 { 2092 2094 #ifdef VBOX_WITH_VRDP 2093 2095 if (mpEntryPoints && mhServer) 2094 2096 { 2095 mpEntryPoints->VRDPAudioVolume 2097 mpEntryPoints->VRDPAudioVolume(mhServer, left, right); 2096 2098 } 2097 2099 #endif 2098 2100 } 2099 2101 2100 void ConsoleVRDPServer::SendUSBRequest 2102 void ConsoleVRDPServer::SendUSBRequest(uint32_t u32ClientId, void *pvParms, uint32_t cbParms) const 2101 2103 { 2102 2104 #ifdef VBOX_WITH_VRDP 2103 2105 if (mpEntryPoints && mhServer) 2104 2106 { 2105 mpEntryPoints->VRDPUSBRequest 2107 mpEntryPoints->VRDPUSBRequest(mhServer, u32ClientId, pvParms, cbParms); 2106 2108 } 2107 2109 #endif 2108 2110 } 2109 2111 2110 void ConsoleVRDPServer::QueryInfo 2112 void ConsoleVRDPServer::QueryInfo(uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) const 2111 2113 { 2112 2114 #ifdef VBOX_WITH_VRDP 2113 2115 if (index == VRDP_QI_PORT) 2114 2116 { 2115 uint32_t cbOut = sizeof 2117 uint32_t cbOut = sizeof(int32_t); 2116 2118 2117 2119 if (cbBuffer >= cbOut) … … 2123 2125 else if (mpEntryPoints && mhServer) 2124 2126 { 2125 mpEntryPoints->VRDPQueryInfo 2127 mpEntryPoints->VRDPQueryInfo(mhServer, index, pvBuffer, cbBuffer, pcbOut); 2126 2128 } 2127 2129 #endif … … 2130 2132 #ifdef VBOX_WITH_VRDP 2131 2133 /* note: static function now! */ 2132 bool ConsoleVRDPServer::loadVRDPLibrary 2134 bool ConsoleVRDPServer::loadVRDPLibrary(void) 2133 2135 { 2134 2136 int rc = VINF_SUCCESS; … … 2136 2138 if (!mVRDPLibrary) 2137 2139 { 2138 rc = SUPR3HardenedLdrLoadAppPriv 2140 rc = SUPR3HardenedLdrLoadAppPriv("VBoxVRDP", &mVRDPLibrary); 2139 2141 2140 2142 if (RT_SUCCESS(rc)) … … 2181 2183 if (mVRDPLibrary) 2182 2184 { 2183 RTLdrClose 2185 RTLdrClose(mVRDPLibrary); 2184 2186 mVRDPLibrary = NULL; 2185 2187 } … … 2213 2215 void RemoteDisplayInfo::FinalRelease() 2214 2216 { 2215 uninit 2217 uninit(); 2216 2218 } 2217 2219 … … 2222 2224 * Initializes the guest object. 2223 2225 */ 2224 HRESULT RemoteDisplayInfo::init 2226 HRESULT RemoteDisplayInfo::init(Console *aParent) 2225 2227 { 2226 2228 LogFlowThisFunc(("aParent=%p\n", aParent)); … … 2260 2262 2261 2263 #define IMPL_GETTER_BOOL(_aType, _aName, _aIndex) \ 2262 STDMETHODIMP RemoteDisplayInfo::COMGETTER(_aName) (_aType *a##_aName)\2264 STDMETHODIMP RemoteDisplayInfo::COMGETTER(_aName)(_aType *a##_aName) \ 2263 2265 { \ 2264 2266 if (!a##_aName) \ … … 2274 2276 uint32_t cbOut = 0; \ 2275 2277 \ 2276 mParent->consoleVRDPServer ()->QueryInfo\2277 (_aIndex, &value, sizeof (value), &cbOut);\2278 mParent->consoleVRDPServer()->QueryInfo \ 2279 (_aIndex, &value, sizeof(value), &cbOut); \ 2278 2280 \ 2279 2281 *a##_aName = cbOut? !!value: FALSE; \ … … 2284 2286 2285 2287 #define IMPL_GETTER_SCALAR(_aType, _aName, _aIndex, _aValueMask) \ 2286 STDMETHODIMP RemoteDisplayInfo::COMGETTER(_aName) (_aType *a##_aName)\2288 STDMETHODIMP RemoteDisplayInfo::COMGETTER(_aName)(_aType *a##_aName) \ 2287 2289 { \ 2288 2290 if (!a##_aName) \ … … 2298 2300 uint32_t cbOut = 0; \ 2299 2301 \ 2300 mParent->consoleVRDPServer ()->QueryInfo\2301 (_aIndex, &value, sizeof (value), &cbOut);\2302 mParent->consoleVRDPServer()->QueryInfo \ 2303 (_aIndex, &value, sizeof(value), &cbOut); \ 2302 2304 \ 2303 2305 if (_aValueMask) value &= (_aValueMask); \ … … 2309 2311 2310 2312 #define IMPL_GETTER_BSTR(_aType, _aName, _aIndex) \ 2311 STDMETHODIMP RemoteDisplayInfo::COMGETTER(_aName) (_aType *a##_aName)\2313 STDMETHODIMP RemoteDisplayInfo::COMGETTER(_aName)(_aType *a##_aName) \ 2312 2314 { \ 2313 2315 if (!a##_aName) \ … … 2322 2324 uint32_t cbOut = 0; \ 2323 2325 \ 2324 mParent->consoleVRDPServer ()->QueryInfo\2326 mParent->consoleVRDPServer()->QueryInfo \ 2325 2327 (_aIndex, NULL, 0, &cbOut); \ 2326 2328 \ … … 2332 2334 } \ 2333 2335 \ 2334 char *pchBuffer = (char *)RTMemTmpAlloc (cbOut);\2336 char *pchBuffer = (char *)RTMemTmpAlloc(cbOut); \ 2335 2337 \ 2336 2338 if (!pchBuffer) \ … … 2342 2344 } \ 2343 2345 \ 2344 mParent->consoleVRDPServer ()->QueryInfo\2346 mParent->consoleVRDPServer()->QueryInfo \ 2345 2347 (_aIndex, pchBuffer, cbOut, &cbOut); \ 2346 2348 \ … … 2349 2351 str.cloneTo(a##_aName); \ 2350 2352 \ 2351 RTMemTmpFree (pchBuffer);\2353 RTMemTmpFree(pchBuffer); \ 2352 2354 \ 2353 2355 return S_OK; \ -
trunk/src/VBox/Main/GuestImpl.cpp
r32138 r32718 196 196 LONG64 u64Timestamp; 197 197 Bstr flags; 198 hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Version") ,198 hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Version").raw(), 199 199 addVersion.asOutParam(), &u64Timestamp, flags.asOutParam()); 200 200 if (hr == S_OK) 201 201 { 202 202 Bstr addRevision; 203 hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Revision") ,203 hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Revision").raw(), 204 204 addRevision.asOutParam(), &u64Timestamp, flags.asOutParam()); 205 205 if ( hr == S_OK … … 640 640 case PROC_STS_STARTED: 641 641 LogRel(("Guest process (PID %u) started\n", pCBData->u32PID)); /** @todo Add process name */ 642 hr = it->second.pProgress->SetNextOperation(Bstr Fmt(tr("Waiting for process to exit ...")), 1 /* Weight */);642 hr = it->second.pProgress->SetNextOperation(Bstr(tr("Waiting for process to exit ...")).raw(), 1 /* Weight */); 643 643 AssertComRC(hr); 644 644 break; … … 978 978 { 979 979 rc = progress->init(static_cast<IGuest*>(this), 980 Bstr Fmt(tr("Executing process")),980 Bstr(tr("Executing process")).raw(), 981 981 TRUE, 982 2, /* Number of operations. */983 Bstr Fmt(tr("Starting process ...")));/* Description of first stage. */982 2, /* Number of operations. */ 983 Bstr(tr("Starting process ...")).raw()); /* Description of first stage. */ 984 984 } 985 985 if (FAILED(rc)) return rc; … … 1276 1276 { 1277 1277 rc = progress->init(static_cast<IGuest*>(this), 1278 Bstr Fmt(tr("Getting output of process")),1278 Bstr(tr("Getting output of process")).raw(), 1279 1279 TRUE); 1280 1280 } -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r31539 r32718 66 66 aInterfaceName.raw(), aGuid.toString().c_str())); 67 67 68 ComAssertRet( aInterfaceName, E_INVALIDARG);68 ComAssertRet(!aInterfaceName.isEmpty(), E_INVALIDARG); 69 69 ComAssertRet(!aGuid.isEmpty(), E_INVALIDARG); 70 70 … … 427 427 { 428 428 m.realIPAddress = 0; 429 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()) , NULL)))429 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()).raw(), NULL))) 430 430 return E_FAIL; 431 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()) , NULL)))431 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(), NULL))) 432 432 return E_FAIL; 433 433 return S_OK; … … 455 455 m.realIPAddress = ip; 456 456 m.realNetworkMask = mask; 457 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()) , Bstr(aIPAddress))))457 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()).raw(), Bstr(aIPAddress).raw()))) 458 458 return E_FAIL; 459 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()) , Bstr(aNetMask))))459 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(), Bstr(aNetMask).raw()))) 460 460 return E_FAIL; 461 461 return S_OK; … … 491 491 if (aIPV6MaskPrefixLength == 0) 492 492 aIPV6MaskPrefixLength = 64; 493 rc = NetIfEnableStaticIpConfigV6(mVBox, this, m.IPV6Address , aIPV6Address, aIPV6MaskPrefixLength);493 rc = NetIfEnableStaticIpConfigV6(mVBox, this, m.IPV6Address.raw(), aIPV6Address, aIPV6MaskPrefixLength); 494 494 if (RT_FAILURE(rc)) 495 495 { … … 501 501 m.realIPV6Address = aIPV6Address; 502 502 m.realIPV6PrefixLength = aIPV6MaskPrefixLength; 503 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", mInterfaceName.raw()) , Bstr(aIPV6Address))))503 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", mInterfaceName.raw()).raw(), Bstr(aIPV6Address).raw()))) 504 504 return E_FAIL; 505 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6NetMask", mInterfaceName.raw()) ,506 BstrFmt("%u", aIPV6MaskPrefixLength) )))505 if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6NetMask", mInterfaceName.raw()).raw(), 506 BstrFmt("%u", aIPV6MaskPrefixLength).raw()))) 507 507 return E_FAIL; 508 508 } … … 560 560 { 561 561 Bstr tmpAddr, tmpMask; 562 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()) , tmpAddr.asOutParam());563 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()) , tmpMask.asOutParam());562 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()).raw(), tmpAddr.asOutParam()); 563 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(), tmpMask.asOutParam()); 564 564 if (tmpAddr.isEmpty()) 565 565 tmpAddr = getDefaultIPv4Address(mInterfaceName); … … 573 573 { 574 574 Bstr tmpPrefixLen; 575 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", mInterfaceName.raw()) , m.IPV6Address.asOutParam());575 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", mInterfaceName.raw()).raw(), m.IPV6Address.asOutParam()); 576 576 if (!m.IPV6Address.isEmpty()) 577 577 { 578 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6PrefixLen", mInterfaceName.raw()) , tmpPrefixLen.asOutParam());578 hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6PrefixLen", mInterfaceName.raw()).raw(), tmpPrefixLen.asOutParam()); 579 579 if (SUCCEEDED(hrc) && !tmpPrefixLen.isEmpty()) 580 580 m.IPV6NetworkMaskPrefixLength = Utf8Str(tmpPrefixLen).toUInt32(); -
trunk/src/VBox/Main/HostUSBDeviceImpl.cpp
r31892 r32718 578 578 */ 579 579 LogFlowThisFunc(("{%s} Calling machine->onUSBDeviceDetach()...\n", mName)); 580 HRESULT hrc = mMachine->onUSBDeviceDetach(mId.toUtf16() , NULL);580 HRESULT hrc = mMachine->onUSBDeviceDetach(mId.toUtf16().raw(), NULL); 581 581 LogFlowThisFunc(("{%s} Done machine->onUSBDeviceDetach()=%Rhrc\n", mName, hrc)); 582 582 NOREF(hrc); -
trunk/src/VBox/Main/KeyboardImpl.cpp
r30681 r32718 5 5 6 6 /* 7 * Copyright (C) 2006-20 08Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 99 99 * @param parent handle of our parent object 100 100 */ 101 HRESULT Keyboard::init 101 HRESULT Keyboard::init(Console *aParent) 102 102 { 103 103 LogFlowThisFunc(("aParent=%p\n", aParent)); … … 149 149 * @param scancode The scancode to send 150 150 */ 151 STDMETHODIMP Keyboard::PutScancode 151 STDMETHODIMP Keyboard::PutScancode(LONG scancode) 152 152 { 153 153 HRESULT rc = S_OK; … … 193 193 This value can be NULL. 194 194 */ 195 STDMETHODIMP Keyboard::PutScancodes (ComSafeArrayIn(LONG, scancodes),196 195 STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn(LONG, scancodes), 196 ULONG *codesStored) 197 197 { 198 198 HRESULT rc = S_OK; 199 199 200 if (ComSafeArrayInIsNull 200 if (ComSafeArrayInIsNull(scancodes)) 201 201 return E_INVALIDARG; 202 202 … … 224 224 return rc; 225 225 226 com::SafeArray<LONG> keys (ComSafeArrayInArg(scancodes));226 com::SafeArray<LONG> keys(ComSafeArrayInArg(scancodes)); 227 227 int vrc = VINF_SUCCESS; 228 228 … … 287 287 * @param pDrvIns The driver instance data. 288 288 */ 289 DECLCALLBACK(void) Keyboard::drvDestruct 289 DECLCALLBACK(void) Keyboard::drvDestruct(PPDMDRVINS pDrvIns) 290 290 { 291 291 PDRVMAINKEYBOARD pData = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD); … … 306 306 } 307 307 308 DECLCALLBACK(void) keyboardLedStatusChange (PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds) 309 { 310 PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD (pInterface); 311 pDrv->pKeyboard->getParent()->onKeyboardLedsChange (!!(enmLeds & PDMKEYBLEDS_NUMLOCK), 312 !!(enmLeds & PDMKEYBLEDS_CAPSLOCK), 313 !!(enmLeds & PDMKEYBLEDS_SCROLLLOCK)); 308 DECLCALLBACK(void) keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, 309 PDMKEYBLEDS enmLeds) 310 { 311 PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface); 312 pDrv->pKeyboard->getParent()->onKeyboardLedsChange(!!(enmLeds & PDMKEYBLEDS_NUMLOCK), 313 !!(enmLeds & PDMKEYBLEDS_CAPSLOCK), 314 !!(enmLeds & PDMKEYBLEDS_SCROLLLOCK)); 314 315 } 315 316 … … 331 332 * @copydoc FNPDMDRVCONSTRUCT 332 333 */ 333 DECLCALLBACK(int) Keyboard::drvConstruct (PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 334 { 335 PDRVMAINKEYBOARD pData = PDMINS_2_DATA (pDrvIns, PDRVMAINKEYBOARD); 334 DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, 335 uint32_t fFlags) 336 { 337 PDRVMAINKEYBOARD pData = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD); 336 338 LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance)); 337 339 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); … … 340 342 * Validate configuration. 341 343 */ 342 if (!CFGMR3AreValuesValid 344 if (!CFGMR3AreValuesValid(pCfg, "Object\0")) 343 345 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 344 346 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, … … 360 362 if (!pData->pUpPort) 361 363 { 362 AssertMsgFailed 364 AssertMsgFailed(("Configuration error: No keyboard port interface above!\n")); 363 365 return VERR_PDM_MISSING_INTERFACE_ABOVE; 364 366 } … … 368 370 */ 369 371 void *pv; 370 int rc = CFGMR3QueryPtr 372 int rc = CFGMR3QueryPtr(pCfg, "Object", &pv); 371 373 if (RT_FAILURE(rc)) 372 374 { 373 AssertMsgFailed 375 AssertMsgFailed(("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc)); 374 376 return rc; 375 377 } -
trunk/src/VBox/Main/MachineImpl.cpp
r32705 r32718 3241 3241 rc = progress->init(mParent, 3242 3242 static_cast<IMachine*>(this), 3243 Bstr(tr("Spawning session")) ,3243 Bstr(tr("Spawning session")).raw(), 3244 3244 TRUE /* aCancelable */, 3245 3245 fTeleporterEnabled ? 20 : 10 /* uTotalOperationsWeight */, 3246 Bstr(tr("Spawning session")) ,3246 Bstr(tr("Spawning session")).raw(), 3247 3247 2 /* uFirstOperationWeight */, 3248 3248 fTeleporterEnabled ? 3 : 1 /* cOtherProgressObjectOperations */); … … 4055 4055 Bstr bstrValue(aValue); 4056 4056 4057 if (!mParent->onExtraDataCanChange(mData->mUuid, aKey, bstrValue , error))4057 if (!mParent->onExtraDataCanChange(mData->mUuid, aKey, bstrValue.raw(), error)) 4058 4058 { 4059 4059 const char *sep = error.isEmpty() ? "" : ": "; … … 4340 4340 pTask->pProgress->init(getVirtualBox(), 4341 4341 static_cast<IMachine*>(this) /* aInitiator */, 4342 Bstr(tr("Deleting files")) ,4342 Bstr(tr("Deleting files")).raw(), 4343 4343 true /* fCancellable */, 4344 4344 pTask->llFilesToDelete.size() + 1, // cOperations 4345 BstrFmt(tr("Deleting '%s'"), pTask->llFilesToDelete.front().c_str()) );4345 BstrFmt(tr("Deleting '%s'"), pTask->llFilesToDelete.front().c_str()).raw()); 4346 4346 4347 4347 int vrc = RTThreadCreate(NULL, … … 4427 4427 if (it == task.llFilesToDelete.end()) 4428 4428 { 4429 task.pProgress->SetNextOperation(Bstr(tr("Cleaning up machine directory")) , 1);4429 task.pProgress->SetNextOperation(Bstr(tr("Cleaning up machine directory")).raw(), 1); 4430 4430 break; 4431 4431 } 4432 4432 4433 task.pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), it->c_str()) , 1);4433 task.pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), it->c_str()).raw(), 1); 4434 4434 } 4435 4435 … … 6823 6823 // look up the object by Id to check it is valid 6824 6824 ComPtr<IGuestOSType> guestOSType; 6825 HRESULT rc = mParent->GetGuestOSType(Bstr(mUserData->s.strOsType) ,6825 HRESULT rc = mParent->GetGuestOSType(Bstr(mUserData->s.strOsType).raw(), 6826 6826 guestOSType.asOutParam()); 6827 6827 if (FAILED(rc)) return rc; … … 6843 6843 6844 6844 // snapshot folder needs special processing so set it again 6845 rc = COMSETTER(SnapshotFolder)(Bstr(config.machineUserData.strSnapshotFolder) );6845 rc = COMSETTER(SnapshotFolder)(Bstr(config.machineUserData.strSnapshotFolder).raw()); 6846 6846 if (FAILED(rc)) return rc; 6847 6847 … … 7164 7164 { 7165 7165 const settings::SharedFolder &sf = *it; 7166 rc = CreateSharedFolder(Bstr(sf.strName), Bstr(sf.strHostPath), sf.fWritable, sf.fAutoMount); 7166 rc = CreateSharedFolder(Bstr(sf.strName).raw(), 7167 Bstr(sf.strHostPath).raw(), 7168 sf.fWritable, sf.fAutoMount); 7167 7169 if (FAILED(rc)) return rc; 7168 7170 } … … 8306 8308 MediaData::AttachmentList atts; 8307 8309 8308 HRESULT rc = getMediumAttachmentsOfController(Bstr(aStorageController->getName()) , atts);8310 HRESULT rc = getMediumAttachmentsOfController(Bstr(aStorageController->getName()).raw(), atts); 8309 8311 if (FAILED(rc)) return rc; 8310 8312 … … 8531 8533 { 8532 8534 if (pMedium == NULL) 8533 aProgress->SetNextOperation(Bstr(tr("Skipping attachment without medium")) ,8535 aProgress->SetNextOperation(Bstr(tr("Skipping attachment without medium")).raw(), 8534 8536 aWeight); // weight 8535 8537 else 8536 8538 aProgress->SetNextOperation(BstrFmt(tr("Skipping medium '%s'"), 8537 pMedium->getBase()->getName().c_str()) ,8539 pMedium->getBase()->getName().c_str()).raw(), 8538 8540 aWeight); // weight 8539 8541 } … … 8545 8547 /* need a diff */ 8546 8548 aProgress->SetNextOperation(BstrFmt(tr("Creating differencing hard disk for '%s'"), 8547 pMedium->getBase()->getName().c_str()) ,8549 pMedium->getBase()->getName().c_str()).raw(), 8548 8550 aWeight); // weight 8549 8551 … … 10454 10456 ComPtr<IUnknown> pPeer(mPeer); 10455 10457 progress->init(mParent, pPeer, 10456 Bstr(tr("Closing session")) ,10458 Bstr(tr("Closing session")).raw(), 10457 10459 FALSE /* aCancelable */); 10458 10460 progress.queryInterfaceTo(aProgress); -
trunk/src/VBox/Main/MediumImpl.cpp
r32695 r32718 2266 2266 static_cast<IMedium*>(this), 2267 2267 (aVariant & MediumVariant_Fixed) 2268 ? BstrFmt(tr("Creating fixed medium storage unit '%s'"), m->strLocationFull.c_str()) 2269 : BstrFmt(tr("Creating dynamic medium storage unit '%s'"), m->strLocationFull.c_str()) ,2268 ? BstrFmt(tr("Creating fixed medium storage unit '%s'"), m->strLocationFull.c_str()).raw() 2269 : BstrFmt(tr("Creating dynamic medium storage unit '%s'"), m->strLocationFull.c_str()).raw(), 2270 2270 TRUE /* aCancelable */); 2271 2271 if (FAILED(rc)) … … 2483 2483 rc = pProgress->init(m->pVirtualBox, 2484 2484 static_cast <IMedium *>(this), 2485 BstrFmt(tr("Creating clone medium '%s'"), pTarget->m->strLocationFull.c_str()) ,2485 BstrFmt(tr("Creating clone medium '%s'"), pTarget->m->strLocationFull.c_str()).raw(), 2486 2486 TRUE /* aCancelable */); 2487 2487 if (FAILED(rc)) … … 2562 2562 rc = pProgress->init(m->pVirtualBox, 2563 2563 static_cast <IMedium *>(this), 2564 BstrFmt(tr("Compacting medium '%s'"), m->strLocationFull.c_str()) ,2564 BstrFmt(tr("Compacting medium '%s'"), m->strLocationFull.c_str()).raw(), 2565 2565 TRUE /* aCancelable */); 2566 2566 if (FAILED(rc)) … … 2635 2635 rc = pProgress->init(m->pVirtualBox, 2636 2636 static_cast <IMedium *>(this), 2637 BstrFmt(tr("Compacting medium '%s'"), m->strLocationFull.c_str()) ,2637 BstrFmt(tr("Compacting medium '%s'"), m->strLocationFull.c_str()).raw(), 2638 2638 TRUE /* aCancelable */); 2639 2639 if (FAILED(rc)) … … 2718 2718 rc = pProgress->init(m->pVirtualBox, 2719 2719 static_cast<IMedium*>(this), 2720 BstrFmt(tr("Resetting differencing medium '%s'"), m->strLocationFull.c_str()) ,2720 BstrFmt(tr("Resetting differencing medium '%s'"), m->strLocationFull.c_str()).raw(), 2721 2721 FALSE /* aCancelable */); 2722 2722 if (FAILED(rc)) … … 4341 4341 rc = pProgress->init(m->pVirtualBox, 4342 4342 static_cast<IMedium*>(this), 4343 BstrFmt(tr("Deleting medium storage unit '%s'"), m->strLocationFull.c_str()) ,4343 BstrFmt(tr("Deleting medium storage unit '%s'"), m->strLocationFull.c_str()).raw(), 4344 4344 FALSE /* aCancelable */); 4345 4345 if (FAILED(rc)) … … 4562 4562 rc = pProgress->init(m->pVirtualBox, 4563 4563 static_cast<IMedium*>(this), 4564 BstrFmt(tr("Creating differencing medium storage unit '%s'"), aTarget->m->strLocationFull.c_str()) ,4564 BstrFmt(tr("Creating differencing medium storage unit '%s'"), aTarget->m->strLocationFull.c_str()).raw(), 4565 4565 TRUE /* aCancelable */); 4566 4566 if (FAILED(rc)) … … 5022 5022 BstrFmt(tr("Merging medium '%s' to '%s'"), 5023 5023 getName().c_str(), 5024 tgtName.c_str()) ,5024 tgtName.c_str()).raw(), 5025 5025 TRUE /* aCancelable */); 5026 5026 if (FAILED(rc)) -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r31287 r32718 332 332 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 333 333 334 ComAssertRet(! !mData->mMACAddress, E_FAIL);334 ComAssertRet(!mData->mMACAddress.isEmpty(), E_FAIL); 335 335 336 336 mData->mMACAddress.cloneTo(aMACAddress); … … 470 470 Bstr bstrEmpty(""); 471 471 if (!aHostInterface) 472 aHostInterface = bstrEmpty ;472 aHostInterface = bstrEmpty.raw(); 473 473 474 474 AutoCaller autoCaller(this); … … 577 577 Bstr bstrEmpty(""); 578 578 if (!aNATNetwork) 579 aNATNetwork = bstrEmpty ;579 aNATNetwork = bstrEmpty.raw(); 580 580 581 581 AutoCaller autoCaller(this); … … 633 633 Bstr bstrEmpty(""); 634 634 if (!aVDENetwork) 635 aVDENetwork = bstrEmpty ;635 aVDENetwork = bstrEmpty.raw(); 636 636 637 637 AutoCaller autoCaller(this); … … 1251 1251 mData->mEnabled = data.fEnabled; 1252 1252 /* MAC address (can be null) */ 1253 rc = COMSETTER(MACAddress)(Bstr(data.strMACAddress) );1253 rc = COMSETTER(MACAddress)(Bstr(data.strMACAddress).raw()); 1254 1254 if (FAILED(rc)) return rc; 1255 1255 /* cable (required) */ … … 1274 1274 1275 1275 case NetworkAttachmentType_Bridged: 1276 rc = COMSETTER(HostInterface)(Bstr(data.strName) );1276 rc = COMSETTER(HostInterface)(Bstr(data.strName).raw()); 1277 1277 if (FAILED(rc)) return rc; 1278 1278 rc = AttachToBridgedInterface(); … … 1290 1290 case NetworkAttachmentType_HostOnly: 1291 1291 #if defined(VBOX_WITH_NETFLT) 1292 rc = COMSETTER(HostInterface)(Bstr(data.strName) );1292 rc = COMSETTER(HostInterface)(Bstr(data.strName).raw()); 1293 1293 if (FAILED(rc)) return rc; 1294 1294 #endif -
trunk/src/VBox/Main/ProgressProxyImpl.cpp
r32431 r32718 227 227 muOtherProgressStartWeight = m_ulOperationsCompletedWeight + m_ulCurrentOperationWeight; 228 228 muOtherProgressWeight = m_ulTotalOperationsWeight - muOtherProgressStartWeight; 229 Progress::SetNextOperation(bstrOperationDescription , muOtherProgressWeight);229 Progress::SetNextOperation(bstrOperationDescription.raw(), muOtherProgressWeight); 230 230 231 231 muOtherProgressStartOperation = m_ulCurrentOperation; -
trunk/src/VBox/Main/SharedFolderImpl.cpp
r31544 r32718 105 105 unconst(mMachine) = aMachine; 106 106 107 HRESULT rc = protectedInit (aMachine, aThat->m.name, 108 aThat->m.hostPath, aThat->m.writable, aThat->m.autoMount); 107 HRESULT rc = protectedInit(aMachine, aThat->m.name.raw(), 108 aThat->m.hostPath.raw(), aThat->m.writable, 109 aThat->m.autoMount); 109 110 110 111 /* Confirm a successful initialization when it's the case */ -
trunk/src/VBox/Main/SnapshotImpl.cpp
r31615 r32718 1452 1452 stateFrom.c_str(), stateTo.c_str())); 1453 1453 1454 aConsoleProgress->SetNextOperation(Bstr(tr("Copying the execution state")) ,1454 aConsoleProgress->SetNextOperation(Bstr(tr("Copying the execution state")).raw(), 1455 1455 1); // weight 1456 1456 … … 1710 1710 pProgress.createObject(); 1711 1711 pProgress->init(mParent, aInitiator, 1712 BstrFmt(tr("Restoring snapshot '%s'"), pSnapshot->getName().c_str()) ,1712 BstrFmt(tr("Restoring snapshot '%s'"), pSnapshot->getName().c_str()).raw(), 1713 1713 FALSE /* aCancelable */, 1714 1714 ulOpCount, 1715 1715 ulTotalWeight, 1716 Bstr(tr("Restoring machine settings")) ,1716 Bstr(tr("Restoring machine settings")).raw(), 1717 1717 1); 1718 1718 … … 1865 1865 snapStateFilePath.c_str(), stateFilePath.c_str())); 1866 1866 1867 aTask.pProgress->SetNextOperation(Bstr(tr("Restoring the execution state")) ,1867 aTask.pProgress->SetNextOperation(Bstr(tr("Restoring the execution state")).raw(), 1868 1868 aTask.m_ulStateFileSizeMB); // weight 1869 1869 … … 2159 2159 pProgress.createObject(); 2160 2160 pProgress->init(mParent, aInitiator, 2161 BstrFmt(tr("Deleting snapshot '%s'"), pSnapshot->getName().c_str()) ,2161 BstrFmt(tr("Deleting snapshot '%s'"), pSnapshot->getName().c_str()).raw(), 2162 2162 FALSE /* aCancelable */, 2163 2163 ulOpCount, 2164 2164 ulTotalWeight, 2165 Bstr(tr("Setting up")) ,2165 Bstr(tr("Setting up")).raw(), 2166 2166 1); 2167 2167 … … 2395 2395 pOnlineMediumAttachment = 2396 2396 findAttachment(mMediaData->mAttachments, 2397 pAttach->getControllerName() ,2397 pAttach->getControllerName().raw(), 2398 2398 pAttach->getPort(), 2399 2399 pAttach->getDevice()); … … 2510 2510 if (!stateFilePath.isEmpty()) 2511 2511 { 2512 aTask.pProgress->SetNextOperation(Bstr(tr("Deleting the execution state")) ,2512 aTask.pProgress->SetNextOperation(Bstr(tr("Deleting the execution state")).raw(), 2513 2513 1); // weight 2514 2514 … … 2536 2536 2537 2537 aTask.pProgress->SetNextOperation(BstrFmt(tr("Merging differencing image '%s'"), 2538 pMedium->getName().c_str()) ,2538 pMedium->getName().c_str()).raw(), 2539 2539 ulWeight); 2540 2540 -
trunk/src/VBox/Main/USBDeviceFilterImpl.cpp
r31892 r32718 257 257 if (FAILED(rc)) break; 258 258 259 rc = COMSETTER(Remote)(Bstr(data.strRemote) );259 rc = COMSETTER(Remote)(Bstr(data.strRemote).raw()); 260 260 if (FAILED(rc)) break; 261 261 -
trunk/src/VBox/Main/VFSExplorerImpl.cpp
r31539 r32718 542 542 rc = progress->init(mVirtualBox, 543 543 static_cast<IVFSExplorer*>(this), 544 progressDesc ,544 progressDesc.raw(), 545 545 TRUE /* aCancelable */); 546 546 if (FAILED(rc)) throw rc; … … 671 671 672 672 rc = progress->init(mVirtualBox, static_cast<IVFSExplorer*>(this), 673 Bstr(tr("Delete files")) ,673 Bstr(tr("Delete files")).raw(), 674 674 TRUE /* aCancelable */); 675 675 if (FAILED(rc)) throw rc; -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r32120 r32718 1695 1695 Bstr bstrValue(aValue); 1696 1696 1697 if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue , error))1697 if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue.raw(), error)) 1698 1698 { 1699 1699 const char *sep = error.isEmpty() ? "" : ": "; … … 4401 4401 4402 4402 ComPtr<IDHCPServer> existing; 4403 rc = FindDHCPServerByNetworkName(name , existing.asOutParam());4403 rc = FindDHCPServerByNetworkName(name.raw(), existing.asOutParam()); 4404 4404 if (SUCCEEDED(rc)) 4405 4405 return E_INVALIDARG; -
trunk/src/VBox/Main/generic/NetIf-generic.cpp
r30714 r32718 5 5 6 6 /* 7 * Copyright (C) 2009 Oracle Corporation7 * Copyright (C) 2009-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 127 127 128 128 129 int NetIfCreateHostOnlyNetworkInterface 129 int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress) 130 130 { 131 131 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) … … 139 139 { 140 140 hrc = progress->init(pVBox, host, 141 Bstr ("Creating host only network interface"),141 Bstr("Creating host only network interface").raw(), 142 142 FALSE /* aCancelable */); 143 143 if (SUCCEEDED(hrc)) … … 220 220 } 221 221 222 int NetIfRemoveHostOnlyNetworkInterface 223 222 int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId, 223 IProgress **aProgress) 224 224 { 225 225 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) … … 234 234 Bstr ifname; 235 235 ComPtr<IHostNetworkInterface> iface; 236 if (FAILED(host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam())))236 if (FAILED(host->FindHostNetworkInterfaceById(Guid(aId).toUtf16().raw(), iface.asOutParam()))) 237 237 return VERR_INVALID_PARAMETER; 238 iface->COMGETTER(Name) 238 iface->COMGETTER(Name)(ifname.asOutParam()); 239 239 if (ifname.isEmpty()) 240 240 return VERR_INTERNAL_ERROR; 241 241 242 rc = progress->init 243 Bstr ("Removing host network interface"),242 rc = progress->init(pVBox, host, 243 Bstr("Removing host network interface").raw(), 244 244 FALSE /* aCancelable */); 245 245 if(SUCCEEDED(rc)) -
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r30739 r32718 7 7 8 8 /* 9 * Copyright (C) 2006-20 07Oracle Corporation9 * Copyright (C) 2006-2010 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 */ 19 19 20 #if !defined (VBOX_WITH_XPCOM) 21 #else 22 #include <nsIServiceManager.h> 23 #include <nsIExceptionService.h> 24 #include <nsCOMPtr.h> 20 #if defined(VBOX_WITH_XPCOM) 21 # include <nsIServiceManager.h> 22 # include <nsIExceptionService.h> 23 # include <nsCOMPtr.h> 25 24 #endif 26 25 … … 92 91 HRESULT rc = E_FAIL; 93 92 94 #if !defined 93 #if !defined(VBOX_WITH_XPCOM) 95 94 96 95 ComPtr<IErrorInfo> err; 97 rc = ::GetErrorInfo 96 rc = ::GetErrorInfo(0, err.asOutParam()); 98 97 if (rc == S_OK && err) 99 98 { … … 104 103 rc = err.queryInterfaceTo(info.asOutParam()); 105 104 if (SUCCEEDED(rc) && info) 106 init 105 init(info); 107 106 108 107 if (!mIsFullAvailable) … … 110 109 bool gotSomething = false; 111 110 112 rc = err->GetGUID 111 rc = err->GetGUID(mInterfaceID.asOutParam()); 113 112 gotSomething |= SUCCEEDED(rc); 114 113 if (SUCCEEDED(rc)) 115 GetInterfaceNameByIID 116 117 rc = err->GetSource 114 GetInterfaceNameByIID(mInterfaceID, mInterfaceName.asOutParam()); 115 116 rc = err->GetSource(mComponent.asOutParam()); 118 117 gotSomething |= SUCCEEDED(rc); 119 118 120 rc = err->GetDescription 119 rc = err->GetDescription(mText.asOutParam()); 121 120 gotSomething |= SUCCEEDED(rc); 122 121 … … 124 123 mIsBasicAvailable = true; 125 124 126 AssertMsg 125 AssertMsg(gotSomething, ("Nothing to fetch!\n")); 127 126 } 128 127 } 129 128 130 #else // defined 129 #else // defined(VBOX_WITH_XPCOM) 131 130 132 131 nsCOMPtr<nsIExceptionService> es; … … 135 134 { 136 135 nsCOMPtr<nsIExceptionManager> em; 137 rc = es->GetCurrentExceptionManager(getter_AddRefs 136 rc = es->GetCurrentExceptionManager(getter_AddRefs(em)); 138 137 if (NS_SUCCEEDED(rc)) 139 138 { … … 148 147 rc = ex.queryInterfaceTo(info.asOutParam()); 149 148 if (NS_SUCCEEDED(rc) && info) 150 init 149 init(info); 151 150 152 151 if (!mIsFullAvailable) … … 163 162 { 164 163 mText = Bstr(pszMsg); 165 nsMemory::Free( mText);164 nsMemory::Free(pszMsg); 166 165 } 167 166 … … 169 168 mIsBasicAvailable = true; 170 169 171 AssertMsg 170 AssertMsg(gotSomething, ("Nothing to fetch!\n")); 172 171 } 173 172 174 173 // set the exception to NULL (to emulate Win32 behavior) 175 em->SetCurrentException 174 em->SetCurrentException(NULL); 176 175 177 176 rc = NS_OK; … … 183 182 rc = NS_OK; 184 183 185 AssertComRC 186 187 #endif // defined 184 AssertComRC(rc); 185 186 #endif // defined(VBOX_WITH_XPCOM) 188 187 } 189 188 … … 196 195 return; 197 196 198 #if !defined 197 #if !defined(VBOX_WITH_XPCOM) 199 198 200 199 ComPtr<IUnknown> iface = aI; … … 203 202 if (SUCCEEDED(rc)) 204 203 { 205 rc = serr->InterfaceSupportsErrorInfo 204 rc = serr->InterfaceSupportsErrorInfo(aIID); 206 205 if (SUCCEEDED(rc)) 207 init 206 init(aKeepObj); 208 207 } 209 208 210 209 #else 211 210 212 init 211 init(aKeepObj); 213 212 214 213 #endif … … 217 216 { 218 217 mCalleeIID = aIID; 219 GetInterfaceNameByIID 218 GetInterfaceNameByIID(aIID, mCalleeName.asOutParam()); 220 219 } 221 220 } … … 223 222 void ErrorInfo::init(IVirtualBoxErrorInfo *info) 224 223 { 225 AssertReturnVoid 224 AssertReturnVoid(info); 226 225 227 226 HRESULT rc = E_FAIL; … … 230 229 LONG lrc; 231 230 232 rc = info->COMGETTER(ResultCode) 231 rc = info->COMGETTER(ResultCode)(&lrc); mResultCode = lrc; 233 232 gotSomething |= SUCCEEDED(rc); 234 233 gotAll &= SUCCEEDED(rc); 235 234 236 235 Bstr iid; 237 rc = info->COMGETTER(InterfaceID) 236 rc = info->COMGETTER(InterfaceID)(iid.asOutParam()); 238 237 gotSomething |= SUCCEEDED(rc); 239 238 gotAll &= SUCCEEDED(rc); … … 241 240 { 242 241 mInterfaceID = iid; 243 GetInterfaceNameByIID 244 } 245 246 rc = info->COMGETTER(Component) 247 gotSomething |= SUCCEEDED(rc); 248 gotAll &= SUCCEEDED(rc); 249 250 rc = info->COMGETTER(Text) 242 GetInterfaceNameByIID(mInterfaceID, mInterfaceName.asOutParam()); 243 } 244 245 rc = info->COMGETTER(Component)(mComponent.asOutParam()); 246 gotSomething |= SUCCEEDED(rc); 247 gotAll &= SUCCEEDED(rc); 248 249 rc = info->COMGETTER(Text)(mText.asOutParam()); 251 250 gotSomething |= SUCCEEDED(rc); 252 251 gotAll &= SUCCEEDED(rc); … … 255 254 256 255 ComPtr<IVirtualBoxErrorInfo> next; 257 rc = info->COMGETTER(Next) 256 rc = info->COMGETTER(Next)(next.asOutParam()); 258 257 if (SUCCEEDED(rc) && !next.isNull()) 259 258 { … … 270 269 mIsFullAvailable = gotAll; 271 270 272 AssertMsg 271 AssertMsg(gotSomething, ("Nothing to fetch!\n")); 273 272 } 274 273 … … 279 278 //////////////////////////////////////////////////////////////////////////////// 280 279 281 ProgressErrorInfo::ProgressErrorInfo 282 ErrorInfo 280 ProgressErrorInfo::ProgressErrorInfo(IProgress *progress) : 281 ErrorInfo(false /* aDummy */) 283 282 { 284 283 Assert(progress); … … 287 286 288 287 ComPtr<IVirtualBoxErrorInfo> info; 289 HRESULT rc = progress->COMGETTER(ErrorInfo) 288 HRESULT rc = progress->COMGETTER(ErrorInfo)(info.asOutParam()); 290 289 if (SUCCEEDED(rc) && info) 291 init 290 init(info); 292 291 } 293 292 … … 305 304 HRESULT rc = S_OK; 306 305 307 #if !defined 306 #if !defined(VBOX_WITH_XPCOM) 308 307 309 308 ComPtr<IErrorInfo> err; … … 311 310 { 312 311 rc = mErrorInfo.queryInterfaceTo(err.asOutParam()); 313 AssertComRC 314 } 315 rc = ::SetErrorInfo 316 317 #else // !defined 312 AssertComRC(rc); 313 } 314 rc = ::SetErrorInfo(0, err); 315 316 #else // !defined(VBOX_WITH_XPCOM) 318 317 319 318 nsCOMPtr <nsIExceptionService> es; 320 es = do_GetService 319 es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 321 320 if (NS_SUCCEEDED(rc)) 322 321 { 323 322 nsCOMPtr <nsIExceptionManager> em; 324 rc = es->GetCurrentExceptionManager (getter_AddRefs(em));323 rc = es->GetCurrentExceptionManager(getter_AddRefs(em)); 325 324 if (NS_SUCCEEDED(rc)) 326 325 { … … 329 328 { 330 329 rc = mErrorInfo.queryInterfaceTo(ex.asOutParam()); 331 AssertComRC 330 AssertComRC(rc); 332 331 } 333 rc = em->SetCurrentException 332 rc = em->SetCurrentException(ex); 334 333 } 335 334 } 336 335 337 #endif // !defined 336 #endif // !defined(VBOX_WITH_XPCOM) 338 337 339 338 if (SUCCEEDED(rc)) -
trunk/src/VBox/Main/glue/errorprint.cpp
r30764 r32718 7 7 8 8 /* 9 * Copyright (C) 2009 Oracle Corporation9 * Copyright (C) 2009-2010 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 25 25 #include <iprt/stream.h> 26 #include <iprt/message.h> 26 27 #include <iprt/path.h> 27 28 … … 31 32 void GluePrintErrorInfo(com::ErrorInfo &info) 32 33 { 33 Utf8Str str = Utf8StrFmt(" ERROR:%ls\n"34 Utf8Str str = Utf8StrFmt("%ls\n" 34 35 "Details: code %Rhrc (0x%RX32), component %ls, interface %ls, callee %ls\n" 35 36 , … … 41 42 info.getCalleeName().raw()); 42 43 // print and log 43 RT Printf("%s", str.c_str());44 Log((" %s", str.c_str()));44 RTMsgError("%s", str.c_str()); 45 Log(("ERROR: %s", str.c_str())); 45 46 } 46 47 … … 55 56 strFilename.c_str()); 56 57 // print and log 57 RT Printf("%s", str.c_str());58 RTStrmPrintf(g_pStdErr, "%s", str.c_str()); 58 59 Log(("%s", str.c_str())); 59 60 } … … 61 62 void GluePrintRCMessage(HRESULT rc) 62 63 { 63 Utf8Str str = Utf8StrFmt(" ERROR: code %Rhra (extended info not available)\n", rc);64 Utf8Str str = Utf8StrFmt("Code %Rhra (extended info not available)\n", rc); 64 65 // print and log 65 RT Printf("%s", str.c_str());66 Log((" %s", str.c_str()));66 RTMsgError("%s", str.c_str()); 67 Log(("ERROR: %s", str.c_str())); 67 68 } 68 69 -
trunk/src/VBox/Main/testcase/tstAPI.cpp
r28800 r32718 48 48 static Bstr getObjectName(ComPtr<IVirtualBox> aVirtualBox, 49 49 ComPtr<IUnknown> aObject); 50 static void queryMetrics 51 52 ComSafeArrayIn(IUnknown *, objects));50 static void queryMetrics(ComPtr<IVirtualBox> aVirtualBox, 51 ComPtr<IPerformanceCollector> collector, 52 ComSafeArrayIn(IUnknown *, objects)); 53 53 static void listAffectedMetrics(ComPtr<IVirtualBox> aVirtualBox, 54 54 ComSafeArrayIn(IPerformanceMetric*, aMetrics)); … … 57 57 /////////////////////////////////////////////////////////////////////////////// 58 58 59 HRESULT readAndChangeMachineSettings 59 HRESULT readAndChangeMachineSettings(IMachine *machine, IMachine *readonlyMachine = 0) 60 60 { 61 61 HRESULT rc = S_OK; 62 62 63 63 Bstr name; 64 RTPrintf 65 CHECK_ERROR_RET (machine, COMGETTER(Name)(name.asOutParam()), rc);66 RTPrintf 64 RTPrintf("Getting machine name...\n"); 65 CHECK_ERROR_RET(machine, COMGETTER(Name)(name.asOutParam()), rc); 66 RTPrintf("Name: {%ls}\n", name.raw()); 67 67 68 68 RTPrintf("Getting machine GUID...\n"); 69 69 Bstr guid; 70 CHECK_ERROR (machine, COMGETTER(Id)(guid.asOutParam()));70 CHECK_ERROR(machine, COMGETTER(Id)(guid.asOutParam())); 71 71 if (SUCCEEDED(rc) && !guid.isEmpty()) { 72 RTPrintf 72 RTPrintf("Guid::toString(): {%s}\n", Utf8Str(guid).c_str()); 73 73 } else { 74 RTPrintf 74 RTPrintf("WARNING: there's no GUID!"); 75 75 } 76 76 77 77 ULONG memorySize; 78 RTPrintf 79 CHECK_ERROR_RET (machine, COMGETTER(MemorySize)(&memorySize), rc);80 RTPrintf 78 RTPrintf("Getting memory size...\n"); 79 CHECK_ERROR_RET(machine, COMGETTER(MemorySize)(&memorySize), rc); 80 RTPrintf("Memory size: %d\n", memorySize); 81 81 82 82 MachineState_T machineState; 83 RTPrintf 84 CHECK_ERROR_RET (machine, COMGETTER(State)(&machineState), rc);85 RTPrintf 83 RTPrintf("Getting machine state...\n"); 84 CHECK_ERROR_RET(machine, COMGETTER(State)(&machineState), rc); 85 RTPrintf("Machine state: %d\n", machineState); 86 86 87 87 BOOL modified; 88 RTPrintf 89 CHECK_ERROR (machine, COMGETTER(SettingsModified)(&modified));88 RTPrintf("Are any settings modified?...\n"); 89 CHECK_ERROR(machine, COMGETTER(SettingsModified)(&modified)); 90 90 if (SUCCEEDED(rc)) 91 RTPrintf 91 RTPrintf("%s\n", modified ? "yes" : "no"); 92 92 93 93 ULONG memorySizeBig = memorySize * 10; 94 94 RTPrintf("Changing memory size to %d...\n", memorySizeBig); 95 CHECK_ERROR (machine, COMSETTER(MemorySize)(memorySizeBig));95 CHECK_ERROR(machine, COMSETTER(MemorySize)(memorySizeBig)); 96 96 97 97 if (SUCCEEDED(rc)) 98 98 { 99 RTPrintf 100 CHECK_ERROR_RET (machine, COMGETTER(SettingsModified)(&modified), rc);101 RTPrintf 102 ASSERT_RET 99 RTPrintf("Are any settings modified now?...\n"); 100 CHECK_ERROR_RET(machine, COMGETTER(SettingsModified)(&modified), rc); 101 RTPrintf("%s\n", modified ? "yes" : "no"); 102 ASSERT_RET(modified, 0); 103 103 104 104 ULONG memorySizeGot; 105 RTPrintf 106 CHECK_ERROR_RET (machine, COMGETTER(MemorySize)(&memorySizeGot), rc);107 RTPrintf 108 ASSERT_RET 105 RTPrintf("Getting memory size again...\n"); 106 CHECK_ERROR_RET(machine, COMGETTER(MemorySize)(&memorySizeGot), rc); 107 RTPrintf("Memory size: %d\n", memorySizeGot); 108 ASSERT_RET(memorySizeGot == memorySizeBig, 0); 109 109 110 110 if (readonlyMachine) 111 111 { 112 RTPrintf 112 RTPrintf("Getting memory size of the counterpart readonly machine...\n"); 113 113 ULONG memorySizeRO; 114 readonlyMachine->COMGETTER(MemorySize) 115 RTPrintf 116 ASSERT_RET 117 } 118 119 RTPrintf 120 CHECK_ERROR_RET 121 RTPrintf 122 CHECK_ERROR_RET (machine, COMGETTER(SettingsModified)(&modified), rc);123 RTPrintf 124 ASSERT_RET 125 126 RTPrintf 127 CHECK_ERROR_RET (machine, COMGETTER(MemorySize)(&memorySizeGot), rc);128 RTPrintf 129 ASSERT_RET 114 readonlyMachine->COMGETTER(MemorySize)(&memorySizeRO); 115 RTPrintf("Memory size: %d\n", memorySizeRO); 116 ASSERT_RET(memorySizeRO != memorySizeGot, 0); 117 } 118 119 RTPrintf("Discarding recent changes...\n"); 120 CHECK_ERROR_RET(machine, DiscardSettings(), rc); 121 RTPrintf("Are any settings modified after discarding?...\n"); 122 CHECK_ERROR_RET(machine, COMGETTER(SettingsModified)(&modified), rc); 123 RTPrintf("%s\n", modified ? "yes" : "no"); 124 ASSERT_RET(!modified, 0); 125 126 RTPrintf("Getting memory size once more...\n"); 127 CHECK_ERROR_RET(machine, COMGETTER(MemorySize)(&memorySizeGot), rc); 128 RTPrintf("Memory size: %d\n", memorySizeGot); 129 ASSERT_RET(memorySizeGot == memorySize, 0); 130 130 131 131 memorySize = memorySize > 128 ? memorySize / 2 : memorySize * 2; 132 132 RTPrintf("Changing memory size to %d...\n", memorySize); 133 CHECK_ERROR_RET (machine, COMSETTER(MemorySize)(memorySize), rc);133 CHECK_ERROR_RET(machine, COMSETTER(MemorySize)(memorySize), rc); 134 134 } 135 135 136 136 Bstr desc; 137 RTPrintf 138 CHECK_ERROR_RET (machine, COMGETTER(Description)(desc.asOutParam()), rc);139 RTPrintf 137 RTPrintf("Getting description...\n"); 138 CHECK_ERROR_RET(machine, COMGETTER(Description)(desc.asOutParam()), rc); 139 RTPrintf("Description is: \"%ls\"\n", desc.raw()); 140 140 141 141 desc = L"This is an exemplary description (changed)."; 142 RTPrintf 143 CHECK_ERROR_RET (machine, COMSETTER(Description) (desc), rc);144 145 RTPrintf 146 CHECK_ERROR 142 RTPrintf("Setting description to \"%ls\"...\n", desc.raw()); 143 CHECK_ERROR_RET(machine, COMSETTER(Description)(desc.raw()), rc); 144 145 RTPrintf("Saving machine settings...\n"); 146 CHECK_ERROR(machine, SaveSettings()); 147 147 if (SUCCEEDED(rc)) 148 148 { 149 RTPrintf 150 CHECK_ERROR_RET (machine, COMGETTER(SettingsModified)(&modified), rc);151 RTPrintf 152 ASSERT_RET 149 RTPrintf("Are any settings modified after saving?...\n"); 150 CHECK_ERROR_RET(machine, COMGETTER(SettingsModified)(&modified), rc); 151 RTPrintf("%s\n", modified ? "yes" : "no"); 152 ASSERT_RET(!modified, 0); 153 153 154 154 if (readonlyMachine) { 155 RTPrintf 155 RTPrintf("Getting memory size of the counterpart readonly machine...\n"); 156 156 ULONG memorySizeRO; 157 readonlyMachine->COMGETTER(MemorySize) 158 RTPrintf 159 ASSERT_RET 157 readonlyMachine->COMGETTER(MemorySize)(&memorySizeRO); 158 RTPrintf("Memory size: %d\n", memorySizeRO); 159 ASSERT_RET(memorySizeRO == memorySize, 0); 160 160 } 161 161 } … … 163 163 Bstr extraDataKey = L"Blafasel"; 164 164 Bstr extraData; 165 RTPrintf 166 CHECK_ERROR_RET (machine, GetExtraData (extraDataKey, extraData.asOutParam()), rc);165 RTPrintf("Getting extra data key {%ls}...\n", extraDataKey.raw()); 166 CHECK_ERROR_RET(machine, GetExtraData(extraDataKey.raw(), extraData.asOutParam()), rc); 167 167 if (!extraData.isEmpty()) { 168 RTPrintf 168 RTPrintf("Extra data value: {%ls}\n", extraData.raw()); 169 169 } else { 170 RTPrintf 170 RTPrintf("No extra data exists\n"); 171 171 } 172 172 … … 175 175 else 176 176 extraData.setNull(); 177 RTPrintf ( 178 "Setting extra data key {%ls} to {%ls}...\n", 179 extraDataKey.raw(), extraData.raw() 180 ); 181 CHECK_ERROR (machine, SetExtraData (extraDataKey, extraData)); 177 RTPrintf("Setting extra data key {%ls} to {%ls}...\n", 178 extraDataKey.raw(), extraData.raw()); 179 CHECK_ERROR(machine, SetExtraData(extraDataKey.raw(), extraData.raw())); 182 180 183 181 if (SUCCEEDED(rc)) { 184 RTPrintf 185 CHECK_ERROR_RET (machine, GetExtraData (extraDataKey, extraData.asOutParam()), rc);182 RTPrintf("Getting extra data key {%ls} again...\n", extraDataKey.raw()); 183 CHECK_ERROR_RET(machine, GetExtraData(extraDataKey.raw(), extraData.asOutParam()), rc); 186 184 if (!extraData.isEmpty()) { 187 RTPrintf 185 RTPrintf("Extra data value: {%ls}\n", extraData.raw()); 188 186 } else { 189 RTPrintf 187 RTPrintf("No extra data exists\n"); 190 188 } 191 189 } … … 208 206 209 207 { 210 char homeDir 211 GetVBoxUserHomeDirectory (homeDir, sizeof(homeDir));212 RTPrintf 213 } 214 215 RTPrintf 208 char homeDir[RTPATH_MAX]; 209 GetVBoxUserHomeDirectory(homeDir, sizeof(homeDir)); 210 RTPrintf("VirtualBox Home Directory = '%s'\n", homeDir); 211 } 212 213 RTPrintf("Initializing COM...\n"); 216 214 217 215 rc = com::Initialize(); … … 235 233 236 234 Utf8Str nullUtf8Str; 237 RTPrintf 235 RTPrintf("nullUtf8Str='%s'\n", nullUtf8Str.raw()); 238 236 239 237 Utf8Str simpleUtf8Str = "simpleUtf8Str"; 240 RTPrintf ("simpleUtf8Str='%s'\n", simpleUtf8Str.raw()); 241 242 Utf8Str utf8StrFmt = Utf8StrFmt ("[0=%d]%s[1=%d]", 243 0, "utf8StrFmt", 1); 244 RTPrintf ("utf8StrFmt='%s'\n", utf8StrFmt.raw()); 245 246 #endif 247 248 RTPrintf ("Creating VirtualBox object...\n"); 249 rc = virtualBox.createLocalObject (CLSID_VirtualBox); 238 RTPrintf("simpleUtf8Str='%s'\n", simpleUtf8Str.raw()); 239 240 Utf8Str utf8StrFmt = Utf8StrFmt("[0=%d]%s[1=%d]", 0, "utf8StrFmt", 1); 241 RTPrintf("utf8StrFmt='%s'\n", utf8StrFmt.raw()); 242 243 #endif 244 245 RTPrintf("Creating VirtualBox object...\n"); 246 rc = virtualBox.createLocalObject(CLSID_VirtualBox); 250 247 if (FAILED(rc)) 251 248 RTPrintf("ERROR: failed to create the VirtualBox object!\n"); … … 257 254 } 258 255 259 if (FAILED 256 if (FAILED(rc)) 260 257 { 261 258 com::ErrorInfo info; … … 277 274 //////////////////////////////////////////////////////////////////////////// 278 275 { 279 RTPrintf 276 RTPrintf("Testing VirtualBox::COMGETTER(ProgressOperations)...\n"); 280 277 281 278 for (;;) { 282 279 com::SafeIfaceArray<IProgress> operations; 283 280 284 CHECK_ERROR_BREAK 281 CHECK_ERROR_BREAK(virtualBox, 285 282 COMGETTER(ProgressOperations)(ComSafeArrayAsOutParam(operations))); 286 283 287 RTPrintf 284 RTPrintf("operations: %d\n", operations.size()); 288 285 if (operations.size() == 0) 289 286 break; // No more operations left. … … 293 290 294 291 operations[i]->COMGETTER(Percent)(&percent); 295 RTPrintf 292 RTPrintf("operations[%u]: %ld\n", (unsigned)i, (long)percent); 296 293 } 297 RTThreadSleep 294 RTThreadSleep(2000); // msec 298 295 } 299 296 } … … 307 304 ComPtr<IVirtualBox> virtualBox2; 308 305 309 RTPrintf 310 CHECK_RC (virtualBox2.createLocalObject(CLSID_VirtualBox));311 if (FAILED 306 RTPrintf("Creating one more VirtualBox object...\n"); 307 CHECK_RC(virtualBox2.createLocalObject(CLSID_VirtualBox)); 308 if (FAILED(rc)) 312 309 { 313 310 CHECK_ERROR_NOCALL(); … … 315 312 } 316 313 317 RTPrintf 318 (IVirtualBox *) virtualBox, (IVirtualBox *)virtualBox2);319 Assert ((IVirtualBox *) virtualBox == (IVirtualBox *)virtualBox2);320 321 ComPtr<IUnknown> unk 314 RTPrintf("IVirtualBox(virtualBox)=%p IVirtualBox(virtualBox2)=%p\n", 315 (IVirtualBox *)virtualBox, (IVirtualBox *)virtualBox2); 316 Assert((IVirtualBox *)virtualBox == (IVirtualBox *)virtualBox2); 317 318 ComPtr<IUnknown> unk(virtualBox); 322 319 ComPtr<IUnknown> unk2; 323 320 unk2 = virtualBox2; 324 321 325 RTPrintf 326 (IUnknown *) unk, (IUnknown *)unk2);327 Assert ((IUnknown *) unk == (IUnknown *)unk2);322 RTPrintf("IUnknown(virtualBox)=%p IUnknown(virtualBox2)=%p\n", 323 (IUnknown *)unk, (IUnknown *)unk2); 324 Assert((IUnknown *)unk == (IUnknown *)unk2); 328 325 329 326 ComPtr<IVirtualBox> vb = unk; 330 327 ComPtr<IVirtualBox> vb2 = unk; 331 328 332 RTPrintf 333 (IVirtualBox *) vb, (IVirtualBox *)vb2);334 Assert ((IVirtualBox *) vb == (IVirtualBox *)vb2);329 RTPrintf("IVirtualBox(IUnknown(virtualBox))=%p IVirtualBox(IUnknown(virtualBox2))=%p\n", 330 (IVirtualBox *)vb, (IVirtualBox *)vb2); 331 Assert((IVirtualBox *)vb == (IVirtualBox *)vb2); 335 332 } 336 333 337 334 { 338 335 ComPtr<IHost> host; 339 CHECK_ERROR_BREAK 340 RTPrintf (" IHost(host)=%p\n", (IHost *)host);336 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam())); 337 RTPrintf(" IHost(host)=%p\n", (IHost *)host); 341 338 ComPtr<IUnknown> unk = host; 342 RTPrintf (" IUnknown(host)=%p\n", (IUnknown *)unk);339 RTPrintf(" IUnknown(host)=%p\n", (IUnknown *)unk); 343 340 ComPtr<IHost> host_copy = unk; 344 RTPrintf (" IHost(host_copy)=%p\n", (IHost *)host_copy);341 RTPrintf(" IHost(host_copy)=%p\n", (IHost *)host_copy); 345 342 ComPtr<IUnknown> unk_copy = host_copy; 346 RTPrintf (" IUnknown(host_copy)=%p\n", (IUnknown *)unk_copy);347 Assert ((IUnknown *) unk == (IUnknown *)unk_copy);343 RTPrintf(" IUnknown(host_copy)=%p\n", (IUnknown *)unk_copy); 344 Assert((IUnknown *)unk == (IUnknown *)unk_copy); 348 345 349 346 /* query IUnknown on IUnknown */ 350 347 ComPtr<IUnknown> unk_copy_copy; 351 348 unk_copy.queryInterfaceTo(unk_copy_copy.asOutParam()); 352 RTPrintf (" IUnknown(unk_copy)=%p\n", (IUnknown *)unk_copy_copy);353 Assert ((IUnknown *) unk_copy == (IUnknown *)unk_copy_copy);349 RTPrintf(" IUnknown(unk_copy)=%p\n", (IUnknown *)unk_copy_copy); 350 Assert((IUnknown *)unk_copy == (IUnknown *)unk_copy_copy); 354 351 /* query IUnknown on IUnknown in the opposite direction */ 355 352 unk_copy_copy.queryInterfaceTo(unk_copy.asOutParam()); 356 RTPrintf (" IUnknown(unk_copy_copy)=%p\n", (IUnknown *)unk_copy);357 Assert ((IUnknown *) unk_copy == (IUnknown *)unk_copy_copy);353 RTPrintf(" IUnknown(unk_copy_copy)=%p\n", (IUnknown *)unk_copy); 354 Assert((IUnknown *)unk_copy == (IUnknown *)unk_copy_copy); 358 355 359 356 /* query IUnknown again after releasing all previous IUnknown instances … … 364 361 unk_copy_copy.setNull(); 365 362 unk = host; 366 RTPrintf (" IUnknown(host)=%p\n", (IUnknown *)unk);367 Assert (oldUnk == (IUnknown *)unk);368 } 369 370 // RTPrintf 363 RTPrintf(" IUnknown(host)=%p\n", (IUnknown *)unk); 364 Assert(oldUnk == (IUnknown *)unk); 365 } 366 367 // RTPrintf("Will be now released (press Enter)..."); 371 368 // getchar(); 372 369 } … … 383 380 { 384 381 Bstr version; 385 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Version)(version.asOutParam()));386 RTPrintf 382 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Version)(version.asOutParam())); 383 RTPrintf("VirtualBox version = %ls\n", version.raw()); 387 384 } 388 385 #endif … … 392 389 //////////////////////////////////////////////////////////////////////////// 393 390 { 394 RTPrintf 391 RTPrintf("Calling IVirtualBox::Machines...\n"); 395 392 396 393 com::SafeIfaceArray<IMachine> machines; 397 CHECK_ERROR_BREAK 398 COMGETTER(Machines) (ComSafeArrayAsOutParam(machines)));399 400 RTPrintf 394 CHECK_ERROR_BREAK(virtualBox, 395 COMGETTER(Machines)(ComSafeArrayAsOutParam(machines))); 396 397 RTPrintf("%u machines registered (machines.isNull()=%d).\n", 401 398 machines.size(), machines.isNull()); 402 399 … … 404 401 { 405 402 Bstr name; 406 CHECK_ERROR_BREAK (machines [i], COMGETTER(Name)(name.asOutParam()));407 RTPrintf ("machines[%u]='%s'\n", i, Utf8Str(name).raw());408 } 409 410 #if 0 411 { 412 RTPrintf 403 CHECK_ERROR_BREAK(machines[i], COMGETTER(Name)(name.asOutParam())); 404 RTPrintf("machines[%u]='%s'\n", i, Utf8Str(name).raw()); 405 } 406 407 #if 0 408 { 409 RTPrintf("Testing [out] arrays...\n"); 413 410 com::SafeGUIDArray uuids; 414 CHECK_ERROR_BREAK 415 COMGETTER(Uuids) (ComSafeArrayAsOutParam(uuids)));411 CHECK_ERROR_BREAK(virtualBox, 412 COMGETTER(Uuids)(ComSafeArrayAsOutParam(uuids))); 416 413 417 414 for (size_t i = 0; i < uuids.size(); ++ i) 418 RTPrintf ("uuids[%u]=%RTuuid\n", i, &uuids[i]);419 } 420 421 { 422 RTPrintf 423 com::SafeGUIDArray uuids 415 RTPrintf("uuids[%u]=%RTuuid\n", i, &uuids[i]); 416 } 417 418 { 419 RTPrintf("Testing [in] arrays...\n"); 420 com::SafeGUIDArray uuids(5); 424 421 for (size_t i = 0; i < uuids.size(); ++ i) 425 422 { 426 423 Guid id; 427 424 id.create(); 428 uuids 429 RTPrintf ("uuids[%u]=%RTuuid\n", i, &uuids[i]);425 uuids[i] = id; 426 RTPrintf("uuids[%u]=%RTuuid\n", i, &uuids[i]); 430 427 } 431 428 432 CHECK_ERROR_BREAK 433 SetUuids (ComSafeArrayAsInParam(uuids)));429 CHECK_ERROR_BREAK(virtualBox, 430 SetUuids(ComSafeArrayAsInParam(uuids))); 434 431 } 435 432 #endif … … 501 498 RTPrintf("Call failed\n"); 502 499 } 503 RTPrintf 500 RTPrintf("\n"); 504 501 #endif 505 502 … … 514 511 ComPtr<IHardDisk> hardDisk; 515 512 rc = virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); 516 RTPrintf 513 RTPrintf("virtualBox->GetHardDisk(null-uuid)=%08X\n", rc); 517 514 518 515 // { 519 // com::ErrorInfo info 520 // PRINT_ERROR_INFO 516 // com::ErrorInfo info(virtualBox); 517 // PRINT_ERROR_INFO(info); 521 518 // } 522 519 523 520 // call a method that will definitely succeed 524 521 Bstr version; 525 rc = virtualBox->COMGETTER(Version) 526 RTPrintf 527 528 { 529 com::ErrorInfo info 530 PRINT_ERROR_INFO 522 rc = virtualBox->COMGETTER(Version)(version.asOutParam()); 523 RTPrintf("virtualBox->COMGETTER(Version)=%08X\n", rc); 524 525 { 526 com::ErrorInfo info(virtualBox); 527 PRINT_ERROR_INFO(info); 531 528 } 532 529 … … 536 533 ComPtr<IMachine> machine; 537 534 rc = session->COMGETTER(Machine)(machine.asOutParam()); 538 RTPrintf 535 RTPrintf("session->COMGETTER(Machine)=%08X\n", rc); 539 536 540 537 // { 541 // com::ErrorInfo info 542 // PRINT_ERROR_INFO 538 // com::ErrorInfo info(virtualBox); 539 // PRINT_ERROR_INFO(info); 543 540 // } 544 541 545 542 // call a method that will definitely succeed 546 543 SessionState_T state; 547 rc = session->COMGETTER(State) 548 RTPrintf 549 550 { 551 com::ErrorInfo info 552 PRINT_ERROR_INFO 544 rc = session->COMGETTER(State)(&state); 545 RTPrintf("session->COMGETTER(State)=%08X\n", rc); 546 547 { 548 com::ErrorInfo info(virtualBox); 549 PRINT_ERROR_INFO(info); 553 550 } 554 551 } … … 562 559 ComPtr<IHardDisk> hd; 563 560 Bstr src = L"E:\\develop\\innotek\\images\\NewHardDisk.vdi"; 564 RTPrintf 565 CHECK_ERROR_BREAK (virtualBox, OpenHardDisk(src, AccessMode_ReadWrite, hd.asOutParam()));566 RTPrintf 561 RTPrintf("Opening the existing hard disk '%ls'...\n", src.raw()); 562 CHECK_ERROR_BREAK(virtualBox, OpenHardDisk(src, AccessMode_ReadWrite, hd.asOutParam())); 563 RTPrintf("Enter to continue...\n"); 567 564 getchar(); 568 RTPrintf 569 CHECK_ERROR_BREAK (virtualBox, RegisterHardDisk(hd));570 RTPrintf 565 RTPrintf("Registering the existing hard disk '%ls'...\n", src.raw()); 566 CHECK_ERROR_BREAK(virtualBox, RegisterHardDisk(hd)); 567 RTPrintf("Enter to continue...\n"); 571 568 getchar(); 572 569 } 573 570 while (FALSE); 574 RTPrintf 571 RTPrintf("\n"); 575 572 #endif 576 573 … … 582 579 ComPtr<IVirtualDiskImage> vdi; 583 580 Bstr src = L"CreatorTest.vdi"; 584 RTPrintf 585 CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage(src, vdi.asOutParam()));581 RTPrintf("Unregistering the hard disk '%ls'...\n", src.raw()); 582 CHECK_ERROR_BREAK(virtualBox, FindVirtualDiskImage(src, vdi.asOutParam())); 586 583 ComPtr<IHardDisk> hd = vdi; 587 584 Guid id; 588 CHECK_ERROR_BREAK (hd, COMGETTER(Id)(id.asOutParam()));589 CHECK_ERROR_BREAK (virtualBox, UnregisterHardDisk(id, hd.asOutParam()));585 CHECK_ERROR_BREAK(hd, COMGETTER(Id)(id.asOutParam())); 586 CHECK_ERROR_BREAK(virtualBox, UnregisterHardDisk(id, hd.asOutParam())); 590 587 } 591 588 while (FALSE); 592 RTPrintf 589 RTPrintf("\n"); 593 590 #endif 594 591 … … 604 601 #endif 605 602 Bstr dst = L"./clone.vdi"; 606 RTPrintf 603 RTPrintf("Cloning '%ls' to '%ls'...\n", src.raw(), dst.raw()); 607 604 ComPtr<IVirtualDiskImage> vdi; 608 CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage(src, vdi.asOutParam()));605 CHECK_ERROR_BREAK(virtualBox, FindVirtualDiskImage(src, vdi.asOutParam())); 609 606 ComPtr<IHardDisk> hd = vdi; 610 607 ComPtr<IProgress> progress; 611 CHECK_ERROR_BREAK (hd, CloneToImage(dst, vdi.asOutParam(), progress.asOutParam()));612 RTPrintf 613 CHECK_ERROR_BREAK (progress, WaitForCompletion(-1));614 ProgressErrorInfo ei 615 if (FAILED 616 { 617 PRINT_ERROR_INFO 608 CHECK_ERROR_BREAK(hd, CloneToImage(dst, vdi.asOutParam(), progress.asOutParam())); 609 RTPrintf("Waiting for completion...\n"); 610 CHECK_ERROR_BREAK(progress, WaitForCompletion(-1)); 611 ProgressErrorInfo ei(progress); 612 if (FAILED(ei.getResultCode())) 613 { 614 PRINT_ERROR_INFO(ei); 618 615 } 619 616 else 620 617 { 621 vdi->COMGETTER(FilePath) 622 RTPrintf 618 vdi->COMGETTER(FilePath)(dst.asOutParam()); 619 RTPrintf("Actual clone path is '%ls'\n", dst.raw()); 623 620 } 624 621 } 625 622 while (FALSE); 626 RTPrintf 623 RTPrintf("\n"); 627 624 #endif 628 625 … … 646 643 }; 647 644 648 RTPrintf 649 650 for (size_t i = 0; i < RT_ELEMENTS 651 { 652 Bstr src = Names 653 RTPrintf 654 rc = virtualBox->FindHardDisk 645 RTPrintf("\n"); 646 647 for (size_t i = 0; i < RT_ELEMENTS(Names); ++ i) 648 { 649 Bstr src = Names[i]; 650 RTPrintf("Searching for hard disk '%ls'...\n", src.raw()); 651 rc = virtualBox->FindHardDisk(src, hd.asOutParam()); 655 652 if (SUCCEEDED(rc)) 656 653 { 657 654 Guid id; 658 655 Bstr location; 659 CHECK_ERROR_BREAK (hd, COMGETTER(Id)(id.asOutParam()));660 CHECK_ERROR_BREAK (hd, COMGETTER(Location)(location.asOutParam()));661 RTPrintf 656 CHECK_ERROR_BREAK(hd, COMGETTER(Id)(id.asOutParam())); 657 CHECK_ERROR_BREAK(hd, COMGETTER(Location)(location.asOutParam())); 658 RTPrintf("Found, UUID={%RTuuid}, location='%ls'.\n", 662 659 id.raw(), location.raw()); 663 660 … … 665 662 com::SafeArray<BSTR> values; 666 663 667 CHECK_ERROR_BREAK (hd, GetProperties(NULL,668 ComSafeArrayAsOutParam(names),669 ComSafeArrayAsOutParam(values)));670 671 RTPrintf 664 CHECK_ERROR_BREAK(hd, GetProperties(NULL, 665 ComSafeArrayAsOutParam(names), 666 ComSafeArrayAsOutParam(values))); 667 668 RTPrintf("Properties:\n"); 672 669 for (size_t i = 0; i < names.size(); ++ i) 673 RTPrintf (" %ls = %ls\n", names [i], values[i]);670 RTPrintf(" %ls = %ls\n", names[i], values[i]); 674 671 675 672 if (names.size() == 0) 676 RTPrintf 677 678 #if 0 679 Bstr name 680 Bstr value = Utf8StrFmt 681 682 RTPrintf 683 CHECK_ERROR (hd, SetProperty(name, value));673 RTPrintf(" <none>\n"); 674 675 #if 0 676 Bstr name("TargetAddress"); 677 Bstr value = Utf8StrFmt("lalala (%llu)", RTTimeMilliTS()); 678 679 RTPrintf("Settings property %ls to %ls...\n", name.raw(), value.raw()); 680 CHECK_ERROR(hd, SetProperty(name, value)); 684 681 #endif 685 682 } 686 683 else 687 684 { 688 com::ErrorInfo info 689 PRINT_ERROR_INFO 685 com::ErrorInfo info(virtualBox); 686 PRINT_ERROR_INFO(info); 690 687 } 691 RTPrintf 688 RTPrintf("\n"); 692 689 } 693 690 } 694 691 while (FALSE); 695 RTPrintf 692 RTPrintf("\n"); 696 693 #endif 697 694 … … 702 699 { 703 700 ComPtr<IMachine> machine; 704 Bstr name = argc > 1 ? argv 705 RTPrintf 706 CHECK_ERROR_BREAK (virtualBox, FindMachine(name, machine.asOutParam()));707 RTPrintf 708 readAndChangeMachineSettings 701 Bstr name = argc > 1 ? argv[1] : "dos"; 702 RTPrintf("Getting a machine object named '%ls'...\n", name.raw()); 703 CHECK_ERROR_BREAK(virtualBox, FindMachine(name, machine.asOutParam())); 704 RTPrintf("Accessing the machine in read-only mode:\n"); 705 readAndChangeMachineSettings(machine); 709 706 #if 0 710 707 if (argc != 2) 711 708 { 712 RTPrintf 709 RTPrintf("Error: a string has to be supplied!\n"); 713 710 } 714 711 else … … 720 717 } 721 718 while (0); 722 RTPrintf 719 RTPrintf("\n"); 723 720 #endif 724 721 … … 729 726 { 730 727 ComPtr<IMachine> machine; 731 #if defined 728 #if defined(RT_OS_LINUX) 732 729 Bstr baseDir = L"/tmp/vbox"; 733 730 #else … … 736 733 Bstr name = L"machina"; 737 734 738 RTPrintf ("Creating a new machine object(base dir '%ls', name '%ls')...\n",735 RTPrintf("Creating a new machine object(base dir '%ls', name '%ls')...\n", 739 736 baseDir.raw(), name.raw()); 740 CHECK_ERROR_BREAK (virtualBox, CreateMachine(name, L"", baseDir, L"",741 742 743 744 RTPrintf 745 CHECK_ERROR_BREAK (machine, COMGETTER(Name)(name.asOutParam()));746 RTPrintf 737 CHECK_ERROR_BREAK(virtualBox, CreateMachine(name, L"", baseDir, L"", 738 false, 739 machine.asOutParam())); 740 741 RTPrintf("Getting name...\n"); 742 CHECK_ERROR_BREAK(machine, COMGETTER(Name)(name.asOutParam())); 743 RTPrintf("Name: {%ls}\n", name.raw()); 747 744 748 745 BOOL modified = FALSE; 749 RTPrintf 750 CHECK_ERROR_BREAK (machine, COMGETTER(SettingsModified)(&modified));751 RTPrintf 752 753 ASSERT_BREAK 746 RTPrintf("Are any settings modified?...\n"); 747 CHECK_ERROR_BREAK(machine, COMGETTER(SettingsModified)(&modified)); 748 RTPrintf("%s\n", modified ? "yes" : "no"); 749 750 ASSERT_BREAK(modified == TRUE); 754 751 755 752 name = L"Kakaya prekrasnaya virtual'naya mashina!"; 756 RTPrintf 757 CHECK_ERROR_BREAK (machine, COMSETTER(Name)(name));758 759 RTPrintf 760 CHECK_ERROR_BREAK (machine, COMSETTER(MemorySize)(111));753 RTPrintf("Setting new name ({%ls})...\n", name.raw()); 754 CHECK_ERROR_BREAK(machine, COMSETTER(Name)(name)); 755 756 RTPrintf("Setting memory size to 111...\n"); 757 CHECK_ERROR_BREAK(machine, COMSETTER(MemorySize)(111)); 761 758 762 759 Bstr desc = L"This is an exemplary description."; 763 RTPrintf 764 CHECK_ERROR_BREAK (machine, COMSETTER(Description)(desc));760 RTPrintf("Setting description to \"%ls\"...\n", desc.raw()); 761 CHECK_ERROR_BREAK(machine, COMSETTER(Description)(desc)); 765 762 766 763 ComPtr<IGuestOSType> guestOSType; 767 764 Bstr type = L"os2warp45"; 768 CHECK_ERROR_BREAK (virtualBox, GetGuestOSType(type, guestOSType.asOutParam()));769 770 RTPrintf 771 CHECK_ERROR_BREAK 772 773 RTPrintf 774 readAndChangeMachineSettings 765 CHECK_ERROR_BREAK(virtualBox, GetGuestOSType(type, guestOSType.asOutParam())); 766 767 RTPrintf("Saving new machine settings...\n"); 768 CHECK_ERROR_BREAK(machine, SaveSettings()); 769 770 RTPrintf("Accessing the newly created machine:\n"); 771 readAndChangeMachineSettings(machine); 775 772 } 776 773 while (FALSE); 777 RTPrintf 774 RTPrintf("\n"); 778 775 #endif 779 776 … … 784 781 { 785 782 ComPtr<IHost> host; 786 CHECK_RC_BREAK (virtualBox->COMGETTER(Host)(host.asOutParam()));783 CHECK_RC_BREAK(virtualBox->COMGETTER(Host)(host.asOutParam())); 787 784 788 785 { 789 786 ComPtr<IHostDVDDriveCollection> coll; 790 CHECK_RC_BREAK (host->COMGETTER(DVDDrives)(coll.asOutParam()));787 CHECK_RC_BREAK(host->COMGETTER(DVDDrives)(coll.asOutParam())); 791 788 ComPtr<IHostDVDDriveEnumerator> enumerator; 792 CHECK_RC_BREAK (coll->Enumerate(enumerator.asOutParam()));789 CHECK_RC_BREAK(coll->Enumerate(enumerator.asOutParam())); 793 790 BOOL hasmore; 794 while (SUCCEEDED(enumerator->HasMore 791 while (SUCCEEDED(enumerator->HasMore(&hasmore)) && hasmore) 795 792 { 796 793 ComPtr<IHostDVDDrive> drive; 797 CHECK_RC_BREAK (enumerator->GetNext(drive.asOutParam()));794 CHECK_RC_BREAK(enumerator->GetNext(drive.asOutParam())); 798 795 Bstr name; 799 CHECK_RC_BREAK (drive->COMGETTER(Name)(name.asOutParam()));800 RTPrintf 796 CHECK_RC_BREAK(drive->COMGETTER(Name)(name.asOutParam())); 797 RTPrintf("Host DVD drive: name={%ls}\n", name.raw()); 801 798 } 802 CHECK_RC_BREAK 799 CHECK_RC_BREAK(rc); 803 800 804 801 ComPtr<IHostDVDDrive> drive; 805 CHECK_ERROR (enumerator, GetNext(drive.asOutParam()));806 CHECK_ERROR (coll, GetItemAt(1000, drive.asOutParam()));807 CHECK_ERROR (coll, FindByName (Bstr("R:"), drive.asOutParam()));802 CHECK_ERROR(enumerator, GetNext(drive.asOutParam())); 803 CHECK_ERROR(coll, GetItemAt(1000, drive.asOutParam())); 804 CHECK_ERROR(coll, FindByName(Bstr("R:"), drive.asOutParam())); 808 805 if (SUCCEEDED(rc)) 809 806 { 810 807 Bstr name; 811 CHECK_RC_BREAK (drive->COMGETTER(Name)(name.asOutParam()));812 RTPrintf 808 CHECK_RC_BREAK(drive->COMGETTER(Name)(name.asOutParam())); 809 RTPrintf("Found by name: name={%ls}\n", name.raw()); 813 810 } 814 811 } 815 812 } 816 813 while (FALSE); 817 RTPrintf 814 RTPrintf("\n"); 818 815 #endif 819 816 … … 824 821 RTPrintf("Supported hard disk backends: --------------------------\n"); 825 822 ComPtr<ISystemProperties> systemProperties; 826 CHECK_ERROR_BREAK 827 COMGETTER(SystemProperties)(systemProperties.asOutParam()));823 CHECK_ERROR_BREAK(virtualBox, 824 COMGETTER(SystemProperties)(systemProperties.asOutParam())); 828 825 com::SafeIfaceArray<IHardDiskFormat> hardDiskFormats; 829 CHECK_ERROR_BREAK 830 COMGETTER(HardDiskFormats) (ComSafeArrayAsOutParam(hardDiskFormats)));826 CHECK_ERROR_BREAK(systemProperties, 827 COMGETTER(HardDiskFormats)(ComSafeArrayAsOutParam(hardDiskFormats))); 831 828 832 829 for (size_t i = 0; i < hardDiskFormats.size(); ++ i) … … 834 831 /* General information */ 835 832 Bstr id; 836 CHECK_ERROR_BREAK (hardDiskFormats[i],837 COMGETTER(Id)(id.asOutParam()));833 CHECK_ERROR_BREAK(hardDiskFormats[i], 834 COMGETTER(Id)(id.asOutParam())); 838 835 839 836 Bstr description; 840 CHECK_ERROR_BREAK (hardDiskFormats[i],841 COMGETTER(Id)(description.asOutParam()));837 CHECK_ERROR_BREAK(hardDiskFormats[i], 838 COMGETTER(Id)(description.asOutParam())); 842 839 843 840 ULONG caps; 844 CHECK_ERROR_BREAK (hardDiskFormats[i],845 COMGETTER(Capabilities)(&caps));841 CHECK_ERROR_BREAK(hardDiskFormats[i], 842 COMGETTER(Capabilities)(&caps)); 846 843 847 844 RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='", … … 850 847 /* File extensions */ 851 848 com::SafeArray<BSTR> fileExtensions; 852 CHECK_ERROR_BREAK (hardDiskFormats[i],853 COMGETTER(FileExtensions) (ComSafeArrayAsOutParam(fileExtensions)));849 CHECK_ERROR_BREAK(hardDiskFormats[i], 850 COMGETTER(FileExtensions)(ComSafeArrayAsOutParam(fileExtensions))); 854 851 for (size_t a = 0; a < fileExtensions.size(); ++ a) 855 852 { 856 RTPrintf ("%ls", Bstr (fileExtensions[a]).raw());853 RTPrintf("%ls", Bstr(fileExtensions[a]).raw()); 857 854 if (a != fileExtensions.size()-1) 858 RTPrintf 855 RTPrintf(","); 859 856 } 860 RTPrintf 857 RTPrintf("'"); 861 858 862 859 /* Configuration keys */ … … 866 863 com::SafeArray<ULONG> propertyFlags; 867 864 com::SafeArray<BSTR> propertyDefaults; 868 CHECK_ERROR_BREAK (hardDiskFormats[i],869 DescribeProperties (ComSafeArrayAsOutParam(propertyNames),870 ComSafeArrayAsOutParam(propertyDescriptions),871 ComSafeArrayAsOutParam(propertyTypes),872 ComSafeArrayAsOutParam(propertyFlags),873 ComSafeArrayAsOutParam(propertyDefaults)));874 875 RTPrintf 865 CHECK_ERROR_BREAK(hardDiskFormats[i], 866 DescribeProperties(ComSafeArrayAsOutParam(propertyNames), 867 ComSafeArrayAsOutParam(propertyDescriptions), 868 ComSafeArrayAsOutParam(propertyTypes), 869 ComSafeArrayAsOutParam(propertyFlags), 870 ComSafeArrayAsOutParam(propertyDefaults))); 871 872 RTPrintf(" config=("); 876 873 if (propertyNames.size() > 0) 877 874 { 878 875 for (size_t a = 0; a < propertyNames.size(); ++ a) 879 876 { 880 RTPrintf ("key='%ls' desc='%ls' type=", Bstr (propertyNames [a]).raw(), Bstr (propertyDescriptions[a]).raw());881 switch (propertyTypes 877 RTPrintf("key='%ls' desc='%ls' type=", Bstr(propertyNames[a]).raw(), Bstr(propertyDescriptions[a]).raw()); 878 switch (propertyTypes[a]) 882 879 { 883 case DataType_Int32Type: RTPrintf 884 case DataType_Int8Type: RTPrintf 885 case DataType_StringType: RTPrintf 880 case DataType_Int32Type: RTPrintf("int"); break; 881 case DataType_Int8Type: RTPrintf("byte"); break; 882 case DataType_StringType: RTPrintf("string"); break; 886 883 } 887 RTPrintf (" flags=%#04x", propertyFlags[a]);888 RTPrintf (" default='%ls'", Bstr (propertyDefaults[a]).raw());884 RTPrintf(" flags=%#04x", propertyFlags[a]); 885 RTPrintf(" default='%ls'", Bstr(propertyDefaults[a]).raw()); 889 886 if (a != propertyNames.size()-1) 890 RTPrintf 887 RTPrintf(","); 891 888 } 892 889 } 893 RTPrintf 890 RTPrintf(")\n"); 894 891 } 895 892 RTPrintf("-------------------------------------------------------\n"); … … 904 901 { 905 902 com::SafeIfaceArray<IHardDisk> disks; 906 CHECK_ERROR_BREAK 907 COMGETTER(HardDisks)(ComSafeArrayAsOutParam(disks)));908 909 RTPrintf 903 CHECK_ERROR_BREAK(virtualBox, 904 COMGETTER(HardDisks)(ComSafeArrayAsOutParam(disks))); 905 906 RTPrintf("%u base hard disks registered (disks.isNull()=%d).\n", 910 907 disks.size(), disks.isNull()); 911 908 … … 913 910 { 914 911 Bstr loc; 915 CHECK_ERROR_BREAK (disks [i], COMGETTER(Location)(loc.asOutParam()));912 CHECK_ERROR_BREAK(disks[i], COMGETTER(Location)(loc.asOutParam())); 916 913 Guid id; 917 CHECK_ERROR_BREAK (disks [i], COMGETTER(Id)(id.asOutParam()));914 CHECK_ERROR_BREAK(disks[i], COMGETTER(Id)(id.asOutParam())); 918 915 MediaState_T state; 919 CHECK_ERROR_BREAK (disks [i], COMGETTER(State)(&state));916 CHECK_ERROR_BREAK(disks[i], COMGETTER(State)(&state)); 920 917 Bstr format; 921 CHECK_ERROR_BREAK (disks [i], COMGETTER(Format)(format.asOutParam()));922 923 RTPrintf 918 CHECK_ERROR_BREAK(disks[i], COMGETTER(Format)(format.asOutParam())); 919 920 RTPrintf(" disks[%u]: '%ls'\n" 924 921 " UUID: {%RTuuid}\n" 925 922 " State: %s\n" … … 937 934 { 938 935 Bstr error; 939 CHECK_ERROR_BREAK (disks[i],940 941 RTPrintf 936 CHECK_ERROR_BREAK(disks[i], 937 COMGETTER(LastAccessError)(error.asOutParam())); 938 RTPrintf(" Access Error: %ls\n", error.raw()); 942 939 } 943 940 944 941 /* get usage */ 945 942 946 RTPrintf 943 RTPrintf(" Used by VMs:\n"); 947 944 948 945 com::SafeGUIDArray ids; 949 CHECK_ERROR_BREAK (disks[i],950 COMGETTER(MachineIds) (ComSafeArrayAsOutParam(ids)));946 CHECK_ERROR_BREAK(disks[i], 947 COMGETTER(MachineIds)(ComSafeArrayAsOutParam(ids))); 951 948 if (ids.size() == 0) 952 949 { 953 RTPrintf 950 RTPrintf(" <not used>\n"); 954 951 } 955 952 else … … 957 954 for (size_t j = 0; j < ids.size(); ++ j) 958 955 { 959 RTPrintf (" {%RTuuid}\n", &ids[j]);956 RTPrintf(" {%RTuuid}\n", &ids[j]); 960 957 } 961 958 } … … 964 961 { 965 962 com::SafeIfaceArray<IDVDImage> images; 966 CHECK_ERROR_BREAK 967 COMGETTER(DVDImages) (ComSafeArrayAsOutParam(images)));968 969 RTPrintf 963 CHECK_ERROR_BREAK(virtualBox, 964 COMGETTER(DVDImages)(ComSafeArrayAsOutParam(images))); 965 966 RTPrintf("%u DVD images registered (images.isNull()=%d).\n", 970 967 images.size(), images.isNull()); 971 968 … … 973 970 { 974 971 Bstr loc; 975 CHECK_ERROR_BREAK (images [i], COMGETTER(Location)(loc.asOutParam()));972 CHECK_ERROR_BREAK(images[i], COMGETTER(Location)(loc.asOutParam())); 976 973 Guid id; 977 CHECK_ERROR_BREAK (images [i], COMGETTER(Id)(id.asOutParam()));974 CHECK_ERROR_BREAK(images[i], COMGETTER(Id)(id.asOutParam())); 978 975 MediaState_T state; 979 CHECK_ERROR_BREAK (images [i], COMGETTER(State)(&state));980 981 RTPrintf 976 CHECK_ERROR_BREAK(images[i], COMGETTER(State)(&state)); 977 978 RTPrintf(" images[%u]: '%ls'\n" 982 979 " UUID: {%RTuuid}\n" 983 980 " State: %s\n", … … 993 990 { 994 991 Bstr error; 995 CHECK_ERROR_BREAK (images[i],996 997 RTPrintf 992 CHECK_ERROR_BREAK(images[i], 993 COMGETTER(LastAccessError)(error.asOutParam())); 994 RTPrintf(" Access Error: %ls\n", error.raw()); 998 995 } 999 996 1000 997 /* get usage */ 1001 998 1002 RTPrintf 999 RTPrintf(" Used by VMs:\n"); 1003 1000 1004 1001 com::SafeGUIDArray ids; 1005 CHECK_ERROR_BREAK (images[i],1006 COMGETTER(MachineIds) (ComSafeArrayAsOutParam(ids)));1002 CHECK_ERROR_BREAK(images[i], 1003 COMGETTER(MachineIds)(ComSafeArrayAsOutParam(ids))); 1007 1004 if (ids.size() == 0) 1008 1005 { 1009 RTPrintf 1006 RTPrintf(" <not used>\n"); 1010 1007 } 1011 1008 else … … 1013 1010 for (size_t j = 0; j < ids.size(); ++ j) 1014 1011 { 1015 RTPrintf (" {%RTuuid}\n", &ids[j]);1012 RTPrintf(" {%RTuuid}\n", &ids[j]); 1016 1013 } 1017 1014 } … … 1020 1017 } 1021 1018 while (FALSE); 1022 RTPrintf 1019 RTPrintf("\n"); 1023 1020 #endif 1024 1021 … … 1029 1026 { 1030 1027 ComPtr<IMachine> machine; 1031 Bstr name = argc > 1 ? argv 1032 RTPrintf 1033 CHECK_ERROR_BREAK (virtualBox, FindMachine(name, machine.asOutParam()));1028 Bstr name = argc > 1 ? argv[1] : "dos"; 1029 RTPrintf("Getting a machine object named '%ls'...\n", name.raw()); 1030 CHECK_ERROR_BREAK(virtualBox, FindMachine(name, machine.asOutParam())); 1034 1031 Guid guid; 1035 CHECK_RC_BREAK (machine->COMGETTER(Id)(guid.asOutParam()));1036 RTPrintf 1037 CHECK_RC_BREAK (virtualBox->OpenSession(session, guid));1032 CHECK_RC_BREAK(machine->COMGETTER(Id)(guid.asOutParam())); 1033 RTPrintf("Opening a session for this machine...\n"); 1034 CHECK_RC_BREAK(virtualBox->OpenSession(session, guid)); 1038 1035 #if 1 1039 1036 ComPtr<IMachine> sessionMachine; 1040 RTPrintf 1041 CHECK_RC_BREAK (session->COMGETTER(Machine)(sessionMachine.asOutParam()));1042 RTPrintf 1043 readAndChangeMachineSettings 1044 #if 0 1045 RTPrintf 1046 RTPrintf 1037 RTPrintf("Getting sessioned machine object...\n"); 1038 CHECK_RC_BREAK(session->COMGETTER(Machine)(sessionMachine.asOutParam())); 1039 RTPrintf("Accessing the machine within the session:\n"); 1040 readAndChangeMachineSettings(sessionMachine, machine); 1041 #if 0 1042 RTPrintf("\n"); 1043 RTPrintf("Enabling the VRDP server (must succeed even if the VM is saved):\n"); 1047 1044 ComPtr<IVRDPServer> vrdp; 1048 CHECK_ERROR_BREAK (sessionMachine, COMGETTER(VRDPServer)(vrdp.asOutParam()));1049 if (FAILED (vrdp->COMSETTER(Enabled)(TRUE)))1050 { 1051 PRINT_ERROR_INFO (com::ErrorInfo(vrdp));1045 CHECK_ERROR_BREAK(sessionMachine, COMGETTER(VRDPServer)(vrdp.asOutParam())); 1046 if (FAILED(vrdp->COMSETTER(Enabled)(TRUE))) 1047 { 1048 PRINT_ERROR_INFO(com::ErrorInfo(vrdp)); 1052 1049 } 1053 1050 else 1054 1051 { 1055 1052 BOOL enabled = FALSE; 1056 CHECK_ERROR_BREAK (vrdp, COMGETTER(Enabled)(&enabled));1057 RTPrintf 1053 CHECK_ERROR_BREAK(vrdp, COMGETTER(Enabled)(&enabled)); 1054 RTPrintf("VRDP server is %s\n", enabled ? "enabled" : "disabled"); 1058 1055 } 1059 1056 #endif … … 1061 1058 #if 0 1062 1059 ComPtr<IConsole> console; 1063 RTPrintf 1064 CHECK_RC_BREAK (session->COMGETTER(Console)(console.asOutParam()));1065 RTPrintf 1060 RTPrintf("Getting the console object...\n"); 1061 CHECK_RC_BREAK(session->COMGETTER(Console)(console.asOutParam())); 1062 RTPrintf("Discarding the current machine state...\n"); 1066 1063 ComPtr<IProgress> progress; 1067 CHECK_ERROR_BREAK (console, DiscardCurrentState(progress.asOutParam()));1068 RTPrintf 1069 CHECK_ERROR_BREAK (progress, WaitForCompletion(-1));1070 ProgressErrorInfo ei 1071 if (FAILED 1072 { 1073 PRINT_ERROR_INFO 1064 CHECK_ERROR_BREAK(console, DiscardCurrentState(progress.asOutParam())); 1065 RTPrintf("Waiting for completion...\n"); 1066 CHECK_ERROR_BREAK(progress, WaitForCompletion(-1)); 1067 ProgressErrorInfo ei(progress); 1068 if (FAILED(ei.getResultCode())) 1069 { 1070 PRINT_ERROR_INFO(ei); 1074 1071 1075 1072 ComPtr<IUnknown> initiator; 1076 CHECK_ERROR_BREAK (progress, COMGETTER(Initiator)(initiator.asOutParam()));1077 1078 RTPrintf ("initiator(unk) = %p\n", (IUnknown *)initiator);1079 RTPrintf ("console(unk) = %p\n", (IUnknown *) ComPtr<IUnknown> ((IConsole *)console));1080 RTPrintf ("console = %p\n", (IConsole *)console);1073 CHECK_ERROR_BREAK(progress, COMGETTER(Initiator)(initiator.asOutParam())); 1074 1075 RTPrintf("initiator(unk) = %p\n", (IUnknown *)initiator); 1076 RTPrintf("console(unk) = %p\n", (IUnknown *)ComPtr<IUnknown>((IConsole *)console)); 1077 RTPrintf("console = %p\n", (IConsole *)console); 1081 1078 } 1082 1079 #endif … … 1086 1083 } 1087 1084 while (FALSE); 1088 RTPrintf 1085 RTPrintf("\n"); 1089 1086 #endif 1090 1087 … … 1096 1093 ComPtr<IMachine> machine; 1097 1094 Bstr name = L"dos"; 1098 RTPrintf 1099 CHECK_RC_BREAK (virtualBox->FindMachine(name, machine.asOutParam()));1095 RTPrintf("Getting a machine object named '%ls'...\n", name.raw()); 1096 CHECK_RC_BREAK(virtualBox->FindMachine(name, machine.asOutParam())); 1100 1097 Guid guid; 1101 CHECK_RC_BREAK (machine->COMGETTER(Id)(guid.asOutParam()));1102 RTPrintf 1098 CHECK_RC_BREAK(machine->COMGETTER(Id)(guid.asOutParam())); 1099 RTPrintf("Opening a remote session for this machine...\n"); 1103 1100 ComPtr<IProgress> progress; 1104 CHECK_RC_BREAK (virtualBox->OpenRemoteSession(session, guid, Bstr("gui"),1101 CHECK_RC_BREAK(virtualBox->OpenRemoteSession(session, guid, Bstr("gui"), 1105 1102 NULL, progress.asOutParam())); 1106 RTPrintf 1107 CHECK_RC_BREAK (progress->WaitForCompletion(-1));1103 RTPrintf("Waiting for the session to open...\n"); 1104 CHECK_RC_BREAK(progress->WaitForCompletion(-1)); 1108 1105 ComPtr<IMachine> sessionMachine; 1109 RTPrintf 1110 CHECK_RC_BREAK (session->COMGETTER(Machine)(sessionMachine.asOutParam()));1106 RTPrintf("Getting sessioned machine object...\n"); 1107 CHECK_RC_BREAK(session->COMGETTER(Machine)(sessionMachine.asOutParam())); 1111 1108 ComPtr<IConsole> console; 1112 RTPrintf 1113 CHECK_RC_BREAK (session->COMGETTER(Console)(console.asOutParam()));1114 RTPrintf 1109 RTPrintf("Getting console object...\n"); 1110 CHECK_RC_BREAK(session->COMGETTER(Console)(console.asOutParam())); 1111 RTPrintf("Press enter to pause the VM execution in the remote session..."); 1115 1112 getchar(); 1116 CHECK_RC 1117 RTPrintf 1113 CHECK_RC(console->Pause()); 1114 RTPrintf("Press enter to close this session..."); 1118 1115 getchar(); 1119 1116 session->Close(); 1120 1117 } 1121 1118 while (FALSE); 1122 RTPrintf 1119 RTPrintf("\n"); 1123 1120 #endif 1124 1121 … … 1130 1127 ComPtr<IMachine> machine; 1131 1128 Bstr name = "dos"; 1132 RTPrintf 1133 CHECK_RC_BREAK (virtualBox->FindMachine(name, machine.asOutParam()));1129 RTPrintf("Getting a machine object named '%ls'...\n", name.raw()); 1130 CHECK_RC_BREAK(virtualBox->FindMachine(name, machine.asOutParam())); 1134 1131 Guid guid; 1135 CHECK_RC_BREAK (machine->COMGETTER(Id)(guid.asOutParam()));1136 RTPrintf 1137 CHECK_RC_BREAK (virtualBox->OpenExistingSession(session, guid));1132 CHECK_RC_BREAK(machine->COMGETTER(Id)(guid.asOutParam())); 1133 RTPrintf("Opening an existing remote session for this machine...\n"); 1134 CHECK_RC_BREAK(virtualBox->OpenExistingSession(session, guid)); 1138 1135 ComPtr<IMachine> sessionMachine; 1139 RTPrintf 1140 CHECK_RC_BREAK (session->COMGETTER(Machine)(sessionMachine.asOutParam()));1136 RTPrintf("Getting sessioned machine object...\n"); 1137 CHECK_RC_BREAK(session->COMGETTER(Machine)(sessionMachine.asOutParam())); 1141 1138 1142 1139 #if 0 1143 1140 Bstr extraDataKey = "VBoxSDL/SecureLabel"; 1144 1141 Bstr extraData = "Das kommt jetzt noch viel krasser vom total konkreten API!"; 1145 CHECK_RC (sessionMachine->SetExtraData(extraDataKey, extraData));1142 CHECK_RC(sessionMachine->SetExtraData(extraDataKey, extraData)); 1146 1143 #endif 1147 1144 #if 0 1148 1145 ComPtr<IConsole> console; 1149 RTPrintf 1150 CHECK_RC_BREAK (session->COMGETTER(Console)(console.asOutParam()));1151 RTPrintf 1146 RTPrintf("Getting console object...\n"); 1147 CHECK_RC_BREAK(session->COMGETTER(Console)(console.asOutParam())); 1148 RTPrintf("Press enter to pause the VM execution in the remote session..."); 1152 1149 getchar(); 1153 CHECK_RC 1154 RTPrintf 1150 CHECK_RC(console->Pause()); 1151 RTPrintf("Press enter to close this session..."); 1155 1152 getchar(); 1156 1153 #endif … … 1158 1155 } 1159 1156 while (FALSE); 1160 RTPrintf 1157 RTPrintf("\n"); 1161 1158 #endif 1162 1159 … … 1165 1162 // Get host 1166 1163 ComPtr<IHost> host; 1167 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));1164 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam())); 1168 1165 1169 1166 ULONG uMemSize, uMemAvail; 1170 CHECK_ERROR_BREAK (host, COMGETTER(MemorySize)(&uMemSize));1167 CHECK_ERROR_BREAK(host, COMGETTER(MemorySize)(&uMemSize)); 1171 1168 RTPrintf("Total memory (MB): %u\n", uMemSize); 1172 CHECK_ERROR_BREAK (host, COMGETTER(MemoryAvailable)(&uMemAvail));1169 CHECK_ERROR_BREAK(host, COMGETTER(MemoryAvailable)(&uMemAvail)); 1173 1170 RTPrintf("Free memory (MB): %u\n", uMemAvail); 1174 1171 } while (0); … … 1179 1176 // Get host 1180 1177 ComPtr<IHost> host; 1181 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));1178 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam())); 1182 1179 1183 1180 com::SafeIfaceArray<IHostNetworkInterface> hostNetworkInterfaces; 1184 1181 CHECK_ERROR_BREAK(host, 1185 COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam(hostNetworkInterfaces)));1182 COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(hostNetworkInterfaces))); 1186 1183 if (hostNetworkInterfaces.size() > 0) 1187 1184 { … … 1195 1192 networkInterface.setNull(); 1196 1193 CHECK_ERROR_BREAK(host, 1197 FindHostNetworkInterfaceByName 1194 FindHostNetworkInterfaceByName(interfaceName, networkInterface.asOutParam())); 1198 1195 Guid interfaceGuid2; 1199 1196 networkInterface->COMGETTER(Id)(interfaceGuid2.asOutParam()); … … 1203 1200 networkInterface.setNull(); 1204 1201 CHECK_ERROR_BREAK(host, 1205 FindHostNetworkInterfaceById 1202 FindHostNetworkInterfaceById(interfaceGuid, networkInterface.asOutParam())); 1206 1203 Bstr interfaceName2; 1207 1204 networkInterface->COMGETTER(Name)(interfaceName2.asOutParam()); … … 1216 1213 #endif 1217 1214 1218 #if 0 && defined 1215 #if 0 && defined(VBOX_WITH_RESOURCE_USAGE_API) 1219 1216 do { 1220 1217 // Get collector 1221 1218 ComPtr<IPerformanceCollector> collector; 1222 CHECK_ERROR_BREAK 1223 COMGETTER(PerformanceCollector)(collector.asOutParam()));1219 CHECK_ERROR_BREAK(virtualBox, 1220 COMGETTER(PerformanceCollector)(collector.asOutParam())); 1224 1221 1225 1222 1226 1223 // Fill base metrics array 1227 1224 Bstr baseMetricNames[] = { L"CPU/Load,RAM/Usage" }; 1228 com::SafeArray<BSTR> baseMetrics 1229 baseMetricNames[0].cloneTo(&baseMetrics 1225 com::SafeArray<BSTR> baseMetrics(1); 1226 baseMetricNames[0].cloneTo(&baseMetrics[0]); 1230 1227 1231 1228 // Get host 1232 1229 ComPtr<IHost> host; 1233 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));1230 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Host)(host.asOutParam())); 1234 1231 1235 1232 // Get machine 1236 1233 ComPtr<IMachine> machine; 1237 Bstr name = argc > 1 ? argv 1238 Bstr sessionType = argc > 2 ? argv 1239 RTPrintf 1240 CHECK_RC_BREAK (virtualBox->FindMachine(name, machine.asOutParam()));1234 Bstr name = argc > 1 ? argv[1] : "dsl"; 1235 Bstr sessionType = argc > 2 ? argv[2] : "vrdp"; 1236 RTPrintf("Getting a machine object named '%ls'...\n", name.raw()); 1237 CHECK_RC_BREAK(virtualBox->FindMachine(name, machine.asOutParam())); 1241 1238 1242 1239 // Open session 1243 1240 Guid guid; 1244 CHECK_RC_BREAK (machine->COMGETTER(Id)(guid.asOutParam()));1245 RTPrintf 1241 CHECK_RC_BREAK(machine->COMGETTER(Id)(guid.asOutParam())); 1242 RTPrintf("Opening a remote session for this machine...\n"); 1246 1243 ComPtr<IProgress> progress; 1247 CHECK_RC_BREAK (virtualBox->OpenRemoteSession(session, guid, sessionType,1244 CHECK_RC_BREAK(virtualBox->OpenRemoteSession(session, guid, sessionType, 1248 1245 NULL, progress.asOutParam())); 1249 RTPrintf 1250 CHECK_RC_BREAK (progress->WaitForCompletion(-1));1246 RTPrintf("Waiting for the session to open...\n"); 1247 CHECK_RC_BREAK(progress->WaitForCompletion(-1)); 1251 1248 ComPtr<IMachine> sessionMachine; 1252 RTPrintf 1253 CHECK_RC_BREAK (session->COMGETTER(Machine)(sessionMachine.asOutParam()));1249 RTPrintf("Getting sessioned machine object...\n"); 1250 CHECK_RC_BREAK(session->COMGETTER(Machine)(sessionMachine.asOutParam())); 1254 1251 1255 1252 // Setup base metrics … … 1259 1256 host.queryInterfaceTo(&objects[0]); 1260 1257 machine.queryInterfaceTo(&objects[1]); 1261 CHECK_ERROR_BREAK 1258 CHECK_ERROR_BREAK(collector, SetupMetrics(ComSafeArrayAsInParam(baseMetrics), 1262 1259 ComSafeArrayAsInParam(objects), 1u, 10u, 1263 ComSafeArrayAsOutParam(affectedMetrics)) 1260 ComSafeArrayAsOutParam(affectedMetrics))); 1264 1261 listAffectedMetrics(virtualBox, 1265 1262 ComSafeArrayAsInParam(affectedMetrics)); … … 1268 1265 // Get console 1269 1266 ComPtr<IConsole> console; 1270 RTPrintf 1271 CHECK_RC_BREAK (session->COMGETTER(Console)(console.asOutParam()));1267 RTPrintf("Getting console object...\n"); 1268 CHECK_RC_BREAK(session->COMGETTER(Console)(console.asOutParam())); 1272 1269 1273 1270 RTThreadSleep(5000); // Sleep for 5 seconds … … 1277 1274 1278 1275 // Pause 1279 //RTPrintf 1276 //RTPrintf("Press enter to pause the VM execution in the remote session..."); 1280 1277 //getchar(); 1281 CHECK_RC 1278 CHECK_RC(console->Pause()); 1282 1279 1283 1280 RTThreadSleep(5000); // Sleep for 5 seconds … … 1287 1284 1288 1285 RTPrintf("\nDrop collected metrics: ----------------------------------------\n"); 1289 CHECK_ERROR_BREAK 1286 CHECK_ERROR_BREAK(collector, 1290 1287 SetupMetrics(ComSafeArrayAsInParam(baseMetrics), 1291 1288 ComSafeArrayAsInParam(objects), 1292 1u, 5u, ComSafeArrayAsOutParam(affectedMetrics)) 1289 1u, 5u, ComSafeArrayAsOutParam(affectedMetrics))); 1293 1290 listAffectedMetrics(virtualBox, 1294 1291 ComSafeArrayAsInParam(affectedMetrics)); … … 1300 1297 1301 1298 RTPrintf("\nDisable collection of VM metrics: ------------------------------\n"); 1302 CHECK_ERROR_BREAK 1299 CHECK_ERROR_BREAK(collector, 1303 1300 DisableMetrics(ComSafeArrayAsInParam(baseMetrics), 1304 1301 ComSafeArrayAsInParam(vmObject), 1305 ComSafeArrayAsOutParam(affectedMetrics)) 1302 ComSafeArrayAsOutParam(affectedMetrics))); 1306 1303 listAffectedMetrics(virtualBox, 1307 1304 ComSafeArrayAsInParam(affectedMetrics)); … … 1311 1308 1312 1309 RTPrintf("\nRe-enable collection of all metrics: ---------------------------\n"); 1313 CHECK_ERROR_BREAK 1310 CHECK_ERROR_BREAK(collector, 1314 1311 EnableMetrics(ComSafeArrayAsInParam(baseMetrics), 1315 1312 ComSafeArrayAsInParam(objects), 1316 ComSafeArrayAsOutParam(affectedMetrics)) 1313 ComSafeArrayAsOutParam(affectedMetrics))); 1317 1314 listAffectedMetrics(virtualBox, 1318 1315 ComSafeArrayAsInParam(affectedMetrics)); … … 1322 1319 1323 1320 // Power off 1324 RTPrintf 1321 RTPrintf("Press enter to power off VM..."); 1325 1322 getchar(); 1326 CHECK_RC 1327 RTPrintf 1323 CHECK_RC(console->PowerDown()); 1324 RTPrintf("Press enter to close this session..."); 1328 1325 getchar(); 1329 1326 session->Close(); … … 1335 1332 do 1336 1333 { 1337 Bstr ovf = argc > 1 ? argv 1338 RTPrintf 1334 Bstr ovf = argc > 1 ? argv[1] : "someOVF.ovf"; 1335 RTPrintf("Try to open %ls ...\n", ovf.raw()); 1339 1336 1340 1337 ComPtr<IAppliance> appliance; 1341 CHECK_ERROR_BREAK (virtualBox, 1342 CreateAppliance (appliance.asOutParam())); 1343 CHECK_ERROR_BREAK (appliance, 1344 Read (ovf)); 1338 CHECK_ERROR_BREAK(virtualBox, 1339 CreateAppliance(appliance.asOutParam())); 1340 CHECK_ERROR_BREAK(appliance, Read(ovf)); 1345 1341 Bstr path; 1346 CHECK_ERROR_BREAK (appliance, COMGETTER (Path)(path.asOutParam())); 1347 RTPrintf ("Successfully opened %ls.\n", path.raw()); 1348 CHECK_ERROR_BREAK (appliance, 1349 Interpret()); 1350 RTPrintf ("Successfully interpreted %ls.\n", path.raw()); 1351 RTPrintf ("Appliance:\n"); 1342 CHECK_ERROR_BREAK(appliance, COMGETTER(Path)(path.asOutParam())); 1343 RTPrintf("Successfully opened %ls.\n", path.raw()); 1344 CHECK_ERROR_BREAK(appliance, Interpret()); 1345 RTPrintf("Successfully interpreted %ls.\n", path.raw()); 1346 RTPrintf("Appliance:\n"); 1352 1347 // Fetch all disks 1353 1348 com::SafeArray<BSTR> retDisks; 1354 CHECK_ERROR_BREAK 1355 COMGETTER (Disks)(ComSafeArrayAsOutParam(retDisks)));1349 CHECK_ERROR_BREAK(appliance, 1350 COMGETTER(Disks)(ComSafeArrayAsOutParam(retDisks))); 1356 1351 if (retDisks.size() > 0) 1357 1352 { 1358 RTPrintf 1353 RTPrintf("Disks:"); 1359 1354 for (unsigned i = 0; i < retDisks.size(); i++) 1360 RTPrintf (" %ls", Bstr (retDisks[i]).raw());1361 RTPrintf 1355 RTPrintf(" %ls", Bstr(retDisks[i]).raw()); 1356 RTPrintf("\n"); 1362 1357 } 1363 1358 /* Fetch all virtual system descriptions */ 1364 1359 com::SafeIfaceArray<IVirtualSystemDescription> retVSD; 1365 CHECK_ERROR_BREAK 1366 COMGETTER (VirtualSystemDescriptions) (ComSafeArrayAsOutParam(retVSD)));1360 CHECK_ERROR_BREAK(appliance, 1361 COMGETTER(VirtualSystemDescriptions)(ComSafeArrayAsOutParam(retVSD))); 1367 1362 if (retVSD.size() > 0) 1368 1363 { … … 1374 1369 com::SafeArray<BSTR> retAutoValues; 1375 1370 com::SafeArray<BSTR> retConfiguration; 1376 CHECK_ERROR_BREAK (retVSD[i],1377 GetDescription (ComSafeArrayAsOutParam(retTypes),1378 ComSafeArrayAsOutParam(retRefValues),1379 ComSafeArrayAsOutParam(retOrigValues),1380 ComSafeArrayAsOutParam(retAutoValues),1381 ComSafeArrayAsOutParam(retConfiguration)));1382 1383 RTPrintf 1371 CHECK_ERROR_BREAK(retVSD[i], 1372 GetDescription(ComSafeArrayAsOutParam(retTypes), 1373 ComSafeArrayAsOutParam(retRefValues), 1374 ComSafeArrayAsOutParam(retOrigValues), 1375 ComSafeArrayAsOutParam(retAutoValues), 1376 ComSafeArrayAsOutParam(retConfiguration))); 1377 1378 RTPrintf("VirtualSystemDescription:\n"); 1384 1379 for (unsigned a = 0; a < retTypes.size(); ++a) 1385 1380 { 1386 RTPrintf 1387 retTypes 1388 Bstr (retOrigValues[a]).raw(),1389 Bstr (retAutoValues[a]).raw(),1390 Bstr (retConfiguration[a]).raw());1381 RTPrintf(" %d %ls %ls %ls\n", 1382 retTypes[a], 1383 Bstr(retOrigValues[a]).raw(), 1384 Bstr(retAutoValues[a]).raw(), 1385 Bstr(retConfiguration[a]).raw()); 1391 1386 } 1392 1387 /* Show warnings from interpret */ 1393 1388 com::SafeArray<BSTR> retWarnings; 1394 CHECK_ERROR_BREAK (retVSD[i],1395 GetWarnings(ComSafeArrayAsOutParam(retWarnings)));1389 CHECK_ERROR_BREAK(retVSD[i], 1390 GetWarnings(ComSafeArrayAsOutParam(retWarnings))); 1396 1391 if (retWarnings.size() > 0) 1397 1392 { 1398 RTPrintf 1393 RTPrintf("The following warnings occurs on interpret:\n"); 1399 1394 for (unsigned r = 0; r < retWarnings.size(); ++r) 1400 RTPrintf ("%ls\n", Bstr (retWarnings[r]).raw());1401 RTPrintf 1395 RTPrintf("%ls\n", Bstr(retWarnings[r]).raw()); 1396 RTPrintf("\n"); 1402 1397 } 1403 1398 } 1404 RTPrintf 1405 } 1406 RTPrintf 1399 RTPrintf("\n"); 1400 } 1401 RTPrintf("Try to import the appliance ...\n"); 1407 1402 ComPtr<IProgress> progress; 1408 CHECK_ERROR_BREAK 1409 ImportMachines(progress.asOutParam()));1410 CHECK_ERROR (progress, WaitForCompletion(-1));1403 CHECK_ERROR_BREAK(appliance, 1404 ImportMachines(progress.asOutParam())); 1405 CHECK_ERROR(progress, WaitForCompletion(-1)); 1411 1406 if (SUCCEEDED(rc)) 1412 1407 { 1413 1408 /* Check if the import was successfully */ 1414 progress->COMGETTER 1415 if (FAILED 1409 progress->COMGETTER(ResultCode)(&rc); 1410 if (FAILED(rc)) 1416 1411 { 1417 com::ProgressErrorInfo info 1412 com::ProgressErrorInfo info(progress); 1418 1413 if (info.isBasicAvailable()) 1419 RTPrintf 1414 RTPrintf("Error: failed to import appliance. Error message: %lS\n", info.getText().raw()); 1420 1415 else 1421 RTPrintf 1416 RTPrintf("Error: failed to import appliance. No error message available!\n"); 1422 1417 }else 1423 RTPrintf 1418 RTPrintf("Successfully imported the appliance.\n"); 1424 1419 } 1425 1420 1426 1421 } 1427 1422 while (FALSE); 1428 RTPrintf 1429 #endif 1430 1431 RTPrintf 1423 RTPrintf("\n"); 1424 #endif 1425 1426 RTPrintf("Press enter to release Session and VirtualBox instances..."); 1432 1427 getchar(); 1433 1428 … … 1442 1437 com::Shutdown(); 1443 1438 1444 RTPrintf 1439 RTPrintf("tstAPI FINISHED.\n"); 1445 1440 1446 1441 return rc; … … 1448 1443 1449 1444 #ifdef VBOX_WITH_RESOURCE_USAGE_API 1450 static void queryMetrics 1451 1452 ComSafeArrayIn(IUnknown *, objects))1445 static void queryMetrics(ComPtr<IVirtualBox> aVirtualBox, 1446 ComPtr<IPerformanceCollector> collector, 1447 ComSafeArrayIn(IUnknown *, objects)) 1453 1448 { 1454 1449 HRESULT rc; … … 1456 1451 //Bstr metricNames[] = { L"CPU/Load/User:avg,CPU/Load/System:avg,CPU/Load/Idle:avg,RAM/Usage/Total,RAM/Usage/Used:avg" }; 1457 1452 Bstr metricNames[] = { L"*" }; 1458 com::SafeArray<BSTR> metrics 1459 metricNames[0].cloneTo(&metrics 1453 com::SafeArray<BSTR> metrics(1); 1454 metricNames[0].cloneTo(&metrics[0]); 1460 1455 com::SafeArray<BSTR> retNames; 1461 1456 com::SafeIfaceArray<IUnknown> retObjects; … … 1466 1461 com::SafeArray<ULONG> retLengths; 1467 1462 com::SafeArray<LONG> retData; 1468 CHECK_ERROR 1469 1470 1471 1472 1473 1474 1475 1476 1477 ComSafeArrayAsOutParam(retData)));1463 CHECK_ERROR(collector, QueryMetricsData(ComSafeArrayAsInParam(metrics), 1464 ComSafeArrayInArg(objects), 1465 ComSafeArrayAsOutParam(retNames), 1466 ComSafeArrayAsOutParam(retObjects), 1467 ComSafeArrayAsOutParam(retUnits), 1468 ComSafeArrayAsOutParam(retScales), 1469 ComSafeArrayAsOutParam(retSequenceNumbers), 1470 ComSafeArrayAsOutParam(retIndices), 1471 ComSafeArrayAsOutParam(retLengths), 1472 ComSafeArrayAsOutParam(retData))); 1478 1473 RTPrintf("Object Metric Values\n" 1479 1474 "---------- -------------------- --------------------------------------------\n"); -
trunk/src/VBox/Main/testcase/tstOVF.cpp
r31333 r32718 94 94 95 95 ComPtr<IProgress> pProgress; 96 rc = pAppl->Read(Bstr(szAbsOVF) , pProgress.asOutParam());96 rc = pAppl->Read(Bstr(szAbsOVF).raw(), pProgress.asOutParam()); 97 97 if (FAILED(rc)) throw MyError(rc, "Appliance::Read() failed\n"); 98 98 rc = pProgress->WaitForCompletion(-1); … … 345 345 Bstr bstrUUID(uuid.toUtf16()); 346 346 ComPtr<IMachine> pMachine; 347 rc = pVirtualBox->GetMachine(bstrUUID , pMachine.asOutParam());347 rc = pVirtualBox->GetMachine(bstrUUID.raw(), pMachine.asOutParam()); 348 348 if (FAILED(rc)) throw MyError(rc, "VirtualBox::FindMachine() failed\n"); 349 349 -
trunk/src/VBox/Main/webservice/websrv-cpp.xsl
r31333 r32718 769 769 <xsl:when test="$attrdir='in'"> 770 770 <xsl:value-of select="concat('comcall_', $varprefix, @name)" /> 771 <xsl:if test="$attrtype='wstring' or $attrtype='uuid'"> 772 <xsl:text>.raw()</xsl:text> 773 </xsl:if> 771 774 </xsl:when> 772 775 <xsl:when test="$attrdir='return'"> … … 797 800 <xsl:otherwise> 798 801 <xsl:value-of select="concat('comcall_', $varprefix, @name)" /> 802 <xsl:if test="@type='wstring' or @type='uuid'"> 803 <xsl:text>.raw()</xsl:text> 804 </xsl:if> 799 805 </xsl:otherwise> 800 806 </xsl:choose>
Note:
See TracChangeset
for help on using the changeset viewer.