Changeset 33294 in vbox
- Timestamp:
- Oct 21, 2010 10:45:26 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/SDKRef.xml
r33238 r33294 3426 3426 3427 3427 <listitem> 3428 <para>IVirtualBox::unregisterMachine was replaced with <xref 3428 <para>To reduce code duplication and for consistency with the 3429 aforementioned changes, IVirtualBox::getMachine() has been merged 3430 with <xref linkend="IVirtualBox__findMachine" 3431 xreflabel="IVirtualBox::findMachine()" />.</para> 3432 </listitem> 3433 3434 <listitem> 3435 <para>IVirtualBox::unregisterMachine() was replaced with <xref 3429 3436 linkend="IMachine__unregister" xreflabel="IMachine::unregister()" /> 3430 3437 with additional functionality.</para> … … 3450 3457 xreflabel="IGuest::additionsVersion()" /> no longer returns the 3451 3458 Guest Additions interface version but the installed Guest Additions 3452 version +revision in form of3459 version and revision in form of 3453 3460 <computeroutput>3.3.0r12345</computeroutput>.</para> 3454 3461 </listitem> 3455 3462 3456 3463 <listitem> 3457 <para>additionsActive() was replaced by<xref3464 <para>additionsActive() was replaced with <xref 3458 3465 linkend="IGuest__additionsRunLevel" 3459 3466 xreflabel="additionsRunLevel()" /> and <xref … … 3490 3497 <listitem> 3491 3498 <para><xref linkend="IAppliance__write" 3492 xreflabel="IAppliance::write()" /> gotan extra parameter3493 <computeroutput>manifest</computeroutput> . This allows to3494 enable/disable the manifest file creationon export.</para>3499 xreflabel="IAppliance::write()" /> received an extra parameter 3500 <computeroutput>manifest</computeroutput>, which can suppress 3501 creating the manifest file on export.</para> 3495 3502 </listitem> 3496 3503 -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r33004 r33294 793 793 ComPtr<IMachine> m; 794 794 795 /* find ID by name */ 796 if (id.isEmpty()) 797 { 798 rc = virtualBox->FindMachine(Bstr(name).raw(), m.asOutParam()); 799 if (FAILED(rc)) 800 { 801 LogError("Invalid machine name!\n", rc); 802 break; 803 } 804 m->COMGETTER(Id)(id.asOutParam()); 805 AssertComRC(rc); 806 if (FAILED(rc)) 807 break; 808 } 809 else 810 { 811 /* Use the GUID. */ 812 rc = virtualBox->GetMachine(id.raw(), m.asOutParam()); 813 if (FAILED(rc)) 814 { 815 LogError("Invalid machine uid!\n", rc); 816 break; 817 } 818 } 795 rc = virtualBox->FindMachine(Bstr(name).raw(), m.asOutParam()); 796 if (FAILED(rc)) 797 { 798 LogError("Invalid machine name or UUID!\n", rc); 799 break; 800 } 801 m->COMGETTER(Id)(id.asOutParam()); 802 AssertComRC(rc); 803 if (FAILED(rc)) 804 break; 819 805 820 806 Log(("VBoxHeadless: Opening a session with machine (id={%s})...\n", -
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r33229 r33294 441 441 */ 442 442 ComPtr<IMachine> machine; 443 /* assume it's a UUID */ 444 rc = aVirtualBox->GetMachine(Bstr(argv[0]).raw(), machine.asOutParam()); 445 if (FAILED(rc) || !machine) 446 { 447 /* must be a name */ 448 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(), 449 machine.asOutParam()), 1); 450 } 443 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(), 444 machine.asOutParam()), 1); 451 445 452 446 /* … … 1906 1900 1907 1901 ComPtr<IMachine> ptrMachine; 1908 HRESULT rc = aVirtualBox->GetMachine(Bstr(argv[0]).raw(), 1909 ptrMachine.asOutParam()); 1910 if (FAILED(rc) || ptrMachine.isNull()) 1911 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(), 1912 ptrMachine.asOutParam()), 1); 1902 HRESULT rc; 1903 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]).raw(), 1904 ptrMachine.asOutParam()), 1); 1913 1905 1914 1906 CHECK_ERROR_RET(ptrMachine, LockMachine(aSession, LockType_Shared), 1); … … 2026 2018 RTSha256ToString(abDigest, pszDigest, sizeof(pszDigest)); 2027 2019 RTPrintf("Password hash: %s\n", pszDigest); 2028 2020 2029 2021 return 0; 2030 2022 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r32885 r33294 75 75 /* try to find the given machine */ 76 76 ComPtr <IMachine> machine; 77 Bstr machineuuid(a->argv[0]); 78 if (!Guid(machineuuid).isEmpty()) 79 { 80 CHECK_ERROR(a->virtualBox, GetMachine(machineuuid.raw(), 81 machine.asOutParam())); 82 } 83 else 84 { 85 CHECK_ERROR(a->virtualBox, FindMachine(machineuuid.raw(), 86 machine.asOutParam())); 87 if (SUCCEEDED (rc)) 88 machine->COMGETTER(Id)(machineuuid.asOutParam()); 89 } 90 if (FAILED (rc)) 77 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 78 machine.asOutParam())); 79 if (FAILED(rc)) 91 80 return 1; 92 81 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r33132 r33294 1305 1305 { 1306 1306 ComPtr<IMachine> machine; 1307 CHECK_ERROR(a->virtualBox, GetMachine(machineIds[j], machine.asOutParam()));1307 CHECK_ERROR(a->virtualBox, FindMachine(machineIds[j], machine.asOutParam())); 1308 1308 ASSERT(machine); 1309 1309 Bstr name; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r33253 r33294 288 288 /* lookup VM. */ 289 289 ComPtr<IMachine> machine; 290 /* assume it's an UUID */ 291 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 292 machine.asOutParam()); 293 if (FAILED(rc) || !machine) 294 { 295 /* must be a name */ 296 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 297 machine.asOutParam())); 298 } 299 290 HRESULT rc; 291 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 292 machine.asOutParam())); 300 293 if (machine) 301 294 { … … 689 682 ComPtr<IMachine> machine; 690 683 /* assume it's an UUID */ 691 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 692 machine.asOutParam()); 693 if (FAILED(rc) || !machine) 694 { 695 /* must be a name */ 696 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 697 machine.asOutParam())); 698 } 699 684 HRESULT rc; 685 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 686 machine.asOutParam())); 700 687 if (machine) 701 688 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp
r32718 r33294 88 88 89 89 ComPtr<IMachine> machine; 90 /* assume it's a UUID */ 91 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 92 machine.asOutParam()); 93 if (FAILED(rc) || !machine) 94 { 95 /* must be a name */ 96 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 97 machine.asOutParam())); 98 } 90 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 91 machine.asOutParam())); 99 92 if (machine) 100 93 { … … 156 149 157 150 ComPtr<IMachine> machine; 158 /* assume it's a UUID */ 159 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 160 machine.asOutParam()); 161 if (FAILED(rc) || !machine) 162 { 163 /* must be a name */ 164 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 165 machine.asOutParam())); 166 } 151 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 152 machine.asOutParam())); 167 153 if (machine) 168 154 { … … 222 208 */ 223 209 ComPtr<IMachine> machine; 224 /* assume it's a UUID */ 225 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 226 machine.asOutParam()); 227 if (FAILED(rc) || !machine) 228 { 229 /* must be a name */ 230 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 231 machine.asOutParam())); 232 } 210 HRESULT rc; 211 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 212 machine.asOutParam())); 233 213 if (machine) 234 214 { … … 280 260 pszPatterns = a->argv[1]; 281 261 ComPtr<IMachine> machine; 282 /* assume it's a UUID */ 283 HRESULT rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 284 machine.asOutParam()); 285 if (FAILED(rc) || !machine) 286 { 287 /* must be a name */ 288 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 289 machine.asOutParam())); 290 } 262 HRESULT rc; 263 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 264 machine.asOutParam())); 291 265 if (!machine) 292 266 usageOK = false; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r32718 r33294 831 831 // must be machine: try UUID or name 832 832 ComPtr<IMachine> machine; 833 /* assume it's a UUID */ 834 rc = a->virtualBox->GetMachine(Bstr(strMachine).raw(), 835 machine.asOutParam()); 836 if (FAILED(rc) || !machine) 837 { 838 /* must be a name */ 839 CHECK_ERROR_BREAK(a->virtualBox, FindMachine(Bstr(strMachine).raw(), 840 machine.asOutParam())); 841 } 842 833 CHECK_ERROR_BREAK(a->virtualBox, FindMachine(Bstr(strMachine).raw(), 834 machine.asOutParam())); 843 835 if (machine) 844 836 llMachines.push_back(machine); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r33020 r33294 2123 2123 /* try to find the given machine */ 2124 2124 ComPtr <IMachine> machine; 2125 Bstr uuid(VMNameOrUuid); 2126 if (!Guid(VMNameOrUuid).isEmpty()) 2127 { 2128 CHECK_ERROR(a->virtualBox, GetMachine(uuid.raw(), 2129 machine.asOutParam())); 2130 } 2131 else 2132 { 2133 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMNameOrUuid).raw(), 2134 machine.asOutParam())); 2135 if (SUCCEEDED(rc)) 2136 machine->COMGETTER(Id)(uuid.asOutParam()); 2137 } 2125 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMNameOrUuid).raw(), 2126 machine.asOutParam())); 2138 2127 if (FAILED(rc)) 2139 2128 return 1; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r33238 r33294 137 137 { 138 138 ComPtr<IMachine> machine; 139 CHECK_ERROR(aVirtualBox, GetMachine(machineIds[j], machine.asOutParam()));139 CHECK_ERROR(aVirtualBox, FindMachine(machineIds[j], machine.asOutParam())); 140 140 ASSERT(machine); 141 141 Bstr name; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r33238 r33294 150 150 151 151 ComPtr<IMachine> machine; 152 /* assume it's a UUID */ 153 rc = a->virtualBox->GetMachine(Bstr(VMName).raw(), machine.asOutParam()); 154 if (FAILED(rc) || !machine) 155 { 156 /* must be a name */ 157 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName).raw(), 158 machine.asOutParam())); 159 } 152 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName).raw(), 153 machine.asOutParam())); 160 154 if (machine) 161 155 { … … 350 344 351 345 ComPtr<IMachine> machine; 352 /* assume it's a UUID */ 353 rc = a->virtualBox->GetMachine(Bstr(VMName).raw(), machine.asOutParam()); 354 if (FAILED(rc) || !machine) 355 { 356 /* must be a name */ 357 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName).raw(), 358 machine.asOutParam())); 359 } 346 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(VMName).raw(), 347 machine.asOutParam())); 360 348 if (machine) 361 349 { … … 411 399 412 400 ComPtr<IMachine> machine; 413 /* assume it's a UUID */ 414 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 415 machine.asOutParam()); 416 if (FAILED(rc) || !machine) 417 { 418 /* must be a name */ 419 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 420 machine.asOutParam())); 421 } 401 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 402 machine.asOutParam())); 422 403 if (machine) 423 404 { … … 447 428 448 429 ComPtr<IMachine> machine; 449 /* assume it's a UUID */ 450 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 451 machine.asOutParam()); 452 if (FAILED(rc) || !machine) 453 { 454 /* must be a name */ 455 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 456 machine.asOutParam())); 457 } 430 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 431 machine.asOutParam())); 458 432 if (machine) 459 433 { … … 517 491 { 518 492 ComPtr<IMachine> machine; 519 /* assume it's a UUID */ 520 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 521 machine.asOutParam()); 522 if (FAILED(rc) || !machine) 523 { 524 /* must be a name */ 525 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 526 machine.asOutParam())); 527 } 493 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 494 machine.asOutParam())); 528 495 if (machine) 529 496 { … … 584 551 { 585 552 ComPtr<IMachine> machine; 586 /* assume it's a UUID */ 587 rc = a->virtualBox->GetMachine(Bstr(a->argv[0]).raw(), 588 machine.asOutParam()); 589 if (FAILED(rc) || !machine) 590 { 591 /* must be a name */ 592 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 593 machine.asOutParam())); 594 } 553 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 554 machine.asOutParam())); 595 555 if (machine) 596 556 { … … 668 628 669 629 ComPtr<IMachine> machine; 670 /* assume it's a UUID */ 671 rc = a->virtualBox->GetMachine(Bstr(a->argv[1]).raw(), 672 machine.asOutParam()); 673 if (FAILED(rc) || !machine) 674 { 675 /* must be a name */ 676 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[1]).raw(), 677 machine.asOutParam())); 678 } 630 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[1]).raw(), 631 machine.asOutParam())); 679 632 if (!machine) 680 633 return 1; … … 852 805 /* try to find the given machine */ 853 806 ComPtr<IMachine> machine; 854 Bstr uuid(a->argv[0]); 855 if (!Guid(a->argv[0]).isEmpty()) 856 CHECK_ERROR(a->virtualBox, GetMachine(uuid.raw(), 857 machine.asOutParam())); 858 else 859 { 860 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 861 machine.asOutParam())); 862 if (SUCCEEDED(rc)) 863 machine->COMGETTER(Id)(uuid.asOutParam()); 864 } 807 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 808 machine.asOutParam())); 865 809 if (FAILED(rc)) 866 810 return 1; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r33201 r33294 284 284 HRESULT rc; 285 285 Bstr name; 286 Bstr machineuuid(a->argv[0]);287 286 RTGETOPTUNION ValueUnion; 288 287 RTGETOPTSTATE GetOptState; … … 310 309 311 310 /* try to find the given machine */ 312 if (!Guid(machineuuid).isEmpty()) 313 { 314 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid.raw(), 315 machine.asOutParam()), 1); 316 } 317 else 318 { 319 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 320 machine.asOutParam()), 1); 321 machine->COMGETTER(Id)(machineuuid.asOutParam()); 322 } 311 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 312 machine.asOutParam()), 1); 323 313 324 314 /* open a session for the VM */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
r32718 r33294 227 227 Bstr bstrMachine(a->argv[0]); 228 228 ComPtr<IMachine> pMachine; 229 /* assume it's a UUID */ 230 rc = a->virtualBox->GetMachine(bstrMachine.raw(), pMachine.asOutParam()); 231 if (FAILED(rc) || !pMachine) 232 { 233 /* must be a name */ 234 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine.raw(), 235 pMachine.asOutParam())); 236 } 229 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine.raw(), 230 pMachine.asOutParam())); 237 231 if (!pMachine) 238 232 return 1; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r33140 r33294 65 65 const char *pszMedium = NULL; 66 66 const char *pszPassThrough = NULL; 67 Bstr machineuuid (a->argv[0]);68 67 RTGETOPTUNION ValueUnion; 69 68 RTGETOPTSTATE GetState; … … 162 161 163 162 /* try to find the given machine */ 164 if (!Guid(machineuuid).isEmpty()) 165 { 166 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid.raw(), 167 machine.asOutParam()), 1); 168 } 169 else 170 { 171 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 172 machine.asOutParam()), 1); 173 machine->COMGETTER(Id)(machineuuid.asOutParam()); 174 } 163 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 164 machine.asOutParam()), 1); 175 165 176 166 /* open a session for the VM (new or shared) */ … … 671 661 ULONG sataportcount = ~0U; 672 662 bool fRemoveCtl = false; 673 Bstr machineuuid (a->argv[0]);674 663 ComPtr<IMachine> machine; 675 664 RTGETOPTUNION ValueUnion; … … 752 741 753 742 /* try to find the given machine */ 754 if (!Guid(machineuuid).isEmpty()) 755 { 756 CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid.raw(), 757 machine.asOutParam()), 1); 758 } 759 else 760 { 761 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 762 machine.asOutParam()), 1); 763 machine->COMGETTER(Id)(machineuuid.asOutParam()); 764 } 743 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 744 machine.asOutParam()), 1); 765 745 766 746 /* open a session for the VM */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
r32718 r33294 234 234 { 235 235 /* assume it's a UUID of a machine */ 236 rc = a->virtualBox->GetMachine(Bstr(a->argv[i]).raw(), 237 cmd.mMachine.asOutParam()); 238 if (FAILED(rc) || !cmd.mMachine) 239 { 240 /* must be a name */ 241 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]).raw(), 242 cmd.mMachine.asOutParam()), 1); 243 } 236 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]).raw(), 237 cmd.mMachine.asOutParam()), 1); 244 238 } 245 239 } … … 389 383 else 390 384 { 391 /* assume it's a UUID of a machine */ 392 rc = a->virtualBox->GetMachine(Bstr(a->argv[i]).raw(), 393 cmd.mMachine.asOutParam()); 394 if (FAILED(rc) || !cmd.mMachine) 395 { 396 /* must be a name */ 397 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]).raw(), 398 cmd.mMachine.asOutParam()), 1); 399 } 385 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[i]).raw(), 386 cmd.mMachine.asOutParam()), 1); 400 387 } 401 388 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r33238 r33294 1137 1137 for (QList <QString>::const_iterator it = machineIds.begin(); it != machineIds.end(); ++ it) 1138 1138 { 1139 CMachine m = mVBox. GetMachine (*it);1139 CMachine m = mVBox.FindMachine (*it); 1140 1140 if (!mVBox.isOk()) 1141 1141 continue; … … 1187 1187 else 1188 1188 { 1189 session = vboxGlobal().openSession 1189 session = vboxGlobal().openSession(aMachineId); 1190 1190 if (session.isNull()) 1191 1191 return false; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.cpp
r32532 r33294 191 191 for (QVector <QString>::ConstIterator it = machineIds.begin(); it != machineIds.end(); ++ it) 192 192 { 193 CMachine machine = vbox. GetMachine(*it);193 CMachine machine = vbox.FindMachine(*it); 194 194 195 195 QString sName = machine.GetName(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r33044 r33294 2166 2166 } 2167 2167 2168 CMachine foundMachine = CVirtualBox(mVBox). GetMachine(aId);2168 CMachine foundMachine = CVirtualBox(mVBox).FindMachine(aId); 2169 2169 if (!foundMachine.isNull()) 2170 2170 { … … 4803 4803 if (bForceSeamless && !vmUuid.isEmpty()) 4804 4804 { 4805 mVBox. GetMachine(vmUuid).SetExtraData(VBoxDefs::GUI_Seamless, "on");4805 mVBox.FindMachine(vmUuid).SetExtraData(VBoxDefs::GUI_Seamless, "on"); 4806 4806 } 4807 4807 else if (bForceFullscreen && !vmUuid.isEmpty()) 4808 4808 { 4809 mVBox. GetMachine(vmUuid).SetExtraData(VBoxDefs::GUI_Fullscreen, "on");4809 mVBox.FindMachine(vmUuid).SetExtraData(VBoxDefs::GUI_Fullscreen, "on"); 4810 4810 } 4811 4811 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
r32789 r33294 779 779 } 780 780 781 CMachine foundMachine = vbox. GetMachine(id);781 CMachine foundMachine = vbox.FindMachine(id); 782 782 if (!foundMachine.isNull()) 783 783 foundMachine.LockMachine(session, KLockType_Write); … … 1407 1407 { 1408 1408 CVirtualBox vbox = vboxGlobal().virtualBox(); 1409 CMachine m = vbox. GetMachine(strId);1409 CMachine m = vbox.FindMachine(strId); 1410 1410 if (!m.isNull()) 1411 1411 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIExportApplianceWzd.cpp
r33077 r33294 254 254 { 255 255 /* Get the machine with the uuid */ 256 CMachine m = vbox. GetMachine(uuid);256 CMachine m = vbox.FindMachine(uuid); 257 257 fResult = m.isOk(); 258 258 if (fResult) -
trunk/src/VBox/HostServices/auth/simple/VBoxAuthSimple.cpp
r33229 r33294 101 101 { 102 102 ComPtr<IMachine> machine; 103 virtualBox-> GetMachine(Bstr(uuid).raw(), machine.asOutParam());103 virtualBox->FindMachine(Bstr(uuid).raw(), machine.asOutParam()); 104 104 if (machine) 105 105 machine->GetExtraData(key.raw(), password.asOutParam()); … … 115 115 char pszDigest[RTSHA256_DIGEST_LEN + 1]; 116 116 RTSha256ToString(abDigest, pszDigest, sizeof(pszDigest)); 117 117 118 118 if (password == pszDigest) 119 119 result = VRDPAuthAccessGranted; -
trunk/src/VBox/Main/ApplianceImplImport.cpp
r33289 r33294 1085 1085 Bstr bstrGuid = guid.toUtf16(); 1086 1086 ComPtr<IMachine> failedMachine; 1087 HRESULT rc2 = mVirtualBox-> GetMachine(bstrGuid.raw(), failedMachine.asOutParam());1087 HRESULT rc2 = mVirtualBox->FindMachine(bstrGuid.raw(), failedMachine.asOutParam()); 1088 1088 if (SUCCEEDED(rc2)) 1089 1089 { -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r33254 r33294 1306 1306 } 1307 1307 1308 /** @note Locks objects! */ 1309 STDMETHODIMP VirtualBox::GetMachine(IN_BSTR aId, IMachine **aMachine) 1310 { 1308 /** @note Locks this object for reading, then some machine objects for reading. */ 1309 STDMETHODIMP VirtualBox::FindMachine(IN_BSTR aNameOrId, IMachine **aMachine) 1310 { 1311 LogFlowThisFuncEnter(); 1312 LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aNameOrId, aMachine)); 1313 1314 CheckComArgStrNotEmptyOrNull(aNameOrId); 1311 1315 CheckComArgOutSafeArrayPointerValid(aMachine); 1312 1316 … … 1314 1318 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1315 1319 1316 ComObjPtr<Machine> machine;1317 HRESULT rc = findMachine(Guid(aId),1318 true /* fPermitInaccessible */,1319 true /* setError */,1320 &machine);1321 1322 /* the below will set *aMachine to NULL if machine is null */1323 machine.queryInterfaceTo(aMachine);1324 1325 return rc;1326 }1327 1328 /** @note Locks this object for reading, then some machine objects for reading. */1329 STDMETHODIMP VirtualBox::FindMachine(IN_BSTR aName, IMachine **aMachine)1330 {1331 LogFlowThisFuncEnter();1332 LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aName, aMachine));1333 1334 CheckComArgStrNotEmptyOrNull(aName);1335 CheckComArgOutSafeArrayPointerValid(aMachine);1336 1337 AutoCaller autoCaller(this);1338 if (FAILED(autoCaller.rc())) return autoCaller.rc();1339 1340 1320 /* start with not found */ 1321 HRESULT rc = S_OK; 1341 1322 ComObjPtr<Machine> pMachineFound; 1342 Utf8Str strName(aName); 1343 1344 AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1345 for (MachinesOList::iterator it = m->allMachines.begin(); 1346 it != m->allMachines.end(); 1347 ++it) 1348 { 1349 ComObjPtr<Machine> &pMachine2 = *it; 1350 AutoCaller machCaller(pMachine2); 1351 /* skip inaccessible machines */ 1352 if (FAILED(machCaller.rc())) 1353 continue; 1354 1355 AutoReadLock machLock(pMachine2 COMMA_LOCKVAL_SRC_POS); 1356 if (pMachine2->getName() == strName) 1357 { 1358 pMachineFound = pMachine2; 1359 break; 1360 } 1323 1324 Guid id(aNameOrId); 1325 if (!id.isEmpty()) 1326 rc = findMachine(id, 1327 true /* fPermitInaccessible */, 1328 true /* setError */, 1329 &pMachineFound); 1330 // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error 1331 else 1332 { 1333 Utf8Str strName(aNameOrId); 1334 AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1335 for (MachinesOList::iterator it = m->allMachines.begin(); 1336 it != m->allMachines.end(); 1337 ++it) 1338 { 1339 ComObjPtr<Machine> &pMachine2 = *it; 1340 AutoCaller machCaller(pMachine2); 1341 if (machCaller.rc()) 1342 continue; // we can't ask inaccessible machines for their names 1343 1344 AutoReadLock machLock(pMachine2 COMMA_LOCKVAL_SRC_POS); 1345 if (pMachine2->getName() == strName) 1346 { 1347 pMachineFound = pMachine2; 1348 break; 1349 } 1350 } 1351 1352 if (!pMachineFound) 1353 rc = setError(VBOX_E_OBJECT_NOT_FOUND, 1354 tr("Could not find a registered machine named '%ls'"), aNameOrId); 1361 1355 } 1362 1356 … … 1364 1358 pMachineFound.queryInterfaceTo(aMachine); 1365 1359 1366 HRESULT rc = pMachineFound 1367 ? S_OK 1368 : setError(VBOX_E_OBJECT_NOT_FOUND, 1369 tr("Could not find a registered machine named '%ls'"), aName); 1370 1371 LogFlowThisFunc(("aName=\"%ls\", aMachine=%p, rc=%08X\n", aName, *aMachine, rc)); 1360 LogFlowThisFunc(("aName=\"%ls\", aMachine=%p, rc=%08X\n", aNameOrId, *aMachine, rc)); 1372 1361 LogFlowThisFuncLeave(); 1373 1362 -
trunk/src/VBox/Main/cbinding/tstXPCOMCGlue.c
r31070 r33294 206 206 PRUnichar *sessionType; 207 207 208 rc = virtualBox->vtbl-> GetMachine(virtualBox, id, &machine);208 rc = virtualBox->vtbl->FindMachine(virtualBox, id, &machine); 209 209 210 210 if (NS_FAILED(rc) || !machine) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r33253 r33294 1374 1374 <interface 1375 1375 name="IVirtualBox" extends="$unknown" 1376 uuid=" a35a051c-0966-4582-8e9c-7c1b973f6bd2"1376 uuid="5e887b09-e3f3-4787-b9f3-8ade5d04d675" 1377 1377 wsmap="managed" 1378 1378 > … … 1699 1699 </method> 1700 1700 1701 <method name="getMachine"> 1702 <desc> 1703 Attempts to find a virtual machine given its UUID. 1704 To look up a machine by name, use <link to="IVirtualBox::findMachine" /> 1705 instead. 1701 <method name="findMachine"> 1702 <desc> 1703 Attempts to find a virtual machine given its name or UUID. 1704 1705 <note>Inaccessible machines cannot be found by name, only by UUID, because their name 1706 cannot safely be determined.</note> 1706 1707 1707 1708 <result name="VBOX_E_OBJECT_NOT_FOUND"> 1708 Could not find registered machine matching @a id. 1709 </result> 1710 1711 </desc> 1712 <param name="id" type="uuid" mod="string" dir="in"/> 1713 <param name="machine" type="IMachine" dir="return"/> 1714 </method> 1715 1716 <method name="findMachine"> 1717 <desc> 1718 Attempts to find a virtual machine given its name. 1719 To look up a machine by UUID, use <link to="IVirtualBox::getMachine" /> 1720 instead. 1721 1722 <result name="VBOX_E_OBJECT_NOT_FOUND"> 1723 Could not find registered machine matching @a name. 1724 </result> 1725 1726 </desc> 1727 <param name="name" type="wstring" dir="in"/> 1728 <param name="machine" type="IMachine" dir="return"/> 1709 Could not find registered machine matching @a nameOrId. 1710 </result> 1711 1712 </desc> 1713 <param name="nameOrId" type="wstring" dir="in"> 1714 <desc>What to search for. This can either be the UUID or the name of a virtual machine.</desc> 1715 </param> 1716 <param name="machine" type="IMachine" dir="return"> 1717 <desc>Machine object, if found.</desc> 1718 </param> 1729 1719 </method> 1730 1720 -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r33239 r33294 127 127 STDMETHOD(OpenMachine) (IN_BSTR aSettingsFile, IMachine **aMachine); 128 128 STDMETHOD(RegisterMachine) (IMachine *aMachine); 129 STDMETHOD(GetMachine) (IN_BSTR aId, IMachine **aMachine); 130 STDMETHOD(FindMachine) (IN_BSTR aName, IMachine **aMachine); 129 STDMETHOD(FindMachine) (IN_BSTR aNameOrId, IMachine **aMachine); 131 130 STDMETHOD(CreateAppliance) (IAppliance **anAppliance); 132 131 -
trunk/src/VBox/Main/testcase/tstOVF.cpp
r32718 r33294 345 345 Bstr bstrUUID(uuid.toUtf16()); 346 346 ComPtr<IMachine> pMachine; 347 rc = pVirtualBox-> GetMachine(bstrUUID.raw(), pMachine.asOutParam());347 rc = pVirtualBox->FindMachine(bstrUUID.raw(), pMachine.asOutParam()); 348 348 if (FAILED(rc)) throw MyError(rc, "VirtualBox::FindMachine() failed\n"); 349 349
Note:
See TracChangeset
for help on using the changeset viewer.