Changeset 51498 in vbox for trunk/src/VBox
- Timestamp:
- Jun 2, 2014 6:53:08 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94109
- Location:
- trunk/src/VBox/Main
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/AutoStateDep.h
r33540 r51498 10 10 11 11 /* 12 * Copyright (C) 2006-201 0Oracle Corporation12 * Copyright (C) 2006-2014 Oracle Corporation 13 13 * 14 14 * This file is part of VirtualBox Open Source Edition (OSE), as … … 58 58 { 59 59 Assert(aThat); 60 mRC = aThat-> addStateDependency(taDepType, &mMachineState,60 mRC = aThat->i_addStateDependency(taDepType, &mMachineState, 61 61 &mRegistered); 62 62 } … … 64 64 { 65 65 if (SUCCEEDED(mRC)) 66 mThat-> releaseStateDependency();66 mThat->i_releaseStateDependency(); 67 67 } 68 68 … … 72 72 { 73 73 AssertReturnVoid(SUCCEEDED(mRC)); 74 mThat-> releaseStateDependency();74 mThat->i_releaseStateDependency(); 75 75 mRC = E_FAIL; 76 76 } … … 82 82 { 83 83 AssertReturnVoid(!SUCCEEDED(mRC)); 84 mRC = mThat-> addStateDependency(taDepType, &mMachineState,84 mRC = mThat->i_addStateDependency(taDepType, &mMachineState, 85 85 &mRegistered); 86 86 } -
trunk/src/VBox/Main/include/MachineImpl.h
r51476 r51498 53 53 #include <vector> 54 54 55 #include "MachineWrap.h" 56 55 57 // defines 56 58 //////////////////////////////////////////////////////////////////////////////// … … 86 88 // Machine class 87 89 //////////////////////////////////////////////////////////////////////////////// 88 90 // 89 91 class ATL_NO_VTABLE Machine : 90 public VirtualBoxBase, 91 VBOX_SCRIPTABLE_IMPL(IMachine) 92 public MachineWrap 92 93 { 93 Q_OBJECT94 94 95 95 public: … … 340 340 }; 341 341 342 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Machine, IMachine)343 344 DECLARE_NOT_AGGREGATABLE(Machine)345 346 DECLARE_PROTECT_FINAL_CONSTRUCT()347 348 BEGIN_COM_MAP(Machine)349 VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)350 END_COM_MAP()351 352 342 DECLARE_EMPTY_CTOR_DTOR(Machine) 353 343 … … 381 371 #ifdef VBOX_WITH_RESOURCE_USAGE_API 382 372 // Needed from VirtualBox, for the delayed metrics cleanup. 383 void unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine);373 void i_unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine); 384 374 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 385 375 … … 388 378 const Utf8Str &strConfigFile); 389 379 HRESULT initDataAndChildObjects(); 390 HRESULT registeredInit();391 HRESULT tryCreateMachineConfigFile(bool fForceOverwrite);380 HRESULT i_registeredInit(); 381 HRESULT i_tryCreateMachineConfigFile(bool fForceOverwrite); 392 382 void uninitDataAndChildObjects(); 393 383 394 384 public: 395 // IMachine properties 396 STDMETHOD(COMGETTER(Parent))(IVirtualBox **aParent); 397 STDMETHOD(COMGETTER(Accessible))(BOOL *aAccessible); 398 STDMETHOD(COMGETTER(AccessError))(IVirtualBoxErrorInfo **aAccessError); 399 STDMETHOD(COMGETTER(Name))(BSTR *aName); 400 STDMETHOD(COMSETTER(Name))(IN_BSTR aName); 401 STDMETHOD(COMGETTER(Description))(BSTR *aDescription); 402 STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription); 403 STDMETHOD(COMGETTER(Id))(BSTR *aId); 404 STDMETHOD(COMGETTER(Groups))(ComSafeArrayOut(BSTR, aGroups)); 405 STDMETHOD(COMSETTER(Groups))(ComSafeArrayIn(IN_BSTR, aGroups)); 406 STDMETHOD(COMGETTER(OSTypeId))(BSTR *aOSTypeId); 407 STDMETHOD(COMSETTER(OSTypeId))(IN_BSTR aOSTypeId); 408 STDMETHOD(COMGETTER(HardwareVersion))(BSTR *aVersion); 409 STDMETHOD(COMSETTER(HardwareVersion))(IN_BSTR aVersion); 410 STDMETHOD(COMGETTER(HardwareUUID))(BSTR *aUUID); 411 STDMETHOD(COMSETTER(HardwareUUID))(IN_BSTR aUUID); 412 STDMETHOD(COMGETTER(MemorySize))(ULONG *memorySize); 413 STDMETHOD(COMSETTER(MemorySize))(ULONG memorySize); 414 STDMETHOD(COMGETTER(CPUCount))(ULONG *cpuCount); 415 STDMETHOD(COMSETTER(CPUCount))(ULONG cpuCount); 416 STDMETHOD(COMGETTER(CPUHotPlugEnabled))(BOOL *enabled); 417 STDMETHOD(COMSETTER(CPUHotPlugEnabled))(BOOL enabled); 418 STDMETHOD(COMGETTER(CPUExecutionCap))(ULONG *aExecutionCap); 419 STDMETHOD(COMSETTER(CPUExecutionCap))(ULONG aExecutionCap); 420 STDMETHOD(COMGETTER(EmulatedUSBCardReaderEnabled))(BOOL *aEnabled); 421 STDMETHOD(COMSETTER(EmulatedUSBCardReaderEnabled))(BOOL aEnabled); 422 STDMETHOD(COMGETTER(HPETEnabled))(BOOL *enabled); 423 STDMETHOD(COMSETTER(HPETEnabled))(BOOL enabled); 424 STDMETHOD(COMGETTER(MemoryBalloonSize))(ULONG *memoryBalloonSize); 425 STDMETHOD(COMSETTER(MemoryBalloonSize))(ULONG memoryBalloonSize); 426 STDMETHOD(COMGETTER(PageFusionEnabled))(BOOL *enabled); 427 STDMETHOD(COMSETTER(PageFusionEnabled))(BOOL enabled); 428 STDMETHOD(COMGETTER(GraphicsControllerType))(GraphicsControllerType_T *aGraphicsController); 429 STDMETHOD(COMSETTER(GraphicsControllerType))(GraphicsControllerType_T aGraphicsController); 430 STDMETHOD(COMGETTER(VRAMSize))(ULONG *memorySize); 431 STDMETHOD(COMSETTER(VRAMSize))(ULONG memorySize); 432 STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *aEnabled); 433 STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL aEnabled); 434 STDMETHOD(COMGETTER(Accelerate2DVideoEnabled))(BOOL *aEnabled); 435 STDMETHOD(COMSETTER(Accelerate2DVideoEnabled))(BOOL aEnabled); 436 STDMETHOD(COMGETTER(MonitorCount))(ULONG *monitorCount); 437 STDMETHOD(COMSETTER(MonitorCount))(ULONG monitorCount); 438 STDMETHOD(COMGETTER(VideoCaptureEnabled))(BOOL *u8VideoRecEnabled); 439 STDMETHOD(COMSETTER(VideoCaptureEnabled))(BOOL u8VideoRecEnabled); 440 STDMETHOD(COMGETTER(VideoCaptureScreens))(ComSafeArrayOut(BOOL, aScreens)); 441 STDMETHOD(COMSETTER(VideoCaptureScreens))(ComSafeArrayIn(BOOL, aScreens)); 442 STDMETHOD(COMGETTER(VideoCaptureFile))(BSTR * ppChVideoRecFilename); 443 STDMETHOD(COMSETTER(VideoCaptureFile))(IN_BSTR pChVideoRecFilename); 444 STDMETHOD(COMGETTER(VideoCaptureWidth))(ULONG *aHorzRes); 445 STDMETHOD(COMSETTER(VideoCaptureWidth))(ULONG aorzRes); 446 STDMETHOD(COMGETTER(VideoCaptureHeight))(ULONG *aVertRes); 447 STDMETHOD(COMSETTER(VideoCaptureHeight))(ULONG aVertRes); 448 STDMETHOD(COMGETTER(VideoCaptureRate))(ULONG *aRate); 449 STDMETHOD(COMSETTER(VideoCaptureRate))(ULONG aRate); 450 STDMETHOD(COMGETTER(VideoCaptureFPS))(ULONG *aFPS); 451 STDMETHOD(COMSETTER(VideoCaptureFPS))(ULONG aFPS); 452 STDMETHOD(COMGETTER(BIOSSettings))(IBIOSSettings **biosSettings); 453 STDMETHOD(COMGETTER(SnapshotFolder))(BSTR *aSavedStateFolder); 454 STDMETHOD(COMSETTER(SnapshotFolder))(IN_BSTR aSavedStateFolder); 455 STDMETHOD(COMGETTER(MediumAttachments))(ComSafeArrayOut(IMediumAttachment *, aAttachments)); 456 STDMETHOD(COMGETTER(VRDEServer))(IVRDEServer **vrdeServer); 457 STDMETHOD(COMGETTER(AudioAdapter))(IAudioAdapter **audioAdapter); 458 STDMETHOD(COMGETTER(USBControllers))(ComSafeArrayOut(IUSBController *, aUSBControllers)); 459 STDMETHOD(COMGETTER(USBDeviceFilters))(IUSBDeviceFilters * *aUSBDeviceFilters); 460 STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath); 461 STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified); 462 STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState); 463 STDMETHOD(COMGETTER(SessionType))(BSTR *aSessionType); 464 STDMETHOD(COMGETTER(SessionPID))(ULONG *aSessionPID); 465 STDMETHOD(COMGETTER(State))(MachineState_T *machineState); 466 STDMETHOD(COMGETTER(LastStateChange))(LONG64 *aLastStateChange); 467 STDMETHOD(COMGETTER(StateFilePath))(BSTR *aStateFilePath); 468 STDMETHOD(COMGETTER(LogFolder))(BSTR *aLogFolder); 469 STDMETHOD(COMGETTER(CurrentSnapshot))(ISnapshot **aCurrentSnapshot); 470 STDMETHOD(COMGETTER(SnapshotCount))(ULONG *aSnapshotCount); 471 STDMETHOD(COMGETTER(CurrentStateModified))(BOOL *aCurrentStateModified); 472 STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders)); 473 STDMETHOD(COMGETTER(ClipboardMode))(ClipboardMode_T *aClipboardMode); 474 STDMETHOD(COMSETTER(ClipboardMode))(ClipboardMode_T aClipboardMode); 475 STDMETHOD(COMGETTER(DnDMode))(DnDMode_T *aDnDMode); 476 STDMETHOD(COMSETTER(DnDMode))(DnDMode_T aDnDMode); 477 STDMETHOD(COMGETTER(GuestPropertyNotificationPatterns))(BSTR *aPattern); 478 STDMETHOD(COMSETTER(GuestPropertyNotificationPatterns))(IN_BSTR aPattern); 479 STDMETHOD(COMGETTER(StorageControllers))(ComSafeArrayOut(IStorageController *, aStorageControllers)); 480 STDMETHOD(COMGETTER(TeleporterEnabled))(BOOL *aEnabled); 481 STDMETHOD(COMSETTER(TeleporterEnabled))(BOOL aEnabled); 482 STDMETHOD(COMGETTER(TeleporterPort))(ULONG *aPort); 483 STDMETHOD(COMSETTER(TeleporterPort))(ULONG aPort); 484 STDMETHOD(COMGETTER(TeleporterAddress))(BSTR *aAddress); 485 STDMETHOD(COMSETTER(TeleporterAddress))(IN_BSTR aAddress); 486 STDMETHOD(COMGETTER(TeleporterPassword))(BSTR *aPassword); 487 STDMETHOD(COMSETTER(TeleporterPassword))(IN_BSTR aPassword); 488 STDMETHOD(COMGETTER(FaultToleranceState))(FaultToleranceState_T *aEnabled); 489 STDMETHOD(COMSETTER(FaultToleranceState))(FaultToleranceState_T aEnabled); 490 STDMETHOD(COMGETTER(FaultToleranceAddress))(BSTR *aAddress); 491 STDMETHOD(COMSETTER(FaultToleranceAddress))(IN_BSTR aAddress); 492 STDMETHOD(COMGETTER(FaultTolerancePort))(ULONG *aPort); 493 STDMETHOD(COMSETTER(FaultTolerancePort))(ULONG aPort); 494 STDMETHOD(COMGETTER(FaultTolerancePassword))(BSTR *aPassword); 495 STDMETHOD(COMSETTER(FaultTolerancePassword))(IN_BSTR aPassword); 496 STDMETHOD(COMGETTER(FaultToleranceSyncInterval))(ULONG *aInterval); 497 STDMETHOD(COMSETTER(FaultToleranceSyncInterval))(ULONG aInterval); 498 STDMETHOD(COMGETTER(RTCUseUTC))(BOOL *aEnabled); 499 STDMETHOD(COMSETTER(RTCUseUTC))(BOOL aEnabled); 500 STDMETHOD(COMGETTER(FirmwareType))(FirmwareType_T *aFirmware); 501 STDMETHOD(COMSETTER(FirmwareType))(FirmwareType_T aFirmware); 502 STDMETHOD(COMGETTER(KeyboardHIDType))(KeyboardHIDType_T *aKeyboardHIDType); 503 STDMETHOD(COMSETTER(KeyboardHIDType))(KeyboardHIDType_T aKeyboardHIDType); 504 STDMETHOD(COMGETTER(PointingHIDType))(PointingHIDType_T *aPointingHIDType); 505 STDMETHOD(COMSETTER(PointingHIDType))(PointingHIDType_T aPointingHIDType); 506 STDMETHOD(COMGETTER(ChipsetType))(ChipsetType_T *aChipsetType); 507 STDMETHOD(COMSETTER(ChipsetType))(ChipsetType_T aChipsetType); 508 STDMETHOD(COMGETTER(ParavirtProvider))(ParavirtProvider_T *aParavirtProvider); 509 STDMETHOD(COMSETTER(ParavirtProvider))(ParavirtProvider_T aParavirtProvider); 510 STDMETHOD(COMGETTER(IOCacheEnabled))(BOOL *aEnabled); 511 STDMETHOD(COMSETTER(IOCacheEnabled))(BOOL aEnabled); 512 STDMETHOD(COMGETTER(IOCacheSize))(ULONG *aIOCacheSize); 513 STDMETHOD(COMSETTER(IOCacheSize))(ULONG aIOCacheSize); 514 STDMETHOD(COMGETTER(PCIDeviceAssignments))(ComSafeArrayOut(IPCIDeviceAttachment *, aAssignments)); 515 STDMETHOD(COMGETTER(BandwidthControl))(IBandwidthControl **aBandwidthControl); 516 STDMETHOD(COMGETTER(TracingEnabled))(BOOL *pfEnabled); 517 STDMETHOD(COMSETTER(TracingEnabled))(BOOL fEnabled); 518 STDMETHOD(COMGETTER(TracingConfig))(BSTR *pbstrConfig); 519 STDMETHOD(COMSETTER(TracingConfig))(IN_BSTR bstrConfig); 520 STDMETHOD(COMGETTER(AllowTracingToAccessVM))(BOOL *pfAllow); 521 STDMETHOD(COMSETTER(AllowTracingToAccessVM))(BOOL fAllow); 522 STDMETHOD(COMGETTER(AutostartEnabled))(BOOL *pfEnabled); 523 STDMETHOD(COMSETTER(AutostartEnabled))(BOOL fEnabled); 524 STDMETHOD(COMGETTER(AutostartDelay))(ULONG *puDelay); 525 STDMETHOD(COMSETTER(AutostartDelay))(ULONG uDelay); 526 STDMETHOD(COMGETTER(AutostopType))(AutostopType_T *penmAutostopType); 527 STDMETHOD(COMSETTER(AutostopType))(AutostopType_T enmAutostopType); 528 STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend); 529 STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend); 530 STDMETHOD(COMGETTER(Icon))(ComSafeArrayOut(BYTE, aIcon)); 531 STDMETHOD(COMSETTER(Icon))(ComSafeArrayIn(BYTE, aIcon)); 532 STDMETHOD(COMGETTER(USBProxyAvailable))(BOOL *aAvailable); 533 534 // IMachine methods 535 STDMETHOD(LockMachine)(ISession *aSession, LockType_T lockType); 536 STDMETHOD(LaunchVMProcess)(ISession *aSession, IN_BSTR aType, IN_BSTR aEnvironment, IProgress **aProgress); 537 538 STDMETHOD(SetBootOrder)(ULONG aPosition, DeviceType_T aDevice); 539 STDMETHOD(GetBootOrder)(ULONG aPosition, DeviceType_T *aDevice); 540 STDMETHOD(AttachDeviceWithoutMedium)(IN_BSTR aControllerName, LONG aControllerPort, 541 LONG aDevice, DeviceType_T aType); 542 STDMETHOD(AttachDevice)(IN_BSTR aControllerName, LONG aControllerPort, 543 LONG aDevice, DeviceType_T aType, IMedium *aMedium); 544 STDMETHOD(DetachDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice); 545 STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough); 546 STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject); 547 STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational); 548 STDMETHOD(SetAutoDiscardForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aDiscard); 549 STDMETHOD(SetHotPluggableForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aHotPluggable); 550 STDMETHOD(SetNoBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 551 LONG aDevice); 552 STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 553 LONG aDevice, IBandwidthGroup *aBandwidthGroup); 554 STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort, 555 LONG aDevice, IMedium *aMedium, BOOL aForce); 556 STDMETHOD(UnmountMedium)(IN_BSTR aControllerName, LONG aControllerPort, 557 LONG aDevice, BOOL aForce); 558 STDMETHOD(GetMedium)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, 559 IMedium **aMedium); 560 STDMETHOD(GetSerialPort)(ULONG slot, ISerialPort **port); 561 STDMETHOD(GetParallelPort)(ULONG slot, IParallelPort **port); 562 STDMETHOD(GetNetworkAdapter)(ULONG slot, INetworkAdapter **adapter); 563 STDMETHOD(GetExtraDataKeys)(ComSafeArrayOut(BSTR, aKeys)); 564 STDMETHOD(GetExtraData)(IN_BSTR aKey, BSTR *aValue); 565 STDMETHOD(SetExtraData)(IN_BSTR aKey, IN_BSTR aValue); 566 STDMETHOD(GetCPUProperty)(CPUPropertyType_T property, BOOL *aVal); 567 STDMETHOD(SetCPUProperty)(CPUPropertyType_T property, BOOL aVal); 568 STDMETHOD(GetCPUIDLeaf)(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx); 569 STDMETHOD(SetCPUIDLeaf)(ULONG id, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx); 570 STDMETHOD(RemoveCPUIDLeaf)(ULONG id); 571 STDMETHOD(RemoveAllCPUIDLeaves)(); 572 STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal); 573 STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal); 574 STDMETHOD(SetSettingsFilePath)(IN_BSTR aFilePath, IProgress **aProgress); 575 STDMETHOD(SaveSettings)(); 576 STDMETHOD(DiscardSettings)(); 577 STDMETHOD(Unregister)(CleanupMode_T cleanupMode, ComSafeArrayOut(IMedium*, aMedia)); 578 STDMETHOD(DeleteConfig)(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress); 579 STDMETHOD(ExportTo)(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription); 580 STDMETHOD(FindSnapshot)(IN_BSTR aNameOrId, ISnapshot **aSnapshot); 581 STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount); 582 STDMETHOD(RemoveSharedFolder)(IN_BSTR aName); 583 STDMETHOD(CanShowConsoleWindow)(BOOL *aCanShow); 584 STDMETHOD(ShowConsoleWindow)(LONG64 *aWinId); 585 STDMETHOD(GetGuestProperty)(IN_BSTR aName, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags); 586 STDMETHOD(GetGuestPropertyValue)(IN_BSTR aName, BSTR *aValue); 587 STDMETHOD(GetGuestPropertyTimestamp)(IN_BSTR aName, LONG64 *aTimestamp); 588 STDMETHOD(SetGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags); 589 STDMETHOD(SetGuestPropertyValue)(IN_BSTR aName, IN_BSTR aValue); 590 STDMETHOD(DeleteGuestProperty)(IN_BSTR aName); 591 STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPattern, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags)); 592 STDMETHOD(GetMediumAttachmentsOfController)(IN_BSTR aName, ComSafeArrayOut(IMediumAttachment *, aAttachments)); 593 STDMETHOD(GetMediumAttachment)(IN_BSTR aConstrollerName, LONG aControllerPort, LONG aDevice, IMediumAttachment **aAttachment); 594 STDMETHOD(AddStorageController)(IN_BSTR aName, StorageBus_T aConnectionType, IStorageController **controller); 595 STDMETHOD(RemoveStorageController(IN_BSTR aName)); 596 STDMETHOD(GetStorageControllerByName(IN_BSTR aName, IStorageController **storageController)); 597 STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController)); 598 STDMETHOD(SetStorageControllerBootable)(IN_BSTR aName, BOOL fBootable); 599 STDMETHOD(AddUSBController)(IN_BSTR aName, USBControllerType_T aConnectionType, IUSBController **controller); 600 STDMETHOD(RemoveUSBController(IN_BSTR aName)); 601 STDMETHOD(GetUSBControllerByName(IN_BSTR aName, IUSBController **usbController)); 602 STDMETHOD(GetUSBControllerCountByType(USBControllerType_T aType, ULONG *aControllers)); 603 STDMETHOD(QuerySavedGuestScreenInfo)(ULONG uScreenId, ULONG *puOriginX, ULONG *puOriginY, ULONG *puWidth, ULONG *puHeight, BOOL *pfEnabled); 604 STDMETHOD(QuerySavedThumbnailSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight); 605 STDMETHOD(ReadSavedThumbnailToArray)(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData)); 606 STDMETHOD(ReadSavedThumbnailPNGToArray)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData)); 607 STDMETHOD(QuerySavedScreenshotPNGSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight); 608 STDMETHOD(ReadSavedScreenshotPNGToArray)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData)); 609 STDMETHOD(HotPlugCPU(ULONG aCpu)); 610 STDMETHOD(HotUnplugCPU(ULONG aCpu)); 611 STDMETHOD(GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached)); 612 STDMETHOD(QueryLogFilename(ULONG aIdx, BSTR *aName)); 613 STDMETHOD(ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData))); 614 STDMETHOD(AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL tryToUnbind)); 615 STDMETHOD(DetachHostPCIDevice(LONG hostAddress)); 616 STDMETHOD(CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress)); 385 386 617 387 // public methods only for internal purposes 618 388 619 virtual bool i sSnapshotMachine() const389 virtual bool i_isSnapshotMachine() const 620 390 { 621 391 return false; 622 392 } 623 393 624 virtual bool i sSessionMachine() const394 virtual bool i_isSessionMachine() const 625 395 { 626 396 return false; … … 639 409 // that use it. Note: they should enter Machine lock to keep the returned 640 410 // information valid! 641 bool i sRegistered() { return !!mData->mRegistered; }411 bool i_isRegistered() { return !!mData->mRegistered; } 642 412 643 413 // unsafe inline public methods for internal purposes only (ensure there is … … 651 421 * one) or after doing addCaller() manually. 652 422 */ 653 VirtualBox* getVirtualBox() const { return mParent; }423 VirtualBox* i_getVirtualBox() const { return mParent; } 654 424 655 425 /** … … 661 431 * one) or after doing addCaller() manually. 662 432 */ 663 bool i sAccessible() const { return !!mData->mAccessible; }433 bool i_isAccessible() const { return !!mData->mAccessible; } 664 434 665 435 /** … … 670 440 * one) or after adding a caller manually. 671 441 */ 672 const Guid& getId() const { return mData->mUuid; }442 const Guid& i_getId() const { return mData->mUuid; } 673 443 674 444 /** … … 680 450 * one) or after adding a caller manually. 681 451 */ 682 inline const Guid& getSnapshotId() const;452 inline const Guid& i_getSnapshotId() const; 683 453 684 454 /** … … 689 459 * for reading. 690 460 */ 691 const Utf8Str& getSettingsFileFull() const { return mData->m_strConfigFileFull; }461 const Utf8Str& i_getSettingsFileFull() const { return mData->m_strConfigFileFull; } 692 462 693 463 /** … … 698 468 * for reading. 699 469 */ 700 const Utf8Str& getName() const { return mUserData->s.strName; }470 const Utf8Str& i_getName() const { return mUserData->s.strName; } 701 471 702 472 enum … … 723 493 * for reading. 724 494 */ 725 ChipsetType_T getChipsetType() const { return mHWData->mChipsetType; }726 ParavirtProvider_T getParavirtProvider() const { return mHWData->mParavirtProvider; }727 728 void setModified(uint32_t fl, bool fAllowStateModification = true);729 void setModifiedLock(uint32_t fl, bool fAllowStateModification = true);730 731 bool i sStateModificationAllowed() const { return mData->m_fAllowStateModification; }732 void allowStateModification() { mData->m_fAllowStateModification = true; }733 void disallowStateModification() { mData->m_fAllowStateModification = false; }734 735 const StringsList & getGroups() const { return mUserData->s.llGroups; }495 ChipsetType_T i_getChipsetType() const { return mHWData->mChipsetType; } 496 ParavirtProvider_T i_getParavirtProvider() const { return mHWData->mParavirtProvider; } 497 498 void i_setModified(uint32_t fl, bool fAllowStateModification = true); 499 void i_setModifiedLock(uint32_t fl, bool fAllowStateModification = true); 500 501 bool i_isStateModificationAllowed() const { return mData->m_fAllowStateModification; } 502 void i_allowStateModification() { mData->m_fAllowStateModification = true; } 503 void i_disallowStateModification() { mData->m_fAllowStateModification = false; } 504 505 const StringsList &i_getGroups() const { return mUserData->s.llGroups; } 736 506 737 507 // callback handlers 738 virtual HRESULT onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; } 739 virtual HRESULT onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */, 740 NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */, IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; } 741 virtual HRESULT onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; } 742 virtual HRESULT onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; } 743 virtual HRESULT onVRDEServerChange(BOOL /* aRestart */) { return S_OK; } 744 virtual HRESULT onUSBControllerChange() { return S_OK; } 745 virtual HRESULT onStorageControllerChange() { return S_OK; } 746 virtual HRESULT onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; } 747 virtual HRESULT onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; } 748 virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; } 749 virtual HRESULT onSharedFolderChange() { return S_OK; } 750 virtual HRESULT onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; } 751 virtual HRESULT onDnDModeChange(DnDMode_T /* aDnDMode */) { return S_OK; } 752 virtual HRESULT onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; } 753 virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, BOOL /* silent */) { return S_OK; } 754 virtual HRESULT onVideoCaptureChange() { return S_OK; } 755 756 HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data); 757 758 int calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult); 759 void copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget); 760 761 void getLogFolder(Utf8Str &aLogFolder); 762 Utf8Str queryLogFilename(ULONG idx); 763 764 void composeSavedStateFilename(Utf8Str &strStateFilePath); 765 766 void getDefaultVideoCaptureFile(Utf8Str &strFile); 767 768 bool isUSBControllerPresent(); 769 770 HRESULT launchVMProcess(IInternalSessionControl *aControl, 771 const Utf8Str &strType, 772 const Utf8Str &strEnvironment, 773 ProgressProxy *aProgress); 774 775 HRESULT getDirectControl(ComPtr<IInternalSessionControl> *directControl) 508 virtual HRESULT i_onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; } 509 virtual HRESULT i_onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */, 510 NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */, 511 IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; } 512 virtual HRESULT i_onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; } 513 virtual HRESULT i_onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; } 514 virtual HRESULT i_onVRDEServerChange(BOOL /* aRestart */) { return S_OK; } 515 virtual HRESULT i_onUSBControllerChange() { return S_OK; } 516 virtual HRESULT i_onStorageControllerChange() { return S_OK; } 517 virtual HRESULT i_onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; } 518 virtual HRESULT i_onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; } 519 virtual HRESULT i_onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; } 520 virtual HRESULT i_onSharedFolderChange() { return S_OK; } 521 virtual HRESULT i_onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; } 522 virtual HRESULT i_onDnDModeChange(DnDMode_T /* aDnDMode */) { return S_OK; } 523 virtual HRESULT i_onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; } 524 virtual HRESULT i_onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, 525 BOOL /* silent */) { return S_OK; } 526 virtual HRESULT i_onVideoCaptureChange() { return S_OK; } 527 528 HRESULT i_saveRegistryEntry(settings::MachineRegistryEntry &data); 529 530 int i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult); 531 void i_copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget); 532 533 void i_getLogFolder(Utf8Str &aLogFolder); 534 Utf8Str i_queryLogFilename(ULONG idx); 535 536 void i_composeSavedStateFilename(Utf8Str &strStateFilePath); 537 538 void i_getDefaultVideoCaptureFile(Utf8Str &strFile); 539 540 bool i_isUSBControllerPresent(); 541 542 HRESULT i_launchVMProcess(IInternalSessionControl *aControl, 543 const Utf8Str &strType, 544 const Utf8Str &strEnvironment, 545 ProgressProxy *aProgress); 546 547 HRESULT i_getDirectControl(ComPtr<IInternalSessionControl> *directControl) 776 548 { 777 549 HRESULT rc; … … 786 558 } 787 559 788 bool i sSessionOpen(ComObjPtr<SessionMachine> &aMachine,789 ComPtr<IInternalSessionControl> *aControl = NULL,790 bool aAllowClosing = false);791 bool i sSessionSpawning();792 793 bool i sSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,794 ComPtr<IInternalSessionControl> *aControl = NULL)795 { return i sSessionOpen(aMachine, aControl, true /* aAllowClosing */); }796 797 bool checkForSpawnFailure();798 799 HRESULT prepareRegister();800 801 HRESULT getSharedFolder(CBSTR aName,802 ComObjPtr<SharedFolder> &aSharedFolder,803 bool aSetError = false)560 bool i_isSessionOpen(ComObjPtr<SessionMachine> &aMachine, 561 ComPtr<IInternalSessionControl> *aControl = NULL, 562 bool aAllowClosing = false); 563 bool i_isSessionSpawning(); 564 565 bool i_isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine, 566 ComPtr<IInternalSessionControl> *aControl = NULL) 567 { return i_isSessionOpen(aMachine, aControl, true /* aAllowClosing */); } 568 569 bool i_checkForSpawnFailure(); 570 571 HRESULT i_prepareRegister(); 572 573 HRESULT i_getSharedFolder(CBSTR aName, 574 ComObjPtr<SharedFolder> &aSharedFolder, 575 bool aSetError = false) 804 576 { 805 577 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 806 return findSharedFolder(aName, aSharedFolder, aSetError);578 return i_findSharedFolder(aName, aSharedFolder, aSetError); 807 579 } 808 580 809 HRESULT addStateDependency(StateDependency aDepType = AnyStateDep,810 MachineState_T *aState = NULL,811 BOOL *aRegistered = NULL);812 void releaseStateDependency();813 814 HRESULT getBandwidthGroup(const Utf8Str &strBandwidthGroup,815 ComObjPtr<BandwidthGroup> &pBandwidthGroup,816 bool fSetError = false)581 HRESULT i_addStateDependency(StateDependency aDepType = AnyStateDep, 582 MachineState_T *aState = NULL, 583 BOOL *aRegistered = NULL); 584 void i_releaseStateDependency(); 585 586 HRESULT i_getBandwidthGroup(const Utf8Str &strBandwidthGroup, 587 ComObjPtr<BandwidthGroup> &pBandwidthGroup, 588 bool fSetError = false) 817 589 { 818 590 return mBandwidthControl->i_getBandwidthGroupByName(strBandwidthGroup, … … 821 593 } 822 594 595 596 823 597 protected: 824 598 825 599 class ClientToken; 826 600 827 HRESULT checkStateDependency(StateDependency aDepType); 828 829 Machine *getMachine(); 830 831 void ensureNoStateDependencies(); 832 833 virtual HRESULT setMachineState(MachineState_T aMachineState); 834 835 HRESULT findSharedFolder(const Utf8Str &aName, 836 ComObjPtr<SharedFolder> &aSharedFolder, 837 bool aSetError = false); 838 839 HRESULT loadSettings(bool aRegistered); 840 HRESULT loadMachineDataFromSettings(const settings::MachineConfigFile &config, 841 const Guid *puuidRegistry); 842 HRESULT loadSnapshot(const settings::Snapshot &data, 843 const Guid &aCurSnapshotId, 844 Snapshot *aParentSnapshot); 845 HRESULT loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg, 846 const settings::Autostart *pAutostart); 847 HRESULT loadDebugging(const settings::Debugging *pDbg); 848 HRESULT loadAutostart(const settings::Autostart *pAutostart); 849 HRESULT loadStorageControllers(const settings::Storage &data, 850 const Guid *puuidRegistry, 851 const Guid *puuidSnapshot); 852 HRESULT loadStorageDevices(StorageController *aStorageController, 853 const settings::StorageController &data, 854 const Guid *puuidRegistry, 855 const Guid *puuidSnapshot); 856 857 HRESULT findSnapshotById(const Guid &aId, 858 ComObjPtr<Snapshot> &aSnapshot, 859 bool aSetError = false); 860 HRESULT findSnapshotByName(const Utf8Str &strName, 601 HRESULT i_checkStateDependency(StateDependency aDepType); 602 603 Machine *i_getMachine(); 604 605 void i_ensureNoStateDependencies(); 606 607 virtual HRESULT i_setMachineState(MachineState_T aMachineState); 608 609 HRESULT i_findSharedFolder(const Utf8Str &aName, 610 ComObjPtr<SharedFolder> &aSharedFolder, 611 bool aSetError = false); 612 613 HRESULT i_loadSettings(bool aRegistered); 614 HRESULT i_loadMachineDataFromSettings(const settings::MachineConfigFile &config, 615 const Guid *puuidRegistry); 616 HRESULT i_loadSnapshot(const settings::Snapshot &data, 617 const Guid &aCurSnapshotId, 618 Snapshot *aParentSnapshot); 619 HRESULT i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg, 620 const settings::Autostart *pAutostart); 621 HRESULT i_loadDebugging(const settings::Debugging *pDbg); 622 HRESULT i_loadAutostart(const settings::Autostart *pAutostart); 623 HRESULT i_loadStorageControllers(const settings::Storage &data, 624 const Guid *puuidRegistry, 625 const Guid *puuidSnapshot); 626 HRESULT i_loadStorageDevices(StorageController *aStorageController, 627 const settings::StorageController &data, 628 const Guid *puuidRegistry, 629 const Guid *puuidSnapshot); 630 631 HRESULT i_findSnapshotById(const Guid &aId, 861 632 ComObjPtr<Snapshot> &aSnapshot, 862 633 bool aSetError = false); 863 864 HRESULT getStorageControllerByName(const Utf8Str &aName, 865 ComObjPtr<StorageController> &aStorageController, 866 bool aSetError = false); 867 868 HRESULT getMediumAttachmentsOfController(CBSTR aName, 869 MediaData::AttachmentList &aAttachments); 870 871 HRESULT getUSBControllerByName(const Utf8Str &aName, 872 ComObjPtr<USBController> &aUSBController, 873 bool aSetError = false); 874 875 ULONG getUSBControllerCountByType(USBControllerType_T enmType); 634 HRESULT i_findSnapshotByName(const Utf8Str &strName, 635 ComObjPtr<Snapshot> &aSnapshot, 636 bool aSetError = false); 637 638 HRESULT i_getStorageControllerByName(const Utf8Str &aName, 639 ComObjPtr<StorageController> &aStorageController, 640 bool aSetError = false); 641 642 HRESULT i_getMediumAttachmentsOfController(const Utf8Str &aName, 643 MediaData::AttachmentList &aAttachments); 644 645 HRESULT i_getUSBControllerByName(const Utf8Str &aName, 646 ComObjPtr<USBController> &aUSBController, 647 bool aSetError = false); 648 649 ULONG i_getUSBControllerCountByType(USBControllerType_T enmType); 876 650 877 651 enum … … 887 661 }; 888 662 889 HRESULT prepareSaveSettings(bool *pfNeedsGlobalSaveSettings);890 HRESULT saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0);891 892 void copyMachineDataToSettings(settings::MachineConfigFile &config);893 HRESULT saveAllSnapshots(settings::MachineConfigFile &config);894 HRESULT saveHardware(settings::Hardware &data, settings::Debugging *pDbg,895 settings::Autostart *pAutostart);896 HRESULT saveStorageControllers(settings::Storage &data);897 HRESULT saveStorageDevices(ComObjPtr<StorageController> aStorageController,898 settings::StorageController &data);899 HRESULT saveStateSettings(int aFlags);900 901 void addMediumToRegistry(ComObjPtr<Medium> &pMedium);902 903 HRESULT createImplicitDiffs(IProgress *aProgress,904 ULONG aWeight,905 bool aOnline);906 HRESULT deleteImplicitDiffs(bool aOnline);907 908 MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,909 IN_BSTR aControllerName,910 LONG aControllerPort,911 LONG aDevice);912 MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,913 ComObjPtr<Medium> pMedium);914 MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,915 Guid &id);916 917 HRESULT detachDevice(MediumAttachment *pAttach,918 AutoWriteLock &writeLock,919 Snapshot *pSnapshot);920 921 HRESULT detachAllMedia(AutoWriteLock &writeLock,922 Snapshot *pSnapshot,923 CleanupMode_T cleanupMode,924 MediaList &llMedia);925 926 void commitMedia(bool aOnline = false);927 void rollbackMedia();928 929 bool i sInOwnDir(Utf8Str *aSettingsDir = NULL) const;930 931 void rollback(bool aNotify);932 void commit();933 void copyFrom(Machine *aThat);934 bool i sControllerHotplugCapable(StorageControllerType_T enmCtrlType);663 HRESULT i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings); 664 HRESULT i_saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0); 665 666 void i_copyMachineDataToSettings(settings::MachineConfigFile &config); 667 HRESULT i_saveAllSnapshots(settings::MachineConfigFile &config); 668 HRESULT i_saveHardware(settings::Hardware &data, settings::Debugging *pDbg, 669 settings::Autostart *pAutostart); 670 HRESULT i_saveStorageControllers(settings::Storage &data); 671 HRESULT i_saveStorageDevices(ComObjPtr<StorageController> aStorageController, 672 settings::StorageController &data); 673 HRESULT i_saveStateSettings(int aFlags); 674 675 void i_addMediumToRegistry(ComObjPtr<Medium> &pMedium); 676 677 HRESULT i_createImplicitDiffs(IProgress *aProgress, 678 ULONG aWeight, 679 bool aOnline); 680 HRESULT i_deleteImplicitDiffs(bool aOnline); 681 682 MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll, 683 IN_BSTR aControllerName, 684 LONG aControllerPort, 685 LONG aDevice); 686 MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll, 687 ComObjPtr<Medium> pMedium); 688 MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll, 689 Guid &id); 690 691 HRESULT i_detachDevice(MediumAttachment *pAttach, 692 AutoWriteLock &writeLock, 693 Snapshot *pSnapshot); 694 695 HRESULT i_detachAllMedia(AutoWriteLock &writeLock, 696 Snapshot *pSnapshot, 697 CleanupMode_T cleanupMode, 698 MediaList &llMedia); 699 700 void i_commitMedia(bool aOnline = false); 701 void i_rollbackMedia(); 702 703 bool i_isInOwnDir(Utf8Str *aSettingsDir = NULL) const; 704 705 void i_rollback(bool aNotify); 706 void i_commit(); 707 void i_copyFrom(Machine *aThat); 708 bool i_isControllerHotplugCapable(StorageControllerType_T enmCtrlType); 935 709 936 710 struct DeleteTask; 937 711 static DECLCALLBACK(int) deleteThread(RTTHREAD Thread, void *pvUser); 938 HRESULT deleteTaskWorker(DeleteTask &task); 939 940 Utf8Str getExtraData(const Utf8Str &strKey); 712 HRESULT i_deleteTaskWorker(DeleteTask &task); 713 Utf8Str i_getExtraData(const Utf8Str &strKey); 941 714 942 715 #ifdef VBOX_WITH_GUEST_PROPS 943 HRESULT getGuestPropertyFromService(IN_BSTR aName, BSTR *aValue, 944 LONG64 *aTimestamp, BSTR *aFlags) const; 945 HRESULT getGuestPropertyFromVM(IN_BSTR aName, BSTR *aValue, 946 LONG64 *aTimestamp, BSTR *aFlags) const; 947 HRESULT setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue, 948 IN_BSTR aFlags); 949 HRESULT setGuestPropertyToVM(IN_BSTR aName, IN_BSTR aValue, 950 IN_BSTR aFlags); 951 HRESULT enumerateGuestPropertiesInService 952 (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), 953 ComSafeArrayOut(BSTR, aValues), 954 ComSafeArrayOut(LONG64, aTimestamps), 955 ComSafeArrayOut(BSTR, aFlags)); 956 HRESULT enumerateGuestPropertiesOnVM 957 (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), 958 ComSafeArrayOut(BSTR, aValues), 959 ComSafeArrayOut(LONG64, aTimestamps), 960 ComSafeArrayOut(BSTR, aFlags)); 716 HRESULT i_getGuestPropertyFromService(const com::Utf8Str &aName, com::Utf8Str &aValue, 717 LONG64 *aTimestamp, com::Utf8Str &aFlags) const; 718 HRESULT i_setGuestPropertyToService(const com::Utf8Str &aName, const com::Utf8Str &aValue, 719 const com::Utf8Str &aFlags); 720 HRESULT i_getGuestPropertyFromVM(const com::Utf8Str &aName, com::Utf8Str &aValue, 721 LONG64 *aTimestamp, com::Utf8Str &aFlags) const; 722 HRESULT i_setGuestPropertyToVM(const com::Utf8Str &aName, const com::Utf8Str &aValue, 723 const com::Utf8Str &aFlags); 724 HRESULT i_enumerateGuestPropertiesInService(const com::Utf8Str &aPatterns, 725 std::vector<com::Utf8Str> &aNames, 726 std::vector<com::Utf8Str> &aValues, 727 std::vector<LONG64> &aTimestamps, 728 std::vector<com::Utf8Str> &aFlags); 729 HRESULT i_enumerateGuestPropertiesOnVM(const com::Utf8Str &aPatterns, 730 std::vector<com::Utf8Str> &aNames, 731 std::vector<com::Utf8Str> &aValues, 732 std::vector<LONG64> &aTimestamps, 733 std::vector<com::Utf8Str> &aFlags); 734 961 735 #endif /* VBOX_WITH_GUEST_PROPS */ 962 736 963 737 #ifdef VBOX_WITH_RESOURCE_USAGE_API 964 void getDiskList(MediaList &list);965 void registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);738 void i_getDiskList(MediaList &list); 739 void i_registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid); 966 740 967 741 pm::CollectorGuest *mCollectorGuest; … … 1007 781 1008 782 friend class MachineCloneVM; 783 784 private: 785 // wrapped IMachine properties 786 HRESULT getParent(ComPtr<IVirtualBox> &aParent); 787 HRESULT getIcon(std::vector<BYTE> &aIcon); 788 HRESULT setIcon(const std::vector<BYTE> &aIcon); 789 HRESULT getAccessible(BOOL *aAccessible); 790 HRESULT getAccessError(ComPtr<IVirtualBoxErrorInfo> &aAccessError); 791 HRESULT getName(com::Utf8Str &aName); 792 HRESULT setName(const com::Utf8Str &aName); 793 HRESULT getDescription(com::Utf8Str &aDescription); 794 HRESULT setDescription(const com::Utf8Str &aDescription); 795 HRESULT getId(com::Guid &aId); 796 HRESULT getGroups(std::vector<com::Utf8Str> &aGroups); 797 HRESULT setGroups(const std::vector<com::Utf8Str> &aGroups); 798 HRESULT getOSTypeId(com::Utf8Str &aOSTypeId); 799 HRESULT setOSTypeId(const com::Utf8Str &aOSTypeId); 800 HRESULT getHardwareVersion(com::Utf8Str &aHardwareVersion); 801 HRESULT setHardwareVersion(const com::Utf8Str &aHardwareVersion); 802 HRESULT getHardwareUUID(com::Guid &aHardwareUUID); 803 HRESULT setHardwareUUID(const com::Guid &aHardwareUUID); 804 HRESULT getCPUCount(ULONG *aCPUCount); 805 HRESULT setCPUCount(ULONG aCPUCount); 806 HRESULT getCPUHotPlugEnabled(BOOL *aCPUHotPlugEnabled); 807 HRESULT setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled); 808 HRESULT getCPUExecutionCap(ULONG *aCPUExecutionCap); 809 HRESULT setCPUExecutionCap(ULONG aCPUExecutionCap); 810 HRESULT getMemorySize(ULONG *aMemorySize); 811 HRESULT setMemorySize(ULONG aMemorySize); 812 HRESULT getMemoryBalloonSize(ULONG *aMemoryBalloonSize); 813 HRESULT setMemoryBalloonSize(ULONG aMemoryBalloonSize); 814 HRESULT getPageFusionEnabled(BOOL *aPageFusionEnabled); 815 HRESULT setPageFusionEnabled(BOOL aPageFusionEnabled); 816 HRESULT getGraphicsControllerType(GraphicsControllerType_T *aGraphicsControllerType); 817 HRESULT setGraphicsControllerType(GraphicsControllerType_T aGraphicsControllerType); 818 HRESULT getVRAMSize(ULONG *aVRAMSize); 819 HRESULT setVRAMSize(ULONG aVRAMSize); 820 HRESULT getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled); 821 HRESULT setAccelerate3DEnabled(BOOL aAccelerate3DEnabled); 822 HRESULT getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled); 823 HRESULT setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled); 824 HRESULT getMonitorCount(ULONG *aMonitorCount); 825 HRESULT setMonitorCount(ULONG aMonitorCount); 826 HRESULT getVideoCaptureEnabled(BOOL *aVideoCaptureEnabled); 827 HRESULT setVideoCaptureEnabled(BOOL aVideoCaptureEnabled); 828 HRESULT getVideoCaptureScreens(std::vector<BOOL> &aVideoCaptureScreens); 829 HRESULT setVideoCaptureScreens(const std::vector<BOOL> &aVideoCaptureScreens); 830 HRESULT getVideoCaptureFile(com::Utf8Str &aVideoCaptureFile); 831 HRESULT setVideoCaptureFile(const com::Utf8Str &aVideoCaptureFile); 832 HRESULT getVideoCaptureWidth(ULONG *aVideoCaptureWidth); 833 HRESULT setVideoCaptureWidth(ULONG aVideoCaptureWidth); 834 HRESULT getVideoCaptureHeight(ULONG *aVideoCaptureHeight); 835 HRESULT setVideoCaptureHeight(ULONG aVideoCaptureHeight); 836 HRESULT getVideoCaptureRate(ULONG *aVideoCaptureRate); 837 HRESULT setVideoCaptureRate(ULONG aVideoCaptureRate); 838 HRESULT getVideoCaptureFPS(ULONG *aVideoCaptureFPS); 839 HRESULT setVideoCaptureFPS(ULONG aVideoCaptureFPS); 840 HRESULT getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings); 841 HRESULT getFirmwareType(FirmwareType_T *aFirmwareType); 842 HRESULT setFirmwareType(FirmwareType_T aFirmwareType); 843 HRESULT getPointingHIDType(PointingHIDType_T *aPointingHIDType); 844 HRESULT setPointingHIDType(PointingHIDType_T aPointingHIDType); 845 HRESULT getKeyboardHIDType(KeyboardHIDType_T *aKeyboardHIDType); 846 HRESULT setKeyboardHIDType(KeyboardHIDType_T aKeyboardHIDType); 847 HRESULT getHPETEnabled(BOOL *aHPETEnabled); 848 HRESULT setHPETEnabled(BOOL aHPETEnabled); 849 HRESULT getChipsetType(ChipsetType_T *aChipsetType); 850 HRESULT setChipsetType(ChipsetType_T aChipsetType); 851 HRESULT getSnapshotFolder(com::Utf8Str &aSnapshotFolder); 852 HRESULT setSnapshotFolder(const com::Utf8Str &aSnapshotFolder); 853 HRESULT getVRDEServer(ComPtr<IVRDEServer> &aVRDEServer); 854 HRESULT getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled); 855 HRESULT setEmulatedUSBCardReaderEnabled(BOOL aEmulatedUSBCardReaderEnabled); 856 HRESULT getMediumAttachments(std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments); 857 HRESULT getUSBControllers(std::vector<ComPtr<IUSBController> > &aUSBControllers); 858 HRESULT getUSBDeviceFilters(ComPtr<IUSBDeviceFilters> &aUSBDeviceFilters); 859 HRESULT getAudioAdapter(ComPtr<IAudioAdapter> &aAudioAdapter); 860 HRESULT getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers); 861 HRESULT getSettingsFilePath(com::Utf8Str &aSettingsFilePath); 862 HRESULT getSettingsModified(BOOL *aSettingsModified); 863 HRESULT getSessionState(SessionState_T *aSessionState); 864 HRESULT getSessionType(com::Utf8Str &aSessionType); 865 HRESULT getSessionPID(ULONG *aSessionPID); 866 HRESULT getState(MachineState_T *aState); 867 HRESULT getLastStateChange(LONG64 *aLastStateChange); 868 HRESULT getStateFilePath(com::Utf8Str &aStateFilePath); 869 HRESULT getLogFolder(com::Utf8Str &aLogFolder); 870 HRESULT getCurrentSnapshot(ComPtr<ISnapshot> &aCurrentSnapshot); 871 HRESULT getSnapshotCount(ULONG *aSnapshotCount); 872 HRESULT getCurrentStateModified(BOOL *aCurrentStateModified); 873 HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders); 874 HRESULT getClipboardMode(ClipboardMode_T *aClipboardMode); 875 HRESULT setClipboardMode(ClipboardMode_T aClipboardMode); 876 HRESULT getDnDMode(DnDMode_T *aDnDMode); 877 HRESULT setDnDMode(DnDMode_T aDnDMode); 878 HRESULT getGuestPropertyNotificationPatterns(com::Utf8Str &aGuestPropertyNotificationPatterns); 879 HRESULT setGuestPropertyNotificationPatterns(const com::Utf8Str &aGuestPropertyNotificationPatterns); 880 HRESULT getTeleporterEnabled(BOOL *aTeleporterEnabled); 881 HRESULT setTeleporterEnabled(BOOL aTeleporterEnabled); 882 HRESULT getTeleporterPort(ULONG *aTeleporterPort); 883 HRESULT setTeleporterPort(ULONG aTeleporterPort); 884 HRESULT getTeleporterAddress(com::Utf8Str &aTeleporterAddress); 885 HRESULT setTeleporterAddress(const com::Utf8Str &aTeleporterAddress); 886 HRESULT getTeleporterPassword(com::Utf8Str &aTeleporterPassword); 887 HRESULT setTeleporterPassword(const com::Utf8Str &aTeleporterPassword); 888 HRESULT getParavirtProvider(ParavirtProvider_T *aParavirtProvider); 889 HRESULT setParavirtProvider(ParavirtProvider_T aParavirtProvider); 890 HRESULT getFaultToleranceState(FaultToleranceState_T *aFaultToleranceState); 891 HRESULT setFaultToleranceState(FaultToleranceState_T aFaultToleranceState); 892 HRESULT getFaultTolerancePort(ULONG *aFaultTolerancePort); 893 HRESULT setFaultTolerancePort(ULONG aFaultTolerancePort); 894 HRESULT getFaultToleranceAddress(com::Utf8Str &aFaultToleranceAddress); 895 HRESULT setFaultToleranceAddress(const com::Utf8Str &aFaultToleranceAddress); 896 HRESULT getFaultTolerancePassword(com::Utf8Str &aFaultTolerancePassword); 897 HRESULT setFaultTolerancePassword(const com::Utf8Str &aFaultTolerancePassword); 898 HRESULT getFaultToleranceSyncInterval(ULONG *aFaultToleranceSyncInterval); 899 HRESULT setFaultToleranceSyncInterval(ULONG aFaultToleranceSyncInterval); 900 HRESULT getRTCUseUTC(BOOL *aRTCUseUTC); 901 HRESULT setRTCUseUTC(BOOL aRTCUseUTC); 902 HRESULT getIOCacheEnabled(BOOL *aIOCacheEnabled); 903 HRESULT setIOCacheEnabled(BOOL aIOCacheEnabled); 904 HRESULT getIOCacheSize(ULONG *aIOCacheSize); 905 HRESULT setIOCacheSize(ULONG aIOCacheSize); 906 HRESULT getPCIDeviceAssignments(std::vector<ComPtr<IPCIDeviceAttachment> > &aPCIDeviceAssignments); 907 HRESULT getBandwidthControl(ComPtr<IBandwidthControl> &aBandwidthControl); 908 HRESULT getTracingEnabled(BOOL *aTracingEnabled); 909 HRESULT setTracingEnabled(BOOL aTracingEnabled); 910 HRESULT getTracingConfig(com::Utf8Str &aTracingConfig); 911 HRESULT setTracingConfig(const com::Utf8Str &aTracingConfig); 912 HRESULT getAllowTracingToAccessVM(BOOL *aAllowTracingToAccessVM); 913 HRESULT setAllowTracingToAccessVM(BOOL aAllowTracingToAccessVM); 914 HRESULT getAutostartEnabled(BOOL *aAutostartEnabled); 915 HRESULT setAutostartEnabled(BOOL aAutostartEnabled); 916 HRESULT getAutostartDelay(ULONG *aAutostartDelay); 917 HRESULT setAutostartDelay(ULONG aAutostartDelay); 918 HRESULT getAutostopType(AutostopType_T *aAutostopType); 919 HRESULT setAutostopType(AutostopType_T aAutostopType); 920 HRESULT getDefaultFrontend(com::Utf8Str &aDefaultFrontend); 921 HRESULT setDefaultFrontend(const com::Utf8Str &aDefaultFrontend); 922 HRESULT getUSBProxyAvailable(BOOL *aUSBProxyAvailable); 923 924 // wrapped IMachine methods 925 HRESULT lockMachine(const ComPtr<ISession> &aSession, 926 LockType_T aLockType); 927 HRESULT launchVMProcess(const ComPtr<ISession> &aSession, 928 const com::Utf8Str &aType, 929 const com::Utf8Str &aEnvironment, 930 ComPtr<IProgress> &aProgress); 931 HRESULT setBootOrder(ULONG aPosition, 932 DeviceType_T aDevice); 933 HRESULT getBootOrder(ULONG aPosition, 934 DeviceType_T *aDevice); 935 HRESULT attachDevice(const com::Utf8Str &aName, 936 LONG aControllerPort, 937 LONG aDevice, 938 DeviceType_T aType, 939 const ComPtr<IMedium> &aMedium); 940 HRESULT attachDeviceWithoutMedium(const com::Utf8Str &aName, 941 LONG aControllerPort, 942 LONG aDevice, 943 DeviceType_T aType); 944 HRESULT detachDevice(const com::Utf8Str &aName, 945 LONG aControllerPort, 946 LONG aDevice); 947 HRESULT passthroughDevice(const com::Utf8Str &aName, 948 LONG aControllerPort, 949 LONG aDevice, 950 BOOL aPassthrough); 951 HRESULT temporaryEjectDevice(const com::Utf8Str &aName, 952 LONG aControllerPort, 953 LONG aDevice, 954 BOOL aTemporaryEject); 955 HRESULT nonRotationalDevice(const com::Utf8Str &aName, 956 LONG aControllerPort, 957 LONG aDevice, 958 BOOL aNonRotational); 959 HRESULT setAutoDiscardForDevice(const com::Utf8Str &aName, 960 LONG aControllerPort, 961 LONG aDevice, 962 BOOL aDiscard); 963 HRESULT setHotPluggableForDevice(const com::Utf8Str &aName, 964 LONG aControllerPort, 965 LONG aDevice, 966 BOOL aHotPluggable); 967 HRESULT setBandwidthGroupForDevice(const com::Utf8Str &aName, 968 LONG aControllerPort, 969 LONG aDevice, 970 const ComPtr<IBandwidthGroup> &aBandwidthGroup); 971 HRESULT setNoBandwidthGroupForDevice(const com::Utf8Str &aName, 972 LONG aControllerPort, 973 LONG aDevice); 974 HRESULT unmountMedium(const com::Utf8Str &aName, 975 LONG aControllerPort, 976 LONG aDevice, 977 BOOL aForce); 978 HRESULT mountMedium(const com::Utf8Str &aName, 979 LONG aControllerPort, 980 LONG aDevice, 981 const ComPtr<IMedium> &aMedium, 982 BOOL aForce); 983 HRESULT getMedium(const com::Utf8Str &aName, 984 LONG aControllerPort, 985 LONG aDevice, 986 ComPtr<IMedium> &aMedium); 987 HRESULT getMediumAttachmentsOfController(const com::Utf8Str &aName, 988 std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments); 989 HRESULT getMediumAttachment(const com::Utf8Str &aName, 990 LONG aControllerPort, 991 LONG aDevice, 992 ComPtr<IMediumAttachment> &aAttachment); 993 HRESULT attachHostPCIDevice(LONG aHostAddress, 994 LONG aDesiredGuestAddress, 995 BOOL aTryToUnbind); 996 HRESULT detachHostPCIDevice(LONG aHostAddress); 997 HRESULT getNetworkAdapter(ULONG aSlot, 998 ComPtr<INetworkAdapter> &aAdapter); 999 HRESULT addStorageController(const com::Utf8Str &aName, 1000 StorageBus_T aConnectionType, 1001 ComPtr<IStorageController> &aController); 1002 HRESULT getStorageControllerByName(const com::Utf8Str &aName, 1003 ComPtr<IStorageController> &aStorageController); 1004 HRESULT getStorageControllerByInstance(ULONG aInstance, 1005 ComPtr<IStorageController> &aStorageController); 1006 HRESULT removeStorageController(const com::Utf8Str &aName); 1007 HRESULT setStorageControllerBootable(const com::Utf8Str &aName, 1008 BOOL aBootable); 1009 HRESULT addUSBController(const com::Utf8Str &aName, 1010 USBControllerType_T aType, 1011 ComPtr<IUSBController> &aController); 1012 HRESULT removeUSBController(const com::Utf8Str &aName); 1013 HRESULT getUSBControllerByName(const com::Utf8Str &aName, 1014 ComPtr<IUSBController> &aController); 1015 HRESULT getUSBControllerCountByType(USBControllerType_T aType, 1016 ULONG *aControllers); 1017 HRESULT getSerialPort(ULONG aSlot, 1018 ComPtr<ISerialPort> &aPort); 1019 HRESULT getParallelPort(ULONG aSlot, 1020 ComPtr<IParallelPort> &aPort); 1021 HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys); 1022 HRESULT getExtraData(const com::Utf8Str &aKey, 1023 com::Utf8Str &aValue); 1024 HRESULT setExtraData(const com::Utf8Str &aKey, 1025 const com::Utf8Str &aValue); 1026 HRESULT getCPUProperty(CPUPropertyType_T aProperty, 1027 BOOL *aValue); 1028 HRESULT setCPUProperty(CPUPropertyType_T aProperty, 1029 BOOL aValue); 1030 HRESULT getCPUIDLeaf(ULONG aId, 1031 ULONG *aValEax, 1032 ULONG *aValEbx, 1033 ULONG *aValEcx, 1034 ULONG *aValEdx); 1035 HRESULT setCPUIDLeaf(ULONG aId, 1036 ULONG aValEax, 1037 ULONG aValEbx, 1038 ULONG aValEcx, 1039 ULONG aValEdx); 1040 HRESULT removeCPUIDLeaf(ULONG aId); 1041 HRESULT removeAllCPUIDLeaves(); 1042 HRESULT getHWVirtExProperty(HWVirtExPropertyType_T aProperty, 1043 BOOL *aValue); 1044 HRESULT setHWVirtExProperty(HWVirtExPropertyType_T aProperty, 1045 BOOL aValue); 1046 HRESULT setSettingsFilePath(const com::Utf8Str &aSettingsFilePath, 1047 ComPtr<IProgress> &aProgress); 1048 HRESULT saveSettings(); 1049 HRESULT discardSettings(); 1050 HRESULT unregister(CleanupMode_T aCleanupMode, 1051 std::vector<ComPtr<IMedium> > &aMedia); 1052 HRESULT deleteConfig(const std::vector<ComPtr<IMedium> > &aMedia, 1053 ComPtr<IProgress> &aProgress); 1054 HRESULT exportTo(const ComPtr<IAppliance> &aAppliance, 1055 const com::Utf8Str &aLocation, 1056 ComPtr<IVirtualSystemDescription> &aDescription); 1057 HRESULT findSnapshot(const com::Utf8Str &aNameOrId, 1058 ComPtr<ISnapshot> &aSnapshot); 1059 HRESULT createSharedFolder(const com::Utf8Str &aName, 1060 const com::Utf8Str &aHostPath, 1061 BOOL aWritable, 1062 BOOL aAutomount); 1063 HRESULT removeSharedFolder(const com::Utf8Str &aName); 1064 HRESULT canShowConsoleWindow(BOOL *aCanShow); 1065 HRESULT showConsoleWindow(LONG64 *aWinId); 1066 HRESULT getGuestProperty(const com::Utf8Str &aName, 1067 com::Utf8Str &aValue, 1068 LONG64 *aTimestamp, 1069 com::Utf8Str &aFlags); 1070 HRESULT getGuestPropertyValue(const com::Utf8Str &aProperty, 1071 com::Utf8Str &aValue); 1072 HRESULT getGuestPropertyTimestamp(const com::Utf8Str &aProperty, 1073 LONG64 *aValue); 1074 HRESULT setGuestProperty(const com::Utf8Str &aProperty, 1075 const com::Utf8Str &aValue, 1076 const com::Utf8Str &aFlags); 1077 HRESULT setGuestPropertyValue(const com::Utf8Str &aProperty, 1078 const com::Utf8Str &aValue); 1079 HRESULT deleteGuestProperty(const com::Utf8Str &aName); 1080 HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns, 1081 std::vector<com::Utf8Str> &aNames, 1082 std::vector<com::Utf8Str> &aValues, 1083 std::vector<LONG64> &aTimestamps, 1084 std::vector<com::Utf8Str> &aFlags); 1085 HRESULT querySavedGuestScreenInfo(ULONG aScreenId, 1086 ULONG *aOriginX, 1087 ULONG *aOriginY, 1088 ULONG *aWidth, 1089 ULONG *aHeight, 1090 BOOL *aEnabled); 1091 HRESULT querySavedThumbnailSize(ULONG aScreenId, 1092 ULONG *aSize, 1093 ULONG *aWidth, 1094 ULONG *aHeight); 1095 HRESULT readSavedThumbnailToArray(ULONG aScreenId, 1096 BOOL aBGR, 1097 ULONG *aWidth, 1098 ULONG *aHeight, 1099 std::vector<BYTE> &aData); 1100 HRESULT readSavedThumbnailPNGToArray(ULONG aScreenId, 1101 ULONG *aWidth, 1102 ULONG *aHeight, 1103 std::vector<BYTE> &aData); 1104 HRESULT querySavedScreenshotPNGSize(ULONG aScreenId, 1105 ULONG *aSize, 1106 ULONG *aWidth, 1107 ULONG *aHeight); 1108 HRESULT readSavedScreenshotPNGToArray(ULONG aScreenId, 1109 ULONG *aWidth, 1110 ULONG *aHeight, 1111 std::vector<BYTE> &aData); 1112 HRESULT hotPlugCPU(ULONG aCpu); 1113 HRESULT hotUnplugCPU(ULONG aCpu); 1114 HRESULT getCPUStatus(ULONG aCpu, 1115 BOOL *aAttached); 1116 HRESULT queryLogFilename(ULONG aIdx, 1117 com::Utf8Str &aFilename); 1118 HRESULT readLog(ULONG aIdx, 1119 LONG64 aOffset, 1120 LONG64 aSize, 1121 std::vector<BYTE> &aData); 1122 HRESULT cloneTo(const ComPtr<IMachine> &aTarget, 1123 CloneMode_T aMode, 1124 const std::vector<CloneOptions_T> &aOptions, 1125 ComPtr<IProgress> &aProgress); 1126 1127 // wrapped IInternalMachineControl properties 1128 1129 // wrapped IInternalMachineControl methods 1130 HRESULT setRemoveSavedStateFile(BOOL aRemove); 1131 HRESULT updateState(MachineState_T aState); 1132 HRESULT beginPowerUp(const ComPtr<IProgress> &aProgress); 1133 HRESULT endPowerUp(LONG aResult); 1134 HRESULT beginPoweringDown(ComPtr<IProgress> &aProgress); 1135 HRESULT endPoweringDown(LONG aResult, 1136 const com::Utf8Str &aErrMsg); 1137 HRESULT runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice, 1138 BOOL *aMatched, 1139 ULONG *aMaskedInterfaces); 1140 HRESULT captureUSBDevice(const com::Guid &aId); 1141 HRESULT detachUSBDevice(const com::Guid &aId, 1142 BOOL aDone); 1143 HRESULT autoCaptureUSBDevices(); 1144 HRESULT detachAllUSBDevices(BOOL aDone); 1145 HRESULT onSessionEnd(const ComPtr<ISession> &aSession, 1146 ComPtr<IProgress> &aProgress); 1147 HRESULT beginSavingState(ComPtr<IProgress> &aProgress, 1148 com::Utf8Str &aStateFilePath); 1149 HRESULT endSavingState(LONG aResult, 1150 const com::Utf8Str &aErrMsg); 1151 HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile); 1152 HRESULT beginTakingSnapshot(const ComPtr<IConsole> &aInitiator, 1153 const com::Utf8Str &aName, 1154 const com::Utf8Str &aDescription, 1155 const ComPtr<IProgress> &aConsoleProgress, 1156 BOOL aFTakingSnapshotOnline, 1157 com::Utf8Str &aStateFilePath); 1158 HRESULT endTakingSnapshot(BOOL aSuccess); 1159 HRESULT deleteSnapshot(const ComPtr<IConsole> &aInitiator, 1160 const com::Guid &aStartId, 1161 const com::Guid &aEndId, 1162 BOOL aDeleteAllChildren, 1163 MachineState_T *aMachineState, 1164 ComPtr<IProgress> &aProgress); 1165 HRESULT finishOnlineMergeMedium(); 1166 HRESULT restoreSnapshot(const ComPtr<IConsole> &aInitiator, 1167 const ComPtr<ISnapshot> &aSnapshot, 1168 MachineState_T *aMachineState, 1169 ComPtr<IProgress> &aProgress); 1170 HRESULT pullGuestProperties(std::vector<com::Utf8Str> &aNames, 1171 std::vector<com::Utf8Str> &aValues, 1172 std::vector<LONG64> &aTimestamps, 1173 std::vector<com::Utf8Str> &aFlags); 1174 HRESULT pushGuestProperty(const com::Utf8Str &aName, 1175 const com::Utf8Str &aValue, 1176 LONG64 aTimestamp, 1177 const com::Utf8Str &aFlags); 1178 HRESULT lockMedia(); 1179 HRESULT unlockMedia(); 1180 HRESULT ejectMedium(const ComPtr<IMediumAttachment> &aAttachment, 1181 ComPtr<IMediumAttachment> &aNewAttachment); 1182 HRESULT reportVmStatistics(ULONG aValidStats, 1183 ULONG aCpuUser, 1184 ULONG aCpuKernel, 1185 ULONG aCpuIdle, 1186 ULONG aMemTotal, 1187 ULONG aMemFree, 1188 ULONG aMemBalloon, 1189 ULONG aMemShared, 1190 ULONG aMemCache, 1191 ULONG aPagedTotal, 1192 ULONG aMemAllocTotal, 1193 ULONG aMemFreeTotal, 1194 ULONG aMemBalloonTotal, 1195 ULONG aMemSharedTotal, 1196 ULONG aVmNetRx, 1197 ULONG aVmNetTx); 1198 1199 1200 1201 1009 1202 }; 1010 1203 … … 1021 1214 */ 1022 1215 class ATL_NO_VTABLE SessionMachine : 1023 public Machine, 1024 VBOX_SCRIPTABLE_IMPL(IInternalMachineControl) 1216 public Machine 1025 1217 { 1026 1218 public: … … 1105 1297 // public methods only for internal purposes 1106 1298 1107 virtual bool i sSessionMachine() const1299 virtual bool i_isSessionMachine() const 1108 1300 { 1109 1301 return true; … … 1111 1303 1112 1304 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER 1113 bool checkForDeath();1114 1115 void getTokenId(Utf8Str &strTokenId);1305 bool i_checkForDeath(); 1306 1307 void i_getTokenId(Utf8Str &strTokenId); 1116 1308 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 1117 IToken * getToken();1309 IToken *i_getToken(); 1118 1310 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 1119 1311 // getClientToken must be only used by callers who can guarantee that 1120 1312 // the object cannot be deleted in the mean time, i.e. have a caller/lock. 1121 ClientToken *getClientToken(); 1122 1123 HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter); 1124 HRESULT onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName, 1125 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort); 1126 HRESULT onStorageControllerChange(); 1127 HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce); 1128 HRESULT onSerialPortChange(ISerialPort *serialPort); 1129 HRESULT onParallelPortChange(IParallelPort *parallelPort); 1130 HRESULT onCPUChange(ULONG aCPU, BOOL aRemove); 1131 HRESULT onVRDEServerChange(BOOL aRestart); 1132 HRESULT onVideoCaptureChange(); 1133 HRESULT onUSBControllerChange(); 1134 HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, 1135 IVirtualBoxErrorInfo *aError, 1136 ULONG aMaskedIfs); 1137 HRESULT onUSBDeviceDetach(IN_BSTR aId, 1138 IVirtualBoxErrorInfo *aError); 1139 HRESULT onSharedFolderChange(); 1140 HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode); 1141 HRESULT onDnDModeChange(DnDMode_T aDnDMode); 1142 HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup); 1143 HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent); 1144 HRESULT onCPUExecutionCapChange(ULONG aCpuExecutionCap); 1145 1146 bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); 1313 ClientToken *i_getClientToken(); 1314 1315 HRESULT i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter); 1316 HRESULT i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName, 1317 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, 1318 IN_BSTR aGuestIp, LONG aGuestPort); 1319 HRESULT i_onStorageControllerChange(); 1320 HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce); 1321 HRESULT i_onSerialPortChange(ISerialPort *serialPort); 1322 HRESULT i_onParallelPortChange(IParallelPort *parallelPort); 1323 HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove); 1324 HRESULT i_onVRDEServerChange(BOOL aRestart); 1325 HRESULT i_onVideoCaptureChange(); 1326 HRESULT i_onUSBControllerChange(); 1327 HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, 1328 IVirtualBoxErrorInfo *aError, 1329 ULONG aMaskedIfs); 1330 HRESULT i_onUSBDeviceDetach(IN_BSTR aId, 1331 IVirtualBoxErrorInfo *aError); 1332 HRESULT i_onSharedFolderChange(); 1333 HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode); 1334 HRESULT i_onDnDModeChange(DnDMode_T aDnDMode); 1335 HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup); 1336 HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent); 1337 HRESULT i_onCPUExecutionCapChange(ULONG aCpuExecutionCap); 1338 1339 bool i_hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); 1147 1340 1148 1341 HRESULT lockMedia(); 1149 voidunlockMedia();1342 HRESULT unlockMedia(); 1150 1343 1151 1344 private: … … 1178 1371 1179 1372 HRESULT endSavingState(HRESULT aRC, const Utf8Str &aErrMsg); 1180 void releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);1181 1182 void deleteSnapshotHandler(DeleteSnapshotTask &aTask);1183 void restoreSnapshotHandler(RestoreSnapshotTask &aTask);1184 1185 HRESULT prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,1186 const Guid &machineId,1187 const Guid &snapshotId,1188 bool fOnlineMergePossible,1189 MediumLockList *aVMMALockList,1190 ComObjPtr<Medium> &aSource,1191 ComObjPtr<Medium> &aTarget,1192 bool &fMergeForward,1193 ComObjPtr<Medium> &pParentForTarget,1194 MediumLockList * &aChildrenToReparent,1195 bool &fNeedOnlineMerge,1196 MediumLockList * &aMediumLockList,1197 ComPtr<IToken> &aHDLockToken);1198 void cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,1199 const ComObjPtr<Medium> &aSource,1200 MediumLockList *aChildrenToReparent,1201 bool fNeedsOnlineMerge,1202 MediumLockList *aMediumLockList,1203 const ComPtr<IToken> &aHDLockToken,1204 const Guid &aMediumId,1205 const Guid &aSnapshotId);1206 HRESULT onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,1207 const ComObjPtr<Medium> &aSource,1208 const ComObjPtr<Medium> &aTarget,1209 bool fMergeForward,1210 const ComObjPtr<Medium> &pParentForTarget,1211 MediumLockList *aChildrenToReparent,1212 MediumLockList *aMediumLockList,1213 ComObjPtr<Progress> &aProgress,1214 bool *pfNeedsMachineSaveSettings);1215 1216 HRESULT setMachineState(MachineState_T aMachineState);1217 HRESULT updateMachineStateOnClient();1373 void i_releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore); 1374 1375 void i_deleteSnapshotHandler(DeleteSnapshotTask &aTask); 1376 void i_restoreSnapshotHandler(RestoreSnapshotTask &aTask); 1377 1378 HRESULT i_prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD, 1379 const Guid &machineId, 1380 const Guid &snapshotId, 1381 bool fOnlineMergePossible, 1382 MediumLockList *aVMMALockList, 1383 ComObjPtr<Medium> &aSource, 1384 ComObjPtr<Medium> &aTarget, 1385 bool &fMergeForward, 1386 ComObjPtr<Medium> &pParentForTarget, 1387 MediumLockList * &aChildrenToReparent, 1388 bool &fNeedOnlineMerge, 1389 MediumLockList * &aMediumLockList, 1390 ComPtr<IToken> &aHDLockToken); 1391 void i_cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD, 1392 const ComObjPtr<Medium> &aSource, 1393 MediumLockList *aChildrenToReparent, 1394 bool fNeedsOnlineMerge, 1395 MediumLockList *aMediumLockList, 1396 const ComPtr<IToken> &aHDLockToken, 1397 const Guid &aMediumId, 1398 const Guid &aSnapshotId); 1399 HRESULT i_onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment, 1400 const ComObjPtr<Medium> &aSource, 1401 const ComObjPtr<Medium> &aTarget, 1402 bool fMergeForward, 1403 const ComObjPtr<Medium> &pParentForTarget, 1404 MediumLockList *aChildrenToReparent, 1405 MediumLockList *aMediumLockList, 1406 ComObjPtr<Progress> &aProgress, 1407 bool *pfNeedsMachineSaveSettings); 1408 1409 HRESULT i_setMachineState(MachineState_T aMachineState); 1410 HRESULT i_updateMachineStateOnClient(); 1218 1411 1219 1412 HRESULT mRemoveSavedState; … … 1277 1470 // public methods only for internal purposes 1278 1471 1279 virtual bool i sSnapshotMachine() const1472 virtual bool i_isSnapshotMachine() const 1280 1473 { 1281 1474 return true; 1282 1475 } 1283 1476 1284 HRESULT onSnapshotChange(Snapshot *aSnapshot);1477 HRESULT i_onSnapshotChange(Snapshot *aSnapshot); 1285 1478 1286 1479 // unsafe inline public methods for internal purposes only (ensure there is 1287 1480 // a caller and a read lock before calling them!) 1288 1481 1289 const Guid& getSnapshotId() const { return mSnapshotId; }1482 const Guid& i_getSnapshotId() const { return mSnapshotId; } 1290 1483 1291 1484 private: … … 1302 1495 // third party methods that depend on SnapshotMachine definition 1303 1496 1304 inline const Guid &Machine:: getSnapshotId() const1497 inline const Guid &Machine::i_getSnapshotId() const 1305 1498 { 1306 return (i sSnapshotMachine())1307 ? static_cast<const SnapshotMachine*>(this)-> getSnapshotId()1499 return (i_isSnapshotMachine()) 1500 ? static_cast<const SnapshotMachine*>(this)->i_getSnapshotId() 1308 1501 : Guid::Empty; 1309 1502 } -
trunk/src/VBox/Main/include/USBDeviceFilterImpl.h
r49951 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 178 178 179 179 // util::Lockable interface 180 RWLockHandle * i_lockHandle() const;180 RWLockHandle *lockHandle() const; 181 181 182 182 private: -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r51092 r51498 57 57 * @return 58 58 */ 59 STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription) 59 HRESULT Machine::exportTo(const ComPtr<IAppliance> &aAppliance, const com::Utf8Str &aLocation, 60 ComPtr<IVirtualSystemDescription> &aDescription) 60 61 { 61 62 HRESULT rc = S_OK; … … 64 65 return E_POINTER; 65 66 66 AutoCaller autoCaller(this);67 if (FAILED(autoCaller.rc())) return autoCaller.rc();68 69 67 ComObjPtr<VirtualSystemDescription> pNewDesc; 70 68 71 69 try 72 70 { 73 Appliance *pAppliance = static_cast<Appliance*>(aAppliance); 74 AutoCaller autoCaller1(pAppliance); 75 if (FAILED(autoCaller1.rc())) return autoCaller1.rc(); 71 IAppliance *iAppliance = aAppliance; 72 Appliance *pAppliance = static_cast<Appliance*>(iAppliance); 76 73 77 74 LocationInfo locInfo; 78 i_parseURI( location, locInfo);75 i_parseURI(aLocation, locInfo); 79 76 // create a new virtual system to store in the appliance 80 77 rc = pNewDesc.createObject(); … … 92 89 if (SUCCEEDED(rc)) 93 90 { 94 for (unsigned i = 0; i < usbControllers.size(); i++)91 for (unsigned i = 0; i < usbControllers.size(); ++i) 95 92 { 96 93 USBControllerType_T enmType; … … 509 506 510 507 // <const name="NetworkAdapter" /> 511 uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters( getChipsetType());508 uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(i_getChipsetType()); 512 509 size_t a; 513 510 for (a = 0; a < maxNetworkAdapters; ++a) … … 557 554 /* We return the new description to the caller */ 558 555 ComPtr<IVirtualSystemDescription> copy(pNewDesc); 559 copy.queryInterfaceTo(aDescription );556 copy.queryInterfaceTo(aDescription.asOutParam()); 560 557 561 558 AutoWriteLock alock(pAppliance COMMA_LOCKVAL_SRC_POS); … … 1844 1841 AutoWriteLock machineLock(vsdescThis->m->pMachine COMMA_LOCKVAL_SRC_POS); 1845 1842 // fill the machine config 1846 vsdescThis->m->pMachine-> copyMachineDataToSettings(*pConfig);1843 vsdescThis->m->pMachine->i_copyMachineDataToSettings(*pConfig); 1847 1844 1848 1845 // Apply export tweaks to machine settings … … 2286 2283 Utf8Str strMfFileName = Utf8Str(strMfFilePath).stripPath(); 2287 2284 pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), strMfFileName.c_str()).raw(), 2288 m->ulWeightForManifestOperation); // operation's weight, as set up with the IProgress originally); 2285 m->ulWeightForManifestOperation); // operation's weight, as set up 2286 // with the IProgress originally); 2289 2287 PRTMANIFESTTEST paManifestFiles = (PRTMANIFESTTEST)RTMemAlloc(sizeof(RTMANIFESTTEST) * fileList.size()); 2290 2288 size_t i = 0; … … 2415 2413 tr("Cannot find source file '%s' (%Rrc)"), strTmpOvf.c_str(), vrc); 2416 2414 /* Add the OVF file */ 2417 filesList.push_back(pair<Utf8Str, ULONG>(strTmpOvf, m->ulWeightForXmlOperation)); /* Use 1% of the total for the OVF file upload */ 2415 filesList.push_back(pair<Utf8Str, ULONG>(strTmpOvf, m->ulWeightForXmlOperation)); /* Use 1% of the 2416 total for the OVF file upload */ 2418 2417 /* Add the manifest file */ 2419 2418 if (m->fManifest) 2420 2419 { 2421 2420 Utf8Str strMfFile = Utf8Str(strTmpOvf).stripSuffix().append(".mf"); 2422 filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */ 2421 filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total 2422 for the manifest file upload */ 2423 2423 } 2424 2424 … … 2430 2430 { 2431 2431 ComObjPtr<VirtualSystemDescription> vsdescThis = (*it); 2432 std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage); 2432 std::list<VirtualSystemDescriptionEntry*> avsdeHDs = 2433 vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage); 2433 2434 std::list<VirtualSystemDescriptionEntry*>::const_iterator itH; 2434 2435 for (itH = avsdeHDs.begin(); … … 2450 2451 } 2451 2452 /* Next we have to upload the OVF & all disk images */ 2452 vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/" VBOX_VERSION_STRING); 2453 vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), 2454 pTask->locInfo.strHostname.c_str(), "virtualbox-agent/" VBOX_VERSION_STRING); 2453 2455 if (RT_FAILURE(vrc)) 2454 2456 throw setError(VBOX_E_IPRT_ERROR, -
trunk/src/VBox/Main/src-server/AudioAdapterImpl.cpp
r49875 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 228 228 alock.release(); 229 229 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 230 mParent-> setModified(Machine::IsModified_AudioAdapter);230 mParent->i_setModified(Machine::IsModified_AudioAdapter); 231 231 } 232 232 … … 262 262 alock.release(); 263 263 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 264 mParent-> setModified(Machine::IsModified_AudioAdapter);264 mParent->i_setModified(Machine::IsModified_AudioAdapter); 265 265 } 266 266 else … … 308 308 alock.release(); 309 309 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 310 mParent-> setModified(Machine::IsModified_AudioAdapter);310 mParent->i_setModified(Machine::IsModified_AudioAdapter); 311 311 break; 312 312 } -
trunk/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
r49871 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 207 207 alock.release(); 208 208 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 209 m->pMachine-> setModified(Machine::IsModified_BIOS);209 m->pMachine->i_setModified(Machine::IsModified_BIOS); 210 210 211 211 return S_OK; … … 236 236 alock.release(); 237 237 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 238 m->pMachine-> setModified(Machine::IsModified_BIOS);238 m->pMachine->i_setModified(Machine::IsModified_BIOS); 239 239 240 240 return S_OK; … … 268 268 alock.release(); 269 269 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 270 m->pMachine-> setModified(Machine::IsModified_BIOS);270 m->pMachine->i_setModified(Machine::IsModified_BIOS); 271 271 272 272 return S_OK; … … 296 296 alock.release(); 297 297 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 298 m->pMachine-> setModified(Machine::IsModified_BIOS);298 m->pMachine->i_setModified(Machine::IsModified_BIOS); 299 299 300 300 return S_OK; … … 323 323 alock.release(); 324 324 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 325 m->pMachine-> setModified(Machine::IsModified_BIOS);325 m->pMachine->i_setModified(Machine::IsModified_BIOS); 326 326 327 327 return S_OK; … … 352 352 alock.release(); 353 353 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 354 m->pMachine-> setModified(Machine::IsModified_BIOS);354 m->pMachine->i_setModified(Machine::IsModified_BIOS); 355 355 356 356 return S_OK; … … 381 381 alock.release(); 382 382 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 383 m->pMachine-> setModified(Machine::IsModified_BIOS);383 m->pMachine->i_setModified(Machine::IsModified_BIOS); 384 384 385 385 return S_OK; … … 410 410 alock.release(); 411 411 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 412 m->pMachine-> setModified(Machine::IsModified_BIOS);412 m->pMachine->i_setModified(Machine::IsModified_BIOS); 413 413 414 414 return S_OK; … … 438 438 alock.release(); 439 439 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 440 m->pMachine-> setModified(Machine::IsModified_BIOS);440 m->pMachine->i_setModified(Machine::IsModified_BIOS); 441 441 442 442 return S_OK; -
trunk/src/VBox/Main/src-server/BandwidthControlImpl.cpp
r50454 r51498 415 415 if (FAILED(rc)) return rc; 416 416 417 m->pParent-> setModified(Machine::IsModified_BandwidthControl);417 m->pParent->i_setModified(Machine::IsModified_BandwidthControl); 418 418 m->llBandwidthGroups.backup(); 419 419 m->llBandwidthGroups->push_back(group); … … 439 439 440 440 /* We can remove it now. */ 441 m->pParent-> setModified(Machine::IsModified_BandwidthControl);441 m->pParent->i_setModified(Machine::IsModified_BandwidthControl); 442 442 m->llBandwidthGroups.backup(); 443 443 -
trunk/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
r50436 r51498 245 245 ComObjPtr<Machine> pMachine = m->pParent->i_getMachine(); 246 246 alock.release(); 247 pMachine-> onBandwidthGroupChange(this);247 pMachine->i_onBandwidthGroupChange(this); 248 248 249 249 return S_OK; -
trunk/src/VBox/Main/src-server/ClientWatcher.cpp
r50355 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 211 211 { 212 212 /* machine mutex is released */ 213 (machines[rc - WAIT_OBJECT_0 - 1])-> checkForDeath();213 (machines[rc - WAIT_OBJECT_0 - 1])->i_checkForDeath(); 214 214 update = true; 215 215 } … … 217 217 { 218 218 /* machine mutex is abandoned due to client process termination */ 219 (machines[rc - WAIT_ABANDONED_0 - 1])-> checkForDeath();219 (machines[rc - WAIT_ABANDONED_0 - 1])->i_checkForDeath(); 220 220 update = true; 221 221 } … … 224 224 /* spawned VM process has terminated (normally or abnormally) */ 225 225 (spawnedMachines[rc - WAIT_OBJECT_0 - cnt - 1])-> 226 checkForSpawnFailure();226 i_checkForSpawnFailure(); 227 227 update = true; 228 228 } … … 253 253 254 254 ComObjPtr<SessionMachine> sm; 255 if ((*it)->i sSessionOpenOrClosing(sm))255 if ((*it)->i_isSessionOpenOrClosing(sm)) 256 256 { 257 257 AutoCaller smCaller(sm); … … 259 259 { 260 260 AutoReadLock smLock(sm COMMA_LOCKVAL_SRC_POS); 261 Machine::ClientToken *ct = sm-> getClientToken();261 Machine::ClientToken *ct = sm->i_getClientToken(); 262 262 if (ct) 263 263 { … … 285 285 ("MAXIMUM_WAIT_OBJECTS reached")); 286 286 287 if ((*it)->i sSessionSpawning())287 if ((*it)->i_isSessionSpawning()) 288 288 { 289 289 ULONG pid; … … 388 388 } 389 389 #endif 390 machines[semId]-> checkForDeath();390 machines[semId]->i_checkForDeath(); 391 391 } 392 392 update = true; … … 417 417 } 418 418 #endif 419 machines[i]-> checkForDeath();419 machines[i]->i_checkForDeath(); 420 420 } 421 421 } … … 433 433 for (size_t i = 0; i < cntSpawned; ++i) 434 434 updateSpawned |= (spawnedMachines[i])-> 435 checkForSpawnFailure();435 i_checkForSpawnFailure(); 436 436 } 437 437 } … … 464 464 465 465 ComObjPtr<SessionMachine> sm; 466 if ((*it)->i sSessionOpenOrClosing(sm))466 if ((*it)->i_isSessionOpenOrClosing(sm)) 467 467 { 468 468 AutoCaller smCaller(sm); … … 470 470 { 471 471 AutoReadLock smLock(sm COMMA_LOCKVAL_SRC_POS); 472 ClientToken *ct = sm-> getClientToken();472 ClientToken *ct = sm->i_getClientToken(); 473 473 if (ct) 474 474 { … … 505 505 it != allMachines.end(); ++it) 506 506 { 507 if ((*it)->i sSessionSpawning())507 if ((*it)->i_isSessionSpawning()) 508 508 spawnedMachines.push_back(*it); 509 509 } … … 589 589 { 590 590 ComObjPtr<SessionMachine> sm; 591 if ((*it)->i sSessionOpenOrClosing(sm))591 if ((*it)->i_isSessionOpenOrClosing(sm)) 592 592 machines.push_back(sm); 593 593 } … … 606 606 ++it) 607 607 { 608 if ((*it)->i sSessionSpawning())608 if ((*it)->i_isSessionSpawning()) 609 609 spawnedMachines.push_back(*it); 610 610 } … … 619 619 update = false; 620 620 for (size_t i = 0; i < cnt; ++i) 621 update |= (machines[i])-> checkForDeath();621 update |= (machines[i])->i_checkForDeath(); 622 622 623 623 updateSpawned = false; 624 624 for (size_t i = 0; i < cntSpawned; ++i) 625 updateSpawned |= (spawnedMachines[i])-> checkForSpawnFailure();625 updateSpawned |= (spawnedMachines[i])->i_checkForSpawnFailure(); 626 626 627 627 /* reap child processes */ … … 757 757 ++it) 758 758 { 759 if ((*it)->i sSessionSpawning())759 if ((*it)->i_isSessionSpawning()) 760 760 spawnedMachines.push_back(*it); 761 761 } … … 771 771 updateSpawned = false; 772 772 for (size_t i = 0; i < cntSpawned; ++i) 773 updateSpawned |= (spawnedMachines[i])-> checkForSpawnFailure();773 updateSpawned |= (spawnedMachines[i])->i_checkForSpawnFailure(); 774 774 775 775 /* reap child processes */ -
trunk/src/VBox/Main/src-server/HostPower.cpp
r50355 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 168 168 if (FAILED(rc)) 169 169 { 170 LogRel(("SaveState '%s' failed with %Rhrc\n", pMachine-> getName().c_str(), rc));170 LogRel(("SaveState '%s' failed with %Rhrc\n", pMachine->i_getName().c_str(), rc)); 171 171 continue; 172 172 } … … 185 185 if (SUCCEEDED(rc)) 186 186 { 187 LogRel(("SaveState '%s' succeeded\n", pMachine-> getName().c_str()));187 LogRel(("SaveState '%s' succeeded\n", pMachine->i_getName().c_str())); 188 188 ++saved; 189 189 } -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r51092 r51498 5 5 6 6 /* 7 * Copyright (C) 2005-201 3Oracle Corporation7 * Copyright (C) 2005-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 332 332 return setError(E_INVALIDARG, 333 333 tr("USB device '%s' with UUID {%RTuuid} is already captured by the virtual machine '%s'"), 334 mName, mId.raw(), mMachine-> getName().c_str());334 mName, mId.raw(), mMachine->i_getName().c_str()); 335 335 } 336 336 if (mUniState >= kHostUSBDeviceState_FirstTransitional) … … 439 439 LogFlowThisFunc(("{%s} Calling machine->onUSBDeviceAttach()...\n", mName)); 440 440 alock.release(); 441 HRESULT hrc = aMachine-> onUSBDeviceAttach(d, NULL, aMaskedIfs);441 HRESULT hrc = aMachine->i_onUSBDeviceAttach(d, NULL, aMaskedIfs); 442 442 LogFlowThisFunc(("{%s} Done machine->onUSBDeviceAttach()=%08X\n", mName, hrc)); 443 443 … … 518 518 alock.release(); 519 519 LogFlowThisFunc(("{%s} Calling machine->onUSBDeviceDetach()...\n", mName)); 520 HRESULT hrc = mMachine-> onUSBDeviceDetach(mId.toUtf16().raw(), NULL);520 HRESULT hrc = mMachine->i_onUSBDeviceDetach(mId.toUtf16().raw(), NULL); 521 521 LogFlowThisFunc(("{%s} Done machine->onUSBDeviceDetach()=%Rhrc\n", mName, hrc)); 522 522 NOREF(hrc); … … 1701 1701 * @note The caller must own the write lock for this object. 1702 1702 */ 1703 bool HostUSBDevice::i_setState(HostUSBDeviceState aNewState, HostUSBDeviceState aNewPendingState /*= kHostUSBDeviceState_Invalid*/, 1704 HostUSBDeviceSubState aNewSubState /*= kHostUSBDeviceSubState_Default*/) 1703 bool HostUSBDevice::i_setState(HostUSBDeviceState aNewState, 1704 HostUSBDeviceState aNewPendingState /*= kHostUSBDeviceState_Invalid*/, 1705 HostUSBDeviceSubState aNewSubState /*= kHostUSBDeviceSubState_Default*/) 1705 1706 { 1706 1707 Assert(isWriteLockOnCurrentThread()); -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r51476 r51498 167 167 mVideoCaptureFPS = 25; 168 168 mVideoCaptureEnabled = false; 169 for (unsigned i = 0; i < RT_ELEMENTS(maVideoCaptureScreens); i++)169 for (unsigned i = 0; i < RT_ELEMENTS(maVideoCaptureScreens); ++i) 170 170 maVideoCaptureScreens[i] = true; 171 171 … … 209 209 mEmulatedUSBCardReaderEnabled = FALSE; 210 210 211 for (size_t i = 0; i < RT_ELEMENTS(mCPUAttached); i++)211 for (size_t i = 0; i < RT_ELEMENTS(mCPUAttached); ++i) 212 212 mCPUAttached[i] = false; 213 213 … … 303 303 if (FAILED(rc)) return rc; 304 304 305 rc = tryCreateMachineConfigFile(fForceOverwrite);305 rc = i_tryCreateMachineConfigFile(fForceOverwrite); 306 306 if (FAILED(rc)) return rc; 307 307 … … 329 329 // with the machine file; say so if the settings file name is the same as the 330 330 // settings file parent directory (machine directory) 331 mUserData->s.fNameSync = i sInOwnDir();331 mUserData->s.fNameSync = i_isInOwnDir(); 332 332 333 333 // initialize the default snapshots folder … … 358 358 /* At this point the changing of the current state modification 359 359 * flag is allowed. */ 360 allowStateModification();360 i_allowStateModification(); 361 361 362 362 /* commit all changes made during the initialization */ 363 commit();363 i_commit(); 364 364 } 365 365 … … 421 421 mData->mRegistered = TRUE; 422 422 // now load the settings from XML: 423 rc = registeredInit();423 rc = i_registeredInit(); 424 424 // this calls initDataAndChildObjects() and loadSettings() 425 425 } … … 454 454 unconst(mData->mUuid) = mData->pMachineConfigFile->uuid; 455 455 456 rc = loadMachineDataFromSettings(*mData->pMachineConfigFile,456 rc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile, 457 457 NULL /* puuidRegistry */); 458 458 if (FAILED(rc)) throw rc; … … 460 460 /* At this point the changing of the current state modification 461 461 * flag is allowed. */ 462 allowStateModification();463 464 commit();462 i_allowStateModification(); 463 464 i_commit(); 465 465 } 466 466 catch (HRESULT err) … … 487 487 // uninit media from this machine's media registry, or else 488 488 // reloading the settings will fail 489 mParent->i_unregisterMachineMedia( getId());489 mParent->i_unregisterMachineMedia(i_getId()); 490 490 } 491 491 } … … 533 533 if (FAILED(rc)) return rc; 534 534 535 rc = tryCreateMachineConfigFile(false /* fForceOverwrite */);535 rc = i_tryCreateMachineConfigFile(false /* fForceOverwrite */); 536 536 if (FAILED(rc)) return rc; 537 537 … … 549 549 unconst(mData->mUuid).create(); 550 550 551 rc = loadMachineDataFromSettings(config,552 &mData->mUuid); // puuidRegistry: initialize media with this registry ID551 rc = i_loadMachineDataFromSettings(config, 552 &mData->mUuid); // puuidRegistry: initialize media with this registry ID 553 553 554 554 // override VM name as well, it may be different … … 559 559 /* At this point the changing of the current state modification 560 560 * flag is allowed. */ 561 allowStateModification();561 i_allowStateModification(); 562 562 563 563 /* commit all changes made during the initialization */ 564 commit();564 i_commit(); 565 565 } 566 566 } … … 574 574 { 575 575 /* Ignore all errors from unregistering, they would destroy 576 577 576 - * the more interesting error information we already have, 577 - * pinpointing the issue with the VM config. */ 578 578 ErrorInfoKeeper eik; 579 579 580 autoInitSpan.setLimited(); 580 581 581 582 // uninit media from this machine's media registry, or else 582 583 // reloading the settings will fail 583 mParent->i_unregisterMachineMedia( getId());584 mParent->i_unregisterMachineMedia(i_getId()); 584 585 } 585 586 } … … 639 640 * @return 640 641 */ 641 HRESULT Machine:: tryCreateMachineConfigFile(bool fForceOverwrite)642 HRESULT Machine::i_tryCreateMachineConfigFile(bool fForceOverwrite) 642 643 { 643 644 HRESULT rc = S_OK; … … 689 690 * @note Subclasses must not call this method. 690 691 */ 691 HRESULT Machine:: registeredInit()692 { 693 AssertReturn(!i sSessionMachine(), E_FAIL);694 AssertReturn(!i sSnapshotMachine(), E_FAIL);692 HRESULT Machine::i_registeredInit() 693 { 694 AssertReturn(!i_isSessionMachine(), E_FAIL); 695 AssertReturn(!i_isSnapshotMachine(), E_FAIL); 695 696 AssertReturn(mData->mUuid.isValid(), E_FAIL); 696 697 AssertReturn(!mData->mAccessible, E_FAIL); … … 719 720 mParent->i_settingsFilePath().c_str()); 720 721 721 rc = loadMachineDataFromSettings(*mData->pMachineConfigFile,722 NULL /* const Guid *puuidRegistry */);722 rc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile, 723 NULL /* const Guid *puuidRegistry */); 723 724 if (FAILED(rc)) throw rc; 724 725 } … … 744 745 745 746 /* commit all changes made during loading the settings file */ 746 commit(); // @todo r=dj why do we need a commit during init?!? this is very expensive747 i_commit(); // @todo r=dj why do we need a commit during init?!? this is very expensive 747 748 /// @todo r=klaus for some reason the settings loading logic backs up 748 749 // the settings, and therefore a commit is needed. Should probably be changed. … … 761 762 762 763 /* rollback all changes */ 763 rollback(false /* aNotify */);764 i_rollback(false /* aNotify */); 764 765 765 766 // uninit media from this machine's media registry, or else 766 767 // reloading the settings will fail 767 mParent->i_unregisterMachineMedia( getId());768 mParent->i_unregisterMachineMedia(i_getId()); 768 769 769 770 /* uninitialize the common part to make sure all data is reset to … … 801 802 { 802 803 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 803 saveSettings(NULL, Machine::SaveS_Force);804 i_saveSettings(NULL, Machine::SaveS_Force); 804 805 } 805 806 } … … 810 811 return; 811 812 812 Assert(!i sSnapshotMachine());813 Assert(!i sSessionMachine());813 Assert(!i_isSnapshotMachine()); 814 Assert(!i_isSessionMachine()); 814 815 Assert(!!mData); 815 816 … … 840 841 LogWarningThisFunc(("Setting state to Aborted!\n")); 841 842 /* set machine state using SessionMachine reimplementation */ 842 static_cast<Machine*>(mData->mSession.mMachine)-> setMachineState(MachineState_Aborted);843 static_cast<Machine*>(mData->mSession.mMachine)->i_setMachineState(MachineState_Aborted); 843 844 } 844 845 … … 853 854 854 855 // uninit media from this machine's media registry, if they're still there 855 Guid uuidMachine( getId());856 Guid uuidMachine(i_getId()); 856 857 857 858 /* the lock is no more necessary (SessionMachine is uninitialized) */ … … 870 871 { 871 872 LogWarningThisFunc(("Discarding unsaved settings changes!\n")); 872 rollback(false /* aNotify */);873 i_rollback(false /* aNotify */); 873 874 } 874 875 … … 882 883 } 883 884 884 // IMachine properties885 // Wrapped IMachine properties 885 886 ///////////////////////////////////////////////////////////////////////////// 886 887 STDMETHODIMP Machine::COMGETTER(Parent)(IVirtualBox **aParent) 888 { 889 CheckComArgOutPointerValid(aParent); 890 891 AutoLimitedCaller autoCaller(this); 892 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 893 887 HRESULT Machine::getParent(ComPtr<IVirtualBox> &aParent) 888 { 894 889 /* mParent is constant during life time, no need to lock */ 895 890 ComObjPtr<VirtualBox> pVirtualBox(mParent); 896 pVirtualBox.queryInterfaceTo(aParent); 897 898 return S_OK; 899 } 900 901 STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible) 902 { 903 CheckComArgOutPointerValid(aAccessible); 904 905 AutoLimitedCaller autoCaller(this); 906 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 907 908 LogFlowThisFunc(("ENTER\n")); 909 891 pVirtualBox.queryInterfaceTo(aParent.asOutParam()); 892 893 return S_OK; 894 } 895 896 897 HRESULT Machine::getAccessible(BOOL *aAccessible) 898 { 910 899 /* In some cases (medium registry related), it is necessary to be able to 911 900 * go through the list of all machines. Happens when an inaccessible VM … … 936 925 } 937 926 938 rc = registeredInit();927 rc = i_registeredInit(); 939 928 940 929 if (SUCCEEDED(rc) && mData->mAccessible) … … 957 946 } 958 947 959 STDMETHODIMP Machine::COMGETTER(AccessError)(IVirtualBoxErrorInfo **aAccessError) 960 { 961 CheckComArgOutPointerValid(aAccessError); 962 963 AutoLimitedCaller autoCaller(this); 964 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 965 948 HRESULT Machine::getAccessError(ComPtr<IVirtualBoxErrorInfo> &aAccessError) 949 { 966 950 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 967 951 … … 983 967 Utf8Str(mData->mAccessError.getComponent()).c_str(), 984 968 Utf8Str(mData->mAccessError.getText())); 985 rc = errorInfo.queryInterfaceTo(aAccessError );969 rc = errorInfo.queryInterfaceTo(aAccessError.asOutParam()); 986 970 } 987 971 … … 989 973 } 990 974 991 STDMETHODIMP Machine::COMGETTER(Name)(BSTR *aName) 992 { 993 CheckComArgOutPointerValid(aName); 994 995 AutoCaller autoCaller(this); 996 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 997 975 HRESULT Machine::getName(com::Utf8Str &aName) 976 { 998 977 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 999 978 1000 mUserData->s.strName.cloneTo(aName); 1001 1002 return S_OK; 1003 } 1004 1005 STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName) 1006 { 1007 CheckComArgStrNotEmptyOrNull(aName); 1008 1009 AutoCaller autoCaller(this); 1010 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1011 979 aName = mUserData->s.strName; 980 981 return S_OK; 982 } 983 984 HRESULT Machine::setName(const com::Utf8Str &aName) 985 { 1012 986 // prohibit setting a UUID only as the machine name, or else it can 1013 987 // never be found by findMachine() … … 1019 993 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1020 994 1021 HRESULT rc = checkStateDependency(MutableStateDep);995 HRESULT rc = i_checkStateDependency(MutableStateDep); 1022 996 if (FAILED(rc)) return rc; 1023 997 1024 setModified(IsModified_MachineData);998 i_setModified(IsModified_MachineData); 1025 999 mUserData.backup(); 1026 1000 mUserData->s.strName = aName; … … 1029 1003 } 1030 1004 1031 STDMETHODIMP Machine::COMGETTER(Description)(BSTR *aDescription) 1032 { 1033 CheckComArgOutPointerValid(aDescription); 1034 1035 AutoCaller autoCaller(this); 1036 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1037 1005 HRESULT Machine::getDescription(com::Utf8Str &aDescription) 1006 { 1038 1007 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1039 1008 1040 mUserData->s.strDescription.cloneTo(aDescription); 1041 1042 return S_OK; 1043 } 1044 1045 STDMETHODIMP Machine::COMSETTER(Description)(IN_BSTR aDescription) 1046 { 1047 AutoCaller autoCaller(this); 1048 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1049 1009 aDescription = mUserData->s.strDescription; 1010 1011 return S_OK; 1012 } 1013 1014 HRESULT Machine::setDescription(const com::Utf8Str &aDescription) 1015 { 1050 1016 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1051 1017 … … 1053 1019 // significantly, but play safe by not messing around while complex 1054 1020 // activities are going on 1055 HRESULT rc = checkStateDependency(MutableOrSavedStateDep);1021 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep); 1056 1022 if (FAILED(rc)) return rc; 1057 1023 1058 setModified(IsModified_MachineData);1024 i_setModified(IsModified_MachineData); 1059 1025 mUserData.backup(); 1060 1026 mUserData->s.strDescription = aDescription; … … 1063 1029 } 1064 1030 1065 STDMETHODIMP Machine::COMGETTER(Id)(BSTR *aId) 1066 { 1067 CheckComArgOutPointerValid(aId); 1068 1069 AutoLimitedCaller autoCaller(this); 1070 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1071 1031 HRESULT Machine::getId(com::Guid &aId) 1032 { 1072 1033 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1073 1034 1074 mData->mUuid.toUtf16().cloneTo(aId); 1075 1076 return S_OK; 1077 } 1078 1079 STDMETHODIMP Machine::COMGETTER(Groups)(ComSafeArrayOut(BSTR, aGroups)) 1080 { 1081 CheckComArgOutSafeArrayPointerValid(aGroups); 1082 1083 AutoCaller autoCaller(this); 1084 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1085 1035 aId = mData->mUuid; 1036 1037 return S_OK; 1038 } 1039 1040 HRESULT Machine::getGroups(std::vector<com::Utf8Str> &aGroups) 1041 { 1086 1042 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1087 SafeArray<BSTR> groups(mUserData->s.llGroups.size());1043 aGroups.resize(mUserData->s.llGroups.size()); 1088 1044 size_t i = 0; 1089 1045 for (StringsList::const_iterator it = mUserData->s.llGroups.begin(); 1090 it != mUserData->s.llGroups.end(); 1091 ++it, i++) 1092 { 1093 Bstr tmp = *it; 1094 tmp.cloneTo(&groups[i]); 1095 } 1096 groups.detachTo(ComSafeArrayOutArg(aGroups)); 1097 1098 return S_OK; 1099 } 1100 1101 STDMETHODIMP Machine::COMSETTER(Groups)(ComSafeArrayIn(IN_BSTR, aGroups)) 1102 { 1103 AutoCaller autoCaller(this); 1104 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1105 std::vector<com::Utf8Str> tmplist; 1106 SafeArray<IN_BSTR> tmp(ComSafeArrayInArg(aGroups)); 1107 tmplist.resize(tmp.size()); 1108 for (size_t i = 0; i < tmp.size(); ++i) 1109 tmplist[i] = Utf8Str(tmp[i]); 1110 1046 it != mUserData->s.llGroups.end(); ++it, ++i) 1047 aGroups[i] = (*it); 1048 1049 return S_OK; 1050 } 1051 1052 HRESULT Machine::setGroups(const std::vector<com::Utf8Str> &aGroups) 1053 { 1111 1054 StringsList llGroups; 1112 HRESULT rc = mParent->i_convertMachineGroups( tmplist, &llGroups);1055 HRESULT rc = mParent->i_convertMachineGroups(aGroups, &llGroups); 1113 1056 if (FAILED(rc)) 1114 1057 return rc; … … 1117 1060 1118 1061 // changing machine groups is possible while the VM is offline 1119 rc = checkStateDependency(OfflineStateDep);1062 rc = i_checkStateDependency(OfflineStateDep); 1120 1063 if (FAILED(rc)) return rc; 1121 1064 1122 setModified(IsModified_MachineData);1065 i_setModified(IsModified_MachineData); 1123 1066 mUserData.backup(); 1124 1067 mUserData->s.llGroups = llGroups; … … 1127 1070 } 1128 1071 1129 STDMETHODIMP Machine::COMGETTER(OSTypeId)(BSTR *aOSTypeId) 1130 { 1131 CheckComArgOutPointerValid(aOSTypeId); 1132 1133 AutoCaller autoCaller(this); 1134 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1135 1072 HRESULT Machine::getOSTypeId(com::Utf8Str &aOSTypeId) 1073 { 1136 1074 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1137 1075 1138 mUserData->s.strOsType.cloneTo(aOSTypeId); 1139 1140 return S_OK; 1141 } 1142 1143 STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId) 1144 { 1145 CheckComArgStrNotEmptyOrNull(aOSTypeId); 1146 1147 AutoCaller autoCaller(this); 1148 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1149 1076 aOSTypeId = mUserData->s.strOsType; 1077 1078 return S_OK; 1079 } 1080 1081 HRESULT Machine::setOSTypeId(const com::Utf8Str &aOSTypeId) 1082 { 1150 1083 /* look up the object by Id to check it is valid */ 1151 1084 ComPtr<IGuestOSType> guestOSType; 1152 HRESULT rc = mParent->GetGuestOSType( aOSTypeId, guestOSType.asOutParam());1085 HRESULT rc = mParent->GetGuestOSType(Bstr(aOSTypeId).raw(), guestOSType.asOutParam()); 1153 1086 if (FAILED(rc)) return rc; 1154 1087 … … 1161 1094 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1162 1095 1163 rc = checkStateDependency(MutableStateDep);1096 rc = i_checkStateDependency(MutableStateDep); 1164 1097 if (FAILED(rc)) return rc; 1165 1098 1166 setModified(IsModified_MachineData);1099 i_setModified(IsModified_MachineData); 1167 1100 mUserData.backup(); 1168 1101 mUserData->s.strOsType = osTypeId; … … 1171 1104 } 1172 1105 1173 1174 STDMETHODIMP Machine::COMGETTER(FirmwareType)(FirmwareType_T *aFirmwareType) 1175 { 1176 CheckComArgOutPointerValid(aFirmwareType); 1177 1178 AutoCaller autoCaller(this); 1179 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1180 1106 HRESULT Machine::getFirmwareType(FirmwareType_T *aFirmwareType) 1107 { 1181 1108 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1182 1109 … … 1186 1113 } 1187 1114 1188 STDMETHODIMP Machine::COMSETTER(FirmwareType)(FirmwareType_T aFirmwareType) 1189 { 1190 AutoCaller autoCaller(this); 1191 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1115 HRESULT Machine::setFirmwareType(FirmwareType_T aFirmwareType) 1116 { 1192 1117 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1193 1118 1194 HRESULT rc = checkStateDependency(MutableStateDep);1119 HRESULT rc = i_checkStateDependency(MutableStateDep); 1195 1120 if (FAILED(rc)) return rc; 1196 1121 1197 setModified(IsModified_MachineData);1122 i_setModified(IsModified_MachineData); 1198 1123 mHWData.backup(); 1199 1124 mHWData->mFirmwareType = aFirmwareType; … … 1202 1127 } 1203 1128 1204 STDMETHODIMP Machine::COMGETTER(KeyboardHIDType)(KeyboardHIDType_T *aKeyboardHIDType) 1205 { 1206 CheckComArgOutPointerValid(aKeyboardHIDType); 1207 1208 AutoCaller autoCaller(this); 1209 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1210 1129 HRESULT Machine::getKeyboardHIDType(KeyboardHIDType_T *aKeyboardHIDType) 1130 { 1211 1131 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1212 1132 … … 1216 1136 } 1217 1137 1218 STDMETHODIMP Machine::COMSETTER(KeyboardHIDType)(KeyboardHIDType_T aKeyboardHIDType) 1219 { 1220 AutoCaller autoCaller(this); 1221 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1138 HRESULT Machine::setKeyboardHIDType(KeyboardHIDType_T aKeyboardHIDType) 1139 { 1222 1140 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1223 1141 1224 HRESULT rc = checkStateDependency(MutableStateDep);1142 HRESULT rc = i_checkStateDependency(MutableStateDep); 1225 1143 if (FAILED(rc)) return rc; 1226 1144 1227 setModified(IsModified_MachineData);1145 i_setModified(IsModified_MachineData); 1228 1146 mHWData.backup(); 1229 1147 mHWData->mKeyboardHIDType = aKeyboardHIDType; … … 1232 1150 } 1233 1151 1234 STDMETHODIMP Machine::COMGETTER(PointingHIDType)(PointingHIDType_T *aPointingHIDType) 1235 { 1236 CheckComArgOutPointerValid(aPointingHIDType); 1237 1238 AutoCaller autoCaller(this); 1239 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1240 1152 HRESULT Machine::getPointingHIDType(PointingHIDType_T *aPointingHIDType) 1153 { 1241 1154 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1242 1155 … … 1246 1159 } 1247 1160 1248 STDMETHODIMP Machine::COMSETTER(PointingHIDType)(PointingHIDType_T aPointingHIDType) 1249 { 1250 AutoCaller autoCaller(this); 1251 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1161 HRESULT Machine::setPointingHIDType(PointingHIDType_T aPointingHIDType) 1162 { 1252 1163 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1253 1164 1254 HRESULT rc = checkStateDependency(MutableStateDep);1165 HRESULT rc = i_checkStateDependency(MutableStateDep); 1255 1166 if (FAILED(rc)) return rc; 1256 1167 1257 setModified(IsModified_MachineData);1168 i_setModified(IsModified_MachineData); 1258 1169 mHWData.backup(); 1259 1170 mHWData->mPointingHIDType = aPointingHIDType; … … 1262 1173 } 1263 1174 1264 STDMETHODIMP Machine::COMGETTER(ChipsetType)(ChipsetType_T *aChipsetType) 1265 { 1266 CheckComArgOutPointerValid(aChipsetType); 1267 1268 AutoCaller autoCaller(this); 1269 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1270 1175 HRESULT Machine::getChipsetType(ChipsetType_T *aChipsetType) 1176 { 1271 1177 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1272 1178 … … 1276 1182 } 1277 1183 1278 STDMETHODIMP Machine::COMSETTER(ChipsetType)(ChipsetType_T aChipsetType) 1279 { 1280 AutoCaller autoCaller(this); 1281 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1184 HRESULT Machine::setChipsetType(ChipsetType_T aChipsetType) 1185 { 1282 1186 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1283 1187 1284 HRESULT rc = checkStateDependency(MutableStateDep);1188 HRESULT rc = i_checkStateDependency(MutableStateDep); 1285 1189 if (FAILED(rc)) return rc; 1286 1190 1287 1191 if (aChipsetType != mHWData->mChipsetType) 1288 1192 { 1289 setModified(IsModified_MachineData);1193 i_setModified(IsModified_MachineData); 1290 1194 mHWData.backup(); 1291 1195 mHWData->mChipsetType = aChipsetType; … … 1310 1214 } 1311 1215 1312 STDMETHODIMP Machine::COMGETTER(ParavirtProvider)(ParavirtProvider_T *aParavirtProvider) 1313 { 1314 CheckComArgOutPointerValid(aParavirtProvider); 1315 1316 AutoCaller autoCaller(this); 1317 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1318 1216 HRESULT Machine::getParavirtProvider(ParavirtProvider_T *aParavirtProvider) 1217 { 1319 1218 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1320 1219 … … 1324 1223 } 1325 1224 1326 STDMETHODIMP Machine::COMSETTER(ParavirtProvider)(ParavirtProvider_T aParavirtProvider) 1327 { 1328 AutoCaller autoCaller(this); 1329 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1225 HRESULT Machine::setParavirtProvider(ParavirtProvider_T aParavirtProvider) 1226 { 1330 1227 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1331 1228 1332 HRESULT rc = checkStateDependency(MutableStateDep);1229 HRESULT rc = i_checkStateDependency(MutableStateDep); 1333 1230 if (FAILED(rc)) return rc; 1334 1231 1335 1232 if (aParavirtProvider != mHWData->mParavirtProvider) 1336 1233 { 1337 setModified(IsModified_MachineData);1234 i_setModified(IsModified_MachineData); 1338 1235 mHWData.backup(); 1339 1236 mHWData->mParavirtProvider = aParavirtProvider; … … 1343 1240 } 1344 1241 1345 STDMETHODIMP Machine::COMGETTER(HardwareVersion)(BSTR *aHWVersion) 1346 { 1347 CheckComArgOutPointerValid(aHWVersion); 1348 1349 AutoCaller autoCaller(this); 1350 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1351 1242 HRESULT Machine::getHardwareVersion(com::Utf8Str &aHardwareVersion) 1243 { 1352 1244 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1353 1245 1354 mHWData->mHWVersion.cloneTo(aHWVersion);1355 1356 return S_OK; 1357 } 1358 1359 STDMETHODIMP Machine::COMSETTER(HardwareVersion)(IN_BSTR aHWVersion)1246 aHardwareVersion = mHWData->mHWVersion; 1247 1248 return S_OK; 1249 } 1250 1251 HRESULT Machine::setHardwareVersion(const com::Utf8Str &aHardwareVersion) 1360 1252 { 1361 1253 /* check known version */ 1362 Utf8Str hwVersion = aH WVersion;1254 Utf8Str hwVersion = aHardwareVersion; 1363 1255 if ( hwVersion.compare("1") != 0 1364 1256 && hwVersion.compare("2") != 0) 1365 1257 return setError(E_INVALIDARG, 1366 tr("Invalid hardware version: %ls\n"), aHWVersion); 1367 1368 AutoCaller autoCaller(this); 1369 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1258 tr("Invalid hardware version: %s\n"), aHardwareVersion.c_str()); 1370 1259 1371 1260 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1372 1261 1373 HRESULT rc = checkStateDependency(MutableStateDep);1262 HRESULT rc = i_checkStateDependency(MutableStateDep); 1374 1263 if (FAILED(rc)) return rc; 1375 1264 1376 setModified(IsModified_MachineData);1265 i_setModified(IsModified_MachineData); 1377 1266 mHWData.backup(); 1378 mHWData->mHWVersion = hwVersion; 1379 1380 return S_OK; 1381 } 1382 1383 STDMETHODIMP Machine::COMGETTER(HardwareUUID)(BSTR *aUUID) 1384 { 1385 CheckComArgOutPointerValid(aUUID); 1386 1387 AutoCaller autoCaller(this); 1388 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1389 1267 mHWData->mHWVersion = aHardwareVersion; 1268 1269 return S_OK; 1270 } 1271 1272 HRESULT Machine::getHardwareUUID(com::Guid &aHardwareUUID) 1273 { 1390 1274 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1391 1275 1392 1276 if (!mHWData->mHardwareUUID.isZero()) 1393 mHWData->mHardwareUUID.toUtf16().cloneTo(aUUID);1277 aHardwareUUID = mHWData->mHardwareUUID; 1394 1278 else 1395 mData->mUuid.toUtf16().cloneTo(aUUID); 1396 1397 return S_OK; 1398 } 1399 1400 STDMETHODIMP Machine::COMSETTER(HardwareUUID)(IN_BSTR aUUID) 1401 { 1402 Guid hardwareUUID(aUUID); 1403 if (!hardwareUUID.isValid()) 1279 aHardwareUUID = mData->mUuid; 1280 1281 return S_OK; 1282 } 1283 1284 HRESULT Machine::setHardwareUUID(const com::Guid &aHardwareUUID) 1285 { 1286 if (!aHardwareUUID.isValid()) 1404 1287 return E_INVALIDARG; 1405 1288 1406 AutoCaller autoCaller(this);1407 if (FAILED(autoCaller.rc())) return autoCaller.rc();1408 1409 1289 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1410 1290 1411 HRESULT rc = checkStateDependency(MutableStateDep);1291 HRESULT rc = i_checkStateDependency(MutableStateDep); 1412 1292 if (FAILED(rc)) return rc; 1413 1293 1414 setModified(IsModified_MachineData);1294 i_setModified(IsModified_MachineData); 1415 1295 mHWData.backup(); 1416 if ( hardwareUUID == mData->mUuid)1296 if (aHardwareUUID == mData->mUuid) 1417 1297 mHWData->mHardwareUUID.clear(); 1418 1298 else 1419 mHWData->mHardwareUUID = hardwareUUID; 1420 1421 return S_OK; 1422 } 1423 1424 STDMETHODIMP Machine::COMGETTER(MemorySize)(ULONG *memorySize) 1425 { 1426 CheckComArgOutPointerValid(memorySize); 1427 1428 AutoCaller autoCaller(this); 1429 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1430 1299 mHWData->mHardwareUUID = aHardwareUUID; 1300 1301 return S_OK; 1302 } 1303 1304 HRESULT Machine::getMemorySize(ULONG *aMemorySize) 1305 { 1431 1306 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1432 1307 1433 * memorySize = mHWData->mMemorySize;1434 1435 return S_OK; 1436 } 1437 1438 STDMETHODIMP Machine::COMSETTER(MemorySize)(ULONG memorySize)1308 *aMemorySize = mHWData->mMemorySize; 1309 1310 return S_OK; 1311 } 1312 1313 HRESULT Machine::setMemorySize(ULONG aMemorySize) 1439 1314 { 1440 1315 /* check RAM limits */ 1441 if ( memorySize < MM_RAM_MIN_IN_MB1442 || memorySize > MM_RAM_MAX_IN_MB1316 if ( aMemorySize < MM_RAM_MIN_IN_MB 1317 || aMemorySize > MM_RAM_MAX_IN_MB 1443 1318 ) 1444 1319 return setError(E_INVALIDARG, 1445 1320 tr("Invalid RAM size: %lu MB (must be in range [%lu, %lu] MB)"), 1446 memorySize, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB); 1447 1448 AutoCaller autoCaller(this); 1449 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1321 aMemorySize, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB); 1450 1322 1451 1323 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1452 1324 1453 HRESULT rc = checkStateDependency(MutableStateDep);1325 HRESULT rc = i_checkStateDependency(MutableStateDep); 1454 1326 if (FAILED(rc)) return rc; 1455 1327 1456 setModified(IsModified_MachineData);1328 i_setModified(IsModified_MachineData); 1457 1329 mHWData.backup(); 1458 mHWData->mMemorySize = memorySize; 1459 1460 return S_OK; 1461 } 1462 1463 STDMETHODIMP Machine::COMGETTER(CPUCount)(ULONG *CPUCount) 1464 { 1465 CheckComArgOutPointerValid(CPUCount); 1466 1467 AutoCaller autoCaller(this); 1468 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1469 1330 mHWData->mMemorySize = aMemorySize; 1331 1332 return S_OK; 1333 } 1334 1335 HRESULT Machine::getCPUCount(ULONG *aCPUCount) 1336 { 1470 1337 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1471 1338 1472 * CPUCount = mHWData->mCPUCount;1473 1474 return S_OK; 1475 } 1476 1477 STDMETHODIMP Machine::COMSETTER(CPUCount)(ULONGCPUCount)1339 *aCPUCount = mHWData->mCPUCount; 1340 1341 return S_OK; 1342 } 1343 1344 HRESULT Machine::setCPUCount(ULONG aCPUCount) 1478 1345 { 1479 1346 /* check CPU limits */ 1480 if ( CPUCount < SchemaDefs::MinCPUCount1481 || CPUCount > SchemaDefs::MaxCPUCount1347 if ( aCPUCount < SchemaDefs::MinCPUCount 1348 || aCPUCount > SchemaDefs::MaxCPUCount 1482 1349 ) 1483 1350 return setError(E_INVALIDARG, 1484 1351 tr("Invalid virtual CPU count: %lu (must be in range [%lu, %lu])"), 1485 CPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount); 1486 1487 AutoCaller autoCaller(this); 1488 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1352 aCPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount); 1489 1353 1490 1354 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1493 1357 if (mHWData->mCPUHotPlugEnabled) 1494 1358 { 1495 for (unsigned idx = CPUCount; idx < SchemaDefs::MaxCPUCount; idx++)1359 for (unsigned idx = aCPUCount; idx < SchemaDefs::MaxCPUCount; idx++) 1496 1360 { 1497 1361 if (mHWData->mCPUAttached[idx]) … … 1499 1363 tr("There is still a CPU attached to socket %lu." 1500 1364 "Detach the CPU before removing the socket"), 1501 CPUCount, idx+1);1502 } 1503 } 1504 1505 HRESULT rc = checkStateDependency(MutableStateDep);1365 aCPUCount, idx+1); 1366 } 1367 } 1368 1369 HRESULT rc = i_checkStateDependency(MutableStateDep); 1506 1370 if (FAILED(rc)) return rc; 1507 1371 1508 setModified(IsModified_MachineData);1372 i_setModified(IsModified_MachineData); 1509 1373 mHWData.backup(); 1510 mHWData->mCPUCount = CPUCount; 1511 1512 return S_OK; 1513 } 1514 1515 STDMETHODIMP Machine::COMGETTER(CPUExecutionCap)(ULONG *aExecutionCap) 1516 { 1517 CheckComArgOutPointerValid(aExecutionCap); 1518 1519 AutoCaller autoCaller(this); 1520 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1521 1374 mHWData->mCPUCount = aCPUCount; 1375 1376 return S_OK; 1377 } 1378 1379 HRESULT Machine::getCPUExecutionCap(ULONG *aCPUExecutionCap) 1380 { 1522 1381 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1523 1382 1524 *a ExecutionCap = mHWData->mCpuExecutionCap;1525 1526 return S_OK; 1527 } 1528 1529 STDMETHODIMP Machine::COMSETTER(CPUExecutionCap)(ULONG aExecutionCap)1383 *aCPUExecutionCap = mHWData->mCpuExecutionCap; 1384 1385 return S_OK; 1386 } 1387 1388 HRESULT Machine::setCPUExecutionCap(ULONG aCPUExecutionCap) 1530 1389 { 1531 1390 HRESULT rc = S_OK; 1532 1391 1533 1392 /* check throttle limits */ 1534 if ( a ExecutionCap < 11535 || a ExecutionCap > 1001393 if ( aCPUExecutionCap < 1 1394 || aCPUExecutionCap > 100 1536 1395 ) 1537 1396 return setError(E_INVALIDARG, 1538 1397 tr("Invalid CPU execution cap value: %lu (must be in range [%lu, %lu])"), 1539 aExecutionCap, 1, 100); 1540 1541 AutoCaller autoCaller(this); 1542 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1398 aCPUExecutionCap, 1, 100); 1543 1399 1544 1400 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1545 1401 1546 1402 alock.release(); 1547 rc = onCPUExecutionCapChange(aExecutionCap);1403 rc = i_onCPUExecutionCapChange(aCPUExecutionCap); 1548 1404 alock.acquire(); 1549 1405 if (FAILED(rc)) return rc; 1550 1406 1551 setModified(IsModified_MachineData);1407 i_setModified(IsModified_MachineData); 1552 1408 mHWData.backup(); 1553 mHWData->mCpuExecutionCap = a ExecutionCap;1409 mHWData->mCpuExecutionCap = aCPUExecutionCap; 1554 1410 1555 1411 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 1556 1412 if (Global::IsOnline(mData->mMachineState)) 1557 saveSettings(NULL); 1558 1559 return S_OK; 1560 } 1561 1562 1563 STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled)(BOOL *aEnabled) 1564 { 1565 CheckComArgOutPointerValid(aEnabled); 1566 1567 AutoCaller autoCaller(this); 1568 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1569 1413 i_saveSettings(NULL); 1414 1415 return S_OK; 1416 } 1417 1418 HRESULT Machine::getCPUHotPlugEnabled(BOOL *aCPUHotPlugEnabled) 1419 { 1570 1420 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1571 1421 1572 *a Enabled = mHWData->mCPUHotPlugEnabled;1573 1574 return S_OK; 1575 } 1576 1577 STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled)(BOOL aEnabled)1422 *aCPUHotPlugEnabled = mHWData->mCPUHotPlugEnabled; 1423 1424 return S_OK; 1425 } 1426 1427 HRESULT Machine::setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled) 1578 1428 { 1579 1429 HRESULT rc = S_OK; 1580 1430 1581 AutoCaller autoCaller(this);1582 if (FAILED(autoCaller.rc())) return autoCaller.rc();1583 1584 1431 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1585 1432 1586 rc = checkStateDependency(MutableStateDep);1433 rc = i_checkStateDependency(MutableStateDep); 1587 1434 if (FAILED(rc)) return rc; 1588 1435 1589 if (mHWData->mCPUHotPlugEnabled != a Enabled)1590 { 1591 if (a Enabled)1592 { 1593 setModified(IsModified_MachineData);1436 if (mHWData->mCPUHotPlugEnabled != aCPUHotPlugEnabled) 1437 { 1438 if (aCPUHotPlugEnabled) 1439 { 1440 i_setModified(IsModified_MachineData); 1594 1441 mHWData.backup(); 1595 1442 1596 1443 /* Add the amount of CPUs currently attached */ 1597 for (unsigned i = 0; i < mHWData->mCPUCount; i++) 1598 { 1444 for (unsigned i = 0; i < mHWData->mCPUCount; ++i) 1599 1445 mHWData->mCPUAttached[i] = true; 1600 }1601 1446 } 1602 1447 else … … 1609 1454 unsigned iHighestId = 0; 1610 1455 1611 for (unsigned i = 0; i < SchemaDefs::MaxCPUCount; i++)1456 for (unsigned i = 0; i < SchemaDefs::MaxCPUCount; ++i) 1612 1457 { 1613 1458 if (mHWData->mCPUAttached[i]) … … 1623 1468 tr("CPU hotplugging can't be disabled because the maximum number of CPUs is not equal to the amount of CPUs attached")); 1624 1469 1625 setModified(IsModified_MachineData);1470 i_setModified(IsModified_MachineData); 1626 1471 mHWData.backup(); 1627 1472 } 1628 1473 } 1629 1474 1630 mHWData->mCPUHotPlugEnabled = a Enabled;1475 mHWData->mCPUHotPlugEnabled = aCPUHotPlugEnabled; 1631 1476 1632 1477 return rc; 1633 1478 } 1634 1479 1635 STDMETHODIMP Machine::COMGETTER(EmulatedUSBCardReaderEnabled)(BOOL *aEnabled)1480 HRESULT Machine::getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled) 1636 1481 { 1637 1482 #ifdef VBOX_WITH_USB_CARDREADER 1638 CheckComArgOutPointerValid(aEnabled);1639 1640 AutoCaller autoCaller(this);1641 if (FAILED(autoCaller.rc())) return autoCaller.rc();1642 1643 1483 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1644 1484 1645 *aE nabled = mHWData->mEmulatedUSBCardReaderEnabled;1485 *aEmulatedUSBCardReaderEnabled = mHWData->mEmulatedUSBCardReaderEnabled; 1646 1486 1647 1487 return S_OK; 1648 1488 #else 1649 NOREF(aE nabled);1489 NOREF(aEmulatedUSBCardReaderEnabled); 1650 1490 return E_NOTIMPL; 1651 1491 #endif 1652 1492 } 1653 1493 1654 STDMETHODIMP Machine::COMSETTER(EmulatedUSBCardReaderEnabled)(BOOL aEnabled)1494 HRESULT Machine::setEmulatedUSBCardReaderEnabled(BOOL aEmulatedUSBCardReaderEnabled) 1655 1495 { 1656 1496 #ifdef VBOX_WITH_USB_CARDREADER 1657 AutoCaller autoCaller(this);1658 if (FAILED(autoCaller.rc())) return autoCaller.rc();1659 1497 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1660 1498 1661 HRESULT rc = checkStateDependency(MutableStateDep);1499 HRESULT rc = i_checkStateDependency(MutableStateDep); 1662 1500 if (FAILED(rc)) return rc; 1663 1501 1664 setModified(IsModified_MachineData);1502 i_setModified(IsModified_MachineData); 1665 1503 mHWData.backup(); 1666 mHWData->mEmulatedUSBCardReaderEnabled = aE nabled;1504 mHWData->mEmulatedUSBCardReaderEnabled = aEmulatedUSBCardReaderEnabled; 1667 1505 1668 1506 return S_OK; 1669 1507 #else 1670 NOREF(aE nabled);1508 NOREF(aEmulatedUSBCardReaderEnabled); 1671 1509 return E_NOTIMPL; 1672 1510 #endif 1673 1511 } 1674 1512 1675 STDMETHODIMP Machine::COMGETTER(HPETEnabled)(BOOL *aEnabled) 1676 { 1677 CheckComArgOutPointerValid(aEnabled); 1678 1679 AutoCaller autoCaller(this); 1680 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1513 HRESULT Machine::getHPETEnabled(BOOL *aHPETEnabled) 1514 { 1681 1515 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1682 1516 1683 *a Enabled = mHWData->mHPETEnabled;1684 1685 return S_OK; 1686 } 1687 1688 STDMETHODIMP Machine::COMSETTER(HPETEnabled)(BOOL aEnabled)1517 *aHPETEnabled = mHWData->mHPETEnabled; 1518 1519 return S_OK; 1520 } 1521 1522 HRESULT Machine::setHPETEnabled(BOOL aHPETEnabled) 1689 1523 { 1690 1524 HRESULT rc = S_OK; 1691 1525 1692 AutoCaller autoCaller(this);1693 if (FAILED(autoCaller.rc())) return autoCaller.rc();1694 1526 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1695 1527 1696 rc = checkStateDependency(MutableStateDep);1528 rc = i_checkStateDependency(MutableStateDep); 1697 1529 if (FAILED(rc)) return rc; 1698 1530 1699 setModified(IsModified_MachineData);1531 i_setModified(IsModified_MachineData); 1700 1532 mHWData.backup(); 1701 1533 1702 mHWData->mHPETEnabled = a Enabled;1534 mHWData->mHPETEnabled = aHPETEnabled; 1703 1535 1704 1536 return rc; 1705 1537 } 1706 1538 1707 STDMETHODIMP Machine::COMGETTER(VideoCaptureEnabled)(BOOL *fEnabled) 1708 { 1709 AutoCaller autoCaller(this); 1710 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1711 1539 HRESULT Machine::getVideoCaptureEnabled(BOOL *aVideoCaptureEnabled) 1540 { 1712 1541 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1713 1542 1714 * fEnabled = mHWData->mVideoCaptureEnabled;1715 return S_OK; 1716 } 1717 1718 STDMETHODIMP Machine::COMSETTER(VideoCaptureEnabled)(BOOL fEnabled)1543 *aVideoCaptureEnabled = mHWData->mVideoCaptureEnabled; 1544 return S_OK; 1545 } 1546 1547 HRESULT Machine::setVideoCaptureEnabled(BOOL aVideoCaptureEnabled) 1719 1548 { 1720 1549 HRESULT rc = S_OK; 1721 1550 1722 AutoCaller autoCaller(this);1723 if (FAILED(autoCaller.rc())) return autoCaller.rc();1724 1551 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1725 1552 1726 setModified(IsModified_MachineData);1553 i_setModified(IsModified_MachineData); 1727 1554 mHWData.backup(); 1728 mHWData->mVideoCaptureEnabled = fEnabled;1555 mHWData->mVideoCaptureEnabled = aVideoCaptureEnabled; 1729 1556 1730 1557 alock.release(); 1731 rc = onVideoCaptureChange();1558 rc = i_onVideoCaptureChange(); 1732 1559 alock.acquire(); 1733 1560 if (FAILED(rc)) 1734 1561 { 1735 1562 /* 1736 * Normally we would do the actual change _after_ onVideoCaptureChange() succeeded.1563 * Normally we would do the actual change _after_ i_onVideoCaptureChange() succeeded. 1737 1564 * We cannot do this because that function uses Machine::GetVideoCaptureEnabled to 1738 1565 * determine if it should start or stop capturing. Therefore we need to manually … … 1745 1572 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 1746 1573 if (Global::IsOnline(mData->mMachineState)) 1747 saveSettings(NULL);1574 i_saveSettings(NULL); 1748 1575 1749 1576 return rc; 1750 1577 } 1751 1578 1752 STDMETHODIMP Machine::COMGETTER(VideoCaptureScreens)(ComSafeArrayOut(BOOL, aScreens)) 1753 { 1754 CheckComArgOutSafeArrayPointerValid(aScreens); 1755 1756 AutoCaller autoCaller(this); 1757 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1758 1579 HRESULT Machine::getVideoCaptureScreens(std::vector<BOOL> &aVideoCaptureScreens) 1580 { 1759 1581 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1760 1761 SafeArray<BOOL> screens(mHWData->mMonitorCount); 1762 for (unsigned i = 0; i < screens.size(); i++) 1763 screens[i] = mHWData->maVideoCaptureScreens[i]; 1764 screens.detachTo(ComSafeArrayOutArg(aScreens)); 1765 return S_OK; 1766 } 1767 1768 STDMETHODIMP Machine::COMSETTER(VideoCaptureScreens)(ComSafeArrayIn(BOOL, aScreens)) 1769 { 1770 SafeArray<BOOL> screens(ComSafeArrayInArg(aScreens)); 1582 aVideoCaptureScreens.resize(mHWData->mMonitorCount); 1583 for (unsigned i = 0; i < mHWData->mMonitorCount; ++i) 1584 aVideoCaptureScreens[i] = mHWData->maVideoCaptureScreens[i]; 1585 return S_OK; 1586 } 1587 1588 HRESULT Machine::setVideoCaptureScreens(const std::vector<BOOL> &aVideoCaptureScreens) 1589 { 1590 SafeArray<BOOL> screens(aVideoCaptureScreens); 1771 1591 AssertReturn(screens.size() <= RT_ELEMENTS(mHWData->maVideoCaptureScreens), E_INVALIDARG); 1772 1592 bool fChanged = false; … … 1774 1594 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1775 1595 1776 for (unsigned i = 0; i < screens.size(); i++)1596 for (unsigned i = 0; i < screens.size(); ++i) 1777 1597 { 1778 1598 if (mHWData->maVideoCaptureScreens[i] != RT_BOOL(screens[i])) … … 1785 1605 { 1786 1606 alock.release(); 1787 HRESULT rc = onVideoCaptureChange();1607 HRESULT rc = i_onVideoCaptureChange(); 1788 1608 alock.acquire(); 1789 1609 if (FAILED(rc)) return rc; 1790 setModified(IsModified_MachineData);1610 i_setModified(IsModified_MachineData); 1791 1611 1792 1612 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 1793 1613 if (Global::IsOnline(mData->mMachineState)) 1794 saveSettings(NULL); 1795 } 1796 1797 return S_OK; 1798 } 1799 1800 STDMETHODIMP Machine::COMGETTER(VideoCaptureFile)(BSTR *apFile) 1801 { 1802 AutoCaller autoCaller(this); 1803 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1804 1614 i_saveSettings(NULL); 1615 } 1616 1617 return S_OK; 1618 } 1619 1620 HRESULT Machine::getVideoCaptureFile(com::Utf8Str &aVideoCaptureFile) 1621 { 1805 1622 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1806 1623 if (mHWData->mVideoCaptureFile.isEmpty()) 1807 { 1808 Utf8Str defaultFile; 1809 getDefaultVideoCaptureFile(defaultFile); 1810 defaultFile.cloneTo(apFile); 1811 } 1624 i_getDefaultVideoCaptureFile(aVideoCaptureFile); 1812 1625 else 1813 mHWData->mVideoCaptureFile.cloneTo(apFile); 1814 return S_OK; 1815 } 1816 1817 STDMETHODIMP Machine::COMSETTER(VideoCaptureFile)(IN_BSTR aFile) 1818 { 1819 Utf8Str strFile(aFile); 1820 AutoCaller autoCaller(this); 1821 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1822 1626 aVideoCaptureFile = mHWData->mVideoCaptureFile; 1627 return S_OK; 1628 } 1629 1630 HRESULT Machine::setVideoCaptureFile(const com::Utf8Str &aVideoCaptureFile) 1631 { 1632 Utf8Str strFile(aVideoCaptureFile); 1823 1633 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1824 1634 … … 1833 1643 { 1834 1644 Utf8Str defaultFile; 1835 getDefaultVideoCaptureFile(defaultFile);1645 i_getDefaultVideoCaptureFile(defaultFile); 1836 1646 if (!RTPathCompare(strFile.c_str(), defaultFile.c_str())) 1837 1647 strFile.setNull(); 1838 1648 } 1839 1649 1840 setModified(IsModified_MachineData);1650 i_setModified(IsModified_MachineData); 1841 1651 mHWData.backup(); 1842 1652 mHWData->mVideoCaptureFile = strFile; … … 1845 1655 } 1846 1656 1847 STDMETHODIMP Machine::COMGETTER(VideoCaptureWidth)(ULONG *aHorzRes) 1848 { 1849 AutoCaller autoCaller(this); 1850 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1851 1657 HRESULT Machine::getVideoCaptureWidth(ULONG *aVideoCaptureWidth) 1658 { 1852 1659 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1853 *aHorzRes = mHWData->mVideoCaptureWidth; 1854 return S_OK; 1855 } 1856 1857 STDMETHODIMP Machine::COMSETTER(VideoCaptureWidth)(ULONG aHorzRes) 1858 { 1859 AutoCaller autoCaller(this); 1860 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1861 1660 *aVideoCaptureWidth = mHWData->mVideoCaptureWidth; 1661 return S_OK; 1662 } 1663 1664 HRESULT Machine::setVideoCaptureWidth(ULONG aVideoCaptureWidth) 1665 { 1862 1666 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1863 1667 … … 1866 1670 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1867 1671 1868 setModified(IsModified_MachineData);1672 i_setModified(IsModified_MachineData); 1869 1673 mHWData.backup(); 1870 mHWData->mVideoCaptureWidth = aHorzRes; 1871 1872 return S_OK; 1873 } 1874 1875 STDMETHODIMP Machine::COMGETTER(VideoCaptureHeight)(ULONG *aVertRes) 1876 { 1877 AutoCaller autoCaller(this); 1878 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1879 1674 mHWData->mVideoCaptureWidth = aVideoCaptureWidth; 1675 1676 return S_OK; 1677 } 1678 1679 HRESULT Machine::getVideoCaptureHeight(ULONG *aVideoCaptureHeight) 1680 { 1880 1681 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1881 *aVertRes = mHWData->mVideoCaptureHeight; 1882 return S_OK; 1883 } 1884 1885 STDMETHODIMP Machine::COMSETTER(VideoCaptureHeight)(ULONG aVertRes) 1886 { 1887 AutoCaller autoCaller(this); 1888 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1889 1682 *aVideoCaptureHeight = mHWData->mVideoCaptureHeight; 1683 return S_OK; 1684 } 1685 1686 HRESULT Machine::setVideoCaptureHeight(ULONG aVideoCaptureHeight) 1687 { 1890 1688 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1891 1689 … … 1894 1692 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1895 1693 1896 setModified(IsModified_MachineData);1694 i_setModified(IsModified_MachineData); 1897 1695 mHWData.backup(); 1898 mHWData->mVideoCaptureHeight = aVertRes; 1899 1900 return S_OK; 1901 } 1902 1903 STDMETHODIMP Machine::COMGETTER(VideoCaptureRate)(ULONG *aRate) 1904 { 1905 AutoCaller autoCaller(this); 1906 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1907 1696 mHWData->mVideoCaptureHeight = aVideoCaptureHeight; 1697 1698 return S_OK; 1699 } 1700 1701 HRESULT Machine::getVideoCaptureRate(ULONG *aVideoCaptureRate) 1702 { 1908 1703 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1909 *aRate = mHWData->mVideoCaptureRate; 1910 return S_OK; 1911 } 1912 1913 STDMETHODIMP Machine::COMSETTER(VideoCaptureRate)(ULONG aRate) 1914 { 1915 AutoCaller autoCaller(this); 1916 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1917 1704 *aVideoCaptureRate = mHWData->mVideoCaptureRate; 1705 return S_OK; 1706 } 1707 1708 HRESULT Machine::setVideoCaptureRate(ULONG aVideoCaptureRate) 1709 { 1918 1710 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1919 1711 … … 1922 1714 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1923 1715 1924 setModified(IsModified_MachineData);1716 i_setModified(IsModified_MachineData); 1925 1717 mHWData.backup(); 1926 mHWData->mVideoCaptureRate = aRate; 1927 1928 return S_OK; 1929 } 1930 1931 STDMETHODIMP Machine::COMGETTER(VideoCaptureFPS)(ULONG *aFPS) 1932 { 1933 AutoCaller autoCaller(this); 1934 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1935 1718 mHWData->mVideoCaptureRate = aVideoCaptureRate; 1719 1720 return S_OK; 1721 } 1722 1723 HRESULT Machine::getVideoCaptureFPS(ULONG *aVideoCaptureFPS) 1724 { 1936 1725 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1937 *aFPS = mHWData->mVideoCaptureFPS; 1938 return S_OK; 1939 } 1940 1941 STDMETHODIMP Machine::COMSETTER(VideoCaptureFPS)(ULONG aFPS) 1942 { 1943 AutoCaller autoCaller(this); 1944 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1945 1726 *aVideoCaptureFPS = mHWData->mVideoCaptureFPS; 1727 return S_OK; 1728 } 1729 1730 HRESULT Machine::setVideoCaptureFPS(ULONG aVideoCaptureFPS) 1731 { 1946 1732 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1947 1733 … … 1950 1736 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1951 1737 1952 setModified(IsModified_MachineData);1738 i_setModified(IsModified_MachineData); 1953 1739 mHWData.backup(); 1954 mHWData->mVideoCaptureFPS = aFPS; 1955 1956 return S_OK; 1957 } 1958 1959 STDMETHODIMP Machine::COMGETTER(GraphicsControllerType)(GraphicsControllerType_T *aGraphicsControllerType) 1960 { 1961 CheckComArgOutPointerValid(aGraphicsControllerType); 1962 1963 AutoCaller autoCaller(this); 1964 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1965 1740 mHWData->mVideoCaptureFPS = aVideoCaptureFPS; 1741 1742 return S_OK; 1743 } 1744 1745 HRESULT Machine::getGraphicsControllerType(GraphicsControllerType_T *aGraphicsControllerType) 1746 { 1966 1747 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1967 1748 … … 1971 1752 } 1972 1753 1973 STDMETHODIMP Machine::COMSETTER(GraphicsControllerType)(GraphicsControllerType_T aGraphicsControllerType)1754 HRESULT Machine::setGraphicsControllerType(GraphicsControllerType_T aGraphicsControllerType) 1974 1755 { 1975 1756 switch (aGraphicsControllerType) … … 1985 1766 } 1986 1767 1987 AutoCaller autoCaller(this);1988 if (FAILED(autoCaller.rc())) return autoCaller.rc();1989 1990 1768 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1991 1769 1992 HRESULT rc = checkStateDependency(MutableStateDep);1770 HRESULT rc = i_checkStateDependency(MutableStateDep); 1993 1771 if (FAILED(rc)) return rc; 1994 1772 1995 setModified(IsModified_MachineData);1773 i_setModified(IsModified_MachineData); 1996 1774 mHWData.backup(); 1997 1775 mHWData->mGraphicsControllerType = aGraphicsControllerType; … … 2000 1778 } 2001 1779 2002 STDMETHODIMP Machine::COMGETTER(VRAMSize)(ULONG *memorySize) 2003 { 2004 CheckComArgOutPointerValid(memorySize); 2005 2006 AutoCaller autoCaller(this); 2007 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2008 1780 HRESULT Machine::getVRAMSize(ULONG *aVRAMSize) 1781 { 2009 1782 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2010 1783 2011 * memorySize = mHWData->mVRAMSize;2012 2013 return S_OK; 2014 } 2015 2016 STDMETHODIMP Machine::COMSETTER(VRAMSize)(ULONG memorySize)1784 *aVRAMSize = mHWData->mVRAMSize; 1785 1786 return S_OK; 1787 } 1788 1789 HRESULT Machine::setVRAMSize(ULONG aVRAMSize) 2017 1790 { 2018 1791 /* check VRAM limits */ 2019 if ( memorySize < SchemaDefs::MinGuestVRAM ||2020 memorySize > SchemaDefs::MaxGuestVRAM)1792 if (aVRAMSize < SchemaDefs::MinGuestVRAM || 1793 aVRAMSize > SchemaDefs::MaxGuestVRAM) 2021 1794 return setError(E_INVALIDARG, 2022 1795 tr("Invalid VRAM size: %lu MB (must be in range [%lu, %lu] MB)"), 2023 memorySize, SchemaDefs::MinGuestVRAM, SchemaDefs::MaxGuestVRAM); 2024 2025 AutoCaller autoCaller(this); 2026 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1796 aVRAMSize, SchemaDefs::MinGuestVRAM, SchemaDefs::MaxGuestVRAM); 2027 1797 2028 1798 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2029 1799 2030 HRESULT rc = checkStateDependency(MutableStateDep);1800 HRESULT rc = i_checkStateDependency(MutableStateDep); 2031 1801 if (FAILED(rc)) return rc; 2032 1802 2033 setModified(IsModified_MachineData);1803 i_setModified(IsModified_MachineData); 2034 1804 mHWData.backup(); 2035 mHWData->mVRAMSize = memorySize;1805 mHWData->mVRAMSize = aVRAMSize; 2036 1806 2037 1807 return S_OK; … … 2039 1809 2040 1810 /** @todo this method should not be public */ 2041 STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize)(ULONG *memoryBalloonSize) 2042 { 2043 CheckComArgOutPointerValid(memoryBalloonSize); 2044 2045 AutoCaller autoCaller(this); 2046 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2047 1811 HRESULT Machine::getMemoryBalloonSize(ULONG *aMemoryBalloonSize) 1812 { 2048 1813 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2049 1814 2050 * memoryBalloonSize = mHWData->mMemoryBalloonSize;1815 *aMemoryBalloonSize = mHWData->mMemoryBalloonSize; 2051 1816 2052 1817 return S_OK; … … 2059 1824 * we have to make sure that we never call IGuest from here. 2060 1825 */ 2061 STDMETHODIMP Machine::COMSETTER(MemoryBalloonSize)(ULONG memoryBalloonSize)1826 HRESULT Machine::setMemoryBalloonSize(ULONG aMemoryBalloonSize) 2062 1827 { 2063 1828 /* This must match GMMR0Init; currently we only support memory ballooning on all 64-bit hosts except Mac OS X */ 2064 1829 #if HC_ARCH_BITS == 64 && (defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) 2065 1830 /* check limits */ 2066 if ( memoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize))1831 if (aMemoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize)) 2067 1832 return setError(E_INVALIDARG, 2068 1833 tr("Invalid memory balloon size: %lu MB (must be in range [%lu, %lu] MB)"), 2069 memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize)); 2070 2071 AutoCaller autoCaller(this); 2072 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1834 aMemoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize)); 2073 1835 2074 1836 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2075 1837 2076 setModified(IsModified_MachineData);1838 i_setModified(IsModified_MachineData); 2077 1839 mHWData.backup(); 2078 mHWData->mMemoryBalloonSize = memoryBalloonSize;1840 mHWData->mMemoryBalloonSize = aMemoryBalloonSize; 2079 1841 2080 1842 return S_OK; 2081 1843 #else 2082 NOREF( memoryBalloonSize);1844 NOREF(aMemoryBalloonSize); 2083 1845 return setError(E_NOTIMPL, tr("Memory ballooning is only supported on 64-bit hosts")); 2084 1846 #endif 2085 1847 } 2086 1848 2087 STDMETHODIMP Machine::COMGETTER(PageFusionEnabled) (BOOL *aEnabled) 2088 { 2089 CheckComArgOutPointerValid(aEnabled); 2090 2091 AutoCaller autoCaller(this); 2092 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2093 1849 HRESULT Machine::getPageFusionEnabled(BOOL *aPageFusionEnabled) 1850 { 2094 1851 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2095 1852 2096 *a Enabled = mHWData->mPageFusionEnabled;2097 return S_OK; 2098 } 2099 2100 STDMETHODIMP Machine::COMSETTER(PageFusionEnabled) (BOOL aEnabled)1853 *aPageFusionEnabled = mHWData->mPageFusionEnabled; 1854 return S_OK; 1855 } 1856 1857 HRESULT Machine::setPageFusionEnabled(BOOL aPageFusionEnabled) 2101 1858 { 2102 1859 #ifdef VBOX_WITH_PAGE_SHARING 2103 AutoCaller autoCaller(this);2104 if (FAILED(autoCaller.rc())) return autoCaller.rc();2105 2106 1860 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2107 1861 2108 1862 /** @todo must support changes for running vms and keep this in sync with IGuest. */ 2109 setModified(IsModified_MachineData);1863 i_setModified(IsModified_MachineData); 2110 1864 mHWData.backup(); 2111 mHWData->mPageFusionEnabled = a Enabled;1865 mHWData->mPageFusionEnabled = aPageFusionEnabled; 2112 1866 return S_OK; 2113 1867 #else 2114 NOREF(a Enabled);1868 NOREF(aPageFusionEnabled); 2115 1869 return setError(E_NOTIMPL, tr("Page fusion is only supported on 64-bit hosts")); 2116 1870 #endif 2117 1871 } 2118 1872 2119 STDMETHODIMP Machine::COMGETTER(Accelerate3DEnabled)(BOOL *aEnabled) 2120 { 2121 CheckComArgOutPointerValid(aEnabled); 2122 2123 AutoCaller autoCaller(this); 2124 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2125 1873 HRESULT Machine::getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled) 1874 { 2126 1875 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2127 1876 2128 *aEnabled = mHWData->mAccelerate3DEnabled; 2129 2130 return S_OK; 2131 } 2132 2133 STDMETHODIMP Machine::COMSETTER(Accelerate3DEnabled)(BOOL enable) 2134 { 2135 AutoCaller autoCaller(this); 2136 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2137 1877 *aAccelerate3DEnabled = mHWData->mAccelerate3DEnabled; 1878 1879 return S_OK; 1880 } 1881 1882 HRESULT Machine::setAccelerate3DEnabled(BOOL aAccelerate3DEnabled) 1883 { 2138 1884 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2139 1885 2140 HRESULT rc = checkStateDependency(MutableStateDep);1886 HRESULT rc = i_checkStateDependency(MutableStateDep); 2141 1887 if (FAILED(rc)) return rc; 2142 1888 2143 1889 /** @todo check validity! */ 2144 1890 2145 setModified(IsModified_MachineData);1891 i_setModified(IsModified_MachineData); 2146 1892 mHWData.backup(); 2147 mHWData->mAccelerate3DEnabled = enable; 2148 2149 return S_OK; 2150 } 2151 2152 2153 STDMETHODIMP Machine::COMGETTER(Accelerate2DVideoEnabled)(BOOL *aEnabled) 2154 { 2155 CheckComArgOutPointerValid(aEnabled); 2156 2157 AutoCaller autoCaller(this); 2158 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2159 1893 mHWData->mAccelerate3DEnabled = aAccelerate3DEnabled; 1894 1895 return S_OK; 1896 } 1897 1898 1899 HRESULT Machine::getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled) 1900 { 2160 1901 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2161 1902 2162 *aEnabled = mHWData->mAccelerate2DVideoEnabled; 2163 2164 return S_OK; 2165 } 2166 2167 STDMETHODIMP Machine::COMSETTER(Accelerate2DVideoEnabled)(BOOL enable) 2168 { 2169 AutoCaller autoCaller(this); 2170 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2171 1903 *aAccelerate2DVideoEnabled = mHWData->mAccelerate2DVideoEnabled; 1904 1905 return S_OK; 1906 } 1907 1908 HRESULT Machine::setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled) 1909 { 2172 1910 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2173 1911 2174 HRESULT rc = checkStateDependency(MutableStateDep);1912 HRESULT rc = i_checkStateDependency(MutableStateDep); 2175 1913 if (FAILED(rc)) return rc; 2176 1914 2177 1915 /** @todo check validity! */ 2178 2179 setModified(IsModified_MachineData); 1916 i_setModified(IsModified_MachineData); 2180 1917 mHWData.backup(); 2181 mHWData->mAccelerate2DVideoEnabled = enable; 2182 2183 return S_OK; 2184 } 2185 2186 STDMETHODIMP Machine::COMGETTER(MonitorCount)(ULONG *monitorCount) 2187 { 2188 CheckComArgOutPointerValid(monitorCount); 2189 2190 AutoCaller autoCaller(this); 2191 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2192 1918 mHWData->mAccelerate2DVideoEnabled = aAccelerate2DVideoEnabled; 1919 1920 return S_OK; 1921 } 1922 1923 HRESULT Machine::getMonitorCount(ULONG *aMonitorCount) 1924 { 2193 1925 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2194 1926 2195 * monitorCount = mHWData->mMonitorCount;2196 2197 return S_OK; 2198 } 2199 2200 STDMETHODIMP Machine::COMSETTER(MonitorCount)(ULONG monitorCount)1927 *aMonitorCount = mHWData->mMonitorCount; 1928 1929 return S_OK; 1930 } 1931 1932 HRESULT Machine::setMonitorCount(ULONG aMonitorCount) 2201 1933 { 2202 1934 /* make sure monitor count is a sensible number */ 2203 if ( monitorCount < 1 || monitorCount > SchemaDefs::MaxGuestMonitors)1935 if (aMonitorCount < 1 || aMonitorCount > SchemaDefs::MaxGuestMonitors) 2204 1936 return setError(E_INVALIDARG, 2205 1937 tr("Invalid monitor count: %lu (must be in range [%lu, %lu])"), 2206 monitorCount, 1, SchemaDefs::MaxGuestMonitors); 2207 2208 AutoCaller autoCaller(this); 2209 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1938 aMonitorCount, 1, SchemaDefs::MaxGuestMonitors); 2210 1939 2211 1940 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2212 1941 2213 HRESULT rc = checkStateDependency(MutableStateDep);1942 HRESULT rc = i_checkStateDependency(MutableStateDep); 2214 1943 if (FAILED(rc)) return rc; 2215 1944 2216 setModified(IsModified_MachineData);1945 i_setModified(IsModified_MachineData); 2217 1946 mHWData.backup(); 2218 mHWData->mMonitorCount = monitorCount; 2219 2220 return S_OK; 2221 } 2222 2223 STDMETHODIMP Machine::COMGETTER(BIOSSettings)(IBIOSSettings **biosSettings) 2224 { 2225 CheckComArgOutPointerValid(biosSettings); 2226 2227 AutoCaller autoCaller(this); 2228 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2229 1947 mHWData->mMonitorCount = aMonitorCount; 1948 1949 return S_OK; 1950 } 1951 1952 HRESULT Machine::getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings) 1953 { 2230 1954 /* mBIOSSettings is constant during life time, no need to lock */ 2231 mBIOSSettings.queryInterfaceTo(biosSettings); 2232 2233 return S_OK; 2234 } 2235 2236 STDMETHODIMP Machine::GetCPUProperty(CPUPropertyType_T property, BOOL *aVal) 2237 { 2238 CheckComArgOutPointerValid(aVal); 2239 2240 AutoCaller autoCaller(this); 2241 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2242 1955 mBIOSSettings.queryInterfaceTo(aBIOSSettings.asOutParam()); 1956 1957 return S_OK; 1958 } 1959 1960 HRESULT Machine::getCPUProperty(CPUPropertyType_T aProperty, BOOL *aValue) 1961 { 2243 1962 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2244 1963 2245 switch ( property)1964 switch (aProperty) 2246 1965 { 2247 1966 case CPUPropertyType_PAE: 2248 *aVal = mHWData->mPAEEnabled;1967 *aValue = mHWData->mPAEEnabled; 2249 1968 break; 2250 1969 2251 1970 case CPUPropertyType_Synthetic: 2252 *aVal = mHWData->mSyntheticCpu;1971 *aValue = mHWData->mSyntheticCpu; 2253 1972 break; 2254 1973 2255 1974 case CPUPropertyType_LongMode: 2256 1975 if (mHWData->mLongMode == settings::Hardware::LongMode_Enabled) 2257 *aVal = TRUE;1976 *aValue = TRUE; 2258 1977 else if (mHWData->mLongMode == settings::Hardware::LongMode_Disabled) 2259 *aVal = FALSE;1978 *aValue = FALSE; 2260 1979 #if HC_ARCH_BITS == 64 2261 1980 else 2262 *aVal = TRUE;1981 *aValue = TRUE; 2263 1982 #else 2264 1983 else 2265 1984 { 2266 *aVal = FALSE;1985 *aValue = FALSE; 2267 1986 2268 1987 ComPtr<IGuestOSType> ptrGuestOSType; … … 2274 1993 if (SUCCEEDED(hrc2) && fIs64Bit) 2275 1994 { 2276 ComObjPtr<Host> ptrHost = mParent-> i_host();1995 ComObjPtr<Host> ptrHost = mParent->host(); 2277 1996 alock.release(); 2278 1997 2279 1998 hrc2 = ptrHost->GetProcessorFeature(ProcessorFeature_LongMode, aVal); AssertComRC(hrc2); 2280 1999 if (FAILED(hrc2)) 2281 *aVal = FALSE;2000 *aValue = FALSE; 2282 2001 } 2283 2002 } … … 2287 2006 2288 2007 case CPUPropertyType_TripleFaultReset: 2289 *aVal = mHWData->mTripleFaultReset;2008 *aValue = mHWData->mTripleFaultReset; 2290 2009 break; 2291 2010 … … 2296 2015 } 2297 2016 2298 STDMETHODIMP Machine::SetCPUProperty(CPUPropertyType_T property, BOOL aVal) 2299 { 2300 AutoCaller autoCaller(this); 2301 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2302 2017 HRESULT Machine::setCPUProperty(CPUPropertyType_T aProperty, BOOL aValue) 2018 { 2303 2019 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2304 2020 2305 HRESULT rc = checkStateDependency(MutableStateDep);2021 HRESULT rc = i_checkStateDependency(MutableStateDep); 2306 2022 if (FAILED(rc)) return rc; 2307 2023 2308 switch ( property)2024 switch (aProperty) 2309 2025 { 2310 2026 case CPUPropertyType_PAE: 2311 setModified(IsModified_MachineData);2027 i_setModified(IsModified_MachineData); 2312 2028 mHWData.backup(); 2313 mHWData->mPAEEnabled = !!aVal ;2029 mHWData->mPAEEnabled = !!aValue; 2314 2030 break; 2315 2031 2316 2032 case CPUPropertyType_Synthetic: 2317 setModified(IsModified_MachineData);2033 i_setModified(IsModified_MachineData); 2318 2034 mHWData.backup(); 2319 mHWData->mSyntheticCpu = !!aVal ;2035 mHWData->mSyntheticCpu = !!aValue; 2320 2036 break; 2321 2037 2322 2038 case CPUPropertyType_LongMode: 2323 setModified(IsModified_MachineData);2039 i_setModified(IsModified_MachineData); 2324 2040 mHWData.backup(); 2325 mHWData->mLongMode = !aVal ? settings::Hardware::LongMode_Disabled : settings::Hardware::LongMode_Enabled;2041 mHWData->mLongMode = !aValue ? settings::Hardware::LongMode_Disabled : settings::Hardware::LongMode_Enabled; 2326 2042 break; 2327 2043 2328 2044 case CPUPropertyType_TripleFaultReset: 2329 setModified(IsModified_MachineData);2045 i_setModified(IsModified_MachineData); 2330 2046 mHWData.backup(); 2331 mHWData->mTripleFaultReset = !!aVal ;2047 mHWData->mTripleFaultReset = !!aValue; 2332 2048 break; 2333 2049 … … 2338 2054 } 2339 2055 2340 STDMETHODIMP Machine::GetCPUIDLeaf(ULONG aId, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx) 2341 { 2342 CheckComArgOutPointerValid(aValEax); 2343 CheckComArgOutPointerValid(aValEbx); 2344 CheckComArgOutPointerValid(aValEcx); 2345 CheckComArgOutPointerValid(aValEdx); 2346 2347 AutoCaller autoCaller(this); 2348 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2349 2056 HRESULT Machine::getCPUIDLeaf(ULONG aId, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx) 2057 { 2350 2058 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2351 2059 … … 2398 2106 } 2399 2107 2400 STDMETHODIMP Machine::SetCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx) 2401 { 2402 AutoCaller autoCaller(this); 2403 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2404 2108 2109 HRESULT Machine::setCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx) 2110 { 2405 2111 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2406 2112 2407 HRESULT rc = checkStateDependency(MutableStateDep);2113 HRESULT rc = i_checkStateDependency(MutableStateDep); 2408 2114 if (FAILED(rc)) return rc; 2409 2115 … … 2423 2129 AssertCompile(RT_ELEMENTS(mHWData->mCpuIdStdLeafs) == 0xB); 2424 2130 AssertRelease(aId < RT_ELEMENTS(mHWData->mCpuIdStdLeafs)); 2425 setModified(IsModified_MachineData);2131 i_setModified(IsModified_MachineData); 2426 2132 mHWData.backup(); 2427 2133 mHWData->mCpuIdStdLeafs[aId].ulId = aId; … … 2445 2151 AssertCompile(RT_ELEMENTS(mHWData->mCpuIdExtLeafs) == 0xB); 2446 2152 AssertRelease(aId - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs)); 2447 setModified(IsModified_MachineData);2153 i_setModified(IsModified_MachineData); 2448 2154 mHWData.backup(); 2449 2155 mHWData->mCpuIdExtLeafs[aId - 0x80000000].ulId = aId; … … 2460 2166 } 2461 2167 2462 STDMETHODIMP Machine::RemoveCPUIDLeaf(ULONG aId) 2463 { 2464 AutoCaller autoCaller(this); 2465 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2466 2168 HRESULT Machine::removeCPUIDLeaf(ULONG aId) 2169 { 2467 2170 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2468 2171 2469 HRESULT rc = checkStateDependency(MutableStateDep);2172 HRESULT rc = i_checkStateDependency(MutableStateDep); 2470 2173 if (FAILED(rc)) return rc; 2471 2174 … … 2485 2188 AssertCompile(RT_ELEMENTS(mHWData->mCpuIdStdLeafs) == 0xB); 2486 2189 AssertRelease(aId < RT_ELEMENTS(mHWData->mCpuIdStdLeafs)); 2487 setModified(IsModified_MachineData);2190 i_setModified(IsModified_MachineData); 2488 2191 mHWData.backup(); 2489 2192 /* Invalidate leaf. */ … … 2504 2207 AssertCompile(RT_ELEMENTS(mHWData->mCpuIdExtLeafs) == 0xB); 2505 2208 AssertRelease(aId - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs)); 2506 setModified(IsModified_MachineData);2209 i_setModified(IsModified_MachineData); 2507 2210 mHWData.backup(); 2508 2211 /* Invalidate leaf. */ … … 2516 2219 } 2517 2220 2518 STDMETHODIMP Machine::RemoveAllCPUIDLeaves() 2519 { 2520 AutoCaller autoCaller(this); 2521 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2522 2221 HRESULT Machine::removeAllCPUIDLeaves() 2222 { 2523 2223 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2524 2224 2525 HRESULT rc = checkStateDependency(MutableStateDep);2225 HRESULT rc = i_checkStateDependency(MutableStateDep); 2526 2226 if (FAILED(rc)) return rc; 2527 2227 2528 setModified(IsModified_MachineData);2228 i_setModified(IsModified_MachineData); 2529 2229 mHWData.backup(); 2530 2230 2531 2231 /* Invalidate all standard leafs. */ 2532 for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); i++)2232 for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); ++i) 2533 2233 mHWData->mCpuIdStdLeafs[i].ulId = UINT32_MAX; 2534 2234 2535 2235 /* Invalidate all extended leafs. */ 2536 for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); i++)2236 for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); ++i) 2537 2237 mHWData->mCpuIdExtLeafs[i].ulId = UINT32_MAX; 2538 2238 2539 2239 return S_OK; 2540 2240 } 2541 2542 STDMETHODIMP Machine::GetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL *aVal) 2543 { 2544 CheckComArgOutPointerValid(aVal); 2545 2546 AutoCaller autoCaller(this); 2547 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2548 2241 HRESULT Machine::getHWVirtExProperty(HWVirtExPropertyType_T aProperty, BOOL *aValue) 2242 { 2549 2243 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2550 2244 2551 switch( property)2245 switch(aProperty) 2552 2246 { 2553 2247 case HWVirtExPropertyType_Enabled: 2554 *aVal = mHWData->mHWVirtExEnabled;2248 *aValue = mHWData->mHWVirtExEnabled; 2555 2249 break; 2556 2250 2557 2251 case HWVirtExPropertyType_VPID: 2558 *aVal = mHWData->mHWVirtExVPIDEnabled;2252 *aValue = mHWData->mHWVirtExVPIDEnabled; 2559 2253 break; 2560 2254 2561 2255 case HWVirtExPropertyType_NestedPaging: 2562 *aVal = mHWData->mHWVirtExNestedPagingEnabled;2256 *aValue = mHWData->mHWVirtExNestedPagingEnabled; 2563 2257 break; 2564 2258 2565 2259 case HWVirtExPropertyType_UnrestrictedExecution: 2566 *aVal = mHWData->mHWVirtExUXEnabled;2260 *aValue = mHWData->mHWVirtExUXEnabled; 2567 2261 break; 2568 2262 2569 2263 case HWVirtExPropertyType_LargePages: 2570 *aVal = mHWData->mHWVirtExLargePagesEnabled;2264 *aValue = mHWData->mHWVirtExLargePagesEnabled; 2571 2265 #if defined(DEBUG_bird) && defined(RT_OS_LINUX) /* This feature is deadly here */ 2572 *aVal = FALSE;2266 *aValue = FALSE; 2573 2267 #endif 2574 2268 break; 2575 2269 2576 2270 case HWVirtExPropertyType_Force: 2577 *aVal = mHWData->mHWVirtExForceEnabled;2271 *aValue = mHWData->mHWVirtExForceEnabled; 2578 2272 break; 2579 2273 … … 2584 2278 } 2585 2279 2586 STDMETHODIMP Machine::SetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL aVal) 2587 { 2588 AutoCaller autoCaller(this); 2589 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2590 2280 HRESULT Machine::setHWVirtExProperty(HWVirtExPropertyType_T aProperty, BOOL aValue) 2281 { 2591 2282 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2592 2283 2593 HRESULT rc = checkStateDependency(MutableStateDep);2284 HRESULT rc = i_checkStateDependency(MutableStateDep); 2594 2285 if (FAILED(rc)) return rc; 2595 2286 2596 switch( property)2287 switch(aProperty) 2597 2288 { 2598 2289 case HWVirtExPropertyType_Enabled: 2599 setModified(IsModified_MachineData);2290 i_setModified(IsModified_MachineData); 2600 2291 mHWData.backup(); 2601 mHWData->mHWVirtExEnabled = !!aVal ;2292 mHWData->mHWVirtExEnabled = !!aValue; 2602 2293 break; 2603 2294 2604 2295 case HWVirtExPropertyType_VPID: 2605 setModified(IsModified_MachineData);2296 i_setModified(IsModified_MachineData); 2606 2297 mHWData.backup(); 2607 mHWData->mHWVirtExVPIDEnabled = !!aVal ;2298 mHWData->mHWVirtExVPIDEnabled = !!aValue; 2608 2299 break; 2609 2300 2610 2301 case HWVirtExPropertyType_NestedPaging: 2611 setModified(IsModified_MachineData);2302 i_setModified(IsModified_MachineData); 2612 2303 mHWData.backup(); 2613 mHWData->mHWVirtExNestedPagingEnabled = !!aVal ;2304 mHWData->mHWVirtExNestedPagingEnabled = !!aValue; 2614 2305 break; 2615 2306 2616 2307 case HWVirtExPropertyType_UnrestrictedExecution: 2617 setModified(IsModified_MachineData);2308 i_setModified(IsModified_MachineData); 2618 2309 mHWData.backup(); 2619 mHWData->mHWVirtExUXEnabled = !!aVal ;2310 mHWData->mHWVirtExUXEnabled = !!aValue; 2620 2311 break; 2621 2312 2622 2313 case HWVirtExPropertyType_LargePages: 2623 setModified(IsModified_MachineData);2314 i_setModified(IsModified_MachineData); 2624 2315 mHWData.backup(); 2625 mHWData->mHWVirtExLargePagesEnabled = !!aVal ;2316 mHWData->mHWVirtExLargePagesEnabled = !!aValue; 2626 2317 break; 2627 2318 2628 2319 case HWVirtExPropertyType_Force: 2629 setModified(IsModified_MachineData);2320 i_setModified(IsModified_MachineData); 2630 2321 mHWData.backup(); 2631 mHWData->mHWVirtExForceEnabled = !!aVal ;2322 mHWData->mHWVirtExForceEnabled = !!aValue; 2632 2323 break; 2633 2324 … … 2639 2330 } 2640 2331 2641 STDMETHODIMP Machine::COMGETTER(SnapshotFolder)(BSTR *aSnapshotFolder) 2642 { 2643 CheckComArgOutPointerValid(aSnapshotFolder); 2644 2645 AutoCaller autoCaller(this); 2646 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2647 2332 HRESULT Machine::getSnapshotFolder(com::Utf8Str &aSnapshotFolder) 2333 { 2648 2334 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2649 2335 2650 Utf8Str strFullSnapshotFolder; 2651 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 2652 strFullSnapshotFolder.cloneTo(aSnapshotFolder); 2653 2654 return S_OK; 2655 } 2656 2657 STDMETHODIMP Machine::COMSETTER(SnapshotFolder)(IN_BSTR aSnapshotFolder) 2336 i_calculateFullPath(mUserData->s.strSnapshotFolder, aSnapshotFolder); 2337 2338 return S_OK; 2339 } 2340 2341 HRESULT Machine::setSnapshotFolder(const com::Utf8Str &aSnapshotFolder) 2658 2342 { 2659 2343 /* @todo (r=dmik): … … 2665 2349 */ 2666 2350 2667 AutoCaller autoCaller(this);2668 if (FAILED(autoCaller.rc())) return autoCaller.rc();2669 2670 2351 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2671 2352 2672 HRESULT rc = checkStateDependency(MutableStateDep);2353 HRESULT rc = i_checkStateDependency(MutableStateDep); 2673 2354 if (FAILED(rc)) return rc; 2674 2355 … … 2677 2358 tr("The snapshot folder of a machine with snapshots cannot be changed (please delete all snapshots first)")); 2678 2359 2679 Utf8Str strSnapshotFolder0(aSnapshotFolder); // keep original 2680 2681 Utf8Str strSnapshotFolder(strSnapshotFolder0); 2360 Utf8Str strSnapshotFolder(aSnapshotFolder); // keep original 2361 2682 2362 if (strSnapshotFolder.isEmpty()) 2683 2363 strSnapshotFolder = "Snapshots"; 2684 int vrc = calculateFullPath(strSnapshotFolder,2364 int vrc = i_calculateFullPath(strSnapshotFolder, 2685 2365 strSnapshotFolder); 2686 2366 if (RT_FAILURE(vrc)) 2687 2367 return setError(E_FAIL, 2688 tr("Invalid snapshot folder '% ls' (%Rrc)"),2689 aSnapshotFolder, vrc);2690 2691 setModified(IsModified_MachineData);2368 tr("Invalid snapshot folder '%s' (%Rrc)"), 2369 strSnapshotFolder.c_str(), vrc); 2370 2371 i_setModified(IsModified_MachineData); 2692 2372 mUserData.backup(); 2693 2373 2694 copyPathRelativeToMachine(strSnapshotFolder, mUserData->s.strSnapshotFolder); 2695 2696 return S_OK; 2697 } 2698 2699 STDMETHODIMP Machine::COMGETTER(MediumAttachments)(ComSafeArrayOut(IMediumAttachment*, aAttachments)) 2700 { 2701 CheckComArgOutSafeArrayPointerValid(aAttachments); 2702 2703 AutoCaller autoCaller(this); 2704 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2705 2374 i_copyPathRelativeToMachine(strSnapshotFolder, mUserData->s.strSnapshotFolder); 2375 2376 return S_OK; 2377 } 2378 2379 HRESULT Machine::getMediumAttachments(std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments) 2380 { 2706 2381 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2707 2382 2708 SafeIfaceArray<IMediumAttachment> attachments(mMediaData->mAttachments); 2709 attachments.detachTo(ComSafeArrayOutArg(aAttachments)); 2710 2711 return S_OK; 2712 } 2713 2714 STDMETHODIMP Machine::COMGETTER(VRDEServer)(IVRDEServer **vrdeServer) 2715 { 2716 CheckComArgOutPointerValid(vrdeServer); 2717 2718 AutoCaller autoCaller(this); 2719 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2720 2383 aMediumAttachments.resize(mMediaData->mAttachments.size()); 2384 size_t i = 0; 2385 for (MediaData::AttachmentList::iterator it = mMediaData->mAttachments.begin(); 2386 it != mMediaData->mAttachments.end(); ++it, ++i) 2387 (*it).queryInterfaceTo(aMediumAttachments[i].asOutParam()); 2388 2389 return S_OK; 2390 } 2391 2392 HRESULT Machine::getVRDEServer(ComPtr<IVRDEServer> &aVRDEServer) 2393 { 2721 2394 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2722 2395 2723 2396 Assert(!!mVRDEServer); 2724 mVRDEServer.queryInterfaceTo(vrdeServer); 2725 2726 return S_OK; 2727 } 2728 2729 STDMETHODIMP Machine::COMGETTER(AudioAdapter)(IAudioAdapter **audioAdapter) 2730 { 2731 CheckComArgOutPointerValid(audioAdapter); 2732 2733 AutoCaller autoCaller(this); 2734 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2735 2397 2398 mVRDEServer.queryInterfaceTo(aVRDEServer.asOutParam()); 2399 2400 return S_OK; 2401 } 2402 2403 HRESULT Machine::getAudioAdapter(ComPtr<IAudioAdapter> &aAudioAdapter) 2404 { 2736 2405 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2737 2406 2738 mAudioAdapter.queryInterfaceTo(audioAdapter); 2739 return S_OK; 2740 } 2741 2742 STDMETHODIMP Machine::COMGETTER(USBControllers)(ComSafeArrayOut(IUSBController *, aUSBControllers)) 2407 mAudioAdapter.queryInterfaceTo(aAudioAdapter.asOutParam()); 2408 2409 return S_OK; 2410 } 2411 2412 HRESULT Machine::getUSBControllers(std::vector<ComPtr<IUSBController> > &aUSBControllers) 2743 2413 { 2744 2414 #ifdef VBOX_WITH_VUSB 2745 CheckComArgOutPointerValid(aUSBControllers);2746 2747 AutoCaller autoCaller(this);2748 if (FAILED(autoCaller.rc())) return autoCaller.rc();2749 2750 2415 clearError(); 2751 2416 MultiResult rc(S_OK); … … 2758 2423 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2759 2424 2760 SafeIfaceArray<IUSBController> ctrls(*mUSBControllers.data()); 2761 ctrls.detachTo(ComSafeArrayOutArg(aUSBControllers)); 2425 USBControllerList data = *mUSBControllers.data(); 2426 aUSBControllers.resize(data.size()); 2427 size_t i = 0; 2428 for (USBControllerList::iterator it = data.begin(); it != data.end(); ++i, ++it) 2429 (*it).queryInterfaceTo(aUSBControllers[i].asOutParam()); 2430 2762 2431 return S_OK; 2763 2432 #else … … 2770 2439 } 2771 2440 2772 STDMETHODIMP Machine::COMGETTER(USBDeviceFilters)(IUSBDeviceFilters **aUSBDeviceFilters)2441 HRESULT Machine::getUSBDeviceFilters(ComPtr<IUSBDeviceFilters> &aUSBDeviceFilters) 2773 2442 { 2774 2443 #ifdef VBOX_WITH_VUSB 2775 CheckComArgOutPointerValid(aUSBDeviceFilters);2776 2777 AutoCaller autoCaller(this);2778 if (FAILED(autoCaller.rc())) return autoCaller.rc();2779 2780 2444 clearError(); 2781 2445 MultiResult rc(S_OK); … … 2788 2452 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2789 2453 2790 return rc = mUSBDeviceFilters.queryInterfaceTo(aUSBDeviceFilters );2454 return rc = mUSBDeviceFilters.queryInterfaceTo(aUSBDeviceFilters.asOutParam()); 2791 2455 #else 2792 2456 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 2798 2462 } 2799 2463 2800 STDMETHODIMP Machine::COMGETTER(SettingsFilePath)(BSTR *aFilePath) 2801 { 2802 CheckComArgOutPointerValid(aFilePath); 2803 2804 AutoLimitedCaller autoCaller(this); 2805 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2806 2464 HRESULT Machine::getSettingsFilePath(com::Utf8Str &aSettingsFilePath) 2465 { 2807 2466 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2808 2467 2809 mData->m_strConfigFileFull.cloneTo(aFilePath); 2810 return S_OK; 2811 } 2812 2813 STDMETHODIMP Machine::COMGETTER(SettingsModified)(BOOL *aModified) 2814 { 2815 CheckComArgOutPointerValid(aModified); 2816 2817 AutoCaller autoCaller(this); 2818 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2819 2468 aSettingsFilePath = mData->m_strConfigFileFull; 2469 2470 return S_OK; 2471 } 2472 2473 HRESULT Machine::getSettingsModified(BOOL *aSettingsModified) 2474 { 2820 2475 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2821 2476 2822 HRESULT rc = checkStateDependency(MutableStateDep);2477 HRESULT rc = i_checkStateDependency(MutableStateDep); 2823 2478 if (FAILED(rc)) return rc; 2824 2479 2825 2480 if (!mData->pMachineConfigFile->fileExists()) 2826 2481 // this is a new machine, and no config file exists yet: 2827 *a Modified = TRUE;2482 *aSettingsModified = TRUE; 2828 2483 else 2829 *aModified = (mData->flModifications != 0); 2830 2831 return S_OK; 2832 } 2833 2834 STDMETHODIMP Machine::COMGETTER(SessionState)(SessionState_T *aSessionState) 2835 { 2836 CheckComArgOutPointerValid(aSessionState); 2837 2838 AutoCaller autoCaller(this); 2839 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2484 *aSettingsModified = (mData->flModifications != 0); 2485 2486 return S_OK; 2487 } 2488 2489 HRESULT Machine::getSessionState(SessionState_T *aSessionState) 2490 { 2840 2491 2841 2492 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2846 2497 } 2847 2498 2848 STDMETHODIMP Machine::COMGETTER(SessionType)(BSTR *aSessionType) 2849 { 2850 CheckComArgOutPointerValid(aSessionType); 2851 2852 AutoCaller autoCaller(this); 2853 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2854 2499 HRESULT Machine::getSessionType(com::Utf8Str &aSessionType) 2500 { 2855 2501 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2856 2502 2857 mData->mSession.mType.cloneTo(aSessionType); 2858 2859 return S_OK; 2860 } 2861 2862 STDMETHODIMP Machine::COMGETTER(SessionPID)(ULONG *aSessionPID) 2863 { 2864 CheckComArgOutPointerValid(aSessionPID); 2865 2866 AutoCaller autoCaller(this); 2867 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2868 2503 aSessionType = mData->mSession.mType; 2504 2505 return S_OK; 2506 } 2507 2508 HRESULT Machine::getSessionPID(ULONG *aSessionPID) 2509 { 2869 2510 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2870 2511 … … 2874 2515 } 2875 2516 2876 STDMETHODIMP Machine::COMGETTER(State)(MachineState_T *machineState) 2877 { 2878 CheckComArgOutPointerValid(machineState); 2879 2880 AutoCaller autoCaller(this); 2881 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2882 2517 HRESULT Machine::getState(MachineState_T *aState) 2518 { 2883 2519 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2884 2520 2885 *machineState = mData->mMachineState; 2886 2887 return S_OK; 2888 } 2889 2890 STDMETHODIMP Machine::COMGETTER(LastStateChange)(LONG64 *aLastStateChange) 2891 { 2892 CheckComArgOutPointerValid(aLastStateChange); 2893 2894 AutoCaller autoCaller(this); 2895 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2896 2521 *aState = mData->mMachineState; 2522 2523 return S_OK; 2524 } 2525 2526 HRESULT Machine::getLastStateChange(LONG64 *aLastStateChange) 2527 { 2897 2528 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2898 2529 … … 2902 2533 } 2903 2534 2904 STDMETHODIMP Machine::COMGETTER(StateFilePath)(BSTR *aStateFilePath) 2905 { 2906 CheckComArgOutPointerValid(aStateFilePath); 2907 2908 AutoCaller autoCaller(this); 2909 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2910 2535 HRESULT Machine::getStateFilePath(com::Utf8Str &aStateFilePath) 2536 { 2911 2537 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2912 2538 2913 mSSData->strStateFilePath.cloneTo(aStateFilePath); 2914 2915 return S_OK; 2916 } 2917 2918 STDMETHODIMP Machine::COMGETTER(LogFolder)(BSTR *aLogFolder) 2919 { 2920 CheckComArgOutPointerValid(aLogFolder); 2921 2922 AutoCaller autoCaller(this); 2923 AssertComRCReturnRC(autoCaller.rc()); 2924 2539 aStateFilePath = mSSData->strStateFilePath; 2540 2541 return S_OK; 2542 } 2543 2544 HRESULT Machine::getLogFolder(com::Utf8Str &aLogFolder) 2545 { 2925 2546 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2926 2547 2927 Utf8Str logFolder; 2928 getLogFolder(logFolder); 2929 logFolder.cloneTo(aLogFolder); 2930 2931 return S_OK; 2932 } 2933 2934 STDMETHODIMP Machine::COMGETTER(CurrentSnapshot) (ISnapshot **aCurrentSnapshot) 2935 { 2936 CheckComArgOutPointerValid(aCurrentSnapshot); 2937 2938 AutoCaller autoCaller(this); 2939 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2940 2548 i_getLogFolder(aLogFolder); 2549 2550 return S_OK; 2551 } 2552 2553 HRESULT Machine::getCurrentSnapshot(ComPtr<ISnapshot> &aCurrentSnapshot) 2554 { 2941 2555 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2942 2556 2943 mData->mCurrentSnapshot.queryInterfaceTo(aCurrentSnapshot); 2944 2945 return S_OK; 2946 } 2947 2948 STDMETHODIMP Machine::COMGETTER(SnapshotCount)(ULONG *aSnapshotCount) 2949 { 2950 CheckComArgOutPointerValid(aSnapshotCount); 2951 2952 AutoCaller autoCaller(this); 2953 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2954 2557 mData->mCurrentSnapshot.queryInterfaceTo(aCurrentSnapshot.asOutParam()); 2558 2559 return S_OK; 2560 } 2561 2562 HRESULT Machine::getSnapshotCount(ULONG *aSnapshotCount) 2563 { 2955 2564 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2956 2565 … … 2962 2571 } 2963 2572 2964 STDMETHODIMP Machine::COMGETTER(CurrentStateModified)(BOOL *aCurrentStateModified) 2965 { 2966 CheckComArgOutPointerValid(aCurrentStateModified); 2967 2968 AutoCaller autoCaller(this); 2969 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2970 2573 HRESULT Machine::getCurrentStateModified(BOOL *aCurrentStateModified) 2574 { 2971 2575 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2972 2576 … … 2982 2586 } 2983 2587 2984 STDMETHODIMP Machine::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders)) 2985 { 2986 CheckComArgOutSafeArrayPointerValid(aSharedFolders); 2987 2988 AutoCaller autoCaller(this); 2989 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2990 2588 HRESULT Machine::getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders) 2589 { 2991 2590 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2992 2591 2993 SafeIfaceArray<ISharedFolder> folders(mHWData->mSharedFolders); 2994 folders.detachTo(ComSafeArrayOutArg(aSharedFolders)); 2995 2996 return S_OK; 2997 } 2998 2999 STDMETHODIMP Machine::COMGETTER(ClipboardMode)(ClipboardMode_T *aClipboardMode) 3000 { 3001 CheckComArgOutPointerValid(aClipboardMode); 3002 3003 AutoCaller autoCaller(this); 3004 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3005 2592 aSharedFolders.resize(mHWData->mSharedFolders.size()); 2593 size_t i = 0; 2594 for (std::list<ComObjPtr<SharedFolder> >::iterator it = mHWData->mSharedFolders.begin(); 2595 it != mHWData->mSharedFolders.end(); ++i, ++it) 2596 (*it).queryInterfaceTo(aSharedFolders[i].asOutParam()); 2597 2598 return S_OK; 2599 } 2600 2601 HRESULT Machine::getClipboardMode(ClipboardMode_T *aClipboardMode) 2602 { 3006 2603 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3007 2604 … … 3011 2608 } 3012 2609 3013 STDMETHODIMP Machine::COMSETTER(ClipboardMode)(ClipboardMode_T aClipboardMode)2610 HRESULT Machine::setClipboardMode(ClipboardMode_T aClipboardMode) 3014 2611 { 3015 2612 HRESULT rc = S_OK; 3016 2613 3017 AutoCaller autoCaller(this);3018 if (FAILED(autoCaller.rc())) return autoCaller.rc();3019 3020 2614 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3021 2615 3022 2616 alock.release(); 3023 rc = onClipboardModeChange(aClipboardMode);2617 rc = i_onClipboardModeChange(aClipboardMode); 3024 2618 alock.acquire(); 3025 2619 if (FAILED(rc)) return rc; 3026 2620 3027 setModified(IsModified_MachineData);2621 i_setModified(IsModified_MachineData); 3028 2622 mHWData.backup(); 3029 2623 mHWData->mClipboardMode = aClipboardMode; … … 3031 2625 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 3032 2626 if (Global::IsOnline(mData->mMachineState)) 3033 saveSettings(NULL); 3034 3035 return S_OK; 3036 } 3037 3038 STDMETHODIMP Machine::COMGETTER(DnDMode)(DnDMode_T *aDnDMode) 3039 { 3040 CheckComArgOutPointerValid(aDnDMode); 3041 3042 AutoCaller autoCaller(this); 3043 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3044 2627 i_saveSettings(NULL); 2628 2629 return S_OK; 2630 } 2631 2632 HRESULT Machine::getDnDMode(DnDMode_T *aDnDMode) 2633 { 3045 2634 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3046 2635 … … 3050 2639 } 3051 2640 3052 STDMETHODIMP Machine::COMSETTER(DnDMode)(DnDMode_T aDnDMode)2641 HRESULT Machine::setDnDMode(DnDMode_T aDnDMode) 3053 2642 { 3054 2643 HRESULT rc = S_OK; 3055 2644 3056 AutoCaller autoCaller(this);3057 if (FAILED(autoCaller.rc())) return autoCaller.rc();3058 3059 2645 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3060 2646 3061 2647 alock.release(); 3062 rc = onDnDModeChange(aDnDMode); 2648 rc = i_onDnDModeChange(aDnDMode); 2649 3063 2650 alock.acquire(); 3064 2651 if (FAILED(rc)) return rc; 3065 2652 3066 setModified(IsModified_MachineData);2653 i_setModified(IsModified_MachineData); 3067 2654 mHWData.backup(); 3068 2655 mHWData->mDnDMode = aDnDMode; … … 3070 2657 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 3071 2658 if (Global::IsOnline(mData->mMachineState)) 3072 saveSettings(NULL); 3073 3074 return S_OK; 3075 } 3076 3077 STDMETHODIMP Machine::COMGETTER(GuestPropertyNotificationPatterns)(BSTR *aPatterns) 3078 { 3079 CheckComArgOutPointerValid(aPatterns); 3080 3081 AutoCaller autoCaller(this); 3082 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3083 2659 i_saveSettings(NULL); 2660 2661 return S_OK; 2662 } 2663 2664 HRESULT Machine::getGuestPropertyNotificationPatterns(com::Utf8Str &aGuestPropertyNotificationPatterns) 2665 { 3084 2666 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3085 2667 3086 2668 try 3087 2669 { 3088 mHWData->mGuestPropertyNotificationPatterns.cloneTo(aPatterns);2670 aGuestPropertyNotificationPatterns = mHWData->mGuestPropertyNotificationPatterns; 3089 2671 } 3090 2672 catch (...) … … 3096 2678 } 3097 2679 3098 STDMETHODIMP Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns) 3099 { 3100 AutoCaller autoCaller(this); 3101 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3102 2680 HRESULT Machine::setGuestPropertyNotificationPatterns(const com::Utf8Str &aGuestPropertyNotificationPatterns) 2681 { 3103 2682 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3104 2683 3105 HRESULT rc = checkStateDependency(MutableStateDep);2684 HRESULT rc = i_checkStateDependency(MutableStateDep); 3106 2685 if (FAILED(rc)) return rc; 3107 2686 3108 setModified(IsModified_MachineData);2687 i_setModified(IsModified_MachineData); 3109 2688 mHWData.backup(); 3110 mHWData->mGuestPropertyNotificationPatterns = a Patterns;2689 mHWData->mGuestPropertyNotificationPatterns = aGuestPropertyNotificationPatterns; 3111 2690 return rc; 3112 2691 } 3113 2692 3114 STDMETHODIMP Machine::COMGETTER(StorageControllers)(ComSafeArrayOut(IStorageController *, aStorageControllers)) 3115 { 3116 CheckComArgOutSafeArrayPointerValid(aStorageControllers); 3117 3118 AutoCaller autoCaller(this); 3119 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3120 2693 HRESULT Machine::getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers) 2694 { 3121 2695 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3122 3123 SafeIfaceArray<IStorageController> ctrls(*mStorageControllers.data()); 3124 ctrls.detachTo(ComSafeArrayOutArg(aStorageControllers)); 3125 3126 return S_OK; 3127 } 3128 3129 STDMETHODIMP Machine::COMGETTER(TeleporterEnabled)(BOOL *aEnabled) 3130 { 3131 CheckComArgOutPointerValid(aEnabled); 3132 3133 AutoCaller autoCaller(this); 3134 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3135 2696 StorageControllerList data = *mStorageControllers.data(); 2697 size_t i = 0; 2698 aStorageControllers.resize(data.size()); 2699 for (StorageControllerList::iterator it = data.begin(); it != data.end(); ++it, ++i) 2700 (*it).queryInterfaceTo(aStorageControllers[i].asOutParam()); 2701 return S_OK; 2702 } 2703 2704 HRESULT Machine::getTeleporterEnabled(BOOL *aEnabled) 2705 { 3136 2706 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3137 2707 … … 3141 2711 } 3142 2712 3143 STDMETHODIMP Machine::COMSETTER(TeleporterEnabled)(BOOL aEnabled) 3144 { 3145 AutoCaller autoCaller(this); 3146 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3147 2713 HRESULT Machine::setTeleporterEnabled(BOOL aTeleporterEnabled) 2714 { 3148 2715 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3149 2716 3150 2717 /* Only allow it to be set to true when PoweredOff or Aborted. 3151 2718 (Clearing it is always permitted.) */ 3152 if ( a Enabled2719 if ( aTeleporterEnabled 3153 2720 && mData->mRegistered 3154 && ( !i sSessionMachine()2721 && ( !i_isSessionMachine() 3155 2722 || ( mData->mMachineState != MachineState_PoweredOff 3156 2723 && mData->mMachineState != MachineState_Teleported … … 3163 2730 Global::stringifyMachineState(mData->mMachineState)); 3164 2731 3165 setModified(IsModified_MachineData);2732 i_setModified(IsModified_MachineData); 3166 2733 mUserData.backup(); 3167 mUserData->s.fTeleporterEnabled = !!aEnabled; 3168 3169 return S_OK; 3170 } 3171 3172 STDMETHODIMP Machine::COMGETTER(TeleporterPort)(ULONG *aPort) 3173 { 3174 CheckComArgOutPointerValid(aPort); 3175 3176 AutoCaller autoCaller(this); 3177 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3178 2734 mUserData->s.fTeleporterEnabled = !! aTeleporterEnabled; 2735 2736 return S_OK; 2737 } 2738 2739 HRESULT Machine::getTeleporterPort(ULONG *aTeleporterPort) 2740 { 3179 2741 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3180 2742 3181 *aPort = (ULONG)mUserData->s.uTeleporterPort; 3182 3183 return S_OK; 3184 } 3185 3186 STDMETHODIMP Machine::COMSETTER(TeleporterPort)(ULONG aPort) 3187 { 3188 if (aPort >= _64K) 3189 return setError(E_INVALIDARG, tr("Invalid port number %d"), aPort); 3190 3191 AutoCaller autoCaller(this); 3192 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2743 *aTeleporterPort = (ULONG)mUserData->s.uTeleporterPort; 2744 2745 return S_OK; 2746 } 2747 2748 HRESULT Machine::setTeleporterPort(ULONG aTeleporterPort) 2749 { 2750 if (aTeleporterPort >= _64K) 2751 return setError(E_INVALIDARG, tr("Invalid port number %d"), aTeleporterPort); 3193 2752 3194 2753 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3195 2754 3196 HRESULT rc = checkStateDependency(MutableStateDep);2755 HRESULT rc = i_checkStateDependency(MutableStateDep); 3197 2756 if (FAILED(rc)) return rc; 3198 2757 3199 setModified(IsModified_MachineData);2758 i_setModified(IsModified_MachineData); 3200 2759 mUserData.backup(); 3201 mUserData->s.uTeleporterPort = (uint32_t)aPort; 3202 3203 return S_OK; 3204 } 3205 3206 STDMETHODIMP Machine::COMGETTER(TeleporterAddress)(BSTR *aAddress) 3207 { 3208 CheckComArgOutPointerValid(aAddress); 3209 3210 AutoCaller autoCaller(this); 3211 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3212 2760 mUserData->s.uTeleporterPort = (uint32_t)aTeleporterPort; 2761 2762 return S_OK; 2763 } 2764 2765 HRESULT Machine::getTeleporterAddress(com::Utf8Str &aTeleporterAddress) 2766 { 3213 2767 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3214 2768 3215 mUserData->s.strTeleporterAddress.cloneTo(aAddress); 3216 3217 return S_OK; 3218 } 3219 3220 STDMETHODIMP Machine::COMSETTER(TeleporterAddress)(IN_BSTR aAddress) 3221 { 3222 AutoCaller autoCaller(this); 3223 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3224 2769 aTeleporterAddress = mUserData->s.strTeleporterAddress; 2770 2771 return S_OK; 2772 } 2773 2774 HRESULT Machine::setTeleporterAddress(const com::Utf8Str &aTeleporterAddress) 2775 { 3225 2776 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3226 2777 3227 HRESULT rc = checkStateDependency(MutableStateDep);2778 HRESULT rc = i_checkStateDependency(MutableStateDep); 3228 2779 if (FAILED(rc)) return rc; 3229 2780 3230 setModified(IsModified_MachineData);2781 i_setModified(IsModified_MachineData); 3231 2782 mUserData.backup(); 3232 mUserData->s.strTeleporterAddress = aAddress; 3233 3234 return S_OK; 3235 } 3236 3237 STDMETHODIMP Machine::COMGETTER(TeleporterPassword)(BSTR *aPassword) 3238 { 3239 CheckComArgOutPointerValid(aPassword); 3240 3241 AutoCaller autoCaller(this); 3242 HRESULT hrc = autoCaller.rc(); 3243 if (SUCCEEDED(hrc)) 3244 { 3245 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3246 mUserData->s.strTeleporterPassword.cloneTo(aPassword); 3247 } 3248 3249 return hrc; 3250 } 3251 3252 STDMETHODIMP Machine::COMSETTER(TeleporterPassword)(IN_BSTR aPassword) 2783 mUserData->s.strTeleporterAddress = aTeleporterAddress; 2784 2785 return S_OK; 2786 } 2787 2788 HRESULT Machine::getTeleporterPassword(com::Utf8Str &aTeleporterPassword) 2789 { 2790 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2791 aTeleporterPassword = mUserData->s.strTeleporterPassword; 2792 2793 return S_OK; 2794 } 2795 2796 HRESULT Machine::setTeleporterPassword(const com::Utf8Str &aTeleporterPassword) 3253 2797 { 3254 2798 /* 3255 2799 * Hash the password first. 3256 2800 */ 3257 Utf8Str strPassword(aPassword); 3258 if (!strPassword.isEmpty()) 3259 { 3260 if (VBoxIsPasswordHashed(&strPassword)) 2801 com::Utf8Str aT = aTeleporterPassword; 2802 2803 if (!aT.isEmpty()) 2804 { 2805 if (VBoxIsPasswordHashed(&aT)) 3261 2806 return setError(E_INVALIDARG, tr("Cannot set an already hashed password, only plain text password please")); 3262 VBoxHashPassword(& strPassword);2807 VBoxHashPassword(&aT); 3263 2808 } 3264 2809 … … 3266 2811 * Do the update. 3267 2812 */ 3268 Auto Caller autoCaller(this);3269 HRESULT hrc = autoCaller.rc();2813 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2814 HRESULT hrc = i_checkStateDependency(MutableStateDep); 3270 2815 if (SUCCEEDED(hrc)) 3271 2816 { 3272 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3273 hrc = checkStateDependency(MutableStateDep); 3274 if (SUCCEEDED(hrc)) 3275 { 3276 setModified(IsModified_MachineData); 3277 mUserData.backup(); 3278 mUserData->s.strTeleporterPassword = strPassword; 3279 } 2817 i_setModified(IsModified_MachineData); 2818 mUserData.backup(); 2819 mUserData->s.strTeleporterPassword = aT; 3280 2820 } 3281 2821 … … 3283 2823 } 3284 2824 3285 STDMETHODIMP Machine::COMGETTER(FaultToleranceState)(FaultToleranceState_T *aState) 3286 { 3287 CheckComArgOutPointerValid(aState); 3288 3289 AutoCaller autoCaller(this); 3290 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3291 2825 HRESULT Machine::getFaultToleranceState(FaultToleranceState_T *aFaultToleranceState) 2826 { 3292 2827 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3293 2828 3294 *aState = mUserData->s.enmFaultToleranceState; 3295 return S_OK; 3296 } 3297 3298 STDMETHODIMP Machine::COMSETTER(FaultToleranceState)(FaultToleranceState_T aState) 3299 { 3300 AutoCaller autoCaller(this); 3301 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3302 2829 *aFaultToleranceState = mUserData->s.enmFaultToleranceState; 2830 return S_OK; 2831 } 2832 2833 HRESULT Machine::setFaultToleranceState(FaultToleranceState_T aFaultToleranceState) 2834 { 3303 2835 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3304 2836 3305 2837 /* @todo deal with running state change. */ 3306 HRESULT rc = checkStateDependency(MutableStateDep);2838 HRESULT rc = i_checkStateDependency(MutableStateDep); 3307 2839 if (FAILED(rc)) return rc; 3308 2840 3309 setModified(IsModified_MachineData);2841 i_setModified(IsModified_MachineData); 3310 2842 mUserData.backup(); 3311 mUserData->s.enmFaultToleranceState = aState; 3312 return S_OK; 3313 } 3314 3315 STDMETHODIMP Machine::COMGETTER(FaultToleranceAddress)(BSTR *aAddress) 3316 { 3317 CheckComArgOutPointerValid(aAddress); 3318 3319 AutoCaller autoCaller(this); 3320 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3321 2843 mUserData->s.enmFaultToleranceState = aFaultToleranceState; 2844 return S_OK; 2845 } 2846 2847 HRESULT Machine::getFaultToleranceAddress(com::Utf8Str &aFaultToleranceAddress) 2848 { 3322 2849 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3323 2850 3324 mUserData->s.strFaultToleranceAddress.cloneTo(aAddress); 3325 return S_OK; 3326 } 3327 3328 STDMETHODIMP Machine::COMSETTER(FaultToleranceAddress)(IN_BSTR aAddress) 3329 { 3330 AutoCaller autoCaller(this); 3331 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3332 2851 aFaultToleranceAddress = mUserData->s.strFaultToleranceAddress; 2852 return S_OK; 2853 } 2854 2855 HRESULT Machine::setFaultToleranceAddress(const com::Utf8Str &aFaultToleranceAddress) 2856 { 3333 2857 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3334 2858 3335 2859 /* @todo deal with running state change. */ 3336 HRESULT rc = checkStateDependency(MutableStateDep);2860 HRESULT rc = i_checkStateDependency(MutableStateDep); 3337 2861 if (FAILED(rc)) return rc; 3338 2862 3339 setModified(IsModified_MachineData);2863 i_setModified(IsModified_MachineData); 3340 2864 mUserData.backup(); 3341 mUserData->s.strFaultToleranceAddress = aAddress; 3342 return S_OK; 3343 } 3344 3345 STDMETHODIMP Machine::COMGETTER(FaultTolerancePort)(ULONG *aPort) 3346 { 3347 CheckComArgOutPointerValid(aPort); 3348 3349 AutoCaller autoCaller(this); 3350 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3351 2865 mUserData->s.strFaultToleranceAddress = aFaultToleranceAddress; 2866 return S_OK; 2867 } 2868 2869 HRESULT Machine::getFaultTolerancePort(ULONG *aFaultTolerancePort) 2870 { 3352 2871 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3353 2872 3354 *aPort = mUserData->s.uFaultTolerancePort; 3355 return S_OK; 3356 } 3357 3358 STDMETHODIMP Machine::COMSETTER(FaultTolerancePort)(ULONG aPort) 3359 { 3360 AutoCaller autoCaller(this); 3361 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3362 2873 *aFaultTolerancePort = mUserData->s.uFaultTolerancePort; 2874 return S_OK; 2875 } 2876 2877 HRESULT Machine::setFaultTolerancePort(ULONG aFaultTolerancePort) 2878 { 3363 2879 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3364 2880 3365 2881 /* @todo deal with running state change. */ 3366 HRESULT rc = checkStateDependency(MutableStateDep);2882 HRESULT rc = i_checkStateDependency(MutableStateDep); 3367 2883 if (FAILED(rc)) return rc; 3368 2884 3369 setModified(IsModified_MachineData);2885 i_setModified(IsModified_MachineData); 3370 2886 mUserData.backup(); 3371 mUserData->s.uFaultTolerancePort = aPort; 3372 return S_OK; 3373 } 3374 3375 STDMETHODIMP Machine::COMGETTER(FaultTolerancePassword)(BSTR *aPassword) 3376 { 3377 CheckComArgOutPointerValid(aPassword); 3378 3379 AutoCaller autoCaller(this); 3380 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3381 2887 mUserData->s.uFaultTolerancePort = aFaultTolerancePort; 2888 return S_OK; 2889 } 2890 2891 HRESULT Machine::getFaultTolerancePassword(com::Utf8Str &aFaultTolerancePassword) 2892 { 3382 2893 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3383 2894 3384 mUserData->s.strFaultTolerancePassword.cloneTo(aPassword); 3385 3386 return S_OK; 3387 } 3388 3389 STDMETHODIMP Machine::COMSETTER(FaultTolerancePassword)(IN_BSTR aPassword) 3390 { 3391 AutoCaller autoCaller(this); 3392 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3393 2895 aFaultTolerancePassword = mUserData->s.strFaultTolerancePassword; 2896 2897 return S_OK; 2898 } 2899 2900 HRESULT Machine::setFaultTolerancePassword(const com::Utf8Str &aFaultTolerancePassword) 2901 { 3394 2902 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3395 2903 3396 2904 /* @todo deal with running state change. */ 3397 HRESULT rc = checkStateDependency(MutableStateDep);2905 HRESULT rc = i_checkStateDependency(MutableStateDep); 3398 2906 if (FAILED(rc)) return rc; 3399 2907 3400 setModified(IsModified_MachineData);2908 i_setModified(IsModified_MachineData); 3401 2909 mUserData.backup(); 3402 mUserData->s.strFaultTolerancePassword = aPassword; 3403 3404 return S_OK; 3405 } 3406 3407 STDMETHODIMP Machine::COMGETTER(FaultToleranceSyncInterval)(ULONG *aInterval) 3408 { 3409 CheckComArgOutPointerValid(aInterval); 3410 3411 AutoCaller autoCaller(this); 3412 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3413 2910 mUserData->s.strFaultTolerancePassword = aFaultTolerancePassword; 2911 2912 return S_OK; 2913 } 2914 2915 HRESULT Machine::getFaultToleranceSyncInterval(ULONG *aFaultToleranceSyncInterval) 2916 { 3414 2917 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3415 2918 3416 *aInterval = mUserData->s.uFaultToleranceInterval; 3417 return S_OK; 3418 } 3419 3420 STDMETHODIMP Machine::COMSETTER(FaultToleranceSyncInterval)(ULONG aInterval) 3421 { 3422 AutoCaller autoCaller(this); 3423 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3424 2919 *aFaultToleranceSyncInterval = mUserData->s.uFaultToleranceInterval; 2920 return S_OK; 2921 } 2922 2923 HRESULT Machine::setFaultToleranceSyncInterval(ULONG aFaultToleranceSyncInterval) 2924 { 3425 2925 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3426 2926 3427 2927 /* @todo deal with running state change. */ 3428 HRESULT rc = checkStateDependency(MutableStateDep);2928 HRESULT rc = i_checkStateDependency(MutableStateDep); 3429 2929 if (FAILED(rc)) return rc; 3430 2930 3431 setModified(IsModified_MachineData);2931 i_setModified(IsModified_MachineData); 3432 2932 mUserData.backup(); 3433 mUserData->s.uFaultToleranceInterval = aInterval; 3434 return S_OK; 3435 } 3436 3437 STDMETHODIMP Machine::COMGETTER(RTCUseUTC)(BOOL *aEnabled) 3438 { 3439 CheckComArgOutPointerValid(aEnabled); 3440 3441 AutoCaller autoCaller(this); 3442 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3443 2933 mUserData->s.uFaultToleranceInterval = aFaultToleranceSyncInterval; 2934 return S_OK; 2935 } 2936 2937 HRESULT Machine::getRTCUseUTC(BOOL *aRTCUseUTC) 2938 { 3444 2939 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3445 2940 3446 *aEnabled = mUserData->s.fRTCUseUTC; 3447 3448 return S_OK; 3449 } 3450 3451 STDMETHODIMP Machine::COMSETTER(RTCUseUTC)(BOOL aEnabled) 3452 { 3453 AutoCaller autoCaller(this); 3454 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3455 2941 *aRTCUseUTC = mUserData->s.fRTCUseUTC; 2942 2943 return S_OK; 2944 } 2945 2946 HRESULT Machine::setRTCUseUTC(BOOL aRTCUseUTC) 2947 { 3456 2948 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3457 2949 3458 2950 /* Only allow it to be set to true when PoweredOff or Aborted. 3459 2951 (Clearing it is always permitted.) */ 3460 if ( a Enabled2952 if ( aRTCUseUTC 3461 2953 && mData->mRegistered 3462 && ( !i sSessionMachine()2954 && ( !i_isSessionMachine() 3463 2955 || ( mData->mMachineState != MachineState_PoweredOff 3464 2956 && mData->mMachineState != MachineState_Teleported … … 3471 2963 Global::stringifyMachineState(mData->mMachineState)); 3472 2964 3473 setModified(IsModified_MachineData);2965 i_setModified(IsModified_MachineData); 3474 2966 mUserData.backup(); 3475 mUserData->s.fRTCUseUTC = !!aEnabled; 3476 3477 return S_OK; 3478 } 3479 3480 STDMETHODIMP Machine::COMGETTER(IOCacheEnabled)(BOOL *aEnabled) 3481 { 3482 CheckComArgOutPointerValid(aEnabled); 3483 3484 AutoCaller autoCaller(this); 3485 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3486 2967 mUserData->s.fRTCUseUTC = !!aRTCUseUTC; 2968 2969 return S_OK; 2970 } 2971 2972 HRESULT Machine::getIOCacheEnabled(BOOL *aIOCacheEnabled) 2973 { 3487 2974 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3488 2975 3489 *aEnabled = mHWData->mIOCacheEnabled; 3490 3491 return S_OK; 3492 } 3493 3494 STDMETHODIMP Machine::COMSETTER(IOCacheEnabled)(BOOL aEnabled) 3495 { 3496 AutoCaller autoCaller(this); 3497 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3498 2976 *aIOCacheEnabled = mHWData->mIOCacheEnabled; 2977 2978 return S_OK; 2979 } 2980 2981 HRESULT Machine::setIOCacheEnabled(BOOL aIOCacheEnabled) 2982 { 3499 2983 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3500 2984 3501 HRESULT rc = checkStateDependency(MutableStateDep);2985 HRESULT rc = i_checkStateDependency(MutableStateDep); 3502 2986 if (FAILED(rc)) return rc; 3503 2987 3504 setModified(IsModified_MachineData);2988 i_setModified(IsModified_MachineData); 3505 2989 mHWData.backup(); 3506 mHWData->mIOCacheEnabled = aEnabled; 3507 3508 return S_OK; 3509 } 3510 3511 STDMETHODIMP Machine::COMGETTER(IOCacheSize)(ULONG *aIOCacheSize) 3512 { 3513 CheckComArgOutPointerValid(aIOCacheSize); 3514 3515 AutoCaller autoCaller(this); 3516 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3517 2990 mHWData->mIOCacheEnabled = aIOCacheEnabled; 2991 2992 return S_OK; 2993 } 2994 2995 HRESULT Machine::getIOCacheSize(ULONG *aIOCacheSize) 2996 { 3518 2997 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3519 2998 … … 3523 3002 } 3524 3003 3525 STDMETHODIMP Machine::COMSETTER(IOCacheSize)(ULONG aIOCacheSize) 3526 { 3527 AutoCaller autoCaller(this); 3528 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3529 3004 HRESULT Machine::setIOCacheSize(ULONG aIOCacheSize) 3005 { 3530 3006 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3531 3007 3532 HRESULT rc = checkStateDependency(MutableStateDep);3008 HRESULT rc = i_checkStateDependency(MutableStateDep); 3533 3009 if (FAILED(rc)) return rc; 3534 3010 3535 setModified(IsModified_MachineData);3011 i_setModified(IsModified_MachineData); 3536 3012 mHWData.backup(); 3537 3013 mHWData->mIOCacheSize = aIOCacheSize; … … 3544 3020 * @note Locks objects! 3545 3021 */ 3546 STDMETHODIMP Machine::LockMachine(ISession *aSession, 3547 LockType_T lockType) 3548 { 3549 CheckComArgNotNull(aSession); 3550 3551 AutoCaller autoCaller(this); 3552 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3553 3022 HRESULT Machine::lockMachine(const ComPtr<ISession> &aSession, 3023 LockType_T aLockType) 3024 3025 { 3554 3026 /* check the session state */ 3555 3027 SessionState_T state; … … 3590 3062 3591 3063 // try again now 3592 if ( (mData->mSession.mState == SessionState_Locked) // machine is write-locked already (i.e. session machine exists) 3593 && (lockType == LockType_Shared) // caller wants a shared link to the existing session that holds the write lock: 3064 if ( (mData->mSession.mState == SessionState_Locked) // machine is write-locked already 3065 // (i.e. session machine exists) 3066 && (aLockType == LockType_Shared) // caller wants a shared link to the 3067 // existing session that holds the write lock: 3594 3068 ) 3595 3069 { … … 3724 3198 /* Get the client token ID to be passed to the client process */ 3725 3199 Utf8Str strTokenId; 3726 sessionMachine-> getTokenId(strTokenId);3200 sessionMachine->i_getTokenId(strTokenId); 3727 3201 Assert(!strTokenId.isEmpty()); 3728 3202 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 3729 3203 /* Get the client token to be passed to the client process */ 3730 ComPtr<IToken> pToken(sessionMachine-> getToken());3204 ComPtr<IToken> pToken(sessionMachine->i_getToken()); 3731 3205 /* The token is now "owned" by pToken, fix refcount */ 3732 3206 if (!pToken.isNull()) … … 3748 3222 LogFlowThisFunc(("Calling AssignMachine()...\n")); 3749 3223 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER 3750 rc = pSessionControl->AssignMachine(sessionMachine, lockType, Bstr(strTokenId).raw());3224 rc = pSessionControl->AssignMachine(sessionMachine, aLockType, Bstr(strTokenId).raw()); 3751 3225 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 3752 rc = pSessionControl->AssignMachine(sessionMachine, lockType, pToken);3226 rc = pSessionControl->AssignMachine(sessionMachine, aLockType, pToken); 3753 3227 /* Now the token is owned by the client process. */ 3754 3228 pToken.setNull(); … … 3875 3349 if (oldState != SessionState_Locked) 3876 3350 /* fire an event */ 3877 mParent->i_onSessionStateChange( getId(), SessionState_Locked);3351 mParent->i_onSessionStateChange(i_getId(), SessionState_Locked); 3878 3352 } 3879 3353 … … 3884 3358 * @note Locks objects! 3885 3359 */ 3886 STDMETHODIMP Machine::LaunchVMProcess(ISession *aSession, 3887 IN_BSTR aFrontend, 3888 IN_BSTR aEnvironment, 3889 IProgress **aProgress) 3890 { 3891 CheckComArgStr(aFrontend); 3892 Utf8Str strFrontend(aFrontend); 3360 HRESULT Machine::launchVMProcess(const ComPtr<ISession> &aSession, 3361 const com::Utf8Str &aType, 3362 const com::Utf8Str &aEnvironment, 3363 ComPtr<IProgress> &aProgress) 3364 { 3365 Utf8Str strFrontend(aType); 3893 3366 Utf8Str strEnvironment(aEnvironment); 3894 3367 /* "emergencystop" doesn't need the session, so skip the checks/interface … … 3898 3371 if (strFrontend != "emergencystop") 3899 3372 CheckComArgNotNull(aSession); 3900 CheckComArgOutPointerValid(aProgress);3901 3902 AutoCaller autoCaller(this);3903 if (FAILED(autoCaller.rc())) return autoCaller.rc();3904 3373 3905 3374 HRESULT rc = S_OK; … … 3962 3431 TRUE /* aCancelable */, 3963 3432 fTeleporterEnabled ? 20 : 10 /* uTotalOperationsWeight */, 3964 BstrFmt(tr("Creating process for virtual machine \"%s\" (%s)"), mUserData->s.strName.c_str(), strFrontend.c_str()).raw(), 3433 BstrFmt(tr("Creating process for virtual machine \"%s\" (%s)"), 3434 mUserData->s.strName.c_str(), strFrontend.c_str()).raw(), 3965 3435 2 /* uFirstOperationWeight */, 3966 3436 fTeleporterEnabled ? 3 : 1 /* cOtherProgressObjectOperations */); … … 3968 3438 if (SUCCEEDED(rc)) 3969 3439 { 3970 rc = launchVMProcess(control, strFrontend, strEnvironment, progress);3440 rc = i_launchVMProcess(control, strFrontend, strEnvironment, progress); 3971 3441 if (SUCCEEDED(rc)) 3972 3442 { 3973 progress.queryInterfaceTo(aProgress );3443 progress.queryInterfaceTo(aProgress.asOutParam()); 3974 3444 3975 3445 /* signal the client watcher thread */ … … 3977 3447 3978 3448 /* fire an event */ 3979 mParent->i_onSessionStateChange( getId(), SessionState_Spawning);3449 mParent->i_onSessionStateChange(i_getId(), SessionState_Spawning); 3980 3450 } 3981 3451 } … … 3984 3454 { 3985 3455 /* no progress object - either instant success or failure */ 3986 *aProgress = NULL;3456 aProgress = NULL; 3987 3457 3988 3458 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 4012 3482 } 4013 3483 4014 STDMETHODIMP Machine::SetBootOrder(ULONG aPosition, DeviceType_T aDevice)3484 HRESULT Machine::setBootOrder(ULONG aPosition, DeviceType_T aDevice) 4015 3485 { 4016 3486 if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition) … … 4023 3493 tr("Booting from USB device is currently not supported")); 4024 3494 4025 AutoCaller autoCaller(this);4026 if (FAILED(autoCaller.rc())) return autoCaller.rc();4027 4028 3495 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4029 3496 4030 HRESULT rc = checkStateDependency(MutableStateDep);3497 HRESULT rc = i_checkStateDependency(MutableStateDep); 4031 3498 if (FAILED(rc)) return rc; 4032 3499 4033 setModified(IsModified_MachineData);3500 i_setModified(IsModified_MachineData); 4034 3501 mHWData.backup(); 4035 3502 mHWData->mBootOrder[aPosition - 1] = aDevice; … … 4038 3505 } 4039 3506 4040 STDMETHODIMP Machine::GetBootOrder(ULONG aPosition, DeviceType_T *aDevice)3507 HRESULT Machine::getBootOrder(ULONG aPosition, DeviceType_T *aDevice) 4041 3508 { 4042 3509 if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition) … … 4045 3512 aPosition, SchemaDefs::MaxBootPosition); 4046 3513 4047 AutoCaller autoCaller(this);4048 if (FAILED(autoCaller.rc())) return autoCaller.rc();4049 4050 3514 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4051 3515 … … 4055 3519 } 4056 3520 4057 STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName, 4058 LONG aControllerPort, 4059 LONG aDevice, 4060 DeviceType_T aType, 4061 IMedium *aMedium) 4062 { 4063 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n", 4064 aControllerName, aControllerPort, aDevice, aType, aMedium)); 4065 4066 CheckComArgStrNotEmptyOrNull(aControllerName); 4067 4068 AutoCaller autoCaller(this); 4069 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3521 HRESULT Machine::attachDevice(const com::Utf8Str &aName, 3522 LONG aControllerPort, 3523 LONG aDevice, 3524 DeviceType_T aType, 3525 const ComPtr<IMedium> &aMedium) 3526 { 3527 IMedium *aM = aMedium; 3528 LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n", 3529 aName.c_str(), aControllerPort, aDevice, aType, aM)); 4070 3530 4071 3531 // request the host lock first, since might be calling Host methods for getting host drives; … … 4074 3534 AutoWriteLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4075 3535 4076 HRESULT rc = checkStateDependency(MutableStateDep);3536 HRESULT rc = i_checkStateDependency(MutableStateDep); 4077 3537 if (FAILED(rc)) return rc; 4078 3538 … … 4086 3546 /* Check for an existing controller. */ 4087 3547 ComObjPtr<StorageController> ctl; 4088 rc = getStorageControllerByName(aControllerName, ctl, true /* aSetError */);3548 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 4089 3549 if (FAILED(rc)) return rc; 4090 3550 … … 4093 3553 if (FAILED(rc)) 4094 3554 return setError(E_FAIL, 4095 tr("Could not get type of controller '% ls'"),4096 a ControllerName);3555 tr("Could not get type of controller '%s'"), 3556 aName.c_str()); 4097 3557 4098 3558 bool fSilent = false; … … 4100 3560 4101 3561 /* Check whether the flag to allow silent storage attachment reconfiguration is set. */ 4102 strReconfig = getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused"));3562 strReconfig = i_getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused")); 4103 3563 if ( mData->mMachineState == MachineState_Paused 4104 3564 && strReconfig == "1") … … 4110 3570 fHotplug = true; 4111 3571 4112 if (fHotplug && !i sControllerHotplugCapable(ctrlType))3572 if (fHotplug && !i_isControllerHotplugCapable(ctrlType)) 4113 3573 return setError(VBOX_E_INVALID_VM_STATE, 4114 tr("Controller '% ls' does not support hotplugging"),4115 a ControllerName);3574 tr("Controller '%s' does not support hotplugging"), 3575 aName.c_str()); 4116 3576 4117 3577 // check that the port and device are not out of range … … 4121 3581 /* check if the device slot is already busy */ 4122 3582 MediumAttachment *pAttachTemp; 4123 if ((pAttachTemp = findAttachment(mMediaData->mAttachments,4124 aControllerName,4125 aControllerPort,4126 aDevice)))3583 if ((pAttachTemp = i_findAttachment(mMediaData->mAttachments, 3584 Bstr(aName).raw(), 3585 aControllerPort, 3586 aDevice))) 4127 3587 { 4128 3588 Medium *pMedium = pAttachTemp->i_getMedium(); … … 4131 3591 AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS); 4132 3592 return setError(VBOX_E_OBJECT_IN_USE, 4133 tr("Medium '%s' is already attached to port %d, device %d of controller '% ls' of this virtual machine"),3593 tr("Medium '%s' is already attached to port %d, device %d of controller '%s' of this virtual machine"), 4134 3594 pMedium->i_getLocationFull().c_str(), 4135 3595 aControllerPort, 4136 3596 aDevice, 4137 a ControllerName);3597 aName.c_str()); 4138 3598 } 4139 3599 else 4140 3600 return setError(VBOX_E_OBJECT_IN_USE, 4141 tr("Device is already attached to port %d, device %d of controller '% ls' of this virtual machine"),4142 aControllerPort, aDevice, a ControllerName);4143 } 4144 4145 ComObjPtr<Medium> medium = static_cast<Medium*>(aM edium);3601 tr("Device is already attached to port %d, device %d of controller '%s' of this virtual machine"), 3602 aControllerPort, aDevice, aName.c_str()); 3603 } 3604 3605 ComObjPtr<Medium> medium = static_cast<Medium*>(aM); 4146 3606 if (aMedium && medium.isNull()) 4147 3607 return setError(E_INVALIDARG, "The given medium pointer is invalid"); … … 4152 3612 AutoWriteLock mediumLock(medium COMMA_LOCKVAL_SRC_POS); 4153 3613 4154 if ( (pAttachTemp = findAttachment(mMediaData->mAttachments, medium))3614 if ( (pAttachTemp = i_findAttachment(mMediaData->mAttachments, medium)) 4155 3615 && !medium.isNull() 4156 3616 ) … … 4204 3664 * changing attachments in which case the attachment just needs to 4205 3665 * be restored */ 4206 if ((pAttachTemp = findAttachment(oldAtts, medium)))3666 if ((pAttachTemp = i_findAttachment(oldAtts, medium))) 4207 3667 { 4208 3668 AssertReturn(!fIndirect, E_FAIL); 4209 3669 4210 3670 /* see if it's the same bus/channel/device */ 4211 if (pAttachTemp->i_matches( aControllerName, aControllerPort, aDevice))3671 if (pAttachTemp->i_matches(Bstr(aName).raw(), aControllerPort, aDevice)) 4212 3672 { 4213 3673 /* the simplest case: restore the whole attachment … … 4243 3703 if (SUCCEEDED(rc)) 4244 3704 { 4245 rc = onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);3705 rc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent); 4246 3706 /* Remove lock list in case of error. */ 4247 3707 if (FAILED(rc)) … … 4284 3744 uint32_t foundLevel = 0; 4285 3745 4286 for (MediaData::AttachmentList::const_iterator it = oldAtts.begin(); 4287 it != oldAtts.end(); 4288 ++it) 3746 for (MediaData::AttachmentList::const_iterator it = oldAtts.begin(); it != oldAtts.end(); ++it) 4289 3747 { 4290 3748 uint32_t level = 0; … … 4299 3757 /* skip the hard disk if its currently attached (we 4300 3758 * cannot attach the same hard disk twice) */ 4301 if ( findAttachment(mMediaData->mAttachments,4302 pMedium))3759 if (i_findAttachment(mMediaData->mAttachments, 3760 pMedium)) 4303 3761 continue; 4304 3762 … … 4308 3766 * descendant of medium will be used 4309 3767 */ 4310 if (pAttach->i_matches( aControllerName, aControllerPort, aDevice))3768 if (pAttach->i_matches(Bstr(aName).raw(), aControllerPort, aDevice)) 4311 3769 { 4312 3770 /* the simplest case: restore the whole attachment … … 4342 3800 if (SUCCEEDED(rc)) 4343 3801 { 4344 rc = onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);3802 rc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent); 4345 3803 /* Remove lock list in case of error. */ 4346 3804 if (FAILED(rc)) … … 4399 3857 uint32_t foundLevel = 0; 4400 3858 4401 for (MediaData::AttachmentList::const_iterator it = snapAtts.begin(); 4402 it != snapAtts.end(); 4403 ++it) 3859 for (MediaData::AttachmentList::const_iterator it = snapAtts.begin(); it != snapAtts.end(); ++it) 4404 3860 { 4405 3861 MediumAttachment *pAttach = *it; … … 4419 3875 if ( pAttach->i_getDevice() == aDevice 4420 3876 && pAttach->i_getPort() == aControllerPort 4421 && pAttach->i_getControllerName() == a ControllerName3877 && pAttach->i_getControllerName() == aName 4422 3878 ) 4423 3879 { … … 4459 3915 4460 3916 Utf8Str strFullSnapshotFolder; 4461 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);3917 i_calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 4462 3918 4463 3919 ComObjPtr<Medium> diff; … … 4474 3930 treeLock.release(); 4475 3931 alock.release(); 4476 addMediumToRegistry(medium);3932 i_addMediumToRegistry(medium); 4477 3933 alock.acquire(); 4478 3934 treeLock.acquire(); … … 4512 3968 * operation, so protect with the special state */ 4513 3969 MachineState_T oldState = mData->mMachineState; 4514 setMachineState(MachineState_SettingUp);3970 i_setMachineState(MachineState_SettingUp); 4515 3971 4516 3972 mediumLock.release(); … … 4528 3984 mediumLock.acquire(); 4529 3985 4530 setMachineState(oldState);3986 i_setMachineState(oldState); 4531 3987 } 4532 3988 } … … 4549 4005 rc = attachment->init(this, 4550 4006 medium, 4551 a ControllerName,4007 aName, 4552 4008 aControllerPort, 4553 4009 aDevice, … … 4572 4028 treeLock.release(); 4573 4029 alock.release(); 4574 addMediumToRegistry(medium);4030 i_addMediumToRegistry(medium); 4575 4031 alock.acquire(); 4576 4032 treeLock.acquire(); … … 4579 4035 4580 4036 /* success: finally remember the attachment */ 4581 setModified(IsModified_Storage);4037 i_setModified(IsModified_Storage); 4582 4038 mMediaData.backup(); 4583 4039 mMediaData->mAttachments.push_back(attachment); … … 4594 4050 4595 4051 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 4596 true /* fMediumLockWrite */,4597 NULL,4598 *pMediumLockList);4052 true /* fMediumLockWrite */, 4053 NULL, 4054 *pMediumLockList); 4599 4055 alock.acquire(); 4600 4056 if (FAILED(rc)) … … 4613 4069 if (SUCCEEDED(rc)) 4614 4070 { 4615 rc = onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent);4071 rc = i_onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent); 4616 4072 /* Remove lock list in case of error. */ 4617 4073 if (FAILED(rc)) … … 4629 4085 } 4630 4086 4631 STDMETHODIMP Machine::DetachDevice(IN_BSTR aControllerName, LONG aControllerPort, 4632 LONG aDevice) 4633 { 4634 CheckComArgStrNotEmptyOrNull(aControllerName); 4635 4636 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n", 4637 aControllerName, aControllerPort, aDevice)); 4638 4639 AutoCaller autoCaller(this); 4640 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4087 HRESULT Machine::detachDevice(const com::Utf8Str &aName, LONG aControllerPort, 4088 LONG aDevice) 4089 { 4090 LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d\n", 4091 aName.c_str(), aControllerPort, aDevice)); 4641 4092 4642 4093 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4643 4094 4644 HRESULT rc = checkStateDependency(MutableStateDep);4095 HRESULT rc = i_checkStateDependency(MutableStateDep); 4645 4096 if (FAILED(rc)) return rc; 4646 4097 … … 4649 4100 /* Check for an existing controller. */ 4650 4101 ComObjPtr<StorageController> ctl; 4651 rc = getStorageControllerByName(aControllerName, ctl, true /* aSetError */);4102 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 4652 4103 if (FAILED(rc)) return rc; 4653 4104 … … 4656 4107 if (FAILED(rc)) 4657 4108 return setError(E_FAIL, 4658 tr("Could not get type of controller '% ls'"),4659 a ControllerName);4109 tr("Could not get type of controller '%s'"), 4110 aName.c_str()); 4660 4111 4661 4112 bool fSilent = false; … … 4663 4114 4664 4115 /* Check whether the flag to allow silent storage attachment reconfiguration is set. */ 4665 strReconfig = getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused"));4116 strReconfig = i_getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused")); 4666 4117 if ( mData->mMachineState == MachineState_Paused 4667 4118 && strReconfig == "1") … … 4673 4124 fHotplug = true; 4674 4125 4675 if (fHotplug && !i sControllerHotplugCapable(ctrlType))4126 if (fHotplug && !i_isControllerHotplugCapable(ctrlType)) 4676 4127 return setError(VBOX_E_INVALID_VM_STATE, 4677 tr("Controller '% ls' does not support hotplugging"),4678 a ControllerName);4679 4680 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4681 aControllerName,4682 aControllerPort,4683 aDevice);4128 tr("Controller '%s' does not support hotplugging"), 4129 aName.c_str()); 4130 4131 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4132 Bstr(aName).raw(), 4133 aControllerPort, 4134 aDevice); 4684 4135 if (!pAttach) 4685 4136 return setError(VBOX_E_OBJECT_NOT_FOUND, 4686 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),4687 aDevice, aControllerPort, a ControllerName);4137 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4138 aDevice, aControllerPort, aName.c_str()); 4688 4139 4689 4140 if (fHotplug && !pAttach->i_getHotPluggable()) 4690 4141 return setError(VBOX_E_NOT_SUPPORTED, 4691 tr("The device slot %d on port %d of controller '% ls' does not support hotplugging"),4692 aDevice, aControllerPort, a ControllerName);4142 tr("The device slot %d on port %d of controller '%s' does not support hotplugging"), 4143 aDevice, aControllerPort, aName.c_str()); 4693 4144 4694 4145 /* … … 4699 4150 { 4700 4151 alock.release(); 4701 rc = onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent);4152 rc = i_onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent); 4702 4153 alock.acquire(); 4703 4154 } … … 4705 4156 4706 4157 /* If we are here everything went well and we can delete the implicit now. */ 4707 rc = detachDevice(pAttach, alock, NULL /* pSnapshot */);4158 rc = i_detachDevice(pAttach, alock, NULL /* pSnapshot */); 4708 4159 4709 4160 alock.release(); … … 4714 4165 } 4715 4166 4716 STDMETHODIMP Machine::PassthroughDevice(IN_BSTR aControllerName, LONG aControllerPort, 4717 LONG aDevice, BOOL aPassthrough) 4718 { 4719 CheckComArgStrNotEmptyOrNull(aControllerName); 4720 4721 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aPassthrough=%d\n", 4722 aControllerName, aControllerPort, aDevice, aPassthrough)); 4723 4724 AutoCaller autoCaller(this); 4725 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4167 HRESULT Machine::passthroughDevice(const com::Utf8Str &aName, LONG aControllerPort, 4168 LONG aDevice, BOOL aPassthrough) 4169 { 4170 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aPassthrough=%d\n", 4171 aName.c_str(), aControllerPort, aDevice, aPassthrough)); 4726 4172 4727 4173 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4728 4174 4729 HRESULT rc = checkStateDependency(MutableStateDep);4175 HRESULT rc = i_checkStateDependency(MutableStateDep); 4730 4176 if (FAILED(rc)) return rc; 4731 4177 … … 4737 4183 Global::stringifyMachineState(mData->mMachineState)); 4738 4184 4739 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4740 aControllerName,4741 aControllerPort,4742 aDevice);4185 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4186 Bstr(aName).raw(), 4187 aControllerPort, 4188 aDevice); 4743 4189 if (!pAttach) 4744 4190 return setError(VBOX_E_OBJECT_NOT_FOUND, 4745 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),4746 aDevice, aControllerPort, a ControllerName);4747 4748 4749 setModified(IsModified_Storage);4191 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4192 aDevice, aControllerPort, aName.c_str()); 4193 4194 4195 i_setModified(IsModified_Storage); 4750 4196 mMediaData.backup(); 4751 4197 … … 4754 4200 if (pAttach->i_getType() != DeviceType_DVD) 4755 4201 return setError(E_INVALIDARG, 4756 tr("Setting passthrough rejected as the device attached to device slot %d on port %d of controller '% ls' is not a DVD"),4757 aDevice, aControllerPort, a ControllerName);4202 tr("Setting passthrough rejected as the device attached to device slot %d on port %d of controller '%s' is not a DVD"), 4203 aDevice, aControllerPort, aName.c_str()); 4758 4204 pAttach->i_updatePassthrough(!!aPassthrough); 4759 4205 … … 4761 4207 } 4762 4208 4763 STDMETHODIMP Machine::TemporaryEjectDevice(IN_BSTR aControllerName, LONG aControllerPort, 4764 LONG aDevice, BOOL aTemporaryEject) 4765 { 4766 CheckComArgStrNotEmptyOrNull(aControllerName); 4767 4768 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aTemporaryEject=%d\n", 4769 aControllerName, aControllerPort, aDevice, aTemporaryEject)); 4770 4771 AutoCaller autoCaller(this); 4772 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4209 HRESULT Machine::temporaryEjectDevice(const com::Utf8Str &aName, LONG aControllerPort, 4210 LONG aDevice, BOOL aTemporaryEject) 4211 { 4212 4213 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aTemporaryEject=%d\n", 4214 aName.c_str(), aControllerPort, aDevice, aTemporaryEject)); 4773 4215 4774 4216 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4775 4217 4776 HRESULT rc = checkStateDependency(MutableStateDep);4218 HRESULT rc = i_checkStateDependency(MutableStateDep); 4777 4219 if (FAILED(rc)) return rc; 4778 4220 4779 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4780 aControllerName,4781 aControllerPort,4782 aDevice);4221 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4222 Bstr(aName).raw(), 4223 aControllerPort, 4224 aDevice); 4783 4225 if (!pAttach) 4784 4226 return setError(VBOX_E_OBJECT_NOT_FOUND, 4785 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),4786 aDevice, aControllerPort, a ControllerName);4787 4788 4789 setModified(IsModified_Storage);4227 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4228 aDevice, aControllerPort, aName.c_str()); 4229 4230 4231 i_setModified(IsModified_Storage); 4790 4232 mMediaData.backup(); 4791 4233 … … 4794 4236 if (pAttach->i_getType() != DeviceType_DVD) 4795 4237 return setError(E_INVALIDARG, 4796 tr("Setting temporary eject flag rejected as the device attached to device slot %d on port %d of controller '% ls' is not a DVD"),4797 aDevice, aControllerPort, a ControllerName);4238 tr("Setting temporary eject flag rejected as the device attached to device slot %d on port %d of controller '%s' is not a DVD"), 4239 aDevice, aControllerPort, aName.c_str()); 4798 4240 pAttach->i_updateTempEject(!!aTemporaryEject); 4799 4241 … … 4801 4243 } 4802 4244 4803 STDMETHODIMP Machine::NonRotationalDevice(IN_BSTR aControllerName, LONG aControllerPort, 4804 LONG aDevice, BOOL aNonRotational) 4805 { 4806 CheckComArgStrNotEmptyOrNull(aControllerName); 4807 4808 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aNonRotational=%d\n", 4809 aControllerName, aControllerPort, aDevice, aNonRotational)); 4810 4811 AutoCaller autoCaller(this); 4812 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4245 HRESULT Machine::nonRotationalDevice(const com::Utf8Str &aName, LONG aControllerPort, 4246 LONG aDevice, BOOL aNonRotational) 4247 { 4248 4249 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aNonRotational=%d\n", 4250 aName.c_str(), aControllerPort, aDevice, aNonRotational)); 4813 4251 4814 4252 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4815 4253 4816 HRESULT rc = checkStateDependency(MutableStateDep);4254 HRESULT rc = i_checkStateDependency(MutableStateDep); 4817 4255 if (FAILED(rc)) return rc; 4818 4256 … … 4824 4262 Global::stringifyMachineState(mData->mMachineState)); 4825 4263 4826 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4827 aControllerName,4828 aControllerPort,4829 aDevice);4264 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4265 Bstr(aName).raw(), 4266 aControllerPort, 4267 aDevice); 4830 4268 if (!pAttach) 4831 4269 return setError(VBOX_E_OBJECT_NOT_FOUND, 4832 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),4833 aDevice, aControllerPort, a ControllerName);4834 4835 4836 setModified(IsModified_Storage);4270 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4271 aDevice, aControllerPort, aName.c_str()); 4272 4273 4274 i_setModified(IsModified_Storage); 4837 4275 mMediaData.backup(); 4838 4276 … … 4841 4279 if (pAttach->i_getType() != DeviceType_HardDisk) 4842 4280 return setError(E_INVALIDARG, 4843 tr("Setting the non-rotational medium flag rejected as the device attached to device slot %d on port %d of controller '% ls' is not a hard disk"),4844 aDevice, aControllerPort, a ControllerName);4281 tr("Setting the non-rotational medium flag rejected as the device attached to device slot %d on port %d of controller '%s' is not a hard disk"), 4282 aDevice, aControllerPort, aName.c_str()); 4845 4283 pAttach->i_updateNonRotational(!!aNonRotational); 4846 4284 … … 4848 4286 } 4849 4287 4850 STDMETHODIMP Machine::SetAutoDiscardForDevice(IN_BSTR aControllerName, LONG aControllerPort, 4851 LONG aDevice, BOOL aDiscard) 4852 { 4853 CheckComArgStrNotEmptyOrNull(aControllerName); 4854 4855 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aDiscard=%d\n", 4856 aControllerName, aControllerPort, aDevice, aDiscard)); 4857 4858 AutoCaller autoCaller(this); 4859 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4288 HRESULT Machine::setAutoDiscardForDevice(const com::Utf8Str &aName, LONG aControllerPort, 4289 LONG aDevice, BOOL aDiscard) 4290 { 4291 4292 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aDiscard=%d\n", 4293 aName.c_str(), aControllerPort, aDevice, aDiscard)); 4860 4294 4861 4295 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4862 4296 4863 HRESULT rc = checkStateDependency(MutableStateDep);4297 HRESULT rc = i_checkStateDependency(MutableStateDep); 4864 4298 if (FAILED(rc)) return rc; 4865 4299 … … 4871 4305 Global::stringifyMachineState(mData->mMachineState)); 4872 4306 4873 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4874 aControllerName,4875 aControllerPort,4876 aDevice);4307 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4308 Bstr(aName).raw(), 4309 aControllerPort, 4310 aDevice); 4877 4311 if (!pAttach) 4878 4312 return setError(VBOX_E_OBJECT_NOT_FOUND, 4879 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),4880 aDevice, aControllerPort, a ControllerName);4881 4882 4883 setModified(IsModified_Storage);4313 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4314 aDevice, aControllerPort, aName.c_str()); 4315 4316 4317 i_setModified(IsModified_Storage); 4884 4318 mMediaData.backup(); 4885 4319 … … 4888 4322 if (pAttach->i_getType() != DeviceType_HardDisk) 4889 4323 return setError(E_INVALIDARG, 4890 tr("Setting the discard medium flag rejected as the device attached to device slot %d on port %d of controller '% ls' is not a hard disk"),4891 aDevice, aControllerPort, a ControllerName);4324 tr("Setting the discard medium flag rejected as the device attached to device slot %d on port %d of controller '%s' is not a hard disk"), 4325 aDevice, aControllerPort, aName.c_str()); 4892 4326 pAttach->i_updateDiscard(!!aDiscard); 4893 4327 … … 4895 4329 } 4896 4330 4897 STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aControllerPort, 4898 LONG aDevice, BOOL aHotPluggable) 4899 { 4900 CheckComArgStrNotEmptyOrNull(aControllerName); 4901 4902 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n", 4903 aControllerName, aControllerPort, aDevice, aHotPluggable)); 4904 4905 AutoCaller autoCaller(this); 4906 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4331 HRESULT Machine::setHotPluggableForDevice(const com::Utf8Str &aName, LONG aControllerPort, 4332 LONG aDevice, BOOL aHotPluggable) 4333 { 4334 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n", 4335 aName.c_str(), aControllerPort, aDevice, aHotPluggable)); 4907 4336 4908 4337 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4909 4338 4910 HRESULT rc = checkStateDependency(MutableStateDep);4339 HRESULT rc = i_checkStateDependency(MutableStateDep); 4911 4340 if (FAILED(rc)) return rc; 4912 4341 … … 4918 4347 Global::stringifyMachineState(mData->mMachineState)); 4919 4348 4920 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4921 aControllerName,4922 aControllerPort,4923 aDevice);4349 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4350 Bstr(aName).raw(), 4351 aControllerPort, 4352 aDevice); 4924 4353 if (!pAttach) 4925 4354 return setError(VBOX_E_OBJECT_NOT_FOUND, 4926 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),4927 aDevice, aControllerPort, a ControllerName);4355 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4356 aDevice, aControllerPort, aName.c_str()); 4928 4357 4929 4358 /* Check for an existing controller. */ 4930 4359 ComObjPtr<StorageController> ctl; 4931 rc = getStorageControllerByName(aControllerName, ctl, true /* aSetError */);4360 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 4932 4361 if (FAILED(rc)) return rc; 4933 4362 … … 4936 4365 if (FAILED(rc)) 4937 4366 return setError(E_FAIL, 4938 tr("Could not get type of controller '% ls'"),4939 a ControllerName);4940 4941 if (!i sControllerHotplugCapable(ctrlType))4367 tr("Could not get type of controller '%s'"), 4368 aName.c_str()); 4369 4370 if (!i_isControllerHotplugCapable(ctrlType)) 4942 4371 return setError(VBOX_E_NOT_SUPPORTED, 4943 tr("Controller '% ls' does not support changing the hot-pluggable device flag"),4944 a ControllerName);4945 4946 setModified(IsModified_Storage);4372 tr("Controller '%s' does not support changing the hot-pluggable device flag"), 4373 aName.c_str()); 4374 4375 i_setModified(IsModified_Storage); 4947 4376 mMediaData.backup(); 4948 4377 … … 4951 4380 if (pAttach->i_getType() == DeviceType_Floppy) 4952 4381 return setError(E_INVALIDARG, 4953 tr("Setting the hot-pluggable device flag rejected as the device attached to device slot %d on port %d of controller '% ls' is a floppy drive"),4954 aDevice, aControllerPort, a ControllerName);4382 tr("Setting the hot-pluggable device flag rejected as the device attached to device slot %d on port %d of controller '%s' is a floppy drive"), 4383 aDevice, aControllerPort, aName.c_str()); 4955 4384 pAttach->i_updateHotPluggable(!!aHotPluggable); 4956 4385 … … 4958 4387 } 4959 4388 4960 STDMETHODIMP Machine::SetNoBandwidthGroupForDevice(IN_BSTR aControllerName, LONG aControllerPort,4961 4389 HRESULT Machine::setNoBandwidthGroupForDevice(const com::Utf8Str &aName, LONG aControllerPort, 4390 LONG aDevice) 4962 4391 { 4963 4392 int rc = S_OK; 4964 LogFlowThisFunc(("a ControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n",4965 a ControllerName, aControllerPort, aDevice));4966 4967 rc = SetBandwidthGroupForDevice(aControllerName, aControllerPort, aDevice, NULL);4393 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n", 4394 aName.c_str(), aControllerPort, aDevice)); 4395 4396 rc = setBandwidthGroupForDevice(aName, aControllerPort, aDevice, NULL); 4968 4397 4969 4398 return rc; 4970 4399 } 4971 4400 4972 STDMETHODIMP Machine::SetBandwidthGroupForDevice(IN_BSTR aControllerName, LONG aControllerPort, 4973 LONG aDevice, IBandwidthGroup *aBandwidthGroup) 4974 { 4975 CheckComArgStrNotEmptyOrNull(aControllerName); 4976 4977 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n", 4978 aControllerName, aControllerPort, aDevice)); 4979 4980 AutoCaller autoCaller(this); 4981 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4401 HRESULT Machine::setBandwidthGroupForDevice(const com::Utf8Str &aName, LONG aControllerPort, 4402 LONG aDevice, const ComPtr<IBandwidthGroup> &aBandwidthGroup) 4403 { 4404 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n", 4405 aName.c_str(), aControllerPort, aDevice)); 4982 4406 4983 4407 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4984 4408 4985 HRESULT rc = checkStateDependency(MutableStateDep);4409 HRESULT rc = i_checkStateDependency(MutableStateDep); 4986 4410 if (FAILED(rc)) return rc; 4987 4411 … … 4993 4417 Global::stringifyMachineState(mData->mMachineState)); 4994 4418 4995 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,4996 aControllerName,4997 aControllerPort,4998 aDevice);4419 MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments, 4420 Bstr(aName).raw(), 4421 aControllerPort, 4422 aDevice); 4999 4423 if (!pAttach) 5000 4424 return setError(VBOX_E_OBJECT_NOT_FOUND, 5001 tr("No storage device attached to device slot %d on port %d of controller '% ls'"),5002 aDevice, aControllerPort, a ControllerName);5003 5004 5005 setModified(IsModified_Storage);4425 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4426 aDevice, aControllerPort, aName.c_str()); 4427 4428 4429 i_setModified(IsModified_Storage); 5006 4430 mMediaData.backup(); 5007 4431 5008 ComObjPtr<BandwidthGroup> group = static_cast<BandwidthGroup*>(aBandwidthGroup); 4432 IBandwidthGroup *iB = aBandwidthGroup; 4433 ComObjPtr<BandwidthGroup> group = static_cast<BandwidthGroup*>(iB); 5009 4434 if (aBandwidthGroup && group.isNull()) 5010 4435 return setError(E_INVALIDARG, "The given bandwidth group pointer is invalid"); … … 5017 4442 /* Get the bandwidth group object and release it - this must not fail. */ 5018 4443 ComObjPtr<BandwidthGroup> pBandwidthGroupOld; 5019 rc = getBandwidthGroup(strBandwidthGroupOld, pBandwidthGroupOld, false);4444 rc = i_getBandwidthGroup(strBandwidthGroupOld, pBandwidthGroupOld, false); 5020 4445 Assert(SUCCEEDED(rc)); 5021 4446 … … 5033 4458 } 5034 4459 5035 STDMETHODIMP Machine::AttachDeviceWithoutMedium(IN_BSTR aControllerName,5036 LONGaControllerPort,5037 LONGaDevice,5038 4460 HRESULT Machine::attachDeviceWithoutMedium(const com::Utf8Str &aName, 4461 LONG aControllerPort, 4462 LONG aDevice, 4463 DeviceType_T aType) 5039 4464 { 5040 4465 HRESULT rc = S_OK; 5041 4466 5042 LogFlowThisFunc(("a ControllerName=\"%ls\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n",5043 a ControllerName, aControllerPort, aDevice, aType));5044 5045 rc = AttachDevice( aControllerName, aControllerPort, aDevice, aType, NULL);4467 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n", 4468 aName.c_str(), aControllerPort, aDevice, aType)); 4469 4470 rc = AttachDevice(Bstr(aName).raw(), aControllerPort, aDevice, aType, NULL); 5046 4471 5047 4472 return rc; … … 5049 4474 5050 4475 5051 5052 STDMETHODIMP Machine::UnmountMedium(IN_BSTR aControllerName, 5053 LONG aControllerPort, 5054 LONG aDevice, 5055 BOOL aForce) 4476 HRESULT Machine::unmountMedium(const com::Utf8Str &aName, 4477 LONG aControllerPort, 4478 LONG aDevice, 4479 BOOL aForce) 5056 4480 { 5057 4481 int rc = S_OK; 5058 LogFlowThisFunc(("a ControllerName=\"%ls\" aControllerPort=%d aDevice=%d",5059 a ControllerName, aControllerPort, aForce));5060 5061 rc = MountMedium(aControllerName, aControllerPort, aDevice, NULL, aForce);4482 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d", 4483 aName.c_str(), aControllerPort, aForce)); 4484 4485 rc = mountMedium(aName, aControllerPort, aDevice, NULL, aForce); 5062 4486 5063 4487 return rc; 5064 4488 } 5065 4489 5066 STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName,5067 5068 5069 IMedium *aMedium,5070 4490 HRESULT Machine::mountMedium(const com::Utf8Str &aName, 4491 LONG aControllerPort, 4492 LONG aDevice, 4493 const ComPtr<IMedium> &aMedium, 4494 BOOL aForce) 5071 4495 { 5072 4496 int rc = S_OK; 5073 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aForce=%d\n", 5074 aControllerName, aControllerPort, aDevice, aForce)); 5075 5076 CheckComArgStrNotEmptyOrNull(aControllerName); 5077 5078 AutoCaller autoCaller(this); 5079 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4497 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aForce=%d\n", 4498 aName.c_str(), aControllerPort, aDevice, aForce)); 5080 4499 5081 4500 // request the host lock first, since might be calling Host methods for getting host drives; … … 5085 4504 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 5086 4505 5087 ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments,5088 aControllerName,5089 aControllerPort,5090 aDevice);4506 ComObjPtr<MediumAttachment> pAttach = i_findAttachment(mMediaData->mAttachments, 4507 Bstr(aName).raw(), 4508 aControllerPort, 4509 aDevice); 5091 4510 if (pAttach.isNull()) 5092 4511 return setError(VBOX_E_OBJECT_NOT_FOUND, 5093 tr("No drive attached to device slot %d on port %d of controller '% ls'"),5094 aDevice, aControllerPort, a ControllerName);4512 tr("No drive attached to device slot %d on port %d of controller '%s'"), 4513 aDevice, aControllerPort, aName.c_str()); 5095 4514 5096 4515 /* Remember previously mounted medium. The medium before taking the … … 5099 4518 oldmedium = pAttach->i_getMedium(); 5100 4519 5101 ComObjPtr<Medium> pMedium = static_cast<Medium*>(aMedium); 4520 IMedium *iM = aMedium; 4521 ComObjPtr<Medium> pMedium = static_cast<Medium*>(iM); 5102 4522 if (aMedium && pMedium.isNull()) 5103 4523 return setError(E_INVALIDARG, "The given medium pointer is invalid"); … … 5118 4538 default: 5119 4539 return setError(VBOX_E_INVALID_OBJECT_STATE, 5120 tr("The device at port %d, device %d of controller '% ls' of this virtual machine is not removeable"),4540 tr("The device at port %d, device %d of controller '%s' of this virtual machine is not removeable"), 5121 4541 aControllerPort, 5122 4542 aDevice, 5123 a ControllerName);5124 } 5125 } 5126 5127 setModified(IsModified_Storage);4543 aName.c_str()); 4544 } 4545 } 4546 4547 i_setModified(IsModified_Storage); 5128 4548 mMediaData.backup(); 5129 4549 … … 5131 4551 // The backup operation makes the pAttach reference point to the 5132 4552 // old settings. Re-get the correct reference. 5133 pAttach = findAttachment(mMediaData->mAttachments,5134 aControllerName,5135 aControllerPort,5136 aDevice);4553 pAttach = i_findAttachment(mMediaData->mAttachments, 4554 Bstr(aName).raw(), 4555 aControllerPort, 4556 aDevice); 5137 4557 if (!oldmedium.isNull()) 5138 4558 oldmedium->i_removeBackReference(mData->mUuid); … … 5143 4563 mediumLock.release(); 5144 4564 multiLock.release(); 5145 addMediumToRegistry(pMedium);4565 i_addMediumToRegistry(pMedium); 5146 4566 multiLock.acquire(); 5147 4567 mediumLock.acquire(); … … 5152 4572 } 5153 4573 5154 setModified(IsModified_Storage);4574 i_setModified(IsModified_Storage); 5155 4575 5156 4576 mediumLock.release(); 5157 4577 multiLock.release(); 5158 rc = onMediumChange(pAttach, aForce);4578 rc = i_onMediumChange(pAttach, aForce); 5159 4579 multiLock.acquire(); 5160 4580 mediumLock.acquire(); … … 5165 4585 if (!pMedium.isNull()) 5166 4586 pMedium->i_removeBackReference(mData->mUuid); 5167 pAttach = findAttachment(mMediaData->mAttachments,5168 aControllerName,5169 aControllerPort,5170 aDevice);4587 pAttach = i_findAttachment(mMediaData->mAttachments, 4588 Bstr(aName).raw(), 4589 aControllerPort, 4590 aDevice); 5171 4591 /* If the attachment is gone in the meantime, bail out. */ 5172 4592 if (pAttach.isNull()) … … 5185 4605 return rc; 5186 4606 } 5187 5188 STDMETHODIMP Machine::GetMedium(IN_BSTR aControllerName, 5189 LONG aControllerPort, 5190 LONG aDevice, 5191 IMedium **aMedium) 5192 { 5193 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n", 5194 aControllerName, aControllerPort, aDevice)); 5195 5196 CheckComArgStrNotEmptyOrNull(aControllerName); 5197 CheckComArgOutPointerValid(aMedium); 5198 5199 AutoCaller autoCaller(this); 5200 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4607 HRESULT Machine::getMedium(const com::Utf8Str &aName, 4608 LONG aControllerPort, 4609 LONG aDevice, 4610 ComPtr<IMedium> &aMedium) 4611 { 4612 LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n", 4613 aName.c_str(), aControllerPort, aDevice)); 5201 4614 5202 4615 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5203 4616 5204 *aMedium = NULL;5205 5206 ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments,5207 aControllerName,5208 aControllerPort,5209 aDevice);4617 aMedium = NULL; 4618 4619 ComObjPtr<MediumAttachment> pAttach = i_findAttachment(mMediaData->mAttachments, 4620 Bstr(aName).raw(), 4621 aControllerPort, 4622 aDevice); 5210 4623 if (pAttach.isNull()) 5211 4624 return setError(VBOX_E_OBJECT_NOT_FOUND, 5212 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 5213 aDevice, aControllerPort, aControllerName); 5214 5215 pAttach->i_getMedium().queryInterfaceTo(aMedium); 5216 5217 return S_OK; 5218 } 5219 5220 STDMETHODIMP Machine::GetSerialPort(ULONG slot, ISerialPort **port) 5221 { 5222 CheckComArgOutPointerValid(port); 5223 CheckComArgExpr(slot, slot < RT_ELEMENTS(mSerialPorts)); 5224 5225 AutoCaller autoCaller(this); 5226 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4625 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 4626 aDevice, aControllerPort, aName.c_str()); 4627 4628 pAttach->i_getMedium().queryInterfaceTo(aMedium.asOutParam()); 4629 4630 return S_OK; 4631 } 4632 4633 HRESULT Machine::getSerialPort(ULONG aSlot, ComPtr<ISerialPort> &aPort) 4634 { 5227 4635 5228 4636 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5229 4637 5230 mSerialPorts[slot].queryInterfaceTo(port); 5231 5232 return S_OK; 5233 } 5234 5235 STDMETHODIMP Machine::GetParallelPort(ULONG slot, IParallelPort **port) 5236 { 5237 CheckComArgOutPointerValid(port); 5238 CheckComArgExpr(slot, slot < RT_ELEMENTS(mParallelPorts)); 5239 5240 AutoCaller autoCaller(this); 5241 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5242 4638 mSerialPorts[aSlot].queryInterfaceTo(aPort.asOutParam()); 4639 4640 return S_OK; 4641 } 4642 4643 HRESULT Machine::getParallelPort(ULONG aSlot, ComPtr<IParallelPort> &aPort) 4644 { 5243 4645 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5244 4646 5245 mParallelPorts[slot].queryInterfaceTo(port); 5246 5247 return S_OK; 5248 } 5249 5250 STDMETHODIMP Machine::GetNetworkAdapter(ULONG slot, INetworkAdapter **adapter) 5251 { 5252 CheckComArgOutPointerValid(adapter); 4647 mParallelPorts[aSlot].queryInterfaceTo(aPort.asOutParam()); 4648 4649 return S_OK; 4650 } 4651 4652 HRESULT Machine::getNetworkAdapter(ULONG aSlot, ComPtr<INetworkAdapter> &aAdapter) 4653 { 5253 4654 /* Do not assert if slot is out of range, just return the advertised 5254 4655 status. testdriver/vbox.py triggers this in logVmInfo. */ 5255 if ( slot >= mNetworkAdapters.size())4656 if (aSlot >= mNetworkAdapters.size()) 5256 4657 return setError(E_INVALIDARG, 5257 4658 tr("No network adapter in slot %RU32 (total %RU32 adapters)"), 5258 slot, mNetworkAdapters.size()); 5259 5260 AutoCaller autoCaller(this); 5261 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4659 aSlot, mNetworkAdapters.size()); 5262 4660 5263 4661 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5264 4662 5265 mNetworkAdapters[slot].queryInterfaceTo(adapter); 5266 5267 return S_OK; 5268 } 5269 5270 STDMETHODIMP Machine::GetExtraDataKeys(ComSafeArrayOut(BSTR, aKeys)) 5271 { 5272 CheckComArgOutSafeArrayPointerValid(aKeys); 5273 5274 AutoCaller autoCaller(this); 5275 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5276 4663 mNetworkAdapters[aSlot].queryInterfaceTo(aAdapter.asOutParam()); 4664 4665 return S_OK; 4666 } 4667 4668 HRESULT Machine::getExtraDataKeys(std::vector<com::Utf8Str> &aKeys) 4669 { 5277 4670 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5278 4671 5279 4672 com::SafeArray<BSTR> saKeys(mData->pMachineConfigFile->mapExtraDataItems.size()); 5280 int i = 0; 4673 aKeys.resize(mData->pMachineConfigFile->mapExtraDataItems.size()); 4674 size_t i = 0; 5281 4675 for (settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.begin(); 5282 4676 it != mData->pMachineConfigFile->mapExtraDataItems.end(); 5283 4677 ++it, ++i) 5284 { 5285 const Utf8Str &strKey = it->first; 5286 strKey.cloneTo(&saKeys[i]); 5287 } 5288 saKeys.detachTo(ComSafeArrayOutArg(aKeys)); 5289 5290 return S_OK; 5291 } 4678 aKeys[i] = it->first; 4679 4680 return S_OK; 4681 } 5292 4682 5293 4683 /** 5294 4684 * @note Locks this object for reading. 5295 4685 */ 5296 STDMETHODIMP Machine::GetExtraData(IN_BSTR aKey, 5297 BSTR *aValue) 5298 { 5299 CheckComArgStrNotEmptyOrNull(aKey); 5300 CheckComArgOutPointerValid(aValue); 5301 5302 AutoCaller autoCaller(this); 5303 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5304 4686 HRESULT Machine::getExtraData(const com::Utf8Str &aKey, 4687 com::Utf8Str &aValue) 4688 { 5305 4689 /* start with nothing found */ 5306 Bstr bstrResult("");4690 aValue = ""; 5307 4691 5308 4692 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5309 4693 5310 settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find( Utf8Str(aKey));4694 settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(aKey); 5311 4695 if (it != mData->pMachineConfigFile->mapExtraDataItems.end()) 5312 4696 // found: 5313 bstrResult= it->second; // source is a Utf8Str4697 aValue = it->second; // source is a Utf8Str 5314 4698 5315 4699 /* return the result to caller (may be empty) */ 5316 bstrResult.cloneTo(aValue);5317 5318 4700 return S_OK; 5319 4701 } … … 5322 4704 * @note Locks mParent for writing + this object for writing. 5323 4705 */ 5324 STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue) 5325 { 5326 CheckComArgStrNotEmptyOrNull(aKey); 5327 5328 AutoCaller autoCaller(this); 5329 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5330 5331 Utf8Str strKey(aKey); 5332 Utf8Str strValue(aValue); 4706 HRESULT Machine::setExtraData(const com::Utf8Str &aKey, const com::Utf8Str &aValue) 4707 { 5333 4708 Utf8Str strOldValue; // empty 5334 4709 … … 5343 4718 { 5344 4719 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); // hold read lock only while looking up 5345 settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find( strKey);4720 settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(aKey); 5346 4721 if (it != mData->pMachineConfigFile->mapExtraDataItems.end()) 5347 4722 strOldValue = it->second; … … 5349 4724 5350 4725 bool fChanged; 5351 if ((fChanged = (strOldValue != strValue)))4726 if ((fChanged = (strOldValue != aValue))) 5352 4727 { 5353 4728 // ask for permission from all listeners outside the locks; … … 5357 4732 Bstr bstrValue(aValue); 5358 4733 5359 if (!mParent->i_onExtraDataCanChange(mData->mUuid, aKey, bstrValue.raw(), error))4734 if (!mParent->i_onExtraDataCanChange(mData->mUuid, Bstr(aKey).raw(), bstrValue.raw(), error)) 5360 4735 { 5361 4736 const char *sep = error.isEmpty() ? "" : ": "; … … 5364 4739 sep, err)); 5365 4740 return setError(E_ACCESSDENIED, 5366 tr("Could not set extra data because someone refused the requested change of '% ls' to '%ls'%s%ls"),5367 aKey ,5368 bstrValue.raw(),4741 tr("Could not set extra data because someone refused the requested change of '%s' to '%s'%s%ls"), 4742 aKey.c_str(), 4743 aValue.c_str(), 5369 4744 sep, 5370 4745 err); … … 5374 4749 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5375 4750 5376 if (i sSnapshotMachine())5377 { 5378 HRESULT rc = checkStateDependency(MutableStateDep);4751 if (i_isSnapshotMachine()) 4752 { 4753 HRESULT rc = i_checkStateDependency(MutableStateDep); 5379 4754 if (FAILED(rc)) return rc; 5380 4755 } 5381 4756 5382 if ( strValue.isEmpty())5383 mData->pMachineConfigFile->mapExtraDataItems.erase( strKey);4757 if (aValue.isEmpty()) 4758 mData->pMachineConfigFile->mapExtraDataItems.erase(aKey); 5384 4759 else 5385 mData->pMachineConfigFile->mapExtraDataItems[ strKey] = strValue;4760 mData->pMachineConfigFile->mapExtraDataItems[aKey] = aValue; 5386 4761 // creates a new key if needed 5387 4762 5388 4763 bool fNeedsGlobalSaveSettings = false; 5389 saveSettings(&fNeedsGlobalSaveSettings);4764 i_saveSettings(&fNeedsGlobalSaveSettings); 5390 4765 5391 4766 if (fNeedsGlobalSaveSettings) … … 5400 4775 // fire notification outside the lock 5401 4776 if (fChanged) 5402 mParent->i_onExtraDataChange(mData->mUuid, aKey, aValue); 5403 5404 return S_OK; 5405 } 5406 5407 STDMETHODIMP Machine::SetSettingsFilePath(IN_BSTR aFilePath, IProgress **aProgress) 5408 { 5409 CheckComArgStrNotEmptyOrNull(aFilePath); 5410 CheckComArgOutPointerValid(aProgress); 5411 5412 AutoCaller autoCaller(this); 5413 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5414 5415 *aProgress = NULL; 4777 mParent->i_onExtraDataChange(mData->mUuid, Bstr(aKey).raw(), Bstr(aValue).raw()); 4778 4779 return S_OK; 4780 } 4781 4782 HRESULT Machine::setSettingsFilePath(const com::Utf8Str &aSettingsFilePath, ComPtr<IProgress> &aProgress) 4783 { 4784 aProgress = NULL; 4785 NOREF(aSettingsFilePath); 5416 4786 ReturnComNotImplemented(); 5417 4787 } 5418 4788 5419 STDMETHODIMP Machine::SaveSettings() 5420 { 5421 AutoCaller autoCaller(this); 5422 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5423 4789 HRESULT Machine::saveSettings() 4790 { 5424 4791 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 5425 4792 5426 4793 /* when there was auto-conversion, we want to save the file even if 5427 4794 * the VM is saved */ 5428 HRESULT rc = checkStateDependency(MutableOrSavedStateDep);4795 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep); 5429 4796 if (FAILED(rc)) return rc; 5430 4797 … … 5434 4801 /* save all VM data excluding snapshots */ 5435 4802 bool fNeedsGlobalSaveSettings = false; 5436 rc = saveSettings(&fNeedsGlobalSaveSettings);4803 rc = i_saveSettings(&fNeedsGlobalSaveSettings); 5437 4804 mlock.release(); 5438 4805 … … 5447 4814 } 5448 4815 5449 STDMETHODIMP Machine::DiscardSettings() 5450 { 5451 AutoCaller autoCaller(this); 5452 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5453 4816 4817 HRESULT Machine::discardSettings() 4818 { 5454 4819 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5455 4820 5456 HRESULT rc = checkStateDependency(MutableStateDep);4821 HRESULT rc = i_checkStateDependency(MutableStateDep); 5457 4822 if (FAILED(rc)) return rc; 5458 4823 … … 5461 4826 * been actually changed 5462 4827 */ 5463 rollback(true /* aNotify */);4828 i_rollback(true /* aNotify */); 5464 4829 5465 4830 return S_OK; … … 5467 4832 5468 4833 /** @note Locks objects! */ 5469 STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,5470 ComSafeArrayOut(IMedium*, aMedia))4834 HRESULT Machine::unregister(CleanupMode_T aCleanupMode, 4835 std::vector<ComPtr<IMedium> > &aMedia) 5471 4836 { 5472 4837 // use AutoLimitedCaller because this call is valid on inaccessible machines as well … … 5476 4841 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5477 4842 5478 Guid id( getId());4843 Guid id(i_getId()); 5479 4844 5480 4845 if (mData->mSession.mState != SessionState_Unlocked) … … 5484 4849 5485 4850 // wait for state dependents to drop to zero 5486 ensureNoStateDependencies();4851 i_ensureNoStateDependencies(); 5487 4852 5488 4853 if (!mData->mAccessible) … … 5498 4863 5499 4864 mParent->i_unregisterMachine(this, id); 5500 // calls VirtualBox:: saveSettings()4865 // calls VirtualBox::i_saveSettings() 5501 4866 5502 4867 return S_OK; … … 5522 4887 if (mData->mFirstSnapshot) 5523 4888 cSnapshots = mData->mFirstSnapshot->i_getAllChildrenCount() + 1; 5524 if (cSnapshots && cleanupMode == CleanupMode_UnregisterOnly)4889 if (cSnapshots && aCleanupMode == CleanupMode_UnregisterOnly) 5525 4890 // fail now before we start detaching media 5526 4891 return setError(VBOX_E_INVALID_OBJECT_STATE, … … 5544 4909 { 5545 4910 // we have media attachments: detach them all and add the Medium objects to our list 5546 if ( cleanupMode != CleanupMode_UnregisterOnly)5547 detachAllMedia(alock, NULL /* pSnapshot */, cleanupMode, llMedia);4911 if (aCleanupMode != CleanupMode_UnregisterOnly) 4912 i_detachAllMedia(alock, NULL /* pSnapshot */, aCleanupMode, llMedia); 5548 4913 else 5549 4914 return setError(VBOX_E_INVALID_OBJECT_STATE, … … 5571 4936 5572 4937 // GO! 5573 pFirstSnapshot->i_uninitRecursively(alock, cleanupMode, llMedia, mData->llFilesToDelete);4938 pFirstSnapshot->i_uninitRecursively(alock, aCleanupMode, llMedia, mData->llFilesToDelete); 5574 4939 5575 4940 mData->mMachineState = oldState; … … 5578 4943 if (FAILED(rc)) 5579 4944 { 5580 rollbackMedia();4945 i_rollbackMedia(); 5581 4946 return rc; 5582 4947 } 5583 4948 5584 4949 // commit all the media changes made above 5585 commitMedia();4950 i_commitMedia(); 5586 4951 5587 4952 mData->mRegistered = false; … … 5591 4956 5592 4957 // return media to caller 5593 SafeIfaceArray<IMedium> sfaMedia(llMedia); 5594 sfaMedia.detachTo(ComSafeArrayOutArg(aMedia)); 4958 size_t i = 0; 4959 aMedia.resize(llMedia.size()); 4960 for (MediaList::iterator it = llMedia.begin(); it != llMedia.end(); ++it, ++i) 4961 (*it).queryInterfaceTo(aMedia[i].asOutParam()); 5595 4962 5596 4963 mParent->i_unregisterMachine(this, id); 5597 // calls VirtualBox:: saveSettings() and VirtualBox::i_saveModifiedRegistries()4964 // calls VirtualBox::i_saveSettings() and VirtualBox::saveModifiedRegistries() 5598 4965 5599 4966 return S_OK; … … 5608 4975 }; 5609 4976 5610 STDMETHODIMP Machine::DeleteConfig(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress) 5611 { 5612 LogFlowFuncEnter(); 5613 5614 AutoCaller autoCaller(this); 5615 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5616 4977 HRESULT Machine::deleteConfig(const std::vector<ComPtr<IMedium> > &aMedia, ComPtr<IProgress> &aProgress) 4978 { 5617 4979 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5618 4980 5619 HRESULT rc = checkStateDependency(MutableStateDep);4981 HRESULT rc = i_checkStateDependency(MutableStateDep); 5620 4982 if (FAILED(rc)) return rc; 5621 4983 … … 5626 4988 DeleteTask *pTask = new DeleteTask; 5627 4989 pTask->pMachine = this; 5628 com::SafeIfaceArray<IMedium> sfaMedia(ComSafeArrayInArg(aMedia));5629 4990 5630 4991 // collect files to delete 5631 4992 pTask->llFilesToDelete = mData->llFilesToDelete; // saved states pushed here by Unregister() 5632 4993 5633 for (size_t i = 0; i < sfaMedia.size(); ++i)5634 { 5635 IMedium *pIMedium( sfaMedia[i]);4994 for (size_t i = 0; i < aMedia.size(); ++i) 4995 { 4996 IMedium *pIMedium(aMedia[i]); 5636 4997 ComObjPtr<Medium> pMedium = static_cast<Medium*>(pIMedium); 5637 4998 if (pMedium.isNull()) … … 5650 5011 5651 5012 pTask->pProgress.createObject(); 5652 pTask->pProgress->init( getVirtualBox(),5013 pTask->pProgress->init(i_getVirtualBox(), 5653 5014 static_cast<IMachine*>(this) /* aInitiator */, 5654 5015 Bstr(tr("Deleting files")).raw(), … … 5665 5026 "MachineDelete"); 5666 5027 5667 pTask->pProgress.queryInterfaceTo(aProgress );5028 pTask->pProgress.queryInterfaceTo(aProgress.asOutParam()); 5668 5029 5669 5030 if (RT_FAILURE(vrc)) … … 5695 5056 Assert(pTask->pProgress); 5696 5057 5697 HRESULT rc = pTask->pMachine-> deleteTaskWorker(*pTask);5058 HRESULT rc = pTask->pMachine->i_deleteTaskWorker(*pTask); 5698 5059 pTask->pProgress->i_notifyComplete(rc); 5699 5060 … … 5712 5073 * @return 5713 5074 */ 5714 HRESULT Machine:: deleteTaskWorker(DeleteTask &task)5075 HRESULT Machine::i_deleteTaskWorker(DeleteTask &task) 5715 5076 { 5716 5077 AutoCaller autoCaller(this); … … 5735 5096 5736 5097 MachineState_T oldState = mData->mMachineState; 5737 setMachineState(MachineState_SettingUp);5098 i_setMachineState(MachineState_SettingUp); 5738 5099 alock.release(); 5739 5100 for (size_t i = 0; i < task.llMediums.size(); ++i) … … 5763 5124 5764 5125 /* Close the medium, deliberately without checking the return 5765 5766 5767 5126 - * code, and without leaving any trace in the error info, as 5127 - * a failure here is a very minor issue, which shouldn't happen 5128 - * as above we even managed to delete the medium. */ 5768 5129 { 5769 5130 ErrorInfoKeeper eik; … … 5771 5132 } 5772 5133 } 5773 setMachineState(oldState);5134 i_setMachineState(oldState); 5774 5135 alock.acquire(); 5775 5136 … … 5846 5207 * some private files there that we don't want to delete) */ 5847 5208 Utf8Str strFullSnapshotFolder; 5848 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);5209 i_calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 5849 5210 Assert(!strFullSnapshotFolder.isEmpty()); 5850 5211 if (RTDirExists(strFullSnapshotFolder.c_str())) … … 5854 5215 // if it matches the VM name 5855 5216 Utf8Str settingsDir; 5856 if (i sInOwnDir(&settingsDir))5217 if (i_isInOwnDir(&settingsDir)) 5857 5218 RTDirRemove(settingsDir.c_str()); 5858 5219 } … … 5867 5228 } 5868 5229 5869 STDMETHODIMP Machine::FindSnapshot(IN_BSTR aNameOrId, ISnapshot **aSnapshot) 5870 { 5871 CheckComArgOutPointerValid(aSnapshot); 5872 5873 AutoCaller autoCaller(this); 5874 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5875 5230 HRESULT Machine::findSnapshot(const com::Utf8Str &aNameOrId, ComPtr<ISnapshot> &aSnapshot) 5231 { 5876 5232 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 5877 5233 … … 5879 5235 HRESULT rc; 5880 5236 5881 if ( !aNameOrId || !*aNameOrId)5882 // null case (caller wants root snapshot): findSnapshotById() handles this5883 rc = findSnapshotById(Guid(), pSnapshot, true /* aSetError */);5237 if (aNameOrId.isEmpty()) 5238 // null case (caller wants root snapshot): i_findSnapshotById() handles this 5239 rc = i_findSnapshotById(Guid(), pSnapshot, true /* aSetError */); 5884 5240 else 5885 5241 { 5886 5242 Guid uuid(aNameOrId); 5887 5243 if (uuid.isValid()) 5888 rc = findSnapshotById(uuid, pSnapshot, true /* aSetError */);5244 rc = i_findSnapshotById(uuid, pSnapshot, true /* aSetError */); 5889 5245 else 5890 rc = findSnapshotByName(Utf8Str(aNameOrId), pSnapshot, true /* aSetError */);5891 } 5892 pSnapshot.queryInterfaceTo(aSnapshot );5246 rc = i_findSnapshotByName(aNameOrId, pSnapshot, true /* aSetError */); 5247 } 5248 pSnapshot.queryInterfaceTo(aSnapshot.asOutParam()); 5893 5249 5894 5250 return rc; 5895 5251 } 5896 5252 5897 STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount) 5898 { 5899 CheckComArgStrNotEmptyOrNull(aName); 5900 CheckComArgStrNotEmptyOrNull(aHostPath); 5901 5902 AutoCaller autoCaller(this); 5903 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5904 5253 HRESULT Machine::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL aWritable, BOOL aAutomount) 5254 { 5905 5255 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5906 5256 5907 HRESULT rc = checkStateDependency(MutableStateDep);5257 HRESULT rc = i_checkStateDependency(MutableStateDep); 5908 5258 if (FAILED(rc)) return rc; 5909 5259 5910 Utf8Str strName(aName);5911 5912 5260 ComObjPtr<SharedFolder> sharedFolder; 5913 rc = findSharedFolder(strName, sharedFolder, false /* aSetError */);5261 rc = i_findSharedFolder(aName, sharedFolder, false /* aSetError */); 5914 5262 if (SUCCEEDED(rc)) 5915 5263 return setError(VBOX_E_OBJECT_IN_USE, 5916 5264 tr("Shared folder named '%s' already exists"), 5917 strName.c_str());5265 aName.c_str()); 5918 5266 5919 5267 sharedFolder.createObject(); 5920 rc = sharedFolder->init( getMachine(),5921 strName,5268 rc = sharedFolder->init(i_getMachine(), 5269 aName, 5922 5270 aHostPath, 5923 5271 !!aWritable, 5924 !!aAuto Mount,5272 !!aAutomount, 5925 5273 true /* fFailOnError */); 5926 5274 if (FAILED(rc)) return rc; 5927 5275 5928 setModified(IsModified_SharedFolders);5276 i_setModified(IsModified_SharedFolders); 5929 5277 mHWData.backup(); 5930 5278 mHWData->mSharedFolders.push_back(sharedFolder); … … 5932 5280 /* inform the direct session if any */ 5933 5281 alock.release(); 5934 onSharedFolderChange(); 5935 5936 return S_OK; 5937 } 5938 5939 STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName) 5940 { 5941 CheckComArgStrNotEmptyOrNull(aName); 5942 5943 AutoCaller autoCaller(this); 5944 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5945 5282 i_onSharedFolderChange(); 5283 5284 return S_OK; 5285 } 5286 5287 HRESULT Machine::removeSharedFolder(const com::Utf8Str &aName) 5288 { 5946 5289 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5947 5290 5948 HRESULT rc = checkStateDependency(MutableStateDep);5291 HRESULT rc = i_checkStateDependency(MutableStateDep); 5949 5292 if (FAILED(rc)) return rc; 5950 5293 5951 5294 ComObjPtr<SharedFolder> sharedFolder; 5952 rc = findSharedFolder(aName, sharedFolder, true /* aSetError */);5295 rc = i_findSharedFolder(aName, sharedFolder, true /* aSetError */); 5953 5296 if (FAILED(rc)) return rc; 5954 5297 5955 setModified(IsModified_SharedFolders);5298 i_setModified(IsModified_SharedFolders); 5956 5299 mHWData.backup(); 5957 5300 mHWData->mSharedFolders.remove(sharedFolder); … … 5959 5302 /* inform the direct session if any */ 5960 5303 alock.release(); 5961 onSharedFolderChange(); 5962 5963 return S_OK; 5964 } 5965 5966 STDMETHODIMP Machine::CanShowConsoleWindow(BOOL *aCanShow) 5967 { 5968 CheckComArgOutPointerValid(aCanShow); 5969 5304 i_onSharedFolderChange(); 5305 5306 return S_OK; 5307 } 5308 5309 HRESULT Machine::canShowConsoleWindow(BOOL *aCanShow) 5310 { 5970 5311 /* start with No */ 5971 5312 *aCanShow = FALSE; 5972 5973 AutoCaller autoCaller(this);5974 AssertComRCReturnRC(autoCaller.rc());5975 5313 5976 5314 ComPtr<IInternalSessionControl> directControl; … … 5994 5332 } 5995 5333 5996 STDMETHODIMP Machine::ShowConsoleWindow(LONG64 *aWinId) 5997 { 5998 CheckComArgOutPointerValid(aWinId); 5999 6000 AutoCaller autoCaller(this); 6001 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 6002 5334 HRESULT Machine::showConsoleWindow(LONG64 *aWinId) 5335 { 6003 5336 ComPtr<IInternalSessionControl> directControl; 6004 5337 { … … 6025 5358 * Look up a guest property in VBoxSVC's internal structures. 6026 5359 */ 6027 HRESULT Machine:: getGuestPropertyFromService(IN_BSTRaName,6028 BSTR *aValue,6029 LONG64 *aTimestamp,6030 BSTR *aFlags) const5360 HRESULT Machine::i_getGuestPropertyFromService(const com::Utf8Str &aName, 5361 com::Utf8Str &aValue, 5362 LONG64 *aTimestamp, 5363 com::Utf8Str &aFlags) const 6031 5364 { 6032 5365 using namespace guestProp; 6033 5366 6034 5367 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6035 Utf8Str strName(aName); 6036 HWData::GuestPropertyMap::const_iterator it = mHWData->mGuestProperties.find(strName); 5368 HWData::GuestPropertyMap::const_iterator it = mHWData->mGuestProperties.find(aName); 6037 5369 6038 5370 if (it != mHWData->mGuestProperties.end()) 6039 5371 { 6040 5372 char szFlags[MAX_FLAGS_LEN + 1]; 6041 it->second.strValue.cloneTo(aValue);5373 aValue = it->second.strValue; 6042 5374 *aTimestamp = it->second.mTimestamp; 6043 5375 writeFlags(it->second.mFlags, szFlags); 6044 Bstr(szFlags).cloneTo(aFlags);5376 aFlags = Utf8Str(szFlags); 6045 5377 } 6046 5378 … … 6054 5386 * VBoxSVC. 6055 5387 */ 6056 HRESULT Machine::getGuestPropertyFromVM(IN_BSTR aName, 6057 BSTR *aValue, 6058 LONG64 *aTimestamp, 6059 BSTR *aFlags) const 6060 { 6061 HRESULT rc; 5388 HRESULT Machine::i_getGuestPropertyFromVM(const com::Utf8Str &aName, 5389 com::Utf8Str &aValue, 5390 LONG64 *aTimestamp, 5391 com::Utf8Str &aFlags) const 5392 { 5393 HRESULT rc = S_OK; 5394 BSTR bValue; 5395 BSTR bFlags; 5396 6062 5397 ComPtr<IInternalSessionControl> directControl; 6063 5398 directControl = mData->mSession.mDirectControl; … … 6072 5407 rc = E_ACCESSDENIED; 6073 5408 else 6074 rc = directControl->AccessGuestProperty( aName, NULL, NULL,5409 rc = directControl->AccessGuestProperty(Bstr(aName).raw(), NULL, NULL, 6075 5410 false /* isSetter */, 6076 aValue, aTimestamp, aFlags); 5411 &bValue, aTimestamp, &bFlags); 5412 5413 aValue = bValue; 5414 aFlags = bFlags; 5415 6077 5416 return rc; 6078 5417 } 6079 5418 #endif // VBOX_WITH_GUEST_PROPS 6080 5419 6081 STDMETHODIMP Machine::GetGuestProperty(IN_BSTRaName,6082 BSTR *aValue,6083 6084 BSTR *aFlags)5420 HRESULT Machine::getGuestProperty(const com::Utf8Str &aName, 5421 com::Utf8Str &aValue, 5422 LONG64 *aTimestamp, 5423 com::Utf8Str &aFlags) 6085 5424 { 6086 5425 #ifndef VBOX_WITH_GUEST_PROPS 6087 5426 ReturnComNotImplemented(); 6088 5427 #else // VBOX_WITH_GUEST_PROPS 6089 CheckComArgStrNotEmptyOrNull(aName); 6090 CheckComArgOutPointerValid(aValue); 6091 CheckComArgOutPointerValid(aTimestamp); 6092 CheckComArgOutPointerValid(aFlags); 6093 6094 AutoCaller autoCaller(this); 6095 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6096 6097 HRESULT rc = getGuestPropertyFromVM(aName, aValue, aTimestamp, aFlags); 5428 5429 HRESULT rc = i_getGuestPropertyFromVM(aName, aValue, aTimestamp, aFlags); 5430 6098 5431 if (rc == E_ACCESSDENIED) 6099 5432 /* The VM is not running or the service is not (yet) accessible */ 6100 rc = getGuestPropertyFromService(aName, aValue, aTimestamp, aFlags);5433 rc = i_getGuestPropertyFromService(aName, aValue, aTimestamp, aFlags); 6101 5434 return rc; 6102 5435 #endif // VBOX_WITH_GUEST_PROPS 6103 5436 } 6104 5437 6105 STDMETHODIMP Machine::GetGuestPropertyValue(IN_BSTR aName, BSTR *aValue)5438 HRESULT Machine::getGuestPropertyValue(const com::Utf8Str &aProperty, com::Utf8Str &aValue) 6106 5439 { 6107 5440 LONG64 dummyTimestamp; 6108 Bstr dummyFlags; 6109 return GetGuestProperty(aName, aValue, &dummyTimestamp, dummyFlags.asOutParam()); 6110 } 6111 6112 STDMETHODIMP Machine::GetGuestPropertyTimestamp(IN_BSTR aName, LONG64 *aTimestamp) 6113 { 6114 Bstr dummyValue; 6115 Bstr dummyFlags; 6116 return GetGuestProperty(aName, dummyValue.asOutParam(), aTimestamp, dummyFlags.asOutParam()); 5441 com::Utf8Str dummyFlags; 5442 HRESULT rc = getGuestProperty(aProperty, aValue, &dummyTimestamp, dummyFlags); 5443 return rc; 5444 5445 } 5446 HRESULT Machine::getGuestPropertyTimestamp(const com::Utf8Str &aProperty, LONG64 *aValue) 5447 { 5448 com::Utf8Str dummyFlags; 5449 com::Utf8Str dummyValue; 5450 HRESULT rc = getGuestProperty(aProperty, dummyValue, aValue, dummyFlags); 5451 return rc; 6117 5452 } 6118 5453 … … 6121 5456 * Set a guest property in VBoxSVC's internal structures. 6122 5457 */ 6123 HRESULT Machine:: setGuestPropertyToService(IN_BSTR aName, IN_BSTRaValue,6124 IN_BSTRaFlags)5458 HRESULT Machine::i_setGuestPropertyToService(const com::Utf8Str &aName, const com::Utf8Str &aValue, 5459 const com::Utf8Str &aFlags) 6125 5460 { 6126 5461 using namespace guestProp; … … 6129 5464 HRESULT rc = S_OK; 6130 5465 6131 rc = checkStateDependency(MutableStateDep);5466 rc = i_checkStateDependency(MutableStateDep); 6132 5467 if (FAILED(rc)) return rc; 6133 5468 6134 5469 try 6135 5470 { 6136 Utf8Str utf8Name(aName);6137 Utf8Str utf8Flags(aFlags);6138 5471 uint32_t fFlags = NILFLAG; 6139 if ( aFlags != NULL 6140 && RT_FAILURE(validateFlags(utf8Flags.c_str(), &fFlags))) 6141 return setError(E_INVALIDARG, 6142 tr("Invalid guest property flag values: '%ls'"), 6143 aFlags); 6144 6145 bool fDelete = !RT_VALID_PTR(aValue) || *(aValue) == '\0'; 6146 HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.find(utf8Name); 5472 if (aFlags.length() && RT_FAILURE(validateFlags(aFlags.c_str(), &fFlags))) 5473 return setError(E_INVALIDARG, tr("Invalid guest property flag values: '%s'"), aFlags.c_str()); 5474 5475 bool fDelete = aValue.isEmpty(); 5476 HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.find(aName); 6147 5477 if (it == mHWData->mGuestProperties.end()) 6148 5478 { 6149 5479 if (!fDelete) 6150 5480 { 6151 setModified(IsModified_MachineData);5481 i_setModified(IsModified_MachineData); 6152 5482 mHWData.backupEx(); 6153 5483 6154 5484 RTTIMESPEC time; 6155 5485 HWData::GuestProperty prop; 6156 prop.strValue = aValue;5486 prop.strValue = Bstr(aValue).raw(); 6157 5487 prop.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time)); 6158 5488 prop.mFlags = fFlags; 6159 mHWData->mGuestProperties[ Utf8Str(aName)] = prop;5489 mHWData->mGuestProperties[aName] = prop; 6160 5490 } 6161 5491 } … … 6164 5494 if (it->second.mFlags & (RDONLYHOST)) 6165 5495 { 6166 rc = setError(E_ACCESSDENIED, 6167 tr("The property '%ls' cannot be changed by the host"), 6168 aName); 5496 rc = setError(E_ACCESSDENIED, tr("The property '%s' cannot be changed by the host"), aName.c_str()); 6169 5497 } 6170 5498 else 6171 5499 { 6172 setModified(IsModified_MachineData);5500 i_setModified(IsModified_MachineData); 6173 5501 mHWData.backupEx(); 6174 5502 6175 5503 /* The backupEx() operation invalidates our iterator, 6176 5504 * so get a new one. */ 6177 it = mHWData->mGuestProperties.find( utf8Name);5505 it = mHWData->mGuestProperties.find(aName); 6178 5506 Assert(it != mHWData->mGuestProperties.end()); 6179 5507 … … 6194 5522 || RTStrSimplePatternMultiMatch(mHWData->mGuestPropertyNotificationPatterns.c_str(), 6195 5523 RTSTR_MAX, 6196 utf8Name.c_str(),5524 aName.c_str(), 6197 5525 RTSTR_MAX, 6198 5526 NULL) … … 6202 5530 alock.release(); 6203 5531 6204 mParent->i_onGuestPropertyChange(mData->mUuid, aName, 6205 aValue ? aValue : Bstr("").raw(), 6206 aFlags ? aFlags : Bstr("").raw()); 5532 mParent->i_onGuestPropertyChange(mData->mUuid, 5533 Bstr(aName).raw(), 5534 Bstr(aValue).raw(), 5535 Bstr(aFlags).raw()); 6207 5536 } 6208 5537 } … … 6221 5550 * VBoxSVC. 6222 5551 */ 6223 HRESULT Machine:: setGuestPropertyToVM(IN_BSTR aName, IN_BSTRaValue,6224 IN_BSTRaFlags)5552 HRESULT Machine::i_setGuestPropertyToVM(const com::Utf8Str &aName, const com::Utf8Str &aValue, 5553 const com::Utf8Str &aFlags) 6225 5554 { 6226 5555 HRESULT rc; … … 6236 5565 else 6237 5566 /** @todo Fix when adding DeleteGuestProperty(), see defect. */ 6238 rc = directControl->AccessGuestProperty( aName, aValue, aFlags,5567 rc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw(), 6239 5568 true /* isSetter */, 6240 5569 &dummy, &dummy64, &dummy); … … 6249 5578 #endif // VBOX_WITH_GUEST_PROPS 6250 5579 6251 STDMETHODIMP Machine::SetGuestProperty(IN_BSTR aName, IN_BSTRaValue,6252 IN_BSTRaFlags)5580 HRESULT Machine::setGuestProperty(const com::Utf8Str &aProperty, const com::Utf8Str &aValue, 5581 const com::Utf8Str &aFlags) 6253 5582 { 6254 5583 #ifndef VBOX_WITH_GUEST_PROPS 6255 5584 ReturnComNotImplemented(); 6256 5585 #else // VBOX_WITH_GUEST_PROPS 6257 CheckComArgStrNotEmptyOrNull(aName); 6258 CheckComArgMaybeNull(aFlags); 6259 CheckComArgMaybeNull(aValue); 6260 6261 AutoCaller autoCaller(this); 6262 if (FAILED(autoCaller.rc())) 6263 return autoCaller.rc(); 6264 6265 HRESULT rc = setGuestPropertyToVM(aName, aValue, aFlags); 5586 HRESULT rc = i_setGuestPropertyToVM(aProperty, aValue, aFlags); 6266 5587 if (rc == E_ACCESSDENIED) 6267 5588 /* The VM is not running or the service is not (yet) accessible */ 6268 rc = setGuestPropertyToService(aName, aValue, aFlags);5589 rc = i_setGuestPropertyToService(aProperty, aValue, aFlags); 6269 5590 return rc; 6270 5591 #endif // VBOX_WITH_GUEST_PROPS 6271 5592 } 6272 5593 6273 STDMETHODIMP Machine::SetGuestPropertyValue(IN_BSTR aName, IN_BSTRaValue)6274 { 6275 return SetGuestProperty(aName, aValue, NULL);6276 } 6277 6278 STDMETHODIMP Machine::DeleteGuestProperty(IN_BSTRaName)6279 { 6280 return SetGuestProperty(aName, NULL, NULL);5594 HRESULT Machine::setGuestPropertyValue(const com::Utf8Str &aProperty, const com::Utf8Str &aValue) 5595 { 5596 return setGuestProperty(aProperty, aValue, ""); 5597 } 5598 5599 HRESULT Machine::deleteGuestProperty(const com::Utf8Str &aName) 5600 { 5601 return setGuestProperty(aName, "", ""); 6281 5602 } 6282 5603 … … 6285 5606 * Enumerate the guest properties in VBoxSVC's internal structures. 6286 5607 */ 6287 HRESULT Machine:: enumerateGuestPropertiesInService6288 (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),6289 ComSafeArrayOut(BSTR, aValues),6290 ComSafeArrayOut(LONG64, aTimestamps),6291 ComSafeArrayOut(BSTR, aFlags))5608 HRESULT Machine::i_enumerateGuestPropertiesInService(const com::Utf8Str &aPatterns, 5609 std::vector<com::Utf8Str> &aNames, 5610 std::vector<com::Utf8Str> &aValues, 5611 std::vector<LONG64> &aTimestamps, 5612 std::vector<com::Utf8Str> &aFlags) 6292 5613 { 6293 5614 using namespace guestProp; … … 6311 5632 NULL) 6312 5633 ) 6313 {6314 5634 propMap.insert(*it); 6315 }6316 6317 5635 it++; 6318 5636 } … … 6324 5642 */ 6325 5643 size_t cEntries = propMap.size(); 6326 SafeArray<BSTR> names(cEntries); 6327 SafeArray<BSTR> values(cEntries); 6328 SafeArray<LONG64> timestamps(cEntries); 6329 SafeArray<BSTR> flags(cEntries); 6330 size_t iProp = 0; 6331 6332 it = propMap.begin(); 6333 while (it != propMap.end()) 6334 { 6335 char szFlags[MAX_FLAGS_LEN + 1]; 6336 it->first.cloneTo(&names[iProp]); 6337 it->second.strValue.cloneTo(&values[iProp]); 6338 timestamps[iProp] = it->second.mTimestamp; 6339 writeFlags(it->second.mFlags, szFlags); 6340 Bstr(szFlags).cloneTo(&flags[iProp++]); 6341 it++; 6342 } 6343 names.detachTo(ComSafeArrayOutArg(aNames)); 6344 values.detachTo(ComSafeArrayOutArg(aValues)); 6345 timestamps.detachTo(ComSafeArrayOutArg(aTimestamps)); 6346 flags.detachTo(ComSafeArrayOutArg(aFlags)); 5644 5645 aNames.resize(cEntries); 5646 aValues.resize(cEntries); 5647 aTimestamps.resize(cEntries); 5648 aFlags.resize(cEntries); 5649 5650 char szFlags[MAX_FLAGS_LEN + 1]; 5651 size_t i= 0; 5652 for (it = propMap.begin(); it != propMap.end(); ++i, ++it) 5653 { 5654 aNames[i] = it->first; 5655 aValues[i] = it->second.strValue; 5656 aTimestamps[i] = it->second.mTimestamp; 5657 writeFlags(it->second.mFlags, szFlags); 5658 aFlags[i] = Utf8Str(szFlags); 5659 } 5660 6347 5661 return S_OK; 6348 5662 } … … 6354 5668 * VBoxSVC. 6355 5669 */ 6356 HRESULT Machine:: enumerateGuestPropertiesOnVM6357 (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),6358 ComSafeArrayOut(BSTR, aValues),6359 ComSafeArrayOut(LONG64, aTimestamps),6360 ComSafeArrayOut(BSTR, aFlags))5670 HRESULT Machine::i_enumerateGuestPropertiesOnVM(const com::Utf8Str &aPatterns, 5671 std::vector<com::Utf8Str> &aNames, 5672 std::vector<com::Utf8Str> &aValues, 5673 std::vector<LONG64> &aTimestamps, 5674 std::vector<com::Utf8Str> &aFlags) 6361 5675 { 6362 5676 HRESULT rc; … … 6364 5678 directControl = mData->mSession.mDirectControl; 6365 5679 5680 5681 com::SafeArray<BSTR> bNames; 5682 com::SafeArray<BSTR> bValues; 5683 com::SafeArray<LONG64> bTimestamps; 5684 com::SafeArray<BSTR> bFlags; 5685 6366 5686 if (!directControl) 6367 5687 rc = E_ACCESSDENIED; 6368 5688 else 6369 rc = directControl->EnumerateGuestProperties 6370 (aPatterns, ComSafeArrayOutArg(aNames), 6371 ComSafeArrayOutArg(aValues), 6372 ComSafeArrayOutArg(aTimestamps), 6373 ComSafeArrayOutArg(aFlags)); 5689 rc = directControl->EnumerateGuestProperties(Bstr(aPatterns).raw(), 5690 ComSafeArrayAsOutParam(bNames), 5691 ComSafeArrayAsOutParam(bValues), 5692 ComSafeArrayAsOutParam(bTimestamps), 5693 ComSafeArrayAsOutParam(bFlags)); 5694 size_t i; 5695 aNames.resize(bNames.size()); 5696 for (i = 0; i < bNames.size(); ++i) 5697 aNames[i] = Utf8Str(bNames[i]); 5698 aValues.resize(bValues.size()); 5699 for (i = 0; i < bValues.size(); ++i) 5700 aValues[i] = Utf8Str(bValues[i]); 5701 aTimestamps.resize(bTimestamps.size()); 5702 for (i = 0; i < bTimestamps.size(); ++i) 5703 aTimestamps[i] = bTimestamps[i]; 5704 aFlags.resize(bFlags.size()); 5705 for (i = 0; i < bFlags.size(); ++i) 5706 aFlags[i] = Utf8Str(bFlags[i]); 5707 6374 5708 return rc; 6375 5709 } 6376 5710 #endif // VBOX_WITH_GUEST_PROPS 6377 6378 STDMETHODIMP Machine::EnumerateGuestProperties(IN_BSTR aPatterns, 6379 ComSafeArrayOut(BSTR, aNames), 6380 ComSafeArrayOut(BSTR, aValues), 6381 ComSafeArrayOut(LONG64, aTimestamps), 6382 ComSafeArrayOut(BSTR, aFlags)) 5711 HRESULT Machine::enumerateGuestProperties(const com::Utf8Str &aPatterns, 5712 std::vector<com::Utf8Str> &aNames, 5713 std::vector<com::Utf8Str> &aValues, 5714 std::vector<LONG64> &aTimestamps, 5715 std::vector<com::Utf8Str> &aFlags) 6383 5716 { 6384 5717 #ifndef VBOX_WITH_GUEST_PROPS 6385 5718 ReturnComNotImplemented(); 6386 5719 #else // VBOX_WITH_GUEST_PROPS 6387 CheckComArgMaybeNull(aPatterns); 6388 CheckComArgOutSafeArrayPointerValid(aNames); 6389 CheckComArgOutSafeArrayPointerValid(aValues); 6390 CheckComArgOutSafeArrayPointerValid(aTimestamps); 6391 CheckComArgOutSafeArrayPointerValid(aFlags); 6392 6393 AutoCaller autoCaller(this); 6394 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6395 6396 HRESULT rc = enumerateGuestPropertiesOnVM 6397 (aPatterns, ComSafeArrayOutArg(aNames), 6398 ComSafeArrayOutArg(aValues), 6399 ComSafeArrayOutArg(aTimestamps), 6400 ComSafeArrayOutArg(aFlags)); 5720 5721 HRESULT rc = i_enumerateGuestPropertiesOnVM(aPatterns, aNames, aValues, aTimestamps, aFlags); 5722 6401 5723 if (rc == E_ACCESSDENIED) 6402 5724 /* The VM is not running or the service is not (yet) accessible */ 6403 rc = enumerateGuestPropertiesInService 6404 (aPatterns, ComSafeArrayOutArg(aNames), 6405 ComSafeArrayOutArg(aValues), 6406 ComSafeArrayOutArg(aTimestamps), 6407 ComSafeArrayOutArg(aFlags)); 5725 rc = i_enumerateGuestPropertiesInService(aPatterns, aNames, aValues, aTimestamps, aFlags); 6408 5726 return rc; 6409 5727 #endif // VBOX_WITH_GUEST_PROPS 6410 5728 } 6411 5729 6412 STDMETHODIMP Machine::GetMediumAttachmentsOfController(IN_BSTRaName,6413 ComSafeArrayOut(IMediumAttachment*, aAttachments))5730 HRESULT Machine::getMediumAttachmentsOfController(const com::Utf8Str &aName, 5731 std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments) 6414 5732 { 6415 5733 MediaData::AttachmentList atts; 6416 5734 6417 HRESULT rc = getMediumAttachmentsOfController(aName, atts);5735 HRESULT rc = i_getMediumAttachmentsOfController(aName, atts); 6418 5736 if (FAILED(rc)) return rc; 6419 5737 6420 SafeIfaceArray<IMediumAttachment> attachments(atts); 6421 attachments.detachTo(ComSafeArrayOutArg(aAttachments)); 6422 6423 return S_OK; 6424 } 6425 6426 STDMETHODIMP Machine::GetMediumAttachment(IN_BSTR aControllerName, 6427 LONG aControllerPort, 6428 LONG aDevice, 6429 IMediumAttachment **aAttachment) 6430 { 6431 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n", 6432 aControllerName, aControllerPort, aDevice)); 6433 6434 CheckComArgStrNotEmptyOrNull(aControllerName); 6435 CheckComArgOutPointerValid(aAttachment); 6436 6437 AutoCaller autoCaller(this); 6438 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5738 size_t i = 0; 5739 aMediumAttachments.resize(atts.size()); 5740 for (MediaData::AttachmentList::iterator it = atts.begin(); it != atts.end(); ++it, ++i) 5741 (*it).queryInterfaceTo(aMediumAttachments[i].asOutParam()); 5742 5743 return S_OK; 5744 } 5745 5746 HRESULT Machine::getMediumAttachment(const com::Utf8Str &aName, 5747 LONG aControllerPort, 5748 LONG aDevice, 5749 ComPtr<IMediumAttachment> &aAttachment) 5750 { 5751 LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d\n", 5752 aName.c_str(), aControllerPort, aDevice)); 6439 5753 6440 5754 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6441 5755 6442 *aAttachment = NULL;6443 6444 ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments,6445 aControllerName,6446 aControllerPort,6447 aDevice);5756 aAttachment = NULL; 5757 5758 ComObjPtr<MediumAttachment> pAttach = i_findAttachment(mMediaData->mAttachments, 5759 Bstr(aName).raw(), 5760 aControllerPort, 5761 aDevice); 6448 5762 if (pAttach.isNull()) 6449 5763 return setError(VBOX_E_OBJECT_NOT_FOUND, 6450 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 6451 aDevice, aControllerPort, aControllerName); 6452 6453 pAttach.queryInterfaceTo(aAttachment); 6454 6455 return S_OK; 6456 } 6457 6458 STDMETHODIMP Machine::AddStorageController(IN_BSTR aName, 6459 StorageBus_T aConnectionType, 6460 IStorageController **controller) 6461 { 6462 CheckComArgStrNotEmptyOrNull(aName); 6463 5764 tr("No storage device attached to device slot %d on port %d of controller '%s'"), 5765 aDevice, aControllerPort, aName.c_str()); 5766 5767 pAttach.queryInterfaceTo(aAttachment.asOutParam()); 5768 5769 return S_OK; 5770 } 5771 5772 5773 HRESULT Machine::addStorageController(const com::Utf8Str &aName, 5774 StorageBus_T aConnectionType, 5775 ComPtr<IStorageController> &aController) 5776 { 6464 5777 if ( (aConnectionType <= StorageBus_Null) 6465 5778 || (aConnectionType > StorageBus_USB)) … … 6468 5781 aConnectionType); 6469 5782 6470 AutoCaller autoCaller(this);6471 if (FAILED(autoCaller.rc())) return autoCaller.rc();6472 6473 5783 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6474 5784 6475 HRESULT rc = checkStateDependency(MutableStateDep);5785 HRESULT rc = i_checkStateDependency(MutableStateDep); 6476 5786 if (FAILED(rc)) return rc; 6477 5787 … … 6479 5789 ComObjPtr<StorageController> ctrl; 6480 5790 6481 rc = getStorageControllerByName(aName, ctrl, false /* aSetError */);5791 rc = i_getStorageControllerByName(aName, ctrl, false /* aSetError */); 6482 5792 if (SUCCEEDED(rc)) 6483 5793 return setError(VBOX_E_OBJECT_IN_USE, 6484 tr("Storage controller named '% ls' already exists"),6485 aName );5794 tr("Storage controller named '%s' already exists"), 5795 aName.c_str()); 6486 5796 6487 5797 ctrl.createObject(); … … 6510 5820 if (FAILED(rc)) return rc; 6511 5821 6512 setModified(IsModified_Storage);5822 i_setModified(IsModified_Storage); 6513 5823 mStorageControllers.backup(); 6514 5824 mStorageControllers->push_back(ctrl); 6515 5825 6516 ctrl.queryInterfaceTo( controller);5826 ctrl.queryInterfaceTo(aController.asOutParam()); 6517 5827 6518 5828 /* inform the direct session if any */ 6519 5829 alock.release(); 6520 onStorageControllerChange(); 6521 6522 return S_OK; 6523 } 6524 6525 STDMETHODIMP Machine::GetStorageControllerByName(IN_BSTR aName, 6526 IStorageController **aStorageController) 6527 { 6528 CheckComArgStrNotEmptyOrNull(aName); 6529 6530 AutoCaller autoCaller(this); 6531 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6532 5830 i_onStorageControllerChange(); 5831 5832 return S_OK; 5833 } 5834 5835 HRESULT Machine::getStorageControllerByName(const com::Utf8Str &aName, 5836 ComPtr<IStorageController> &aStorageController) 5837 { 6533 5838 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6534 5839 6535 5840 ComObjPtr<StorageController> ctrl; 6536 5841 6537 HRESULT rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);5842 HRESULT rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */); 6538 5843 if (SUCCEEDED(rc)) 6539 ctrl.queryInterfaceTo(aStorageController );5844 ctrl.queryInterfaceTo(aStorageController.asOutParam()); 6540 5845 6541 5846 return rc; 6542 5847 } 6543 5848 6544 STDMETHODIMP Machine::GetStorageControllerByInstance(ULONG aInstance, 6545 IStorageController **aStorageController) 6546 { 6547 AutoCaller autoCaller(this); 6548 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6549 5849 HRESULT Machine::getStorageControllerByInstance(ULONG aInstance, 5850 ComPtr<IStorageController> &aStorageController) 5851 { 6550 5852 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6551 5853 … … 6556 5858 if ((*it)->i_getInstance() == aInstance) 6557 5859 { 6558 (*it).queryInterfaceTo(aStorageController );5860 (*it).queryInterfaceTo(aStorageController.asOutParam()); 6559 5861 return S_OK; 6560 5862 } … … 6566 5868 } 6567 5869 6568 STDMETHODIMP Machine::SetStorageControllerBootable(IN_BSTR aName, BOOL fBootable) 6569 { 6570 AutoCaller autoCaller(this); 6571 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6572 5870 HRESULT Machine::setStorageControllerBootable(const com::Utf8Str &aName, BOOL aBootable) 5871 { 6573 5872 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6574 5873 6575 HRESULT rc = checkStateDependency(MutableStateDep);5874 HRESULT rc = i_checkStateDependency(MutableStateDep); 6576 5875 if (FAILED(rc)) return rc; 6577 5876 6578 5877 ComObjPtr<StorageController> ctrl; 6579 5878 6580 rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);5879 rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */); 6581 5880 if (SUCCEEDED(rc)) 6582 5881 { 6583 5882 /* Ensure that only one controller of each type is marked as bootable. */ 6584 if ( fBootable == TRUE)5883 if (aBootable == TRUE) 6585 5884 { 6586 5885 for (StorageControllerList::const_iterator it = mStorageControllers->begin(); … … 6590 5889 ComObjPtr<StorageController> aCtrl = (*it); 6591 5890 6592 if ( (aCtrl->i_getName() != Utf8Str(aName))5891 if ( (aCtrl->i_getName() != aName) 6593 5892 && aCtrl->i_getBootable() == TRUE 6594 5893 && aCtrl->i_getStorageBus() == ctrl->i_getStorageBus() … … 6603 5902 if (SUCCEEDED(rc)) 6604 5903 { 6605 ctrl->i_setBootable( fBootable);6606 setModified(IsModified_Storage);5904 ctrl->i_setBootable(aBootable); 5905 i_setModified(IsModified_Storage); 6607 5906 } 6608 5907 } … … 6612 5911 /* inform the direct session if any */ 6613 5912 alock.release(); 6614 onStorageControllerChange();5913 i_onStorageControllerChange(); 6615 5914 } 6616 5915 … … 6618 5917 } 6619 5918 6620 STDMETHODIMP Machine::RemoveStorageController(IN_BSTR aName) 6621 { 6622 CheckComArgStrNotEmptyOrNull(aName); 6623 6624 AutoCaller autoCaller(this); 6625 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6626 5919 HRESULT Machine::removeStorageController(const com::Utf8Str &aName) 5920 { 6627 5921 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6628 5922 6629 HRESULT rc = checkStateDependency(MutableStateDep);5923 HRESULT rc = i_checkStateDependency(MutableStateDep); 6630 5924 if (FAILED(rc)) return rc; 6631 5925 6632 5926 ComObjPtr<StorageController> ctrl; 6633 rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);5927 rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */); 6634 5928 if (FAILED(rc)) return rc; 6635 5929 … … 6653 5947 if (pAttachTemp->i_getControllerName() == aName) 6654 5948 { 6655 rc = detachDevice(pAttachTemp, alock, NULL);5949 rc = i_detachDevice(pAttachTemp, alock, NULL); 6656 5950 if (FAILED(rc)) return rc; 6657 5951 } … … 6660 5954 6661 5955 /* We can remove it now. */ 6662 setModified(IsModified_Storage);5956 i_setModified(IsModified_Storage); 6663 5957 mStorageControllers.backup(); 6664 5958 … … 6669 5963 /* inform the direct session if any */ 6670 5964 alock.release(); 6671 onStorageControllerChange();6672 6673 return S_OK; 6674 } 6675 6676 STDMETHODIMP Machine::AddUSBController(IN_BSTRaName, USBControllerType_T aType,6677 IUSBController **controller)5965 i_onStorageControllerChange(); 5966 5967 return S_OK; 5968 } 5969 5970 HRESULT Machine::addUSBController(const com::Utf8Str &aName, USBControllerType_T aType, 5971 ComPtr<IUSBController> &aController) 6678 5972 { 6679 5973 if ( (aType <= USBControllerType_Null) … … 6683 5977 aType); 6684 5978 6685 AutoCaller autoCaller(this);6686 if (FAILED(autoCaller.rc())) return autoCaller.rc();6687 6688 5979 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6689 5980 6690 HRESULT rc = checkStateDependency(MutableStateDep);5981 HRESULT rc = i_checkStateDependency(MutableStateDep); 6691 5982 if (FAILED(rc)) return rc; 6692 5983 … … 6694 5985 ComObjPtr<USBController> ctrl; 6695 5986 6696 rc = getUSBControllerByName(aName, ctrl, false /* aSetError */);5987 rc = i_getUSBControllerByName(aName, ctrl, false /* aSetError */); 6697 5988 if (SUCCEEDED(rc)) 6698 5989 return setError(VBOX_E_OBJECT_IN_USE, 6699 tr("USB controller named '% ls' already exists"),6700 aName );5990 tr("USB controller named '%s' already exists"), 5991 aName.c_str()); 6701 5992 6702 5993 /* Check that we don't exceed the maximum number of USB controllers for the given type. */ … … 6706 5997 return rc; 6707 5998 6708 ULONG cInstances = getUSBControllerCountByType(aType);5999 ULONG cInstances = i_getUSBControllerCountByType(aType); 6709 6000 if (cInstances >= maxInstances) 6710 6001 return setError(E_INVALIDARG, … … 6716 6007 if (FAILED(rc)) return rc; 6717 6008 6718 setModified(IsModified_USB);6009 i_setModified(IsModified_USB); 6719 6010 mUSBControllers.backup(); 6720 6011 mUSBControllers->push_back(ctrl); 6721 6012 6722 ctrl.queryInterfaceTo( controller);6013 ctrl.queryInterfaceTo(aController.asOutParam()); 6723 6014 6724 6015 /* inform the direct session if any */ 6725 6016 alock.release(); 6726 onUSBControllerChange(); 6727 6728 return S_OK; 6729 } 6730 6731 STDMETHODIMP Machine::GetUSBControllerByName(IN_BSTR aName, IUSBController **aUSBController) 6732 { 6733 CheckComArgStrNotEmptyOrNull(aName); 6734 6735 AutoCaller autoCaller(this); 6736 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6737 6017 i_onUSBControllerChange(); 6018 6019 return S_OK; 6020 } 6021 6022 HRESULT Machine::getUSBControllerByName(const com::Utf8Str &aName, ComPtr<IUSBController> &aController) 6023 { 6738 6024 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6739 6025 6740 6026 ComObjPtr<USBController> ctrl; 6741 6027 6742 HRESULT rc = getUSBControllerByName(aName, ctrl, true /* aSetError */);6028 HRESULT rc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */); 6743 6029 if (SUCCEEDED(rc)) 6744 ctrl.queryInterfaceTo(a USBController);6030 ctrl.queryInterfaceTo(aController.asOutParam()); 6745 6031 6746 6032 return rc; 6747 6033 } 6748 6034 6749 STDMETHODIMP Machine::GetUSBControllerCountByType(USBControllerType_T aType, 6750 ULONG *aControllers) 6751 { 6752 CheckComArgOutPointerValid(aControllers); 6753 6035 HRESULT Machine::getUSBControllerCountByType(USBControllerType_T aType, 6036 ULONG *aControllers) 6037 { 6754 6038 if ( (aType <= USBControllerType_Null) 6755 6039 || (aType >= USBControllerType_Last)) … … 6758 6042 aType); 6759 6043 6760 AutoCaller autoCaller(this);6761 if (FAILED(autoCaller.rc())) return autoCaller.rc();6762 6763 6044 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6764 6045 6765 6046 ComObjPtr<USBController> ctrl; 6766 6047 6767 *aControllers = getUSBControllerCountByType(aType); 6768 6769 return S_OK; 6770 } 6771 6772 STDMETHODIMP Machine::RemoveUSBController(IN_BSTR aName) 6773 { 6774 CheckComArgStrNotEmptyOrNull(aName); 6775 6776 AutoCaller autoCaller(this); 6777 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6048 *aControllers = i_getUSBControllerCountByType(aType); 6049 6050 return S_OK; 6051 } 6052 6053 HRESULT Machine::removeUSBController(const com::Utf8Str &aName) 6054 { 6778 6055 6779 6056 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6780 6057 6781 HRESULT rc = checkStateDependency(MutableStateDep);6058 HRESULT rc = i_checkStateDependency(MutableStateDep); 6782 6059 if (FAILED(rc)) return rc; 6783 6060 6784 6061 ComObjPtr<USBController> ctrl; 6785 rc = getUSBControllerByName(aName, ctrl, true /* aSetError */);6062 rc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */); 6786 6063 if (FAILED(rc)) return rc; 6787 6064 6788 setModified(IsModified_USB);6065 i_setModified(IsModified_USB); 6789 6066 mUSBControllers.backup(); 6790 6067 … … 6795 6072 /* inform the direct session if any */ 6796 6073 alock.release(); 6797 onUSBControllerChange(); 6798 6799 return S_OK; 6800 } 6801 6802 STDMETHODIMP Machine::QuerySavedGuestScreenInfo(ULONG uScreenId, 6803 ULONG *puOriginX, 6804 ULONG *puOriginY, 6805 ULONG *puWidth, 6806 ULONG *puHeight, 6807 BOOL *pfEnabled) 6808 { 6809 LogFlowThisFunc(("\n")); 6810 6811 CheckComArgNotNull(puOriginX); 6812 CheckComArgNotNull(puOriginY); 6813 CheckComArgNotNull(puWidth); 6814 CheckComArgNotNull(puHeight); 6815 CheckComArgNotNull(pfEnabled); 6816 6074 i_onUSBControllerChange(); 6075 6076 return S_OK; 6077 } 6078 6079 HRESULT Machine::querySavedGuestScreenInfo(ULONG aScreenId, 6080 ULONG *aOriginX, 6081 ULONG *aOriginY, 6082 ULONG *aWidth, 6083 ULONG *aHeight, 6084 BOOL *aEnabled) 6085 { 6817 6086 uint32_t u32OriginX= 0; 6818 6087 uint32_t u32OriginY= 0; … … 6821 6090 uint16_t u16Flags = 0; 6822 6091 6823 int vrc = readSavedGuestScreenInfo(mSSData->strStateFilePath, uScreenId,6092 int vrc = readSavedGuestScreenInfo(mSSData->strStateFilePath, aScreenId, 6824 6093 &u32OriginX, &u32OriginY, &u32Width, &u32Height, &u16Flags); 6825 6094 if (RT_FAILURE(vrc)) … … 6832 6101 * are changed only if API succeeds. 6833 6102 */ 6834 * pfEnabled = TRUE;6103 *aEnabled = TRUE; 6835 6104 #endif 6836 6105 return setError(VBOX_E_IPRT_ERROR, … … 6839 6108 } 6840 6109 6841 *puOriginX = u32OriginX; 6842 *puOriginY = u32OriginY; 6843 *puWidth = u32Width; 6844 *puHeight = u32Height; 6845 *pfEnabled = (u16Flags & VBVA_SCREEN_F_DISABLED) == 0; 6846 6847 return S_OK; 6848 } 6849 6850 STDMETHODIMP Machine::QuerySavedThumbnailSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight) 6851 { 6852 LogFlowThisFunc(("\n")); 6853 6854 CheckComArgNotNull(aSize); 6855 CheckComArgNotNull(aWidth); 6856 CheckComArgNotNull(aHeight); 6857 6110 *aOriginX = u32OriginX; 6111 *aOriginY = u32OriginY; 6112 *aWidth = u32Width; 6113 *aHeight = u32Height; 6114 *aEnabled = (u16Flags & VBVA_SCREEN_F_DISABLED) == 0; 6115 6116 return S_OK; 6117 } 6118 6119 HRESULT Machine::querySavedThumbnailSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight) 6120 { 6858 6121 if (aScreenId != 0) 6859 6122 return E_NOTIMPL; 6860 6861 AutoCaller autoCaller(this);6862 if (FAILED(autoCaller.rc())) return autoCaller.rc();6863 6123 6864 6124 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 6885 6145 } 6886 6146 6887 STDMETHODIMP Machine::ReadSavedThumbnailToArray(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData)) 6888 { 6889 LogFlowThisFunc(("\n")); 6890 6891 CheckComArgNotNull(aWidth); 6892 CheckComArgNotNull(aHeight); 6893 CheckComArgOutSafeArrayPointerValid(aData); 6894 6147 6148 HRESULT Machine::readSavedThumbnailToArray(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData) 6149 { 6895 6150 if (aScreenId != 0) 6896 6151 return E_NOTIMPL; 6897 6898 AutoCaller autoCaller(this);6899 if (FAILED(autoCaller.rc())) return autoCaller.rc();6900 6152 6901 6153 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 6940 6192 } 6941 6193 } 6942 bitmap.detachTo(ComSafeArrayOutArg(aData)); 6194 aData.resize(bitmap.size()); 6195 for (size_t i = 0; i < bitmap.size(); ++i) 6196 aData[i] = bitmap[i]; 6943 6197 6944 6198 freeSavedDisplayScreenshot(pu8Data); … … 6947 6201 } 6948 6202 6949 6950 STDMETHODIMP Machine::ReadSavedThumbnailPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData)) 6951 { 6952 LogFlowThisFunc(("\n")); 6953 6954 CheckComArgNotNull(aWidth); 6955 CheckComArgNotNull(aHeight); 6956 CheckComArgOutSafeArrayPointerValid(aData); 6957 6203 HRESULT Machine::readSavedThumbnailPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData) 6204 { 6958 6205 if (aScreenId != 0) 6959 6206 return E_NOTIMPL; 6960 6961 AutoCaller autoCaller(this);6962 if (FAILED(autoCaller.rc())) return autoCaller.rc();6963 6207 6964 6208 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 6993 6237 if (pu8PNG) 6994 6238 RTMemFree(pu8PNG); 6995 screenData.detachTo(ComSafeArrayOutArg(aData)); 6239 aData.resize(screenData.size()); 6240 for (size_t i = 0; i < screenData.size(); ++i) 6241 aData[i] = screenData[i]; 6996 6242 } 6997 6243 else … … 7009 6255 } 7010 6256 7011 STDMETHODIMP Machine::QuerySavedScreenshotPNGSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight) 7012 { 7013 LogFlowThisFunc(("\n")); 7014 7015 CheckComArgNotNull(aSize); 7016 CheckComArgNotNull(aWidth); 7017 CheckComArgNotNull(aHeight); 7018 6257 HRESULT Machine::querySavedScreenshotPNGSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight) 6258 { 7019 6259 if (aScreenId != 0) 7020 6260 return E_NOTIMPL; 7021 7022 AutoCaller autoCaller(this);7023 if (FAILED(autoCaller.rc())) return autoCaller.rc();7024 6261 7025 6262 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 7046 6283 } 7047 6284 7048 STDMETHODIMP Machine::ReadSavedScreenshotPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData)) 7049 { 7050 LogFlowThisFunc(("\n")); 7051 7052 CheckComArgNotNull(aWidth); 7053 CheckComArgNotNull(aHeight); 7054 CheckComArgOutSafeArrayPointerValid(aData); 7055 6285 HRESULT Machine::readSavedScreenshotPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData) 6286 { 7056 6287 if (aScreenId != 0) 7057 6288 return E_NOTIMPL; 7058 7059 AutoCaller autoCaller(this);7060 if (FAILED(autoCaller.rc())) return autoCaller.rc();7061 6289 7062 6290 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 7079 6307 com::SafeArray<BYTE> png(cbData); 7080 6308 png.initFrom(pu8Data, cbData); 7081 png.detachTo(ComSafeArrayOutArg(aData)); 6309 aData.resize(png.size()); 6310 for (size_t i = 0; i < png.size(); ++i) 6311 aData[i] = png[i]; 7082 6312 7083 6313 freeSavedDisplayScreenshot(pu8Data); … … 7086 6316 } 7087 6317 7088 STDMETHODIMP Machine::HotPlugCPU(ULONG aCpu)6318 HRESULT Machine::hotPlugCPU(ULONG aCpu) 7089 6319 { 7090 6320 HRESULT rc = S_OK; 7091 LogFlowThisFunc(("\n"));7092 7093 AutoCaller autoCaller(this);7094 if (FAILED(autoCaller.rc())) return autoCaller.rc();7095 7096 6321 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7097 6322 … … 7106 6331 7107 6332 alock.release(); 7108 rc = onCPUChange(aCpu, false);6333 rc = i_onCPUChange(aCpu, false); 7109 6334 alock.acquire(); 7110 6335 if (FAILED(rc)) return rc; 7111 6336 7112 setModified(IsModified_MachineData);6337 i_setModified(IsModified_MachineData); 7113 6338 mHWData.backup(); 7114 6339 mHWData->mCPUAttached[aCpu] = true; … … 7116 6341 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 7117 6342 if (Global::IsOnline(mData->mMachineState)) 7118 saveSettings(NULL);7119 7120 return S_OK; 7121 } 7122 7123 STDMETHODIMP Machine::HotUnplugCPU(ULONG aCpu)6343 i_saveSettings(NULL); 6344 6345 return S_OK; 6346 } 6347 6348 HRESULT Machine::hotUnplugCPU(ULONG aCpu) 7124 6349 { 7125 6350 HRESULT rc = S_OK; 7126 LogFlowThisFunc(("\n"));7127 7128 AutoCaller autoCaller(this);7129 if (FAILED(autoCaller.rc())) return autoCaller.rc();7130 6351 7131 6352 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 7147 6368 7148 6369 alock.release(); 7149 rc = onCPUChange(aCpu, true);6370 rc = i_onCPUChange(aCpu, true); 7150 6371 alock.acquire(); 7151 6372 if (FAILED(rc)) return rc; 7152 6373 7153 setModified(IsModified_MachineData);6374 i_setModified(IsModified_MachineData); 7154 6375 mHWData.backup(); 7155 6376 mHWData->mCPUAttached[aCpu] = false; … … 7157 6378 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 7158 6379 if (Global::IsOnline(mData->mMachineState)) 7159 saveSettings(NULL); 7160 7161 return S_OK; 7162 } 7163 7164 STDMETHODIMP Machine::GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached) 7165 { 7166 LogFlowThisFunc(("\n")); 7167 7168 CheckComArgNotNull(aCpuAttached); 7169 7170 *aCpuAttached = false; 7171 7172 AutoCaller autoCaller(this); 7173 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6380 i_saveSettings(NULL); 6381 6382 return S_OK; 6383 } 6384 6385 HRESULT Machine::getCPUStatus(ULONG aCpu, BOOL *aAttached) 6386 { 6387 *aAttached = false; 7174 6388 7175 6389 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 7179 6393 { 7180 6394 if (aCpu < mHWData->mCPUCount) 7181 *a CpuAttached = true;6395 *aAttached = true; 7182 6396 } 7183 6397 else 7184 6398 { 7185 6399 if (aCpu < SchemaDefs::MaxCPUCount) 7186 *aCpuAttached = mHWData->mCPUAttached[aCpu]; 7187 } 7188 7189 return S_OK; 7190 } 7191 7192 STDMETHODIMP Machine::QueryLogFilename(ULONG aIdx, BSTR *aName) 7193 { 7194 CheckComArgOutPointerValid(aName); 7195 7196 AutoCaller autoCaller(this); 7197 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 7198 6400 *aAttached = mHWData->mCPUAttached[aCpu]; 6401 } 6402 6403 return S_OK; 6404 } 6405 6406 HRESULT Machine::queryLogFilename(ULONG aIdx, com::Utf8Str &aFilename) 6407 { 7199 6408 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7200 6409 7201 Utf8Str log = queryLogFilename(aIdx);6410 Utf8Str log = i_queryLogFilename(aIdx); 7202 6411 if (!RTFileExists(log.c_str())) 7203 6412 log.setNull(); 7204 log.cloneTo(aName); 7205 7206 return S_OK; 7207 } 7208 7209 STDMETHODIMP Machine::ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData)) 7210 { 7211 LogFlowThisFunc(("\n")); 7212 CheckComArgOutSafeArrayPointerValid(aData); 6413 aFilename = log; 6414 6415 return S_OK; 6416 } 6417 6418 HRESULT Machine::readLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, std::vector<BYTE> &aData) 6419 { 7213 6420 if (aSize < 0) 7214 6421 return setError(E_INVALIDARG, tr("The size argument (%lld) is negative"), aSize); 7215 6422 7216 AutoCaller autoCaller(this);7217 if (FAILED(autoCaller.rc())) return autoCaller.rc();7218 7219 6423 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7220 6424 7221 6425 HRESULT rc = S_OK; 7222 Utf8Str log = queryLogFilename(aIdx);6426 Utf8Str log = i_queryLogFilename(aIdx); 7223 6427 7224 6428 /* do not unnecessarily hold the lock while doing something which does … … 7253 6457 if (FAILED(rc)) 7254 6458 logData.resize(0); 7255 logData.detachTo(ComSafeArrayOutArg(aData)); 6459 6460 aData.resize(logData.size()); 6461 for (size_t i = 0; i < logData.size(); ++i) 6462 aData[i] = logData[i]; 7256 6463 7257 6464 return rc; … … 7263 6470 * just makes sure it's plugged on next VM start. 7264 6471 */ 7265 STDMETHODIMP Machine::AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL /*tryToUnbind*/) 7266 { 7267 AutoCaller autoCaller(this); 7268 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 7269 6472 HRESULT Machine::attachHostPCIDevice(LONG aHostAddress, LONG aDesiredGuestAddress, BOOL /* aTryToUnbind */) 6473 { 7270 6474 // lock scope 7271 6475 { 7272 6476 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7273 6477 7274 HRESULT rc = checkStateDependency(MutableStateDep);6478 HRESULT rc = i_checkStateDependency(MutableStateDep); 7275 6479 if (FAILED(rc)) return rc; 7276 6480 … … 7293 6497 pAttach = *it; 7294 6498 pAttach->COMGETTER(HostAddress)(&iHostAddress); 7295 if (iHostAddress == hostAddress)6499 if (iHostAddress == aHostAddress) 7296 6500 return setError(E_INVALIDARG, 7297 6501 tr("Device with host PCI address already attached to this VM")); … … 7301 6505 char name[32]; 7302 6506 7303 RTStrPrintf(name, sizeof(name), "host%02x:%02x.%x", (hostAddress>>8) & 0xff, (hostAddress & 0xf8) >> 3, hostAddress & 7); 6507 RTStrPrintf(name, sizeof(name), "host%02x:%02x.%x", (aHostAddress>>8) & 0xff, 6508 (aHostAddress & 0xf8) >> 3, aHostAddress & 7); 7304 6509 Bstr bname(name); 7305 6510 pda.createObject(); 7306 pda->init(this, bname, hostAddress, desiredGuestAddress, TRUE);7307 setModified(IsModified_MachineData);6511 pda->init(this, bname, aHostAddress, aDesiredGuestAddress, TRUE); 6512 i_setModified(IsModified_MachineData); 7308 6513 mHWData.backup(); 7309 6514 mHWData->mPCIDeviceAssignments.push_back(pda); … … 7317 6522 * just makes sure it's not plugged on next VM start. 7318 6523 */ 7319 STDMETHODIMP Machine::DetachHostPCIDevice(LONG hostAddress) 7320 { 7321 AutoCaller autoCaller(this); 7322 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 7323 6524 HRESULT Machine::detachHostPCIDevice(LONG aHostAddress) 6525 { 7324 6526 ComObjPtr<PCIDeviceAttachment> pAttach; 7325 6527 bool fRemoved = false; … … 7330 6532 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7331 6533 7332 rc = checkStateDependency(MutableStateDep);6534 rc = i_checkStateDependency(MutableStateDep); 7333 6535 if (FAILED(rc)) return rc; 7334 6536 … … 7340 6542 pAttach = *it; 7341 6543 pAttach->COMGETTER(HostAddress)(&iHostAddress); 7342 if (iHostAddress != -1 && iHostAddress == hostAddress)6544 if (iHostAddress != -1 && iHostAddress == aHostAddress) 7343 6545 { 7344 setModified(IsModified_MachineData);6546 i_setModified(IsModified_MachineData); 7345 6547 mHWData.backup(); 7346 6548 mHWData->mPCIDeviceAssignments.remove(pAttach); … … 7367 6569 return fRemoved ? S_OK : setError(VBOX_E_OBJECT_NOT_FOUND, 7368 6570 tr("No host PCI device %08x attached"), 7369 hostAddress6571 aHostAddress 7370 6572 ); 7371 6573 } 7372 6574 7373 STDMETHODIMP Machine::COMGETTER(PCIDeviceAssignments)(ComSafeArrayOut(IPCIDeviceAttachment *, aAssignments)) 7374 { 7375 CheckComArgOutSafeArrayPointerValid(aAssignments); 7376 7377 AutoCaller autoCaller(this); 7378 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 7379 6575 HRESULT Machine::getPCIDeviceAssignments(std::vector<ComPtr<IPCIDeviceAttachment> > &aPCIDeviceAssignments) 6576 { 7380 6577 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7381 6578 7382 6579 SafeIfaceArray<IPCIDeviceAttachment> assignments(mHWData->mPCIDeviceAssignments); 7383 assignments.detachTo(ComSafeArrayOutArg(aAssignments)); 7384 7385 return S_OK; 7386 } 7387 7388 STDMETHODIMP Machine::COMGETTER(BandwidthControl)(IBandwidthControl **aBandwidthControl) 7389 { 7390 CheckComArgOutPointerValid(aBandwidthControl); 7391 7392 AutoCaller autoCaller(this); 7393 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 7394 7395 mBandwidthControl.queryInterfaceTo(aBandwidthControl); 7396 7397 return S_OK; 7398 } 7399 7400 STDMETHODIMP Machine::COMGETTER(TracingEnabled)(BOOL *pfEnabled) 7401 { 7402 CheckComArgOutPointerValid(pfEnabled); 7403 AutoCaller autoCaller(this); 7404 HRESULT hrc = autoCaller.rc(); 6580 aPCIDeviceAssignments.resize(assignments.size()); 6581 for (size_t i = 0; i < assignments.size(); ++i) 6582 aPCIDeviceAssignments[i] = assignments[i]; 6583 return S_OK; 6584 } 6585 6586 HRESULT Machine::getBandwidthControl(ComPtr<IBandwidthControl> &aBandwidthControl) 6587 { 6588 mBandwidthControl.queryInterfaceTo(aBandwidthControl.asOutParam()); 6589 6590 return S_OK; 6591 } 6592 6593 HRESULT Machine::getTracingEnabled(BOOL *aTracingEnabled) 6594 { 6595 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6596 6597 *aTracingEnabled = mHWData->mDebugging.fTracingEnabled; 6598 6599 return S_OK; 6600 } 6601 6602 HRESULT Machine::setTracingEnabled(BOOL aTracingEnabled) 6603 { 6604 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6605 HRESULT hrc = i_checkStateDependency(MutableStateDep); 7405 6606 if (SUCCEEDED(hrc)) 7406 6607 { 7407 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7408 *pfEnabled = mHWData->mDebugging.fTracingEnabled; 6608 hrc = mHWData.backupEx(); 6609 if (SUCCEEDED(hrc)) 6610 { 6611 i_setModified(IsModified_MachineData); 6612 mHWData->mDebugging.fTracingEnabled = aTracingEnabled != FALSE; 6613 } 7409 6614 } 7410 6615 return hrc; 7411 6616 } 7412 6617 7413 STDMETHODIMP Machine::COMSETTER(TracingEnabled)(BOOL fEnabled) 7414 { 7415 AutoCaller autoCaller(this); 7416 HRESULT hrc = autoCaller.rc(); 6618 HRESULT Machine::getTracingConfig(com::Utf8Str &aTracingConfig) 6619 { 6620 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6621 aTracingConfig = mHWData->mDebugging.strTracingConfig; 6622 return S_OK; 6623 } 6624 6625 HRESULT Machine::setTracingConfig(const com::Utf8Str &aTracingConfig) 6626 { 6627 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6628 HRESULT hrc = i_checkStateDependency(MutableStateDep); 7417 6629 if (SUCCEEDED(hrc)) 7418 6630 { 7419 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7420 hrc = checkStateDependency(MutableStateDep); 6631 hrc = mHWData.backupEx(); 7421 6632 if (SUCCEEDED(hrc)) 6633 { 6634 mHWData->mDebugging.strTracingConfig = aTracingConfig; 6635 if (SUCCEEDED(hrc)) 6636 i_setModified(IsModified_MachineData); 6637 } 6638 } 6639 return hrc; 6640 } 6641 6642 HRESULT Machine::getAllowTracingToAccessVM(BOOL *aAllowTracingToAccessVM) 6643 { 6644 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6645 6646 *aAllowTracingToAccessVM = mHWData->mDebugging.fAllowTracingToAccessVM; 6647 6648 return S_OK; 6649 } 6650 6651 HRESULT Machine::setAllowTracingToAccessVM(BOOL aAllowTracingToAccessVM) 6652 { 6653 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6654 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6655 if (SUCCEEDED(hrc)) 6656 { 6657 hrc = mHWData.backupEx(); 6658 if (SUCCEEDED(hrc)) 6659 { 6660 i_setModified(IsModified_MachineData); 6661 mHWData->mDebugging.fAllowTracingToAccessVM = aAllowTracingToAccessVM != FALSE; 6662 } 6663 } 6664 return hrc; 6665 } 6666 6667 HRESULT Machine::getAutostartEnabled(BOOL *aAutostartEnabled) 6668 { 6669 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6670 6671 *aAutostartEnabled = mHWData->mAutostart.fAutostartEnabled; 6672 6673 return S_OK; 6674 } 6675 6676 HRESULT Machine::setAutostartEnabled(BOOL aAutostartEnabled) 6677 { 6678 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6679 6680 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6681 if ( SUCCEEDED(hrc) 6682 && mHWData->mAutostart.fAutostartEnabled != !!aAutostartEnabled) 6683 { 6684 AutostartDb *autostartDb = mParent->i_getAutostartDb(); 6685 int vrc; 6686 6687 if (aAutostartEnabled) 6688 vrc = autostartDb->addAutostartVM(mUserData->s.strName.c_str()); 6689 else 6690 vrc = autostartDb->removeAutostartVM(mUserData->s.strName.c_str()); 6691 6692 if (RT_SUCCESS(vrc)) 7422 6693 { 7423 6694 hrc = mHWData.backupEx(); 7424 6695 if (SUCCEEDED(hrc)) 7425 6696 { 7426 setModified(IsModified_MachineData);7427 mHWData->m Debugging.fTracingEnabled = fEnabled != FALSE;6697 i_setModified(IsModified_MachineData); 6698 mHWData->mAutostart.fAutostartEnabled = aAutostartEnabled != FALSE; 7428 6699 } 7429 6700 } 6701 else if (vrc == VERR_NOT_SUPPORTED) 6702 hrc = setError(VBOX_E_NOT_SUPPORTED, 6703 tr("The VM autostart feature is not supported on this platform")); 6704 else if (vrc == VERR_PATH_NOT_FOUND) 6705 hrc = setError(E_FAIL, 6706 tr("The path to the autostart database is not set")); 6707 else 6708 hrc = setError(E_UNEXPECTED, 6709 tr("%s machine '%s' to the autostart database failed with %Rrc"), 6710 aAutostartEnabled ? "Adding" : "Removing", 6711 mUserData->s.strName.c_str(), vrc); 7430 6712 } 7431 6713 return hrc; 7432 6714 } 7433 6715 7434 STDMETHODIMP Machine::COMGETTER(TracingConfig)(BSTR *pbstrConfig) 7435 { 7436 CheckComArgOutPointerValid(pbstrConfig); 7437 AutoCaller autoCaller(this); 7438 HRESULT hrc = autoCaller.rc(); 6716 HRESULT Machine::getAutostartDelay(ULONG *aAutostartDelay) 6717 { 6718 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6719 6720 *aAutostartDelay = mHWData->mAutostart.uAutostartDelay; 6721 6722 return S_OK; 6723 } 6724 6725 HRESULT Machine::setAutostartDelay(ULONG aAutostartDelay) 6726 { 6727 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6728 HRESULT hrc = i_checkStateDependency(MutableStateDep); 7439 6729 if (SUCCEEDED(hrc)) 7440 6730 { 7441 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7442 hrc = mHWData->mDebugging.strTracingConfig.cloneToEx(pbstrConfig); 6731 hrc = mHWData.backupEx(); 6732 if (SUCCEEDED(hrc)) 6733 { 6734 i_setModified(IsModified_MachineData); 6735 mHWData->mAutostart.uAutostartDelay = aAutostartDelay; 6736 } 7443 6737 } 7444 6738 return hrc; 7445 6739 } 7446 6740 7447 STDMETHODIMP Machine::COMSETTER(TracingConfig)(IN_BSTR bstrConfig) 7448 { 7449 CheckComArgStr(bstrConfig); 7450 AutoCaller autoCaller(this); 7451 HRESULT hrc = autoCaller.rc(); 6741 HRESULT Machine::getAutostopType(AutostopType_T *aAutostopType) 6742 { 6743 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6744 6745 *aAutostopType = mHWData->mAutostart.enmAutostopType; 6746 6747 return S_OK; 6748 } 6749 6750 HRESULT Machine::setAutostopType(AutostopType_T aAutostopType) 6751 { 6752 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6753 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6754 if ( SUCCEEDED(hrc) 6755 && mHWData->mAutostart.enmAutostopType != aAutostopType) 6756 { 6757 AutostartDb *autostartDb = mParent->i_getAutostartDb(); 6758 int vrc; 6759 6760 if (aAutostopType != AutostopType_Disabled) 6761 vrc = autostartDb->addAutostopVM(mUserData->s.strName.c_str()); 6762 else 6763 vrc = autostartDb->removeAutostopVM(mUserData->s.strName.c_str()); 6764 6765 if (RT_SUCCESS(vrc)) 6766 { 6767 hrc = mHWData.backupEx(); 6768 if (SUCCEEDED(hrc)) 6769 { 6770 i_setModified(IsModified_MachineData); 6771 mHWData->mAutostart.enmAutostopType = aAutostopType; 6772 } 6773 } 6774 else if (vrc == VERR_NOT_SUPPORTED) 6775 hrc = setError(VBOX_E_NOT_SUPPORTED, 6776 tr("The VM autostop feature is not supported on this platform")); 6777 else if (vrc == VERR_PATH_NOT_FOUND) 6778 hrc = setError(E_FAIL, 6779 tr("The path to the autostart database is not set")); 6780 else 6781 hrc = setError(E_UNEXPECTED, 6782 tr("%s machine '%s' to the autostop database failed with %Rrc"), 6783 aAutostopType != AutostopType_Disabled ? "Adding" : "Removing", 6784 mUserData->s.strName.c_str(), vrc); 6785 } 6786 return hrc; 6787 } 6788 6789 HRESULT Machine::getDefaultFrontend(com::Utf8Str &aDefaultFrontend) 6790 { 6791 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6792 6793 aDefaultFrontend = mHWData->mDefaultFrontend; 6794 6795 return S_OK; 6796 } 6797 6798 HRESULT Machine::setDefaultFrontend(const com::Utf8Str &aDefaultFrontend) 6799 { 6800 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6801 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 7452 6802 if (SUCCEEDED(hrc)) 7453 6803 { 7454 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7455 hrc = checkStateDependency(MutableStateDep); 6804 hrc = mHWData.backupEx(); 7456 6805 if (SUCCEEDED(hrc)) 7457 6806 { 7458 hrc = mHWData.backupEx(); 7459 if (SUCCEEDED(hrc)) 7460 { 7461 hrc = mHWData->mDebugging.strTracingConfig.cloneEx(bstrConfig); 7462 if (SUCCEEDED(hrc)) 7463 setModified(IsModified_MachineData); 7464 } 6807 i_setModified(IsModified_MachineData); 6808 mHWData->mDefaultFrontend = aDefaultFrontend; 7465 6809 } 7466 6810 } 7467 6811 return hrc; 7468 7469 } 7470 7471 STDMETHODIMP Machine::COMGETTER(AllowTracingToAccessVM)(BOOL *pfAllow) 7472 { 7473 CheckComArgOutPointerValid(pfAllow); 7474 AutoCaller autoCaller(this); 7475 HRESULT hrc = autoCaller.rc(); 6812 } 6813 6814 HRESULT Machine::getIcon(std::vector<BYTE> &aIcon) 6815 { 6816 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6817 com::SafeArray<BYTE> icon(mUserData->mIcon.size()); 6818 aIcon.resize(mUserData->mIcon.size()); 6819 memcpy(icon.raw(), &mUserData->mIcon[0], mUserData->mIcon.size()); 6820 aIcon.resize(icon.size()); 6821 for (size_t i = 0; i < icon.size(); ++i) 6822 aIcon[i] = icon[i]; 6823 return S_OK; 6824 } 6825 6826 HRESULT Machine::setIcon(const std::vector<BYTE> &aIcon) 6827 { 6828 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6829 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 7476 6830 if (SUCCEEDED(hrc)) 7477 6831 { 7478 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7479 *pfAllow = mHWData->mDebugging.fAllowTracingToAccessVM; 6832 i_setModified(IsModified_MachineData); 6833 mUserData.backup(); 6834 com::SafeArray<BYTE> icon(aIcon); 6835 mUserData->mIcon.resize(aIcon.size()); 6836 memcpy(&mUserData->mIcon[0], icon.raw(), mUserData->mIcon.size()); 7480 6837 } 7481 6838 return hrc; 7482 6839 } 7483 6840 7484 STDMETHODIMP Machine::COMSETTER(AllowTracingToAccessVM)(BOOL fAllow) 7485 { 7486 AutoCaller autoCaller(this); 7487 HRESULT hrc = autoCaller.rc(); 7488 if (SUCCEEDED(hrc)) 7489 { 7490 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7491 hrc = checkStateDependency(MutableStateDep); 7492 if (SUCCEEDED(hrc)) 7493 { 7494 hrc = mHWData.backupEx(); 7495 if (SUCCEEDED(hrc)) 7496 { 7497 setModified(IsModified_MachineData); 7498 mHWData->mDebugging.fAllowTracingToAccessVM = fAllow != FALSE; 7499 } 7500 } 7501 } 7502 return hrc; 7503 } 7504 7505 STDMETHODIMP Machine::COMGETTER(AutostartEnabled)(BOOL *pfEnabled) 7506 { 7507 CheckComArgOutPointerValid(pfEnabled); 7508 AutoCaller autoCaller(this); 7509 HRESULT hrc = autoCaller.rc(); 7510 if (SUCCEEDED(hrc)) 7511 { 7512 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7513 *pfEnabled = mHWData->mAutostart.fAutostartEnabled; 7514 } 7515 return hrc; 7516 } 7517 7518 STDMETHODIMP Machine::COMSETTER(AutostartEnabled)(BOOL fEnabled) 7519 { 7520 AutoCaller autoCaller(this); 7521 HRESULT hrc = autoCaller.rc(); 7522 if (SUCCEEDED(hrc)) 7523 { 7524 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7525 hrc = checkStateDependency(MutableStateDep); 7526 if ( SUCCEEDED(hrc) 7527 && mHWData->mAutostart.fAutostartEnabled != !!fEnabled) 7528 { 7529 AutostartDb *autostartDb = mParent->i_getAutostartDb(); 7530 int vrc; 7531 7532 if (fEnabled) 7533 vrc = autostartDb->addAutostartVM(mUserData->s.strName.c_str()); 7534 else 7535 vrc = autostartDb->removeAutostartVM(mUserData->s.strName.c_str()); 7536 7537 if (RT_SUCCESS(vrc)) 7538 { 7539 hrc = mHWData.backupEx(); 7540 if (SUCCEEDED(hrc)) 7541 { 7542 setModified(IsModified_MachineData); 7543 mHWData->mAutostart.fAutostartEnabled = fEnabled != FALSE; 7544 } 7545 } 7546 else if (vrc == VERR_NOT_SUPPORTED) 7547 hrc = setError(VBOX_E_NOT_SUPPORTED, 7548 tr("The VM autostart feature is not supported on this platform")); 7549 else if (vrc == VERR_PATH_NOT_FOUND) 7550 hrc = setError(E_FAIL, 7551 tr("The path to the autostart database is not set")); 7552 else 7553 hrc = setError(E_UNEXPECTED, 7554 tr("%s machine '%s' to the autostart database failed with %Rrc"), 7555 fEnabled ? "Adding" : "Removing", 7556 mUserData->s.strName.c_str(), vrc); 7557 } 7558 } 7559 return hrc; 7560 } 7561 7562 STDMETHODIMP Machine::COMGETTER(AutostartDelay)(ULONG *puDelay) 7563 { 7564 CheckComArgOutPointerValid(puDelay); 7565 AutoCaller autoCaller(this); 7566 HRESULT hrc = autoCaller.rc(); 7567 if (SUCCEEDED(hrc)) 7568 { 7569 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7570 *puDelay = mHWData->mAutostart.uAutostartDelay; 7571 } 7572 return hrc; 7573 } 7574 7575 STDMETHODIMP Machine::COMSETTER(AutostartDelay)(ULONG uDelay) 7576 { 7577 AutoCaller autoCaller(this); 7578 HRESULT hrc = autoCaller.rc(); 7579 if (SUCCEEDED(hrc)) 7580 { 7581 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7582 hrc = checkStateDependency(MutableStateDep); 7583 if (SUCCEEDED(hrc)) 7584 { 7585 hrc = mHWData.backupEx(); 7586 if (SUCCEEDED(hrc)) 7587 { 7588 setModified(IsModified_MachineData); 7589 mHWData->mAutostart.uAutostartDelay = uDelay; 7590 } 7591 } 7592 } 7593 return hrc; 7594 } 7595 7596 STDMETHODIMP Machine::COMGETTER(AutostopType)(AutostopType_T *penmAutostopType) 7597 { 7598 CheckComArgOutPointerValid(penmAutostopType); 7599 AutoCaller autoCaller(this); 7600 HRESULT hrc = autoCaller.rc(); 7601 if (SUCCEEDED(hrc)) 7602 { 7603 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7604 *penmAutostopType = mHWData->mAutostart.enmAutostopType; 7605 } 7606 return hrc; 7607 } 7608 7609 STDMETHODIMP Machine::COMSETTER(AutostopType)(AutostopType_T enmAutostopType) 7610 { 7611 AutoCaller autoCaller(this); 7612 HRESULT hrc = autoCaller.rc(); 7613 if (SUCCEEDED(hrc)) 7614 { 7615 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7616 hrc = checkStateDependency(MutableStateDep); 7617 if ( SUCCEEDED(hrc) 7618 && mHWData->mAutostart.enmAutostopType != enmAutostopType) 7619 { 7620 AutostartDb *autostartDb = mParent->i_getAutostartDb(); 7621 int vrc; 7622 7623 if (enmAutostopType != AutostopType_Disabled) 7624 vrc = autostartDb->addAutostopVM(mUserData->s.strName.c_str()); 7625 else 7626 vrc = autostartDb->removeAutostopVM(mUserData->s.strName.c_str()); 7627 7628 if (RT_SUCCESS(vrc)) 7629 { 7630 hrc = mHWData.backupEx(); 7631 if (SUCCEEDED(hrc)) 7632 { 7633 setModified(IsModified_MachineData); 7634 mHWData->mAutostart.enmAutostopType = enmAutostopType; 7635 } 7636 } 7637 else if (vrc == VERR_NOT_SUPPORTED) 7638 hrc = setError(VBOX_E_NOT_SUPPORTED, 7639 tr("The VM autostop feature is not supported on this platform")); 7640 else if (vrc == VERR_PATH_NOT_FOUND) 7641 hrc = setError(E_FAIL, 7642 tr("The path to the autostart database is not set")); 7643 else 7644 hrc = setError(E_UNEXPECTED, 7645 tr("%s machine '%s' to the autostop database failed with %Rrc"), 7646 enmAutostopType != AutostopType_Disabled ? "Adding" : "Removing", 7647 mUserData->s.strName.c_str(), vrc); 7648 } 7649 } 7650 return hrc; 7651 } 7652 7653 STDMETHODIMP Machine::COMGETTER(DefaultFrontend)(BSTR *aDefaultFrontend) 7654 { 7655 CheckComArgOutPointerValid(aDefaultFrontend); 7656 AutoCaller autoCaller(this); 7657 HRESULT hrc = autoCaller.rc(); 7658 if (SUCCEEDED(hrc)) 7659 { 7660 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7661 mHWData->mDefaultFrontend.cloneTo(aDefaultFrontend); 7662 } 7663 return hrc; 7664 } 7665 7666 STDMETHODIMP Machine::COMSETTER(DefaultFrontend)(IN_BSTR aDefaultFrontend) 7667 { 7668 CheckComArgStr(aDefaultFrontend); 7669 AutoCaller autoCaller(this); 7670 HRESULT hrc = autoCaller.rc(); 7671 if (SUCCEEDED(hrc)) 7672 { 7673 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7674 hrc = checkStateDependency(MutableOrSavedStateDep); 7675 if (SUCCEEDED(hrc)) 7676 { 7677 hrc = mHWData.backupEx(); 7678 if (SUCCEEDED(hrc)) 7679 { 7680 setModified(IsModified_MachineData); 7681 mHWData->mDefaultFrontend = aDefaultFrontend; 7682 } 7683 } 7684 } 7685 return hrc; 7686 } 7687 7688 STDMETHODIMP Machine::COMGETTER(Icon)(ComSafeArrayOut(BYTE, aIcon)) 7689 { 7690 CheckComArgSafeArrayNotNull(aIcon); 7691 CheckComArgOutSafeArrayPointerValid(aIcon); 7692 AutoCaller autoCaller(this); 7693 HRESULT hrc = autoCaller.rc(); 7694 if (SUCCEEDED(hrc)) 7695 { 7696 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7697 com::SafeArray<BYTE> icon(mUserData->mIcon.size()); 7698 memcpy(icon.raw(), &mUserData->mIcon[0], mUserData->mIcon.size()); 7699 icon.detachTo(ComSafeArrayOutArg(aIcon)); 7700 } 7701 return hrc; 7702 } 7703 7704 STDMETHODIMP Machine::COMSETTER(Icon)(ComSafeArrayIn(BYTE, aIcon)) 7705 { 7706 CheckComArgSafeArrayNotNull(aIcon); 7707 AutoCaller autoCaller(this); 7708 HRESULT hrc = autoCaller.rc(); 7709 if (SUCCEEDED(hrc)) 7710 { 7711 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7712 hrc = checkStateDependency(MutableOrSavedStateDep); 7713 if (SUCCEEDED(hrc)) 7714 { 7715 setModified(IsModified_MachineData); 7716 mUserData.backup(); 7717 com::SafeArray<BYTE> icon(ComSafeArrayInArg(aIcon)); 7718 mUserData->mIcon.resize(icon.size()); 7719 memcpy(&mUserData->mIcon[0], icon.raw(), mUserData->mIcon.size()); 7720 } 7721 } 7722 return hrc; 7723 } 7724 7725 STDMETHODIMP Machine::COMGETTER(USBProxyAvailable)(BOOL *aAvailable) 7726 { 7727 CheckComArgOutPointerValid(aAvailable); 7728 7729 AutoCaller autoCaller(this); 7730 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 6841 HRESULT Machine::getUSBProxyAvailable(BOOL *aUSBProxyAvailable) 6842 { 7731 6843 7732 6844 #ifdef VBOX_WITH_USB 7733 *a Available = true;6845 *aUSBProxyAvailable = true; 7734 6846 #else 7735 *a Available = false;6847 *aUSBProxyAvailable = false; 7736 6848 #endif 7737 6849 return S_OK; 7738 6850 } 7739 6851 7740 STDMETHODIMP Machine::CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress) 7741 { 7742 LogFlowFuncEnter(); 7743 7744 CheckComArgNotNull(pTarget); 7745 CheckComArgOutPointerValid(pProgress); 6852 HRESULT Machine::cloneTo(const ComPtr<IMachine> &aTarget, CloneMode_T aMode, const std::vector<CloneOptions_T> &aOptions, 6853 ComPtr<IProgress> &aProgress) 6854 { 6855 ComObjPtr<Progress> pP; 6856 Progress *ppP = pP; 6857 IProgress *iP = static_cast<IProgress *>(ppP); 6858 IProgress **pProgress = &iP; 6859 6860 IMachine *pTarget = aTarget; 7746 6861 7747 6862 /* Convert the options. */ 7748 6863 RTCList<CloneOptions_T> optList; 7749 if (options != NULL) 7750 optList = com::SafeArray<CloneOptions_T>(ComSafeArrayInArg(options)).toList(); 6864 if (aOptions.size()) 6865 for (size_t i = 0; i < aOptions.size(); ++i) 6866 optList.append(aOptions[i]); 7751 6867 7752 6868 if (optList.contains(CloneOptions_Link)) 7753 6869 { 7754 if (!i sSnapshotMachine())6870 if (!i_isSnapshotMachine()) 7755 6871 return setError(E_INVALIDARG, 7756 6872 tr("Linked clone can only be created from a snapshot")); 7757 if ( mode != CloneMode_MachineState)6873 if (aMode != CloneMode_MachineState) 7758 6874 return setError(E_INVALIDARG, 7759 6875 tr("Linked clone can only be created for a single machine state")); … … 7761 6877 AssertReturn(!(optList.contains(CloneOptions_KeepAllMACs) && optList.contains(CloneOptions_KeepNATMACs)), E_INVALIDARG); 7762 6878 7763 AutoCaller autoCaller(this); 7764 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 7765 7766 7767 MachineCloneVM *pWorker = new MachineCloneVM(this, static_cast<Machine*>(pTarget), mode, optList); 6879 MachineCloneVM *pWorker = new MachineCloneVM(this, static_cast<Machine*>(pTarget), aMode, optList); 7768 6880 7769 6881 HRESULT rc = pWorker->start(pProgress); 7770 6882 7771 LogFlowFuncLeave(); 6883 pP = static_cast<Progress *>(*pProgress); 6884 pP.queryInterfaceTo(aProgress.asOutParam()); 7772 6885 7773 6886 return rc; 6887 7774 6888 } 7775 6889 … … 7779 6893 /** 7780 6894 * Adds the given IsModified_* flag to the dirty flags of the machine. 7781 * This must be called either during loadSettings or under the machine write lock.6895 * This must be called either during i_loadSettings or under the machine write lock. 7782 6896 * @param fl 7783 6897 */ 7784 void Machine:: setModified(uint32_t fl, bool fAllowStateModification /* = true */)6898 void Machine::i_setModified(uint32_t fl, bool fAllowStateModification /* = true */) 7785 6899 { 7786 6900 mData->flModifications |= fl; 7787 if (fAllowStateModification && i sStateModificationAllowed())6901 if (fAllowStateModification && i_isStateModificationAllowed()) 7788 6902 mData->mCurrentStateModified = true; 7789 6903 } … … 7795 6909 * @param fModifications The flag to add. 7796 6910 */ 7797 void Machine:: setModifiedLock(uint32_t fModification, bool fAllowStateModification /* = true */)6911 void Machine::i_setModifiedLock(uint32_t fModification, bool fAllowStateModification /* = true */) 7798 6912 { 7799 6913 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7800 setModified(fModification, fAllowStateModification);6914 i_setModified(fModification, fAllowStateModification); 7801 6915 } 7802 6916 … … 7808 6922 * @note locks this object for reading. 7809 6923 */ 7810 HRESULT Machine:: saveRegistryEntry(settings::MachineRegistryEntry &data)6924 HRESULT Machine::i_saveRegistryEntry(settings::MachineRegistryEntry &data) 7811 6925 { 7812 6926 AutoLimitedCaller autoCaller(this); … … 7832 6946 * @note Locks this object for reading. 7833 6947 */ 7834 int Machine:: calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)6948 int Machine::i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult) 7835 6949 { 7836 6950 AutoCaller autoCaller(this); … … 7861 6975 * @note Locks this object for reading. 7862 6976 */ 7863 void Machine:: copyPathRelativeToMachine(const Utf8Str &strSource,7864 Utf8Str &strTarget)6977 void Machine::i_copyPathRelativeToMachine(const Utf8Str &strSource, 6978 Utf8Str &strTarget) 7865 6979 { 7866 6980 AutoCaller autoCaller(this); … … 7891 7005 * \a aLogFolder argument. 7892 7006 */ 7893 void Machine:: getLogFolder(Utf8Str &aLogFolder)7007 void Machine::i_getLogFolder(Utf8Str &aLogFolder) 7894 7008 { 7895 7009 AutoCaller autoCaller(this); … … 7929 7043 * Returns the full path to the machine's log file for an given index. 7930 7044 */ 7931 Utf8Str Machine:: queryLogFilename(ULONG idx)7045 Utf8Str Machine::i_queryLogFilename(ULONG idx) 7932 7046 { 7933 7047 Utf8Str logFolder; … … 7961 7075 * @param str 7962 7076 */ 7963 void Machine::composeSavedStateFilename(Utf8Str &strStateFilePath) 7077 7078 void Machine::i_composeSavedStateFilename(Utf8Str &strStateFilePath) 7964 7079 { 7965 7080 AutoCaller autoCaller(this); … … 7968 7083 { 7969 7084 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7970 calculateFullPath(mUserData->s.strSnapshotFolder, strStateFilePath);7085 i_calculateFullPath(mUserData->s.strSnapshotFolder, strStateFilePath); 7971 7086 } 7972 7087 … … 7985 7100 * Returns the full path to the default video capture file. 7986 7101 */ 7987 void Machine:: getDefaultVideoCaptureFile(Utf8Str &strFile)7102 void Machine::i_getDefaultVideoCaptureFile(Utf8Str &strFile) 7988 7103 { 7989 7104 AutoCaller autoCaller(this); … … 8000 7115 * Returns whether at least one USB controller is present for the VM. 8001 7116 */ 8002 bool Machine::i sUSBControllerPresent()7117 bool Machine::i_isUSBControllerPresent() 8003 7118 { 8004 7119 AutoCaller autoCaller(this); … … 8014 7129 * (inside the lock). 8015 7130 */ 8016 HRESULT Machine:: launchVMProcess(IInternalSessionControl *aControl,8017 const Utf8Str &strFrontend,8018 const Utf8Str &strEnvironment,8019 ProgressProxy *aProgress)7131 HRESULT Machine::i_launchVMProcess(IInternalSessionControl *aControl, 7132 const Utf8Str &strFrontend, 7133 const Utf8Str &strEnvironment, 7134 ProgressProxy *aProgress) 8020 7135 { 8021 7136 LogFlowThisFuncEnter(); … … 8124 7239 #define OSX_APP_PATH_FMT "/Resources/%s.app/Contents/MacOS/VirtualBoxVM" 8125 7240 8126 Utf8Str strAppOverride = getExtraData(Utf8Str("VBoxInternal2/VirtualBoxVMAppOverride"));7241 Utf8Str strAppOverride = i_getExtraData(Utf8Str("VBoxInternal2/VirtualBoxVMAppOverride")); 8127 7242 if ( strAppOverride.contains(".") 8128 7243 || strAppOverride.contains("/") … … 8151 7266 8152 7267 Utf8Str idStr = mData->mUuid.toString(); 8153 const char * args[] = {szPath, "--comment", mUserData->s.strName.c_str(), "--startvm", idStr.c_str(), "--no-startvm-errormsgbox", 0 }; 7268 const char * args[] = {szPath, "--comment", mUserData->s.strName.c_str(), 7269 "--startvm", idStr.c_str(), "--no-startvm-errormsgbox", 0 }; 8154 7270 vrc = RTProcCreate(szPath, args, env, 0, &pid); 8155 7271 } … … 8295 7411 * @note locks this object for reading. 8296 7412 */ 8297 bool Machine::i sSessionOpen(ComObjPtr<SessionMachine> &aMachine,8298 ComPtr<IInternalSessionControl> *aControl /*= NULL*/,8299 bool aAllowClosing /*= false*/)7413 bool Machine::i_isSessionOpen(ComObjPtr<SessionMachine> &aMachine, 7414 ComPtr<IInternalSessionControl> *aControl /*= NULL*/, 7415 bool aAllowClosing /*= false*/) 8300 7416 { 8301 7417 AutoLimitedCaller autoCaller(this); … … 8330 7446 * @note locks this object for reading. 8331 7447 */ 8332 bool Machine::i sSessionSpawning()7448 bool Machine::i_isSessionSpawning() 8333 7449 { 8334 7450 AutoLimitedCaller autoCaller(this); … … 8361 7477 * @note Locks this object for writing. 8362 7478 */ 8363 bool Machine:: checkForSpawnFailure()7479 bool Machine::i_checkForSpawnFailure() 8364 7480 { 8365 7481 AutoCaller autoCaller(this); … … 8394 7510 rc = setError(E_FAIL, 8395 7511 tr("The virtual machine '%s' has terminated unexpectedly during startup with exit code %d"), 8396 getName().c_str(), status.iStatus);7512 i_getName().c_str(), status.iStatus); 8397 7513 else if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_SIGNAL) 8398 7514 rc = setError(E_FAIL, 8399 7515 tr("The virtual machine '%s' has terminated unexpectedly during startup because of signal %d"), 8400 getName().c_str(), status.iStatus);7516 i_getName().c_str(), status.iStatus); 8401 7517 else if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_ABEND) 8402 7518 rc = setError(E_FAIL, 8403 7519 tr("The virtual machine '%s' has terminated abnormally"), 8404 getName().c_str(), status.iStatus);7520 i_getName().c_str(), status.iStatus); 8405 7521 else 8406 7522 rc = setError(E_FAIL, 8407 7523 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)"), 8408 getName().c_str(), vrc);7524 i_getName().c_str(), vrc); 8409 7525 } 8410 7526 … … 8428 7544 if (!mData->mSession.mProgress.isNull()) 8429 7545 { 8430 mData->mSession.mProgress-> i_notifyComplete(rc);7546 mData->mSession.mProgress->notifyComplete(rc); 8431 7547 mData->mSession.mProgress.setNull(); 8432 7548 } … … 8448 7564 * children for writing. 8449 7565 */ 8450 HRESULT Machine:: prepareRegister()7566 HRESULT Machine::i_prepareRegister() 8451 7567 { 8452 7568 AssertReturn(mParent->isWriteLockOnCurrentThread(), E_FAIL); … … 8458 7574 8459 7575 /* wait for state dependents to drop to zero */ 8460 ensureNoStateDependencies();7576 i_ensureNoStateDependencies(); 8461 7577 8462 7578 if (!mData->mAccessible) … … 8477 7593 8478 7594 // Ensure the settings are saved. If we are going to be registered and 8479 // no config file exists yet, create it by calling saveSettings() too.7595 // no config file exists yet, create it by calling i_saveSettings() too. 8480 7596 if ( (mData->flModifications) 8481 7597 || (!mData->pMachineConfigFile->fileExists()) 8482 7598 ) 8483 7599 { 8484 rc = saveSettings(NULL);7600 rc = i_saveSettings(NULL); 8485 7601 // no need to check whether VirtualBox.xml needs saving too since 8486 7602 // we can't have a machine XML file rename pending … … 8493 7609 { 8494 7610 /* we may have had implicit modifications we want to fix on success */ 8495 commit();7611 i_commit(); 8496 7612 8497 7613 mData->mRegistered = true; … … 8500 7616 { 8501 7617 /* we may have had implicit modifications we want to cancel on failure*/ 8502 rollback(false /* aNotify */);7618 i_rollback(false /* aNotify */); 8503 7619 } 8504 7620 … … 8525 7641 * @note Locks this object for writing. 8526 7642 */ 8527 HRESULT Machine:: addStateDependency(StateDependency aDepType /* = AnyStateDep */,8528 MachineState_T *aState /* = NULL */,8529 BOOL *aRegistered /* = NULL */)7643 HRESULT Machine::i_addStateDependency(StateDependency aDepType /* = AnyStateDep */, 7644 MachineState_T *aState /* = NULL */, 7645 BOOL *aRegistered /* = NULL */) 8530 7646 { 8531 7647 AutoCaller autoCaller(this); … … 8534 7650 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 8535 7651 8536 HRESULT rc = checkStateDependency(aDepType);7652 HRESULT rc = i_checkStateDependency(aDepType); 8537 7653 if (FAILED(rc)) return rc; 8538 7654 … … 8540 7656 if (mData->mMachineStateChangePending != 0) 8541 7657 { 8542 /* ensureNoStateDependencies() is waiting for state dependencies to7658 /* i_ensureNoStateDependencies() is waiting for state dependencies to 8543 7659 * drop to zero so don't add more. It may make sense to wait a bit 8544 7660 * and retry before reporting an error (since the pending state … … 8569 7685 * dependency is no more necessary. 8570 7686 */ 8571 void Machine:: releaseStateDependency()7687 void Machine::i_releaseStateDependency() 8572 7688 { 8573 7689 AutoCaller autoCaller(this); … … 8582 7698 if (mData->mMachineStateDeps == 0) 8583 7699 { 8584 /* inform ensureNoStateDependencies() that there are no more deps */7700 /* inform i_ensureNoStateDependencies() that there are no more deps */ 8585 7701 if (mData->mMachineStateChangePending != 0) 8586 7702 { … … 8591 7707 } 8592 7708 8593 Utf8Str Machine:: getExtraData(const Utf8Str &strKey)7709 Utf8Str Machine::i_getExtraData(const Utf8Str &strKey) 8594 7710 { 8595 7711 /* start with nothing found */ … … 8641 7757 * lock. 8642 7758 */ 8643 HRESULT Machine:: checkStateDependency(StateDependency aDepType)7759 HRESULT Machine::i_checkStateDependency(StateDependency aDepType) 8644 7760 { 8645 7761 switch (aDepType) … … 8652 7768 { 8653 7769 if ( mData->mRegistered 8654 && ( !isSessionMachine() /** @todo This was just converted raw; Check if Running and Paused should actually be included here... (Live Migration) */ 7770 && ( !i_isSessionMachine() /** @todo This was just converted raw; Check if Running and 7771 Paused should actually be included here... (Live Migration) */ 8655 7772 || ( mData->mMachineState != MachineState_Paused 8656 7773 && mData->mMachineState != MachineState_Running … … 8669 7786 { 8670 7787 if ( mData->mRegistered 8671 && ( !isSessionMachine() /** @todo This was just converted raw; Check if Running and Paused should actually be included here... (Live Migration) */ 7788 && ( !i_isSessionMachine() /** @todo This was just converted raw; Check if Running and 7789 Paused should actually be included here... (Live Migration) */ 8672 7790 || ( mData->mMachineState != MachineState_Paused 8673 7791 && mData->mMachineState != MachineState_Running … … 8687 7805 { 8688 7806 if ( mData->mRegistered 8689 && ( !i sSessionMachine()7807 && ( !i_isSessionMachine() 8690 7808 || ( mData->mMachineState != MachineState_PoweredOff 8691 7809 && mData->mMachineState != MachineState_Saved … … 8743 7861 8744 7862 /* create associated serial port objects */ 8745 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)7863 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 8746 7864 { 8747 7865 unconst(mSerialPorts[slot]).createObject(); … … 8750 7868 8751 7869 /* create associated parallel port objects */ 8752 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)7870 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 8753 7871 { 8754 7872 unconst(mParallelPorts[slot]).createObject(); … … 8766 7884 /* create associated network adapter objects */ 8767 7885 mNetworkAdapters.resize(Global::getMaxNetworkAdapters(mHWData->mChipsetType)); 8768 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)7886 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 8769 7887 { 8770 7888 unconst(mNetworkAdapters[slot]).createObject(); … … 8802 7920 } 8803 7921 8804 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)7922 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 8805 7923 { 8806 7924 if (mNetworkAdapters[slot]) … … 8823 7941 } 8824 7942 8825 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)7943 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 8826 7944 { 8827 7945 if (mParallelPorts[slot]) … … 8832 7950 } 8833 7951 8834 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)7952 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 8835 7953 { 8836 7954 if (mSerialPorts[slot]) … … 8862 7980 * code will not affect them. */ 8863 7981 if ( !!mMediaData 8864 && (!i sSessionMachine())7982 && (!i_isSessionMachine()) 8865 7983 ) 8866 7984 { … … 8872 7990 if (pMedium.isNull()) 8873 7991 continue; 8874 HRESULT rc = pMedium->i_removeBackReference(mData->mUuid, getSnapshotId());7992 HRESULT rc = pMedium->i_removeBackReference(mData->mUuid, i_getSnapshotId()); 8875 7993 AssertComRC(rc); 8876 7994 } 8877 7995 } 8878 7996 8879 if (!i sSessionMachine() && !isSnapshotMachine())7997 if (!i_isSessionMachine() && !i_isSnapshotMachine()) 8880 7998 { 8881 7999 // clean up the snapshots list (Snapshot::uninit() will handle the snapshot's children recursively) … … 8911 8029 * (primary) machine pointer. 8912 8030 */ 8913 Machine* Machine:: getMachine()8914 { 8915 if (i sSessionMachine())8031 Machine* Machine::i_getMachine() 8032 { 8033 if (i_isSessionMachine()) 8916 8034 return (Machine*)mPeer; 8917 8035 return this; … … 8931 8049 * @warning To be used only in methods that change the machine state! 8932 8050 */ 8933 void Machine:: ensureNoStateDependencies()8051 void Machine::i_ensureNoStateDependencies() 8934 8052 { 8935 8053 AssertReturnVoid(isWriteLockOnCurrentThread()); … … 8971 8089 * @note Locks this object for writing. 8972 8090 */ 8973 HRESULT Machine:: setMachineState(MachineState_T aMachineState)8091 HRESULT Machine::i_setMachineState(MachineState_T aMachineState) 8974 8092 { 8975 8093 LogFlowThisFuncEnter(); … … 8982 8100 8983 8101 /* wait for state dependents to drop to zero */ 8984 ensureNoStateDependencies();8102 i_ensureNoStateDependencies(); 8985 8103 8986 8104 if (mData->mMachineState != aMachineState) … … 9011 8129 * must be called from under the object's lock! 9012 8130 */ 9013 HRESULT Machine:: findSharedFolder(const Utf8Str &aName,9014 ComObjPtr<SharedFolder> &aSharedFolder,9015 bool aSetError /* = false */)8131 HRESULT Machine::i_findSharedFolder(const Utf8Str &aName, 8132 ComObjPtr<SharedFolder> &aSharedFolder, 8133 bool aSetError /* = false */) 9016 8134 { 9017 8135 HRESULT rc = VBOX_E_OBJECT_NOT_FOUND; … … 9056 8174 * 9057 8175 * @param config Machine settings from XML. 9058 * @param puuidRegistry If != NULL, Medium::setRegistryIdIfFirst() gets called with this registry ID for each attached medium in the config. 8176 * @param puuidRegistry If != NULL, Medium::setRegistryIdIfFirst() gets called with this registry ID 8177 * for each attached medium in the config. 9059 8178 * @return 9060 8179 */ 9061 HRESULT Machine:: loadMachineDataFromSettings(const settings::MachineConfigFile &config,9062 const Guid *puuidRegistry)8180 HRESULT Machine::i_loadMachineDataFromSettings(const settings::MachineConfigFile &config, 8181 const Guid *puuidRegistry) 9063 8182 { 9064 8183 // copy name, description, OS type, teleporter, UTC etc. … … 9096 8215 { 9097 8216 Utf8Str stateFilePathFull(config.strStateFile); 9098 int vrc = calculateFullPath(stateFilePathFull, stateFilePathFull);8217 int vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull); 9099 8218 if (RT_FAILURE(vrc)) 9100 8219 return setError(E_FAIL, … … 9130 8249 { 9131 8250 // determine machine folder 9132 Utf8Str strMachineFolder = getSettingsFileFull();8251 Utf8Str strMachineFolder = i_getSettingsFileFull(); 9133 8252 strMachineFolder.stripFilename(); 9134 rc = mParent->initMedia( getId(),// media registry ID == machine UUID8253 rc = mParent->initMedia(i_getId(), // media registry ID == machine UUID 9135 8254 config.mediaRegistry, 9136 8255 strMachineFolder); … … 9147 8266 const settings::Snapshot &snap = config.llFirstSnapshot.front(); 9148 8267 9149 rc = loadSnapshot(snap,9150 config.uuidCurrentSnapshot,9151 NULL); // no parent == first snapshot8268 rc = i_loadSnapshot(snap, 8269 config.uuidCurrentSnapshot, 8270 NULL); // no parent == first snapshot 9152 8271 if (FAILED(rc)) return rc; 9153 8272 } 9154 8273 9155 8274 // hardware data 9156 rc = loadHardware(config.hardwareMachine, &config.debugging, &config.autostart);8275 rc = i_loadHardware(config.hardwareMachine, &config.debugging, &config.autostart); 9157 8276 if (FAILED(rc)) return rc; 9158 8277 9159 8278 // load storage controllers 9160 rc = loadStorageControllers(config.storageMachine,9161 puuidRegistry,9162 NULL /* puuidSnapshot */);8279 rc = i_loadStorageControllers(config.storageMachine, 8280 puuidRegistry, 8281 NULL /* puuidSnapshot */); 9163 8282 if (FAILED(rc)) return rc; 9164 8283 … … 9167 8286 * otherwise it will be not possible to change the settings 9168 8287 * somewhere in the code above because all setters will be 9169 * blocked by checkStateDependency(MutableStateDep).8288 * blocked by i_checkStateDependency(MutableStateDep). 9170 8289 */ 9171 8290 … … 9175 8294 mSSData->strStateFilePath.setNull(); 9176 8295 9177 /* no need to use setMachineState() during init() */8296 /* no need to use i_setMachineState() during init() */ 9178 8297 mData->mMachineState = MachineState_Aborted; 9179 8298 } 9180 8299 else if (!mSSData->strStateFilePath.isEmpty()) 9181 8300 { 9182 /* no need to use setMachineState() during init() */8301 /* no need to use i_setMachineState() during init() */ 9183 8302 mData->mMachineState = MachineState_Saved; 9184 8303 } … … 9197 8316 * @param aParentSnapshot Parent snapshot. 9198 8317 */ 9199 HRESULT Machine:: loadSnapshot(const settings::Snapshot &data,9200 const Guid &aCurSnapshotId,9201 Snapshot *aParentSnapshot)9202 { 9203 AssertReturn(!i sSnapshotMachine(), E_FAIL);9204 AssertReturn(!i sSessionMachine(), E_FAIL);8318 HRESULT Machine::i_loadSnapshot(const settings::Snapshot &data, 8319 const Guid &aCurSnapshotId, 8320 Snapshot *aParentSnapshot) 8321 { 8322 AssertReturn(!i_isSnapshotMachine(), E_FAIL); 8323 AssertReturn(!i_isSessionMachine(), E_FAIL); 9205 8324 9206 8325 HRESULT rc = S_OK; … … 9211 8330 /* optional */ 9212 8331 strStateFile = data.strStateFile; 9213 int vrc = calculateFullPath(strStateFile, strStateFile);8332 int vrc = i_calculateFullPath(strStateFile, strStateFile); 9214 8333 if (RT_FAILURE(vrc)) 9215 8334 return setError(E_FAIL, … … 9261 8380 const settings::Snapshot &childData = *it; 9262 8381 // recurse 9263 rc = loadSnapshot(childData,9264 aCurSnapshotId,9265 pSnapshot); // parent = the one we created above8382 rc = i_loadSnapshot(childData, 8383 aCurSnapshotId, 8384 pSnapshot); // parent = the one we created above 9266 8385 if (FAILED(rc)) return rc; 9267 8386 } … … 9277 8396 * @param pAutostart Pointer to the autostart settings. 9278 8397 */ 9279 HRESULT Machine:: loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,9280 const settings::Autostart *pAutostart)9281 { 9282 AssertReturn(!i sSessionMachine(), E_FAIL);8398 HRESULT Machine::i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg, 8399 const settings::Autostart *pAutostart) 8400 { 8401 AssertReturn(!i_isSessionMachine(), E_FAIL); 9283 8402 9284 8403 HRESULT rc = S_OK; … … 9364 8483 9365 8484 // boot order 9366 for (size_t i = 0; 9367 i < RT_ELEMENTS(mHWData->mBootOrder); 9368 i++) 8485 for (size_t i = 0; i < RT_ELEMENTS(mHWData->mBootOrder); ++i) 9369 8486 { 9370 8487 settings::BootOrderMap::const_iterator it = data.mapBootOrder.find(i); … … 9383 8500 mHWData->mVideoCaptureHeight = data.ulVideoCaptureVertRes; 9384 8501 mHWData->mVideoCaptureEnabled = data.fVideoCaptureEnabled; 9385 for (unsigned i = 0; i < RT_ELEMENTS(mHWData->maVideoCaptureScreens); i++)8502 for (unsigned i = 0; i < RT_ELEMENTS(mHWData->maVideoCaptureScreens); ++i) 9386 8503 mHWData->maVideoCaptureScreens[i] = ASMBitTest(&data.u64VideoCaptureScreens, i); 9387 8504 AssertCompile(RT_ELEMENTS(mHWData->maVideoCaptureScreens) == sizeof(data.u64VideoCaptureScreens) * 8); … … 9389 8506 mHWData->mVideoCaptureFPS = data.ulVideoCaptureFPS; 9390 8507 if (!data.strVideoCaptureFile.isEmpty()) 9391 calculateFullPath(data.strVideoCaptureFile, mHWData->mVideoCaptureFile);8508 i_calculateFullPath(data.strVideoCaptureFile, mHWData->mVideoCaptureFile); 9392 8509 else 9393 8510 mHWData->mVideoCaptureFile.setNull(); … … 9396 8513 mHWData->mKeyboardHIDType = data.keyboardHIDType; 9397 8514 mHWData->mChipsetType = data.chipsetType; 9398 mHWData->mParavirtProvider = data.paravirtProvider;9399 8515 mHWData->mEmulatedUSBCardReaderEnabled = data.fEmulatedUSBCardReader; 9400 8516 mHWData->mHPETEnabled = data.fHPETEnabled; … … 9435 8551 { 9436 8552 mNetworkAdapters.resize(newCount); 9437 for (ULONG slot = oldCount; slot < mNetworkAdapters.size(); slot++)8553 for (ULONG slot = oldCount; slot < mNetworkAdapters.size(); ++slot) 9438 8554 { 9439 8555 unconst(mNetworkAdapters[slot]).createObject(); … … 9492 8608 ComObjPtr<SharedFolder> sharedFolder; 9493 8609 /* Check for double entries. Not allowed! */ 9494 rc = findSharedFolder(sf.strName, sharedFolder, false /* aSetError */);8610 rc = i_findSharedFolder(sf.strName, sharedFolder, false /* aSetError */); 9495 8611 if (SUCCEEDED(rc)) 9496 8612 return setError(VBOX_E_OBJECT_IN_USE, … … 9501 8617 * reported when the machine starts. */ 9502 8618 sharedFolder.createObject(); 9503 rc = sharedFolder->init( getMachine(),8619 rc = sharedFolder->init(i_getMachine(), 9504 8620 sf.strName, 9505 8621 sf.strHostPath, … … 9558 8674 #endif /* VBOX_WITH_GUEST_PROPS defined */ 9559 8675 9560 rc = loadDebugging(pDbg);8676 rc = i_loadDebugging(pDbg); 9561 8677 if (FAILED(rc)) 9562 8678 return rc; … … 9582 8698 * @param pDbg Pointer to the settings. 9583 8699 */ 9584 HRESULT Machine:: loadDebugging(const settings::Debugging *pDbg)8700 HRESULT Machine::i_loadDebugging(const settings::Debugging *pDbg) 9585 8701 { 9586 8702 mHWData->mDebugging = *pDbg; … … 9590 8706 9591 8707 /** 9592 * Called from loadMachineDataFromSettings() for the storage controller data, including media.8708 * Called from i_loadMachineDataFromSettings() for the storage controller data, including media. 9593 8709 * 9594 8710 * @param data 9595 * @param puuidRegistry media registry ID to set media to or NULL; see Machine:: loadMachineDataFromSettings()8711 * @param puuidRegistry media registry ID to set media to or NULL; see Machine::i_loadMachineDataFromSettings() 9596 8712 * @param puuidSnapshot 9597 8713 * @return 9598 8714 */ 9599 HRESULT Machine:: loadStorageControllers(const settings::Storage &data,9600 const Guid *puuidRegistry,9601 const Guid *puuidSnapshot)9602 { 9603 AssertReturn(!i sSessionMachine(), E_FAIL);8715 HRESULT Machine::i_loadStorageControllers(const settings::Storage &data, 8716 const Guid *puuidRegistry, 8717 const Guid *puuidSnapshot) 8718 { 8719 AssertReturn(!i_isSessionMachine(), E_FAIL); 9604 8720 9605 8721 HRESULT rc = S_OK; … … 9613 8729 ComObjPtr<StorageController> pCtl; 9614 8730 /* Try to find one with the name first. */ 9615 rc = getStorageControllerByName(ctlData.strName, pCtl, false /* aSetError */);8731 rc = i_getStorageControllerByName(ctlData.strName, pCtl, false /* aSetError */); 9616 8732 if (SUCCEEDED(rc)) 9617 8733 return setError(VBOX_E_OBJECT_IN_USE, … … 9650 8766 9651 8767 /* Load the attached devices now. */ 9652 rc = loadStorageDevices(pCtl,9653 ctlData,9654 puuidRegistry,9655 puuidSnapshot);8768 rc = i_loadStorageDevices(pCtl, 8769 ctlData, 8770 puuidRegistry, 8771 puuidSnapshot); 9656 8772 if (FAILED(rc)) return rc; 9657 8773 } … … 9661 8777 9662 8778 /** 9663 * Called from loadStorageControllers for a controller's devices.8779 * Called from i_loadStorageControllers for a controller's devices. 9664 8780 * 9665 8781 * @param aStorageController 9666 8782 * @param data 9667 * @param puuidRegistry media registry ID to set media to or NULL; see Machine:: loadMachineDataFromSettings()8783 * @param puuidRegistry media registry ID to set media to or NULL; see Machine::i_loadMachineDataFromSettings() 9668 8784 * @param aSnapshotId pointer to the snapshot ID if this is a snapshot machine 9669 8785 * @return 9670 8786 */ 9671 HRESULT Machine:: loadStorageDevices(StorageController *aStorageController,9672 const settings::StorageController &data,9673 const Guid *puuidRegistry,9674 const Guid *puuidSnapshot)8787 HRESULT Machine::i_loadStorageDevices(StorageController *aStorageController, 8788 const settings::StorageController &data, 8789 const Guid *puuidRegistry, 8790 const Guid *puuidSnapshot) 9675 8791 { 9676 8792 HRESULT rc = S_OK; … … 9717 8833 case DeviceType_DVD: 9718 8834 if (dev.strHostDriveSrc.isNotEmpty()) 9719 rc = mParent->i_host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, false /* fRefresh */, medium); 8835 rc = mParent->i_host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, 8836 false /* fRefresh */, medium); 9720 8837 else 9721 8838 rc = mParent->i_findRemoveableMedium(dev.deviceType, … … 9725 8842 medium); 9726 8843 if (rc == VBOX_E_OBJECT_NOT_FOUND) 9727 // This is not an error. The host drive or UUID might have vanished, so just go ahead without this removeable medium attachment 8844 // This is not an error. The host drive or UUID might have vanished, so just go 8845 // ahead without this removeable medium attachment 9728 8846 rc = S_OK; 9729 8847 break; … … 9735 8853 if (FAILED(rc)) 9736 8854 { 9737 if (i sSnapshotMachine())8855 if (i_isSnapshotMachine()) 9738 8856 { 9739 8857 // wrap another error message around the "cannot find hard disk" set by findHardDisk … … 9753 8871 if (medium->i_getType() == MediumType_Immutable) 9754 8872 { 9755 if (i sSnapshotMachine())8873 if (i_isSnapshotMachine()) 9756 8874 return setError(E_FAIL, 9757 8875 tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} " … … 9773 8891 if (medium->i_getType() == MediumType_MultiAttach) 9774 8892 { 9775 if (i sSnapshotMachine())8893 if (i_isSnapshotMachine()) 9776 8894 return setError(E_FAIL, 9777 8895 tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} " … … 9791 8909 } 9792 8910 9793 if ( !i sSnapshotMachine()8911 if ( !i_isSnapshotMachine() 9794 8912 && medium->i_getChildren().size() != 0 9795 8913 ) … … 9803 8921 medium->i_getChildren().size()); 9804 8922 9805 if ( findAttachment(mMediaData->mAttachments,9806 medium))8923 if (i_findAttachment(mMediaData->mAttachments, 8924 medium)) 9807 8925 return setError(E_FAIL, 9808 8926 tr("Hard disk '%s' with UUID {%RTuuid} is already attached to the virtual machine '%s' ('%s')"), … … 9867 8985 AutoWriteLock mlock(medium COMMA_LOCKVAL_SRC_POS); 9868 8986 9869 if (i sSnapshotMachine())8987 if (i_isSnapshotMachine()) 9870 8988 rc = medium->i_addBackReference(mData->mUuid, *puuidSnapshot); 9871 8989 else … … 9884 9002 /* back up mMediaData to let registeredInit() properly rollback on failure 9885 9003 * (= limited accessibility) */ 9886 setModified(IsModified_Storage);9004 i_setModified(IsModified_Storage); 9887 9005 mMediaData.backup(); 9888 9006 mMediaData->mAttachments.push_back(pAttachment); … … 9899 9017 * @param aSetError true to set extended error info on failure 9900 9018 */ 9901 HRESULT Machine:: findSnapshotById(const Guid &aId,9902 ComObjPtr<Snapshot> &aSnapshot,9903 bool aSetError /* = false */)9019 HRESULT Machine::i_findSnapshotById(const Guid &aId, 9020 ComObjPtr<Snapshot> &aSnapshot, 9021 bool aSetError /* = false */) 9904 9022 { 9905 9023 AutoReadLock chlock(this COMMA_LOCKVAL_SRC_POS); … … 9936 9054 * @param aSetError true to set extended error info on failure 9937 9055 */ 9938 HRESULT Machine:: findSnapshotByName(const Utf8Str &strName,9939 ComObjPtr<Snapshot> &aSnapshot,9940 bool aSetError /* = false */)9056 HRESULT Machine::i_findSnapshotByName(const Utf8Str &strName, 9057 ComObjPtr<Snapshot> &aSnapshot, 9058 bool aSetError /* = false */) 9941 9059 { 9942 9060 AssertReturn(!strName.isEmpty(), E_INVALIDARG); … … 9972 9090 * @param aSetError true to set extended error info on failure 9973 9091 */ 9974 HRESULT Machine:: getStorageControllerByName(const Utf8Str &aName,9975 ComObjPtr<StorageController> &aStorageController,9976 bool aSetError /* = false */)9092 HRESULT Machine::i_getStorageControllerByName(const Utf8Str &aName, 9093 ComObjPtr<StorageController> &aStorageController, 9094 bool aSetError /* = false */) 9977 9095 { 9978 9096 AssertReturn(!aName.isEmpty(), E_INVALIDARG); … … 10003 9121 * @param aSetError true to set extended error info on failure 10004 9122 */ 10005 HRESULT Machine:: getUSBControllerByName(const Utf8Str &aName,10006 ComObjPtr<USBController> &aUSBController,10007 bool aSetError /* = false */)9123 HRESULT Machine::i_getUSBControllerByName(const Utf8Str &aName, 9124 ComObjPtr<USBController> &aUSBController, 9125 bool aSetError /* = false */) 10008 9126 { 10009 9127 AssertReturn(!aName.isEmpty(), E_INVALIDARG); … … 10032 9150 * @param enmType USB controller type. 10033 9151 */ 10034 ULONG Machine:: getUSBControllerCountByType(USBControllerType_T enmType)9152 ULONG Machine::i_getUSBControllerCountByType(USBControllerType_T enmType) 10035 9153 { 10036 9154 ULONG cCtrls = 0; … … 10047 9165 } 10048 9166 10049 HRESULT Machine:: getMediumAttachmentsOfController(CBSTRaName,10050 MediaData::AttachmentList &atts)9167 HRESULT Machine::i_getMediumAttachmentsOfController(const Utf8Str &aName, 9168 MediaData::AttachmentList &atts) 10051 9169 { 10052 9170 AutoCaller autoCaller(this); … … 10060 9178 { 10061 9179 const ComObjPtr<MediumAttachment> &pAtt = *it; 10062 10063 9180 // should never happen, but deal with NULL pointers in the list. 10064 9181 AssertStmt(!pAtt.isNull(), continue); … … 10073 9190 AutoReadLock attLock(pAtt COMMA_LOCKVAL_SRC_POS); 10074 9191 10075 if (pAtt->i_getControllerName() == aName)9192 if (pAtt->i_getControllerName() == Bstr(aName).raw()) 10076 9193 atts.push_back(pAtt); 10077 9194 } … … 10080 9197 } 10081 9198 9199 10082 9200 /** 10083 * Helper for # saveSettings. Cares about renaming the settings directory and9201 * Helper for #i_saveSettings. Cares about renaming the settings directory and 10084 9202 * file if the machine name was changed and about creating a new settings file 10085 9203 * if this is a new machine. … … 10087 9205 * @note Must be never called directly but only from #saveSettings(). 10088 9206 */ 10089 HRESULT Machine:: prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)9207 HRESULT Machine::i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings) 10090 9208 { 10091 9209 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); … … 10141 9259 newConfigDir = configDir; 10142 9260 if ( configDir.length() >= groupPlusName.length() 10143 && !RTPathCompare(configDir.substr(configDir.length() - groupPlusName.length(), groupPlusName.length()).c_str(), groupPlusName.c_str())) 9261 && !RTPathCompare(configDir.substr(configDir.length() - groupPlusName.length(), groupPlusName.length()).c_str(), 9262 groupPlusName.c_str())) 10144 9263 { 10145 9264 newConfigDir = newConfigDir.substr(0, configDir.length() - groupPlusName.length()); … … 10225 9344 mParent->i_copyPathRelativeToConfig(newConfigFile, mData->m_strConfigFile); 10226 9345 10227 // store the old and new so that VirtualBox:: saveSettings() can update9346 // store the old and new so that VirtualBox::i_saveSettings() can update 10228 9347 // the media registry 10229 9348 if ( mData->mRegistered … … 10320 9439 * @param pfNeedsGlobalSaveSettings Optional pointer to a bool that must have been 10321 9440 * initialized to false and that will be set to true by this function if 10322 * the caller must invoke VirtualBox:: saveSettings() because the global9441 * the caller must invoke VirtualBox::i_saveSettings() because the global 10323 9442 * settings have changed. This will happen if a machine rename has been 10324 9443 * saved and the global machine and media registries will therefore need 10325 9444 * updating. 10326 9445 */ 10327 HRESULT Machine:: saveSettings(bool *pfNeedsGlobalSaveSettings,10328 intaFlags /*= 0*/)9446 HRESULT Machine::i_saveSettings(bool *pfNeedsGlobalSaveSettings, 9447 int aFlags /*= 0*/) 10329 9448 { 10330 9449 LogFlowThisFuncEnter(); … … 10334 9453 /* make sure child objects are unable to modify the settings while we are 10335 9454 * saving them */ 10336 ensureNoStateDependencies();10337 10338 AssertReturn(!i sSnapshotMachine(),9455 i_ensureNoStateDependencies(); 9456 9457 AssertReturn(!i_isSnapshotMachine(), 10339 9458 E_FAIL); 10340 9459 … … 10345 9464 * settings directory and file if the machine name was changed and about 10346 9465 * creating a new settings file if this is a new machine. */ 10347 rc = prepareSaveSettings(pfNeedsGlobalSaveSettings);9466 rc = i_prepareSaveSettings(pfNeedsGlobalSaveSettings); 10348 9467 if (FAILED(rc)) return rc; 10349 9468 … … 10359 9478 10360 9479 // now go and copy all the settings data from COM to the settings structures 10361 // (this calles saveSettings() on all the COM objects in the machine)10362 copyMachineDataToSettings(*pNewConfig);9480 // (this calles i_saveSettings() on all the COM objects in the machine) 9481 i_copyMachineDataToSettings(*pNewConfig); 10363 9482 10364 9483 if (aFlags & SaveS_ResetCurStateModified) … … 10399 9518 mData->pMachineConfigFile = pNewConfig; 10400 9519 delete pOldConfig; 10401 commit();9520 i_commit(); 10402 9521 10403 9522 // after saving settings, we are no longer different from the XML on disk … … 10425 9544 * to the client process that creates them) and thus don't need to 10426 9545 * inform callbacks. */ 10427 if (i sSessionMachine())9546 if (i_isSessionMachine()) 10428 9547 mParent->i_onMachineDataChange(mData->mUuid); 10429 9548 } … … 10441 9560 * This gets called from two locations: 10442 9561 * 10443 * -- Machine:: saveSettings(), during the regular XML writing;9562 * -- Machine::i_saveSettings(), during the regular XML writing; 10444 9563 * 10445 9564 * -- Appliance::buildXMLForOneVirtualSystem(), when a machine gets … … 10459 9578 * This throws XML errors and HRESULT, so the caller must have a catch block! 10460 9579 */ 10461 void Machine:: copyMachineDataToSettings(settings::MachineConfigFile &config)9580 void Machine::i_copyMachineDataToSettings(settings::MachineConfigFile &config) 10462 9581 { 10463 9582 // deep copy extradata … … 10502 9621 Assert(!mSSData->strStateFilePath.isEmpty()); 10503 9622 /* try to make the file name relative to the settings file dir */ 10504 copyPathRelativeToMachine(mSSData->strStateFilePath, config.strStateFile);9623 i_copyPathRelativeToMachine(mSSData->strStateFilePath, config.strStateFile); 10505 9624 } 10506 9625 else … … 10519 9638 /// @todo Live Migration: config.fTeleported = (mData->mMachineState == MachineState_Teleported); 10520 9639 10521 HRESULT rc = saveHardware(config.hardwareMachine, &config.debugging, &config.autostart);9640 HRESULT rc = i_saveHardware(config.hardwareMachine, &config.debugging, &config.autostart); 10522 9641 if (FAILED(rc)) throw rc; 10523 9642 10524 rc = saveStorageControllers(config.storageMachine);9643 rc = i_saveStorageControllers(config.storageMachine); 10525 9644 if (FAILED(rc)) throw rc; 10526 9645 … … 10529 9648 { 10530 9649 // determine machine folder 10531 Utf8Str strMachineFolder = getSettingsFileFull();9650 Utf8Str strMachineFolder = i_getSettingsFileFull(); 10532 9651 strMachineFolder.stripFilename(); 10533 9652 mParent->i_saveMediaRegistry(config.mediaRegistry, 10534 getId(), // only media with registry ID == machine UUID9653 i_getId(), // only media with registry ID == machine UUID 10535 9654 strMachineFolder); 10536 9655 // this throws HRESULT … … 10538 9657 10539 9658 // save snapshots 10540 rc = saveAllSnapshots(config);9659 rc = i_saveAllSnapshots(config); 10541 9660 if (FAILED(rc)) throw rc; 10542 9661 } … … 10548 9667 * @return 10549 9668 */ 10550 HRESULT Machine:: saveAllSnapshots(settings::MachineConfigFile &config)9669 HRESULT Machine::i_saveAllSnapshots(settings::MachineConfigFile &config) 10551 9670 { 10552 9671 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); … … 10598 9717 * which happens to live in mHWData. 10599 9718 */ 10600 HRESULT Machine:: saveHardware(settings::Hardware &data, settings::Debugging *pDbg,10601 settings::Autostart *pAutostart)9719 HRESULT Machine::i_saveHardware(settings::Hardware &data, settings::Debugging *pDbg, 9720 settings::Autostart *pAutostart) 10602 9721 { 10603 9722 HRESULT rc = S_OK; … … 10610 9729 && mSSData->strStateFilePath.isEmpty() 10611 9730 ) 10612 mHWData->mHWVersion = "2"; /** @todo Is this safe, to update mHWVersion here? If not some other point needs to be found where this can be done. */ 9731 mHWData->mHWVersion = "2"; /** @todo Is this safe, to update mHWVersion here? If not some 9732 other point needs to be found where this can be done. */ 10613 9733 10614 9734 data.strVersion = mHWData->mHWVersion; … … 10629 9749 /* Standard and Extended CPUID leafs. */ 10630 9750 data.llCpuIdLeafs.clear(); 10631 for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); idx++)9751 for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); ++idx) 10632 9752 { 10633 9753 if (mHWData->mCpuIdStdLeafs[idx].ulId != UINT32_MAX) 10634 9754 data.llCpuIdLeafs.push_back(mHWData->mCpuIdStdLeafs[idx]); 10635 9755 } 10636 for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); idx++)9756 for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); ++idx) 10637 9757 { 10638 9758 if (mHWData->mCpuIdExtLeafs[idx].ulId != UINT32_MAX) … … 10647 9767 if (data.fCpuHotPlug) 10648 9768 { 10649 for (unsigned idx = 0; idx < data.cCPUs; idx++)9769 for (unsigned idx = 0; idx < data.cCPUs; ++idx) 10650 9770 { 10651 9771 if (mHWData->mCPUAttached[idx]) … … 10675 9795 data.paravirtProvider = mHWData->mParavirtProvider; 10676 9796 9797 10677 9798 data.fEmulatedUSBCardReader = !!mHWData->mEmulatedUSBCardReaderEnabled; 10678 9799 … … 10682 9803 // boot order 10683 9804 data.mapBootOrder.clear(); 10684 for (size_t i = 0; 10685 i < RT_ELEMENTS(mHWData->mBootOrder); 10686 ++i) 9805 for (size_t i = 0; i < RT_ELEMENTS(mHWData->mBootOrder); ++i) 10687 9806 data.mapBootOrder[i] = mHWData->mBootOrder[i]; 10688 9807 … … 10698 9817 data.ulVideoCaptureFPS = mHWData->mVideoCaptureFPS; 10699 9818 data.fVideoCaptureEnabled = !!mHWData->mVideoCaptureEnabled; 10700 for (unsigned i = 0; i < sizeof(data.u64VideoCaptureScreens) * 8; i++)9819 for (unsigned i = 0; i < sizeof(data.u64VideoCaptureScreens) * 8; ++i) 10701 9820 { 10702 9821 if (mHWData->maVideoCaptureScreens[i]) … … 10706 9825 } 10707 9826 /* store relative video capture file if possible */ 10708 copyPathRelativeToMachine(mHWData->mVideoCaptureFile, data.strVideoCaptureFile);9827 i_copyPathRelativeToMachine(mHWData->mVideoCaptureFile, data.strVideoCaptureFile); 10709 9828 10710 9829 /* VRDEServer settings (optional) */ … … 10717 9836 10718 9837 /* USB Controller (required) */ 10719 for (USBControllerList::const_iterator it = mUSBControllers->begin(); 10720 it != mUSBControllers->end(); 10721 ++it) 9838 for (USBControllerList::const_iterator it = mUSBControllers->begin(); it != mUSBControllers->end(); ++it) 10722 9839 { 10723 9840 ComObjPtr<USBController> ctrl = *it; … … 10756 9873 /* Serial ports */ 10757 9874 data.llSerialPorts.clear(); 10758 for (ULONG slot = 0; 10759 slot < RT_ELEMENTS(mSerialPorts); 10760 ++slot) 9875 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 10761 9876 { 10762 9877 settings::SerialPort s; … … 10770 9885 /* Parallel ports */ 10771 9886 data.llParallelPorts.clear(); 10772 for (ULONG slot = 0; 10773 slot < RT_ELEMENTS(mParallelPorts); 10774 ++slot) 9887 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 10775 9888 { 10776 9889 settings::ParallelPort p; … … 10888 10001 * @param aNode <StorageControllers> node to save the VM hardware configuration to. 10889 10002 */ 10890 HRESULT Machine:: saveStorageControllers(settings::Storage &data)10003 HRESULT Machine::i_saveStorageControllers(settings::Storage &data) 10891 10004 { 10892 10005 data.llStorageControllers.clear(); … … 10930 10043 10931 10044 /* save the devices now. */ 10932 rc = saveStorageDevices(pCtl, ctl);10045 rc = i_saveStorageDevices(pCtl, ctl); 10933 10046 ComAssertComRCRet(rc, rc); 10934 10047 … … 10942 10055 * Saves the hard disk configuration. 10943 10056 */ 10944 HRESULT Machine:: saveStorageDevices(ComObjPtr<StorageController> aStorageController,10945 settings::StorageController &data)10057 HRESULT Machine::i_saveStorageDevices(ComObjPtr<StorageController> aStorageController, 10058 settings::StorageController &data) 10946 10059 { 10947 10060 MediaData::AttachmentList atts; 10948 10061 10949 HRESULT rc = getMediumAttachmentsOfController(Bstr(aStorageController->i_getName()).raw(), atts);10062 HRESULT rc = i_getMediumAttachmentsOfController(aStorageController->i_getName(), atts); 10950 10063 if (FAILED(rc)) return rc; 10951 10064 10952 10065 data.llAttachedDevices.clear(); 10953 for ( MediaData::AttachmentList::const_iterator it = atts.begin();10066 for ( MediaData::AttachmentList::iterator it = atts.begin(); 10954 10067 it != atts.end(); 10955 10068 ++it) 10956 10069 { 10957 10070 settings::AttachedDevice dev; 10958 10959 MediumAttachment *pAttach = *it;10071 IMediumAttachment *iA = *it; 10072 MediumAttachment *pAttach = static_cast<MediumAttachment *>(iA); 10960 10073 Medium *pMedium = pAttach->i_getMedium(); 10961 10074 … … 10992 10105 * @note Locks objects for writing. 10993 10106 */ 10994 HRESULT Machine:: saveStateSettings(int aFlags)10107 HRESULT Machine::i_saveStateSettings(int aFlags) 10995 10108 { 10996 10109 if (aFlags == 0) … … 11017 10130 if (!mSSData->strStateFilePath.isEmpty()) 11018 10131 /* try to make the file name relative to the settings file dir */ 11019 copyPathRelativeToMachine(mSSData->strStateFilePath, mData->pMachineConfigFile->strStateFile);10132 i_copyPathRelativeToMachine(mSSData->strStateFilePath, mData->pMachineConfigFile->strStateFile); 11020 10133 else 11021 10134 mData->pMachineConfigFile->strStateFile.setNull(); … … 11052 10165 * @param pMedium 11053 10166 */ 11054 void Machine:: addMediumToRegistry(ComObjPtr<Medium> &pMedium)10167 void Machine::i_addMediumToRegistry(ComObjPtr<Medium> &pMedium) 11055 10168 { 11056 10169 /* Paranoia checks: do not hold machine or media tree locks. */ … … 11072 10185 if (mData->pMachineConfigFile->canHaveOwnMediaRegistry()) 11073 10186 // machine XML is VirtualBox 4.0 or higher: 11074 uuid = getId(); // machine UUID10187 uuid = i_getId(); // machine UUID 11075 10188 else 11076 10189 uuid = mParent->i_getGlobalRegistryId(); // VirtualBox global registry UUID … … 11119 10232 * @note Locks this object and the media tree for writing. 11120 10233 */ 11121 HRESULT Machine:: createImplicitDiffs(IProgress *aProgress,11122 ULONG aWeight,11123 bool aOnline)10234 HRESULT Machine::i_createImplicitDiffs(IProgress *aProgress, 10235 ULONG aWeight, 10236 bool aOnline) 11124 10237 { 11125 10238 LogFlowThisFunc(("aOnline=%d\n", aOnline)); … … 11244 10357 11245 10358 Utf8Str strFullSnapshotFolder; 11246 calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);10359 i_calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder); 11247 10360 11248 10361 ComObjPtr<Medium> diff; … … 11339 10452 * @note Locks this object and the media tree for writing. 11340 10453 */ 11341 HRESULT Machine:: deleteImplicitDiffs(bool aOnline)10454 HRESULT Machine::i_deleteImplicitDiffs(bool aOnline) 11342 10455 { 11343 10456 LogFlowThisFunc(("aOnline=%d\n", aOnline)); … … 11388 10501 && oldState != MachineState_DeletingSnapshotPaused 11389 10502 ) 11390 setMachineState(MachineState_SettingUp);10503 i_setMachineState(MachineState_SettingUp); 11391 10504 11392 10505 // use appropriate locked media map (online or offline) … … 11466 10579 11467 10580 /* Was this medium attached before? */ 11468 if (! findAttachment(oldAtts, pMedium))10581 if (!i_findAttachment(oldAtts, pMedium)) 11469 10582 { 11470 10583 /* no: de-associate */ … … 11502 10615 alock.release(); 11503 10616 11504 for (MediaData::AttachmentList::const_iterator it = implicitAtts.begin(); 11505 it != implicitAtts.end(); 11506 ++it) 10617 for (MediaData::AttachmentList::const_iterator it = implicitAtts.begin(); it != implicitAtts.end(); ++it) 11507 10618 { 11508 10619 // Remove medium associated with this attachment. … … 11515 10626 rc = pMedium->i_deleteStorage(NULL /*aProgress*/, true /*aWait*/); 11516 10627 // continue on delete failure, just collect error messages 11517 AssertMsg(SUCCEEDED(rc), ("rc=%Rhrc it=%s hd=%s\n", rc, pAtt->i_getLogName(), pMedium->i_getLocationFull().c_str() )); 10628 AssertMsg(SUCCEEDED(rc), ("rc=%Rhrc it=%s hd=%s\n", rc, pAtt->i_getLogName(), 10629 pMedium->i_getLocationFull().c_str() )); 11518 10630 mrc = rc; 11519 10631 } … … 11541 10653 11542 10654 if (mData->mMachineState == MachineState_SettingUp) 11543 setMachineState(oldState);10655 i_setMachineState(oldState); 11544 10656 11545 10657 /* unlock all hard disks we locked when there is no VM */ … … 11567 10679 * @return 11568 10680 */ 11569 MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll, 11570 IN_BSTR aControllerName, 11571 LONG aControllerPort, 11572 LONG aDevice) 11573 { 11574 for (MediaData::AttachmentList::const_iterator it = ll.begin(); 11575 it != ll.end(); 11576 ++it) 10681 MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll, 10682 IN_BSTR aControllerName, 10683 LONG aControllerPort, 10684 LONG aDevice) 10685 { 10686 for (MediaData::AttachmentList::const_iterator it = ll.begin(); it != ll.end(); ++it) 11577 10687 { 11578 10688 MediumAttachment *pAttach = *it; … … 11595 10705 * @return 11596 10706 */ 11597 MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll, 11598 ComObjPtr<Medium> pMedium) 11599 { 11600 for (MediaData::AttachmentList::const_iterator it = ll.begin(); 11601 it != ll.end(); 11602 ++it) 10707 MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll, 10708 ComObjPtr<Medium> pMedium) 10709 { 10710 for (MediaData::AttachmentList::const_iterator it = ll.begin(); it != ll.end(); ++it) 11603 10711 { 11604 10712 MediumAttachment *pAttach = *it; … … 11622 10730 * @return 11623 10731 */ 11624 MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll, 11625 Guid &id) 11626 { 11627 for (MediaData::AttachmentList::const_iterator it = ll.begin(); 11628 it != ll.end(); 11629 ++it) 10732 MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll, 10733 Guid &id) 10734 { 10735 for (MediaData::AttachmentList::const_iterator it = ll.begin(); it != ll.end(); ++it) 11630 10736 { 11631 10737 MediumAttachment *pAttach = *it; … … 11644 10750 * @param pAttach Medium attachment to detach. 11645 10751 * @param writeLock Machine write lock which the caller must have locked once. This may be released temporarily in here. 11646 * @param pSnapshot If NULL, then the detachment is for the current machine. Otherwise this is for a SnapshotMachine, and this must be its snapshot. 10752 * @param pSnapshot If NULL, then the detachment is for the current machine. Otherwise this is for a 10753 * SnapshotMachine, and this must be its snapshot. 11647 10754 * @return 11648 10755 */ 11649 HRESULT Machine:: detachDevice(MediumAttachment *pAttach,11650 AutoWriteLock &writeLock,11651 Snapshot *pSnapshot)10756 HRESULT Machine::i_detachDevice(MediumAttachment *pAttach, 10757 AutoWriteLock &writeLock, 10758 Snapshot *pSnapshot) 11652 10759 { 11653 10760 ComObjPtr<Medium> oldmedium = pAttach->i_getMedium(); … … 11669 10776 * protect with the special state */ 11670 10777 MachineState_T oldState = mData->mMachineState; 11671 setMachineState(MachineState_SettingUp);10778 i_setMachineState(MachineState_SettingUp); 11672 10779 11673 10780 writeLock.release(); … … 11678 10785 writeLock.acquire(); 11679 10786 11680 setMachineState(oldState);10787 i_setMachineState(oldState); 11681 10788 11682 10789 if (FAILED(rc)) return rc; 11683 10790 } 11684 10791 11685 setModified(IsModified_Storage);10792 i_setModified(IsModified_Storage); 11686 10793 mMediaData.backup(); 11687 10794 mMediaData->mAttachments.remove(pAttach); … … 11703 10810 * Goes thru all media of the given list and 11704 10811 * 11705 * 1) calls detachDevice() on each of them for this machine and10812 * 1) calls i_detachDevice() on each of them for this machine and 11706 10813 * 2) adds all Medium objects found in the process to the given list, 11707 10814 * depending on cleanupMode. … … 11715 10822 * 11716 10823 * Requires caller and locking. The machine lock must be passed in because it 11717 * will be passed on to detachDevice which needs it for temporary unlocking.10824 * will be passed on to i_detachDevice which needs it for temporary unlocking. 11718 10825 * 11719 * @param writeLock Machine lock from top-level caller; this gets passed to detachDevice.10826 * @param writeLock Machine lock from top-level caller; this gets passed to i_detachDevice. 11720 10827 * @param pSnapshot Must be NULL when called for a "real" Machine or a snapshot object if called for a SnapshotMachine. 11721 * @param cleanupMode If DetachAllReturnHardDisksOnly, only hard disk media get added to llMedia; if Full, then all media get added; 10828 * @param cleanupMode If DetachAllReturnHardDisksOnly, only hard disk media get added to llMedia; if 10829 * Full, then all media get added; 11722 10830 * otherwise no media get added. 11723 10831 * @param llMedia Caller's list to receive Medium objects which got detached so caller can close() them, depending on cleanupMode. 11724 10832 * @return 11725 10833 */ 11726 HRESULT Machine:: detachAllMedia(AutoWriteLock &writeLock,11727 Snapshot *pSnapshot,11728 CleanupMode_T cleanupMode,11729 MediaList &llMedia)10834 HRESULT Machine::i_detachAllMedia(AutoWriteLock &writeLock, 10835 Snapshot *pSnapshot, 10836 CleanupMode_T cleanupMode, 10837 MediaList &llMedia) 11730 10838 { 11731 10839 Assert(isWriteLockOnCurrentThread()); … … 11733 10841 HRESULT rc; 11734 10842 11735 // make a temporary list because detachDevice invalidates iterators into10843 // make a temporary list because i_detachDevice invalidates iterators into 11736 10844 // mMediaData->mAttachments 11737 10845 MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments; 11738 10846 11739 for (MediaData::AttachmentList::iterator it = llAttachments2.begin(); 11740 it != llAttachments2.end(); 11741 ++it) 10847 for (MediaData::AttachmentList::iterator it = llAttachments2.begin(); it != llAttachments2.end(); ++it) 11742 10848 { 11743 10849 ComObjPtr<MediumAttachment> &pAttach = *it; … … 11785 10891 11786 10892 // real machine: then we need to use the proper method 11787 rc = detachDevice(pAttach, writeLock, pSnapshot);10893 rc = i_detachDevice(pAttach, writeLock, pSnapshot); 11788 10894 11789 10895 if (FAILED(rc)) … … 11808 10914 * @note Locks this object for writing! 11809 10915 */ 11810 void Machine:: commitMedia(bool aOnline /*= false*/)10916 void Machine::i_commitMedia(bool aOnline /*= false*/) 11811 10917 { 11812 10918 AutoCaller autoCaller(this); … … 11883 10989 { 11884 10990 /* was this medium attached before? */ 11885 for (MediaData::AttachmentList::iterator oldIt = oldAtts.begin(); 11886 oldIt != oldAtts.end(); 11887 ++oldIt) 10991 for (MediaData::AttachmentList::iterator oldIt = oldAtts.begin(); oldIt != oldAtts.end(); ++oldIt) 11888 10992 { 11889 10993 MediumAttachment *pOldAttach = *oldIt; … … 11902 11006 /* enumerate remaining old attachments and de-associate from the 11903 11007 * current machine state */ 11904 for (MediaData::AttachmentList::const_iterator it = oldAtts.begin(); 11905 it != oldAtts.end(); 11906 ++it) 11008 for (MediaData::AttachmentList::const_iterator it = oldAtts.begin(); it != oldAtts.end(); ++it) 11907 11009 { 11908 11010 MediumAttachment *pAttach = *it; … … 11955 11057 mMediaData.commit(); 11956 11058 11957 if (i sSessionMachine())11059 if (i_isSessionMachine()) 11958 11060 { 11959 11061 /* … … 11971 11073 it != mMediaData->mAttachments.end(); 11972 11074 ++it) 11973 {11974 11075 (*it)->i_updateParentMachine(mPeer); 11975 }11976 11076 11977 11077 /* attach new data to the primary machine and reshare it */ … … 11990 11090 * @note Locks this object for writing! 11991 11091 */ 11992 void Machine:: rollbackMedia()11092 void Machine::i_rollbackMedia() 11993 11093 { 11994 11094 AutoCaller autoCaller(this); … … 12038 11138 /** @todo convert all this Machine-based voodoo to MediumAttachment 12039 11139 * based rollback logic. */ 12040 deleteImplicitDiffs(Global::IsOnline(mData->mMachineState));11140 i_deleteImplicitDiffs(Global::IsOnline(mData->mMachineState)); 12041 11141 12042 11142 return; … … 12054 11154 * @note Not thread safe (must be called from this object's lock). 12055 11155 */ 12056 bool Machine::i sInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const11156 bool Machine::i_isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const 12057 11157 { 12058 11158 Utf8Str strMachineDirName(mData->m_strConfigFileFull); // path/to/machinesfolder/vmname/vmname.vbox … … 12081 11181 * @note Locks objects for writing! 12082 11182 */ 12083 void Machine:: rollback(bool aNotify)11183 void Machine::i_rollback(bool aNotify) 12084 11184 { 12085 11185 AutoCaller autoCaller(this); … … 12161 11261 12162 11262 if (mData->flModifications & IsModified_Storage) 12163 rollbackMedia();11263 i_rollbackMedia(); 12164 11264 12165 11265 if (mBIOSSettings) … … 12185 11285 12186 11286 if (mData->flModifications & IsModified_NetworkAdapters) 12187 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)11287 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 12188 11288 if ( mNetworkAdapters[slot] 12189 11289 && mNetworkAdapters[slot]->i_isModified()) … … 12194 11294 12195 11295 if (mData->flModifications & IsModified_SerialPorts) 12196 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)11296 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 12197 11297 if ( mSerialPorts[slot] 12198 11298 && mSerialPorts[slot]->i_isModified()) … … 12203 11303 12204 11304 if (mData->flModifications & IsModified_ParallelPorts) 12205 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)11305 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 12206 11306 if ( mParallelPorts[slot] 12207 11307 && mParallelPorts[slot]->i_isModified()) … … 12220 11320 12221 11321 if (flModifications & IsModified_SharedFolders) 12222 that-> onSharedFolderChange();11322 that->i_onSharedFolderChange(); 12223 11323 12224 11324 if (flModifications & IsModified_VRDEServer) 12225 that-> onVRDEServerChange(/* aRestart */ TRUE);11325 that->i_onVRDEServerChange(/* aRestart */ TRUE); 12226 11326 if (flModifications & IsModified_USB) 12227 that-> onUSBControllerChange();12228 12229 for (ULONG slot = 0; slot < networkAdapters.size(); slot++)11327 that->i_onUSBControllerChange(); 11328 11329 for (ULONG slot = 0; slot < networkAdapters.size(); ++slot) 12230 11330 if (networkAdapters[slot]) 12231 that-> onNetworkAdapterChange(networkAdapters[slot], FALSE);12232 for (ULONG slot = 0; slot < RT_ELEMENTS(serialPorts); slot++)11331 that->i_onNetworkAdapterChange(networkAdapters[slot], FALSE); 11332 for (ULONG slot = 0; slot < RT_ELEMENTS(serialPorts); ++slot) 12233 11333 if (serialPorts[slot]) 12234 that-> onSerialPortChange(serialPorts[slot]);12235 for (ULONG slot = 0; slot < RT_ELEMENTS(parallelPorts); slot++)11334 that->i_onSerialPortChange(serialPorts[slot]); 11335 for (ULONG slot = 0; slot < RT_ELEMENTS(parallelPorts); ++slot) 12236 11336 if (parallelPorts[slot]) 12237 that-> onParallelPortChange(parallelPorts[slot]);11337 that->i_onParallelPortChange(parallelPorts[slot]); 12238 11338 12239 11339 if (flModifications & IsModified_Storage) 12240 that-> onStorageControllerChange();11340 that->i_onStorageControllerChange(); 12241 11341 12242 11342 #if 0 … … 12254 11354 * @note Locks this object and children for writing. 12255 11355 */ 12256 void Machine:: commit()11356 void Machine::i_commit() 12257 11357 { 12258 11358 AutoCaller autoCaller(this); … … 12273 11373 12274 11374 if (mMediaData.isBackedUp()) 12275 commitMedia(Global::IsOnline(mData->mMachineState));11375 i_commitMedia(Global::IsOnline(mData->mMachineState)); 12276 11376 12277 11377 mBIOSSettings->i_commit(); … … 12308 11408 } 12309 11409 /* uninit any no longer needed network adapters */ 12310 for (size_t slot = newSize; slot < mNetworkAdapters.size(); slot++)11410 for (size_t slot = newSize; slot < mNetworkAdapters.size(); ++slot) 12311 11411 mNetworkAdapters[slot]->uninit(); 12312 for (size_t slot = newSize; slot < mPeer->mNetworkAdapters.size(); slot++)11412 for (size_t slot = newSize; slot < mPeer->mNetworkAdapters.size(); ++slot) 12313 11413 { 12314 11414 if (mPeer->mNetworkAdapters[slot]) … … 12327 11427 } 12328 11428 if (commitNetworkAdapters) 12329 { 12330 for (size_t slot = 0; slot < mNetworkAdapters.size(); slot++) 11429 for (size_t slot = 0; slot < mNetworkAdapters.size(); ++slot) 12331 11430 mNetworkAdapters[slot]->i_commit(); 12332 } 12333 12334 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 11431 11432 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 12335 11433 mSerialPorts[slot]->i_commit(); 12336 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)11434 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 12337 11435 mParallelPorts[slot]->i_commit(); 12338 11436 … … 12479 11577 } 12480 11578 12481 if (i sSessionMachine())11579 if (i_isSessionMachine()) 12482 11580 { 12483 11581 /* attach new data to the primary machine and reshare it */ … … 12502 11600 * unsaved. 12503 11601 */ 12504 void Machine:: copyFrom(Machine *aThat)12505 { 12506 AssertReturnVoid(!i sSnapshotMachine());12507 AssertReturnVoid(aThat->i sSnapshotMachine());11602 void Machine::i_copyFrom(Machine *aThat) 11603 { 11604 AssertReturnVoid(!i_isSnapshotMachine()); 11605 AssertReturnVoid(aThat->i_isSnapshotMachine()); 12508 11606 12509 11607 AssertReturnVoid(!Global::IsOnline(mData->mMachineState)); … … 12519 11617 ComObjPtr<SharedFolder> folder; 12520 11618 folder.createObject(); 12521 HRESULT rc = folder->initCopy( getMachine(), *it);11619 HRESULT rc = folder->initCopy(i_getMachine(), *it); 12522 11620 AssertComRC(rc); 12523 11621 *it = folder; … … 12557 11655 12558 11656 mNetworkAdapters.resize(aThat->mNetworkAdapters.size()); 12559 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)11657 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 12560 11658 mNetworkAdapters[slot]->i_copyFrom(aThat->mNetworkAdapters[slot]); 12561 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)11659 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 12562 11660 mSerialPorts[slot]->i_copyFrom(aThat->mSerialPorts[slot]); 12563 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)11661 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 12564 11662 mParallelPorts[slot]->i_copyFrom(aThat->mParallelPorts[slot]); 12565 11663 } … … 12572 11670 * @param enmCtrlType The controller type to check for. 12573 11671 */ 12574 bool Machine::i sControllerHotplugCapable(StorageControllerType_T enmCtrlType)11672 bool Machine::i_isControllerHotplugCapable(StorageControllerType_T enmCtrlType) 12575 11673 { 12576 11674 ComPtr<ISystemProperties> systemProperties; … … 12587 11685 #ifdef VBOX_WITH_RESOURCE_USAGE_API 12588 11686 12589 void Machine:: getDiskList(MediaList &list)11687 void Machine::i_getDiskList(MediaList &list) 12590 11688 { 12591 11689 for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin(); … … 12607 11705 } 12608 11706 12609 void Machine:: registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid)11707 void Machine::i_registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid) 12610 11708 { 12611 11709 AssertReturnVoid(isWriteLockOnCurrentThread()); … … 12634 11732 aCollector->registerBaseMetric(ramUsage); 12635 11733 MediaList disks; 12636 getDiskList(disks);11734 i_getDiskList(disks); 12637 11735 pm::BaseMetric *diskUsage = new pm::MachineDiskUsage(hal, aMachine, disks, 12638 11736 diskUsageUsed); … … 12690 11788 pm::SubMetric *guestMemBalloon = new pm::SubMetric("Guest/RAM/Usage/Balloon", "Amount of ballooned physical guest RAM."); 12691 11789 pm::SubMetric *guestMemShared = new pm::SubMetric("Guest/RAM/Usage/Shared", "Amount of shared physical guest RAM."); 12692 pm::SubMetric *guestMemCache = new pm::SubMetric("Guest/RAM/Usage/Cache", "Total amount of guest (disk) cache memory."); 12693 12694 pm::SubMetric *guestPagedTotal = new pm::SubMetric("Guest/Pagefile/Usage/Total", "Total amount of space in the page file."); 11790 pm::SubMetric *guestMemCache = new pm::SubMetric( 11791 "Guest/RAM/Usage/Cache", "Total amount of guest (disk) cache memory."); 11792 11793 pm::SubMetric *guestPagedTotal = new pm::SubMetric( 11794 "Guest/Pagefile/Usage/Total", "Total amount of space in the page file."); 12695 11795 12696 11796 /* Create and register base metrics */ … … 12765 11865 } 12766 11866 12767 void Machine:: unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine)11867 void Machine::i_unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine) 12768 11868 { 12769 11869 AssertReturnVoid(isWriteLockOnCurrentThread()); … … 12889 11989 mAudioAdapter->init(this, aMachine->mAudioAdapter); 12890 11990 /* create a list of serial ports that will be mutable */ 12891 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)11991 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 12892 11992 { 12893 11993 unconst(mSerialPorts[slot]).createObject(); … … 12895 11995 } 12896 11996 /* create a list of parallel ports that will be mutable */ 12897 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)11997 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot) 12898 11998 { 12899 11999 unconst(mParallelPorts[slot]).createObject(); … … 12907 12007 /* create a list of network adapters that will be mutable */ 12908 12008 mNetworkAdapters.resize(aMachine->mNetworkAdapters.size()); 12909 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)12009 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 12910 12010 { 12911 12011 unconst(mNetworkAdapters[slot]).createObject(); … … 13018 12118 #ifdef VBOX_WITH_RESOURCE_USAGE_API 13019 12119 /* 13020 * It is safe to call Machine:: unregisterMetrics() here because12120 * It is safe to call Machine::i_unregisterMetrics() here because 13021 12121 * PerformanceCollector::samplerCallback no longer accesses guest methods 13022 12122 * holding the lock. 13023 12123 */ 13024 unregisterMetrics(mParent->i_performanceCollector(), mPeer);12124 i_unregisterMetrics(mParent->i_performanceCollector(), mPeer); 13025 12125 /* The guest must be unregistered after its metrics (@bugref{5949}). */ 13026 12126 LogAleksey(("{%p} " LOG_FN_FMT ": mCollectorGuest=%p\n", … … 13041 12141 /* reset the state to Aborted */ 13042 12142 if (mData->mMachineState != MachineState_Aborted) 13043 setMachineState(MachineState_Aborted);12143 i_setMachineState(MachineState_Aborted); 13044 12144 } 13045 12145 … … 13048 12148 { 13049 12149 LogWarningThisFunc(("Discarding unsaved settings changes!\n")); 13050 rollback(false /* aNotify */);12150 i_rollback(false /* aNotify */); 13051 12151 } 13052 12152 … … 13064 12164 /* delete all differencing hard disks created (this will also attach 13065 12165 * their parents back by rolling back mMediaData) */ 13066 rollbackMedia();12166 i_rollbackMedia(); 13067 12167 13068 12168 // delete the saved state file (it might have been already created) … … 13071 12171 Utf8Str strStateFile = mConsoleTaskData.mSnapshot->i_getStateFilePath(); 13072 12172 mConsoleTaskData.mSnapshot->uninit(); 13073 releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ );12173 i_releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ ); 13074 12174 } 13075 12175 … … 13108 12208 for (; miNATNetworksStarted > 0; miNATNetworksStarted--) 13109 12209 { 13110 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)12210 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 13111 12211 { 13112 12212 NetworkAttachmentType_T type; 13113 12213 HRESULT hrc; 13114 12214 13115 hrc = mNetworkAdapters[slot]->COMGETTER(AttachmentType)(&type);13116 if ( SUCCEEDED(hrc)13117 && type == NetworkAttachmentType_NATNetwork)13118 {13119 Bstr name;13120 hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam());13121 if (SUCCEEDED(hrc))13122 {13123 multilock.release();13124 LogRel(("VM '%s' stops using NAT network '%ls'\n",13125 mUserData->s.strName.c_str(), name.raw()));13126 mParent->i_natNetworkRefDec(name.raw());13127 multilock.acquire();12215 hrc = mNetworkAdapters[slot]->COMGETTER(AttachmentType)(&type); 12216 if ( SUCCEEDED(hrc) 12217 && type == NetworkAttachmentType_NATNetwork) 12218 { 12219 Bstr name; 12220 hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam()); 12221 if (SUCCEEDED(hrc)) 12222 { 12223 multilock.release(); 12224 LogRel(("VM '%s' stops using NAT network '%ls'\n", 12225 mUserData->s.strName.c_str(), name.raw())); 12226 mParent->i_natNetworkRefDec(name.raw()); 12227 multilock.acquire(); 13128 12228 } 13129 }13130 }13131 }12229 } 12230 } 12231 } 13132 12232 13133 12233 /* … … 13163 12263 else 13164 12264 mData->mSession.mProgress->i_notifyComplete(E_FAIL, 13165 COM_IIDOF(ISession),13166 getComponentName(),13167 tr("The VM session was aborted"));12265 COM_IIDOF(ISession), 12266 getComponentName(), 12267 tr("The VM session was aborted")); 13168 12268 mData->mSession.mProgress.setNull(); 13169 12269 } … … 13275 12375 13276 12376 /** 13277 * @note Locks the same as # setMachineState() does.12377 * @note Locks the same as #i_setMachineState() does. 13278 12378 */ 13279 12379 STDMETHODIMP SessionMachine::UpdateState(MachineState_T aMachineState) 13280 12380 { 13281 return setMachineState(aMachineState);12381 return i_setMachineState(aMachineState); 13282 12382 } 13283 12383 … … 13303 12403 if (miNATNetworksStarted < 1) 13304 12404 { 13305 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)12405 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 13306 12406 { 13307 12407 NetworkAttachmentType_T type; … … 13350 12450 if (mData->mSession.mProgress) 13351 12451 { 13352 mData->mSession.mProgress-> i_notifyComplete((HRESULT)iResult);12452 mData->mSession.mProgress->notifyComplete((HRESULT)iResult); 13353 12453 mData->mSession.mProgress.setNull(); 13354 12454 } … … 13360 12460 * now to offer the performance metrics for a running machine 13361 12461 * object. Doing it earlier wouldn't be safe. */ 13362 registerMetrics(mParent->i_performanceCollector(), mPeer,13363 mData->mSession.mPID);12462 i_registerMetrics(mParent->i_performanceCollector(), mPeer, 12463 mData->mSession.mPID); 13364 12464 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 13365 12465 } … … 13375 12475 LogFlowThisFuncEnter(); 13376 12476 13377 CheckComArgOutPointerValid(aProgress);13378 13379 12477 AutoCaller autoCaller(this); 13380 12478 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); … … 13388 12486 ComObjPtr<Progress> pProgress; 13389 12487 pProgress.createObject(); 13390 pProgress->init( getVirtualBox(),12488 pProgress->init(i_getVirtualBox(), 13391 12489 static_cast<IMachine *>(this) /* aInitiator */, 13392 12490 Bstr(tr("Stopping the virtual machine")).raw(), … … 13398 12496 13399 12497 /* set the state to Stopping (this is expected by Console::PowerDown()) */ 13400 setMachineState(MachineState_Stopping);12498 i_setMachineState(MachineState_Stopping); 13401 12499 13402 12500 pProgress.queryInterfaceTo(aProgress); … … 13429 12527 */ 13430 12528 if (FAILED(iResult)) 13431 setMachineState(mConsoleTaskData.mLastState);12529 i_setMachineState(mConsoleTaskData.mLastState); 13432 12530 13433 12531 /* notify the progress object about operation completion */ … … 13467 12565 { 13468 12566 LogFlowThisFunc(("\n")); 13469 13470 CheckComArgNotNull(aUSBDevice);13471 CheckComArgOutPointerValid(aMatched);13472 12567 13473 12568 AutoCaller autoCaller(this); … … 13639 12734 /* finalize the progress, someone might wait if a frontend 13640 12735 * closes the session before powering on the VM. */ 13641 mData->mSession.mProgress-> i_notifyComplete(E_FAIL,13642 13643 13644 12736 mData->mSession.mProgress->notifyComplete(E_FAIL, 12737 COM_IIDOF(ISession), 12738 getComponentName(), 12739 tr("The VM session was closed before any attempt to power it on")); 13645 12740 mData->mSession.mProgress.setNull(); 13646 12741 } … … 13710 12805 ComObjPtr<Progress> pProgress; 13711 12806 pProgress.createObject(); 13712 pProgress->init( getVirtualBox(),12807 pProgress->init(i_getVirtualBox(), 13713 12808 static_cast<IMachine *>(this) /* aInitiator */, 13714 12809 Bstr(tr("Saving the execution state of the virtual machine")).raw(), … … 13718 12813 /* stateFilePath is null when the machine is not running */ 13719 12814 if (mData->mMachineState == MachineState_Paused) 13720 composeSavedStateFilename(strStateFilePath);12815 i_composeSavedStateFilename(strStateFilePath); 13721 12816 13722 12817 /* fill in the console task data */ … … 13726 12821 13727 12822 /* set the state to Saving (this is expected by Console::SaveState()) */ 13728 setMachineState(MachineState_Saving);12823 i_setMachineState(MachineState_Saving); 13729 12824 13730 12825 strStateFilePath.cloneTo(aStateFilePath); … … 13760 12855 */ 13761 12856 if (FAILED(iResult)) 13762 setMachineState(mConsoleTaskData.mLastState);12857 i_setMachineState(mConsoleTaskData.mLastState); 13763 12858 13764 12859 return endSavingState(iResult, aErrMsg); … … 13785 12880 13786 12881 Utf8Str stateFilePathFull = aSavedStateFile; 13787 int vrc = calculateFullPath(stateFilePathFull, stateFilePathFull);12882 int vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull); 13788 12883 if (RT_FAILURE(vrc)) 13789 12884 return setError(VBOX_E_FILE_ERROR, … … 13794 12889 mSSData->strStateFilePath = stateFilePathFull; 13795 12890 13796 /* The below setMachineState() will detect the state transition and will12891 /* The below i_setMachineState() will detect the state transition and will 13797 12892 * update the settings file */ 13798 12893 13799 return setMachineState(MachineState_Saved);12894 return i_setMachineState(MachineState_Saved); 13800 12895 } 13801 12896 … … 13856 12951 STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName, 13857 12952 IN_BSTR aValue, 13858 LONG64 aTimestamp,12953 LONG64 aTimestamp, 13859 12954 IN_BSTR aFlags) 13860 12955 { … … 13908 13003 } 13909 13004 13910 setModified(IsModified_MachineData);13005 i_setModified(IsModified_MachineData); 13911 13006 mHWData.backup(); 13912 13007 … … 13984 13079 STDMETHODIMP SessionMachine::UnlockMedia() 13985 13080 { 13986 unlockMedia();13987 return S_OK;13081 HRESULT hrc = unlockMedia(); 13082 return hrc; 13988 13083 } 13989 13084 … … 14030 13125 oldmedium = pAttach->i_getMedium(); 14031 13126 14032 setModified(IsModified_Storage);13127 i_setModified(IsModified_Storage); 14033 13128 mMediaData.backup(); 14034 13129 14035 13130 // The backup operation makes the pAttach reference point to the 14036 13131 // old settings. Re-get the correct reference. 14037 pAttach = findAttachment(mMediaData->mAttachments,14038 ctrlName.raw(),14039 lPort,14040 lDevice);13132 pAttach = i_findAttachment(mMediaData->mAttachments, 13133 ctrlName.raw(), 13134 lPort, 13135 lDevice); 14041 13136 14042 13137 { … … 14052 13147 } 14053 13148 14054 setModified(IsModified_Storage);13149 i_setModified(IsModified_Storage); 14055 13150 } 14056 13151 else … … 14086 13181 * @note Locks this object for writing. 14087 13182 */ 14088 bool SessionMachine:: checkForDeath()13183 bool SessionMachine::i_checkForDeath() 14089 13184 { 14090 13185 Uninit::Reason reason; … … 14126 13221 } 14127 13222 14128 void SessionMachine:: getTokenId(Utf8Str &strTokenId)13223 void SessionMachine::i_getTokenId(Utf8Str &strTokenId) 14129 13224 { 14130 13225 LogFlowThisFunc(("\n")); … … 14140 13235 } 14141 13236 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 14142 IToken *SessionMachine:: getToken()13237 IToken *SessionMachine::i_getToken() 14143 13238 { 14144 13239 LogFlowThisFunc(("\n")); … … 14155 13250 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 14156 13251 14157 Machine::ClientToken *SessionMachine:: getClientToken()13252 Machine::ClientToken *SessionMachine::i_getClientToken() 14158 13253 { 14159 13254 LogFlowThisFunc(("\n")); … … 14169 13264 * @note Locks this object for reading. 14170 13265 */ 14171 HRESULT SessionMachine:: onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter)13266 HRESULT SessionMachine::i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter) 14172 13267 { 14173 13268 LogFlowThisFunc(("\n")); … … 14192 13287 * @note Locks this object for reading. 14193 13288 */ 14194 HRESULT SessionMachine::onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName, 14195 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort) 13289 HRESULT SessionMachine::i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName, 13290 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, 13291 IN_BSTR aGuestIp, LONG aGuestPort) 14196 13292 { 14197 13293 LogFlowThisFunc(("\n")); … … 14213 13309 */ 14214 13310 14215 mParent->i_onNatRedirectChange(getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort); 13311 mParent->i_onNatRedirectChange(i_getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, 13312 (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort); 14216 13313 return S_OK; 14217 13314 } … … 14220 13317 * @note Locks this object for reading. 14221 13318 */ 14222 HRESULT SessionMachine:: onSerialPortChange(ISerialPort *serialPort)13319 HRESULT SessionMachine::i_onSerialPortChange(ISerialPort *serialPort) 14223 13320 { 14224 13321 LogFlowThisFunc(("\n")); … … 14243 13340 * @note Locks this object for reading. 14244 13341 */ 14245 HRESULT SessionMachine:: onParallelPortChange(IParallelPort *parallelPort)13342 HRESULT SessionMachine::i_onParallelPortChange(IParallelPort *parallelPort) 14246 13343 { 14247 13344 LogFlowThisFunc(("\n")); … … 14266 13363 * @note Locks this object for reading. 14267 13364 */ 14268 HRESULT SessionMachine:: onStorageControllerChange()13365 HRESULT SessionMachine::i_onStorageControllerChange() 14269 13366 { 14270 13367 LogFlowThisFunc(("\n")); … … 14289 13386 * @note Locks this object for reading. 14290 13387 */ 14291 HRESULT SessionMachine:: onMediumChange(IMediumAttachment *aAttachment, BOOL aForce)13388 HRESULT SessionMachine::i_onMediumChange(IMediumAttachment *aAttachment, BOOL aForce) 14292 13389 { 14293 13390 LogFlowThisFunc(("\n")); … … 14312 13409 * @note Locks this object for reading. 14313 13410 */ 14314 HRESULT SessionMachine:: onCPUChange(ULONG aCPU, BOOL aRemove)13411 HRESULT SessionMachine::i_onCPUChange(ULONG aCPU, BOOL aRemove) 14315 13412 { 14316 13413 LogFlowThisFunc(("\n")); … … 14332 13429 } 14333 13430 14334 HRESULT SessionMachine:: onCPUExecutionCapChange(ULONG aExecutionCap)13431 HRESULT SessionMachine::i_onCPUExecutionCapChange(ULONG aExecutionCap) 14335 13432 { 14336 13433 LogFlowThisFunc(("\n")); … … 14355 13452 * @note Locks this object for reading. 14356 13453 */ 14357 HRESULT SessionMachine:: onVRDEServerChange(BOOL aRestart)13454 HRESULT SessionMachine::i_onVRDEServerChange(BOOL aRestart) 14358 13455 { 14359 13456 LogFlowThisFunc(("\n")); … … 14378 13475 * @note Locks this object for reading. 14379 13476 */ 14380 HRESULT SessionMachine:: onVideoCaptureChange()13477 HRESULT SessionMachine::i_onVideoCaptureChange() 14381 13478 { 14382 13479 LogFlowThisFunc(("\n")); … … 14401 13498 * @note Locks this object for reading. 14402 13499 */ 14403 HRESULT SessionMachine:: onUSBControllerChange()13500 HRESULT SessionMachine::i_onUSBControllerChange() 14404 13501 { 14405 13502 LogFlowThisFunc(("\n")); … … 14424 13521 * @note Locks this object for reading. 14425 13522 */ 14426 HRESULT SessionMachine:: onSharedFolderChange()13523 HRESULT SessionMachine::i_onSharedFolderChange() 14427 13524 { 14428 13525 LogFlowThisFunc(("\n")); … … 14447 13544 * @note Locks this object for reading. 14448 13545 */ 14449 HRESULT SessionMachine:: onClipboardModeChange(ClipboardMode_T aClipboardMode)13546 HRESULT SessionMachine::i_onClipboardModeChange(ClipboardMode_T aClipboardMode) 14450 13547 { 14451 13548 LogFlowThisFunc(("\n")); … … 14470 13567 * @note Locks this object for reading. 14471 13568 */ 14472 HRESULT SessionMachine:: onDnDModeChange(DnDMode_T aDnDMode)13569 HRESULT SessionMachine::i_onDnDModeChange(DnDMode_T aDnDMode) 14473 13570 { 14474 13571 LogFlowThisFunc(("\n")); … … 14493 13590 * @note Locks this object for reading. 14494 13591 */ 14495 HRESULT SessionMachine:: onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)13592 HRESULT SessionMachine::i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) 14496 13593 { 14497 13594 LogFlowThisFunc(("\n")); … … 14516 13613 * @note Locks this object for reading. 14517 13614 */ 14518 HRESULT SessionMachine:: onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove, BOOL aSilent)13615 HRESULT SessionMachine::i_onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove, BOOL aSilent) 14519 13616 { 14520 13617 LogFlowThisFunc(("\n")); … … 14542 13639 * @note locks this object for reading. 14543 13640 */ 14544 bool SessionMachine:: hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)13641 bool SessionMachine::i_hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs) 14545 13642 { 14546 13643 AutoCaller autoCaller(this); … … 14576 13673 * @note The calls shall hold no locks. Will temporarily lock this object for reading. 14577 13674 */ 14578 HRESULT SessionMachine:: onUSBDeviceAttach(IUSBDevice *aDevice,14579 IVirtualBoxErrorInfo *aError,14580 ULONG aMaskedIfs)13675 HRESULT SessionMachine::i_onUSBDeviceAttach(IUSBDevice *aDevice, 13676 IVirtualBoxErrorInfo *aError, 13677 ULONG aMaskedIfs) 14581 13678 { 14582 13679 LogFlowThisFunc(("\n")); … … 14609 13706 * @note The calls shall hold no locks. Will temporarily lock this object for reading. 14610 13707 */ 14611 HRESULT SessionMachine:: onUSBDeviceDetach(IN_BSTR aId,14612 IVirtualBoxErrorInfo *aError)13708 HRESULT SessionMachine::i_onUSBDeviceDetach(IN_BSTR aId, 13709 IVirtualBoxErrorInfo *aError) 14613 13710 { 14614 13711 LogFlowThisFunc(("\n")); … … 14667 13764 14668 13765 /* save all VM settings */ 14669 rc = saveSettings(NULL);13766 rc = i_saveSettings(NULL); 14670 13767 // no need to check whether VirtualBox.xml needs saving also since 14671 13768 // we can't have a name change pending at this point … … 14713 13810 * 14714 13811 * @param strStateFile 14715 * @param pSnapshotToIgnore Passed to Snapshot::sharesSavedStateFile(); this snapshot is ignored in the test for whether the saved state file is in use. 13812 * @param pSnapshotToIgnore Passed to Snapshot::sharesSavedStateFile(); this snapshot is ignored in 13813 * the test for whether the saved state file is in use. 14716 13814 */ 14717 void SessionMachine:: releaseSavedStateFile(const Utf8Str &strStateFile,14718 Snapshot *pSnapshotToIgnore)13815 void SessionMachine::i_releaseSavedStateFile(const Utf8Str &strStateFile, 13816 Snapshot *pSnapshotToIgnore) 14719 13817 { 14720 13818 // it is safe to delete this saved state file if it is not currently in use by the machine ... … … 14826 13924 * Undoes the locks made by by #lockMedia(). 14827 13925 */ 14828 voidSessionMachine::unlockMedia()13926 HRESULT SessionMachine::unlockMedia() 14829 13927 { 14830 13928 AutoCaller autoCaller(this); 14831 AssertComRCReturn Void(autoCaller.rc());13929 AssertComRCReturn(autoCaller.rc(),autoCaller.rc()); 14832 13930 14833 13931 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 14839 13937 HRESULT rc = mData->mSession.mLockedMedia.Clear(); 14840 13938 AssertComRC(rc); 13939 return rc; 14841 13940 } 14842 13941 … … 14845 13944 * 14846 13945 * @note Locks this object for writing. 14847 * @note This method must not call saveSettings or SaveSettings, otherwise13946 * @note This method must not call i_saveSettings or SaveSettings, otherwise 14848 13947 * it can cause crashes in random places due to unexpectedly committing 14849 13948 * the current settings. The caller is responsible for that. The call 14850 13949 * to saveStateSettings is fine, because this method does not commit. 14851 13950 */ 14852 HRESULT SessionMachine:: setMachineState(MachineState_T aMachineState)13951 HRESULT SessionMachine::i_setMachineState(MachineState_T aMachineState) 14853 13952 { 14854 13953 LogFlowThisFuncEnter(); … … 15001 14100 15002 14101 /* redirect to the underlying peer machine */ 15003 mPeer-> setMachineState(aMachineState);14102 mPeer->i_setMachineState(aMachineState); 15004 14103 15005 14104 if ( aMachineState == MachineState_PoweredOff … … 15051 14150 #endif 15052 14151 15053 rc = saveStateSettings(stsFlags);14152 rc = i_saveStateSettings(stsFlags); 15054 14153 15055 14154 if ( ( oldMachineState != MachineState_PoweredOff … … 15077 14176 * @note Locks this object for reading, then calls a client process. 15078 14177 */ 15079 HRESULT SessionMachine:: updateMachineStateOnClient()14178 HRESULT SessionMachine::i_updateMachineStateOnClient() 15080 14179 { 15081 14180 AutoCaller autoCaller(this); … … 15105 14204 return directControl->UpdateMachineState(mData->mMachineState); 15106 14205 } 14206 14207 HRESULT Machine::setRemoveSavedStateFile(BOOL aRemove) 14208 { 14209 NOREF(aRemove); 14210 ReturnComNotImplemented(); 14211 } 14212 14213 HRESULT Machine::updateState(MachineState_T aState) 14214 { 14215 NOREF(aState); 14216 ReturnComNotImplemented(); 14217 } 14218 14219 HRESULT Machine::beginPowerUp(const ComPtr<IProgress> &aProgress) 14220 { 14221 NOREF(aProgress); 14222 ReturnComNotImplemented(); 14223 } 14224 14225 HRESULT Machine::endPowerUp(LONG aResult) 14226 { 14227 NOREF(aResult); 14228 ReturnComNotImplemented(); 14229 } 14230 14231 HRESULT Machine::beginPoweringDown(ComPtr<IProgress> &aProgress) 14232 { 14233 NOREF(aProgress); 14234 ReturnComNotImplemented(); 14235 } 14236 14237 HRESULT Machine::endPoweringDown(LONG aResult, 14238 const com::Utf8Str &aErrMsg) 14239 { 14240 NOREF(aResult); 14241 NOREF(aErrMsg); 14242 ReturnComNotImplemented(); 14243 } 14244 14245 HRESULT Machine::runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice, 14246 BOOL *aMatched, 14247 ULONG *aMaskedInterfaces) 14248 { 14249 NOREF(aDevice); 14250 NOREF(aMatched); 14251 NOREF(aMaskedInterfaces); 14252 ReturnComNotImplemented(); 14253 14254 } 14255 14256 HRESULT Machine::captureUSBDevice(const com::Guid &aId) 14257 { 14258 NOREF(aId); 14259 ReturnComNotImplemented(); 14260 } 14261 14262 HRESULT Machine::detachUSBDevice(const com::Guid &aId, 14263 BOOL aDone) 14264 { 14265 NOREF(aId); 14266 NOREF(aDone); 14267 ReturnComNotImplemented(); 14268 } 14269 14270 HRESULT Machine::autoCaptureUSBDevices() 14271 { 14272 ReturnComNotImplemented(); 14273 } 14274 14275 HRESULT Machine::detachAllUSBDevices(BOOL aDone) 14276 { 14277 NOREF(aDone); 14278 ReturnComNotImplemented(); 14279 } 14280 14281 HRESULT Machine::onSessionEnd(const ComPtr<ISession> &aSession, 14282 ComPtr<IProgress> &aProgress) 14283 { 14284 NOREF(aSession); 14285 NOREF(aProgress); 14286 ReturnComNotImplemented(); 14287 } 14288 14289 HRESULT Machine::beginSavingState(ComPtr<IProgress> &aProgress, 14290 com::Utf8Str &aStateFilePath) 14291 { 14292 NOREF(aProgress); 14293 NOREF(aStateFilePath); 14294 ReturnComNotImplemented(); 14295 } 14296 14297 HRESULT Machine::endSavingState(LONG aResult, 14298 const com::Utf8Str &aErrMsg) 14299 { 14300 NOREF(aResult); 14301 NOREF(aErrMsg); 14302 ReturnComNotImplemented(); 14303 } 14304 14305 HRESULT Machine::adoptSavedState(const com::Utf8Str &aSavedStateFile) 14306 { 14307 NOREF(aSavedStateFile); 14308 ReturnComNotImplemented(); 14309 } 14310 14311 HRESULT Machine::beginTakingSnapshot(const ComPtr<IConsole> &aInitiator, 14312 const com::Utf8Str &aName, 14313 const com::Utf8Str &aDescription, 14314 const ComPtr<IProgress> &aConsoleProgress, 14315 BOOL aFTakingSnapshotOnline, 14316 com::Utf8Str &aStateFilePath) 14317 { 14318 NOREF(aInitiator); 14319 NOREF(aName); 14320 NOREF(aDescription); 14321 NOREF(aConsoleProgress); 14322 NOREF(aFTakingSnapshotOnline); 14323 NOREF(aStateFilePath); 14324 ReturnComNotImplemented(); 14325 } 14326 14327 HRESULT Machine::endTakingSnapshot(BOOL aSuccess) 14328 { 14329 NOREF(aSuccess); 14330 ReturnComNotImplemented(); 14331 } 14332 14333 HRESULT Machine::deleteSnapshot(const ComPtr<IConsole> &aInitiator, 14334 const com::Guid &aStartId, 14335 const com::Guid &aEndId, 14336 BOOL aDeleteAllChildren, 14337 MachineState_T *aMachineState, 14338 ComPtr<IProgress> &aProgress) 14339 { 14340 NOREF(aInitiator); 14341 NOREF(aStartId); 14342 NOREF(aEndId); 14343 NOREF(aDeleteAllChildren); 14344 NOREF(aMachineState); 14345 NOREF(aProgress); 14346 ReturnComNotImplemented(); 14347 } 14348 14349 HRESULT Machine::finishOnlineMergeMedium() 14350 { 14351 ReturnComNotImplemented(); 14352 } 14353 14354 HRESULT Machine::restoreSnapshot(const ComPtr<IConsole> &aInitiator, 14355 const ComPtr<ISnapshot> &aSnapshot, 14356 MachineState_T *aMachineState, 14357 ComPtr<IProgress> &aProgress) 14358 { 14359 NOREF(aInitiator); 14360 NOREF(aSnapshot); 14361 NOREF(aMachineState); 14362 NOREF(aProgress); 14363 ReturnComNotImplemented(); 14364 } 14365 14366 HRESULT Machine::pullGuestProperties(std::vector<com::Utf8Str> &aNames, 14367 std::vector<com::Utf8Str> &aValues, 14368 std::vector<LONG64> &aTimestamps, 14369 std::vector<com::Utf8Str> &aFlags) 14370 { 14371 NOREF(aNames); 14372 NOREF(aValues); 14373 NOREF(aTimestamps); 14374 NOREF(aFlags); 14375 ReturnComNotImplemented(); 14376 } 14377 14378 HRESULT Machine::pushGuestProperty(const com::Utf8Str &aName, 14379 const com::Utf8Str &aValue, 14380 LONG64 aTimestamp, 14381 const com::Utf8Str &aFlags) 14382 { 14383 NOREF(aName); 14384 NOREF(aValue); 14385 NOREF(aTimestamp); 14386 NOREF(aFlags); 14387 ReturnComNotImplemented(); 14388 } 14389 14390 HRESULT Machine::lockMedia() 14391 { 14392 ReturnComNotImplemented(); 14393 } 14394 14395 HRESULT Machine::unlockMedia() 14396 { 14397 ReturnComNotImplemented(); 14398 } 14399 14400 HRESULT Machine::ejectMedium(const ComPtr<IMediumAttachment> &aAttachment, 14401 ComPtr<IMediumAttachment> &aNewAttachment) 14402 { 14403 NOREF(aAttachment); 14404 NOREF(aNewAttachment); 14405 ReturnComNotImplemented(); 14406 } 14407 14408 HRESULT Machine::reportVmStatistics(ULONG aValidStats, 14409 ULONG aCpuUser, 14410 ULONG aCpuKernel, 14411 ULONG aCpuIdle, 14412 ULONG aMemTotal, 14413 ULONG aMemFree, 14414 ULONG aMemBalloon, 14415 ULONG aMemShared, 14416 ULONG aMemCache, 14417 ULONG aPagedTotal, 14418 ULONG aMemAllocTotal, 14419 ULONG aMemFreeTotal, 14420 ULONG aMemBalloonTotal, 14421 ULONG aMemSharedTotal, 14422 ULONG aVmNetRx, 14423 ULONG aVmNetTx) 14424 { 14425 NOREF(aValidStats); 14426 NOREF(aCpuUser); 14427 NOREF(aCpuKernel); 14428 NOREF(aCpuIdle); 14429 NOREF(aMemTotal); 14430 NOREF(aMemFree); 14431 NOREF(aMemBalloon); 14432 NOREF(aMemShared); 14433 NOREF(aMemCache); 14434 NOREF(aPagedTotal); 14435 NOREF(aMemAllocTotal); 14436 NOREF(aMemFreeTotal); 14437 NOREF(aMemBalloonTotal); 14438 NOREF(aMemSharedTotal); 14439 NOREF(aVmNetRx); 14440 NOREF(aVmNetTx); 14441 ReturnComNotImplemented(); 14442 } -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r50899 r51498 5 5 6 6 /* 7 * Copyright (C) 2011-201 3Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 208 208 { 209 209 SAVESTATETASK sst; 210 sst.snapshotUuid = machine-> getSnapshotId();210 sst.snapshotUuid = machine->i_getSnapshotId(); 211 211 sst.strSaveStateFile = bstrSrcSaveStatePath; 212 212 uint64_t cbSize; … … 674 674 ComObjPtr<Medium> diff; 675 675 diff.createObject(); 676 rc = diff->init(p-> getVirtualBox(),676 rc = diff->init(p->i_getVirtualBox(), 677 677 pParent->i_getPreferredDiffFormat(), 678 678 Utf8StrFmt("%s%c", strSnapshotFolder.c_str(), RTPATH_DELIMITER), … … 753 753 /** @todo r=klaus this code cannot deal with someone crazy specifying 754 754 * IMachine corresponding to a mutable machine as d->pSrcMachine */ 755 if (d->pSrcMachine->i sSessionMachine())755 if (d->pSrcMachine->i_isSessionMachine()) 756 756 throw p->setError(E_INVALIDARG, "The source machine is mutable"); 757 757 … … 761 761 * just replace the source (snapshot) machine with the current machine. */ 762 762 if ( d->mode == CloneMode_AllStates 763 && d->pSrcMachine->i sSnapshotMachine())763 && d->pSrcMachine->i_isSnapshotMachine()) 764 764 { 765 765 Bstr bstrSrcMachineId; … … 767 767 if (FAILED(rc)) throw rc; 768 768 ComPtr<IMachine> newSrcMachine; 769 rc = d->pSrcMachine-> getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam());769 rc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam()); 770 770 if (FAILED(rc)) throw rc; 771 771 d->pSrcMachine = (Machine*)(IMachine*)newSrcMachine; … … 775 775 if (d->mode == CloneMode_MachineAndChildStates) 776 776 { 777 if (d->pSrcMachine->i sSnapshotMachine())777 if (d->pSrcMachine->i_isSnapshotMachine()) 778 778 { 779 779 /* find machine object for current snapshot of current state */ … … 782 782 if (FAILED(rc)) throw rc; 783 783 ComPtr<IMachine> pCurr; 784 rc = d->pSrcMachine-> getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), pCurr.asOutParam());784 rc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), pCurr.asOutParam()); 785 785 if (FAILED(rc)) throw rc; 786 786 if (pCurr.isNull()) … … 827 827 AutoWriteLock trgLock(d->pTrgMachine COMMA_LOCKVAL_SRC_POS); 828 828 829 if (d->pSrcMachine->i sSnapshotMachine())830 d->snapshotId = d->pSrcMachine-> getSnapshotId();829 if (d->pSrcMachine->i_isSnapshotMachine()) 830 d->snapshotId = d->pSrcMachine->i_getSnapshotId(); 831 831 832 832 /* Add the current machine and all snapshot machines below this machine … … 912 912 rc = d->pProgress.createObject(); 913 913 if (FAILED(rc)) throw rc; 914 rc = d->pProgress->init(p-> getVirtualBox(),914 rc = d->pProgress->init(p->i_getVirtualBox(), 915 915 static_cast<IMachine*>(d->pSrcMachine) /* aInitiator */, 916 916 Bstr(p->tr("Cloning Machine")).raw(), … … 958 958 /* Where should all the media go? */ 959 959 Utf8Str strTrgSnapshotFolder; 960 Utf8Str strTrgMachineFolder = d->pTrgMachine-> getSettingsFileFull();960 Utf8Str strTrgMachineFolder = d->pTrgMachine->i_getSettingsFileFull(); 961 961 strTrgMachineFolder.stripFilename(); 962 962 … … 1389 1389 * over to the new machine. The machine have to be mutable for 1390 1390 * this. */ 1391 rc = d->pTrgMachine-> checkStateDependency(p->MutableStateDep);1391 rc = d->pTrgMachine->i_checkStateDependency(p->MutableStateDep); 1392 1392 if (FAILED(rc)) throw rc; 1393 rc = d->pTrgMachine->loadMachineDataFromSettings(trgMCF, 1394 &d->pTrgMachine->mData->mUuid); 1393 rc = d->pTrgMachine->i_loadMachineDataFromSettings(trgMCF, &d->pTrgMachine->mData->mUuid); 1395 1394 if (FAILED(rc)) throw rc; 1396 1395 /* save all VM data */ 1397 1396 bool fNeedsGlobalSaveSettings = false; 1398 rc = d->pTrgMachine-> saveSettings(&fNeedsGlobalSaveSettings, Machine::SaveS_Force);1397 rc = d->pTrgMachine->i_saveSettings(&fNeedsGlobalSaveSettings, Machine::SaveS_Force); 1399 1398 if (FAILED(rc)) throw rc; 1400 1399 /* Release all locks */ -
trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
r51092 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 365 365 { 366 366 ComObjPtr<BandwidthGroup> pBwGroup; 367 hrc = m->pMachine-> getBandwidthGroup(m->bd->strBandwidthGroup, pBwGroup, true /* fSetError */);367 hrc = m->pMachine->i_getBandwidthGroup(m->bd->strBandwidthGroup, pBwGroup, true /* fSetError */); 368 368 369 369 Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the -
trunk/src/VBox/Main/src-server/NATEngineImpl.cpp
r51092 r51498 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 259 259 260 260 if (m_fModified) 261 mParent-> setModified(Machine::IsModified_NetworkAdapters);261 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 262 262 return S_OK; 263 263 } … … 327 327 r.u16GuestPort = aGuestPort; 328 328 mNATRules.insert(std::make_pair(name, r)); 329 mParent-> setModified(Machine::IsModified_NetworkAdapters);329 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 330 330 m_fModified = true; 331 331 … … 334 334 335 335 alock.release(); 336 mParent-> onNATRedirectRuleChange(ulSlot, FALSE, Bstr(name).raw(), aProto, Bstr(r.strHostIP).raw(),337 r.u16HostPort, Bstr(r.strGuestIP).raw(), r.u16GuestPort);336 mParent->i_onNATRedirectRuleChange(ulSlot, FALSE, Bstr(name).raw(), aProto, Bstr(r.strHostIP).raw(), 337 r.u16HostPort, Bstr(r.strGuestIP).raw(), r.u16GuestPort); 338 338 return S_OK; 339 339 } … … 356 356 357 357 mNATRules.erase(it); 358 mParent-> setModified(Machine::IsModified_NetworkAdapters);358 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 359 359 m_fModified = true; 360 360 mData->m.commit(); 361 361 alock.release(); 362 mParent-> onNATRedirectRuleChange(ulSlot, TRUE, Bstr(aName).raw(), proto, Bstr(strHostIP).raw(),363 u16HostPort, Bstr(strGuestIP).raw(), u16GuestPort);362 mParent->i_onNATRedirectRuleChange(ulSlot, TRUE, Bstr(aName).raw(), proto, Bstr(strHostIP).raw(), 363 u16HostPort, Bstr(strGuestIP).raw(), u16GuestPort); 364 364 return S_OK; 365 365 } … … 443 443 mData->m.backup(); 444 444 mData->m->mNetwork = aNetwork; 445 mParent-> setModified(Machine::IsModified_NetworkAdapters);445 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 446 446 m_fModified = true; 447 447 } … … 468 468 mData->m.backup(); 469 469 mData->m->mBindIP = aHostIP; 470 mParent-> setModified(Machine::IsModified_NetworkAdapters);470 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 471 471 m_fModified = true; 472 472 } … … 490 490 mData->m.backup(); 491 491 mData->m->mTFTPPrefix = aTFTPPrefix; 492 mParent-> setModified(Machine::IsModified_NetworkAdapters);492 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 493 493 m_fModified = true; 494 494 } … … 516 516 mData->m.backup(); 517 517 mData->m->mTFTPBootFile = aTFTPBootFile; 518 mParent-> setModified(Machine::IsModified_NetworkAdapters);518 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 519 519 m_fModified = true; 520 520 } … … 542 542 mData->m.backup(); 543 543 mData->m->mTFTPNextServer = aTFTPNextServer; 544 mParent-> setModified(Machine::IsModified_NetworkAdapters);544 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 545 545 m_fModified = true; 546 546 } … … 568 568 mData->m.backup(); 569 569 mData->m->mDNSPassDomain = aDNSPassDomain; 570 mParent-> setModified(Machine::IsModified_NetworkAdapters);570 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 571 571 m_fModified = true; 572 572 } … … 590 590 mData->m.backup(); 591 591 mData->m->mDNSProxy = aDNSProxy; 592 mParent-> setModified(Machine::IsModified_NetworkAdapters);592 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 593 593 m_fModified = true; 594 594 } … … 618 618 mData->m.backup(); 619 619 mData->m->mDNSUseHostResolver = aDNSUseHostResolver; 620 mParent-> setModified(Machine::IsModified_NetworkAdapters);620 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 621 621 m_fModified = true; 622 622 } … … 632 632 mData->m.backup(); 633 633 mData->m->mAliasMode = aAliasMode; 634 mParent-> setModified(Machine::IsModified_NetworkAdapters);634 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 635 635 m_fModified = true; 636 636 } -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r51441 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 70 70 71 71 ComAssertRet(aParent, E_INVALIDARG); 72 uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(aParent-> getChipsetType());72 uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(aParent->i_getChipsetType()); 73 73 ComAssertRet(aSlot < maxNetworkAdapters, E_INVALIDARG); 74 74 … … 261 261 262 262 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 263 mParent-> setModified(Machine::IsModified_NetworkAdapters);263 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 264 264 mlock.release(); 265 265 266 266 /* Changing the network adapter type during runtime is not allowed, 267 267 * therefore no immediate change in CFGM logic => changeAdapter=FALSE. */ 268 mParent-> onNetworkAdapterChange(this, FALSE);268 mParent->i_onNetworkAdapterChange(this, FALSE); 269 269 } 270 270 … … 309 309 310 310 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 311 mParent-> setModified(Machine::IsModified_NetworkAdapters);311 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 312 312 mlock.release(); 313 313 314 314 /* Disabling the network adapter during runtime is not allowed 315 315 * therefore no immediate change in CFGM logic => changeAdapter=FALSE. */ 316 mParent-> onNetworkAdapterChange(this, FALSE);316 mParent->i_onNetworkAdapterChange(this, FALSE); 317 317 } 318 318 … … 400 400 401 401 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 402 mParent-> setModified(Machine::IsModified_NetworkAdapters);402 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 403 403 mlock.release(); 404 404 405 405 /* Changing the MAC via the Main API during runtime is not allowed, 406 406 * therefore no immediate change in CFGM logic => changeAdapter=FALSE. */ 407 mParent-> onNetworkAdapterChange(this, FALSE);407 mParent->i_onNetworkAdapterChange(this, FALSE); 408 408 } 409 409 … … 454 454 455 455 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 456 mParent-> setModified(Machine::IsModified_NetworkAdapters);456 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 457 457 mlock.release(); 458 458 … … 464 464 465 465 /* Adapt the CFGM logic and notify the guest => changeAdapter=TRUE. */ 466 mParent-> onNetworkAdapterChange(this, TRUE);466 mParent->i_onNetworkAdapterChange(this, TRUE); 467 467 } 468 468 … … 506 506 507 507 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 508 mParent-> setModified(Machine::IsModified_NetworkAdapters);508 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 509 509 mlock.release(); 510 510 … … 512 512 * change immediately effect and to notify the guest that the network 513 513 * might have changed, therefore changeAdapter=TRUE. */ 514 mParent-> onNetworkAdapterChange(this, TRUE);514 mParent->i_onNetworkAdapterChange(this, TRUE); 515 515 } 516 516 … … 555 555 556 556 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 557 mParent-> setModified(Machine::IsModified_NetworkAdapters);557 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 558 558 mlock.release(); 559 559 … … 561 561 * change immediately effect and to notify the guest that the network 562 562 * might have changed, therefore changeAdapter=TRUE. */ 563 mParent-> onNetworkAdapterChange(this, TRUE);563 mParent->i_onNetworkAdapterChange(this, TRUE); 564 564 } 565 565 … … 602 602 603 603 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 604 mParent-> setModified(Machine::IsModified_NetworkAdapters);604 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 605 605 mlock.release(); 606 606 … … 608 608 * change immediately effect and to notify the guest that the network 609 609 * might have changed, therefore changeAdapter=TRUE. */ 610 mParent-> onNetworkAdapterChange(this, TRUE);610 mParent->i_onNetworkAdapterChange(this, TRUE); 611 611 } 612 612 … … 653 653 654 654 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 655 mParent-> setModified(Machine::IsModified_NetworkAdapters);655 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 656 656 mlock.release(); 657 657 i_checkAndSwitchFromNatNetworking(oldNatNetworkName.raw()); … … 661 661 * change immediately effect and to notify the guest that the network 662 662 * might have changed, therefore changeAdapter=TRUE. */ 663 mParent-> onNetworkAdapterChange(this, TRUE);663 mParent->i_onNetworkAdapterChange(this, TRUE); 664 664 } 665 665 … … 692 692 alock.release(); 693 693 694 mParent-> onNetworkAdapterChange(this, FALSE);694 mParent->i_onNetworkAdapterChange(this, FALSE); 695 695 } 696 696 … … 727 727 728 728 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 729 mParent-> setModified(Machine::IsModified_NetworkAdapters);729 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 730 730 mlock.release(); 731 731 732 732 /* No change in CFGM logic => changeAdapter=FALSE. */ 733 mParent-> onNetworkAdapterChange(this, FALSE);733 mParent->i_onNetworkAdapterChange(this, FALSE); 734 734 } 735 735 … … 765 765 766 766 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 767 mParent-> setModified(Machine::IsModified_NetworkAdapters);767 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 768 768 mlock.release(); 769 769 770 770 /* No change in CFGM logic => changeAdapter=FALSE. */ 771 mParent-> onNetworkAdapterChange(this, FALSE);771 mParent->i_onNetworkAdapterChange(this, FALSE); 772 772 } 773 773 … … 809 809 810 810 alock.release(); 811 mParent-> setModifiedLock(Machine::IsModified_NetworkAdapters);812 mParent-> onNetworkAdapterChange(this, TRUE);811 mParent->i_setModifiedLock(Machine::IsModified_NetworkAdapters); 812 mParent->i_onNetworkAdapterChange(this, TRUE); 813 813 } 814 814 } … … 846 846 847 847 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 848 mParent-> setModified(Machine::IsModified_NetworkAdapters);848 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 849 849 mlock.release(); 850 850 851 851 /* Adapt the CFGM logic changeAdapter=TRUE */ 852 mParent-> onNetworkAdapterChange(this, TRUE);852 mParent->i_onNetworkAdapterChange(this, TRUE); 853 853 } 854 854 … … 884 884 885 885 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 886 mParent-> setModified(Machine::IsModified_NetworkAdapters);886 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 887 887 mlock.release(); 888 888 889 889 /* No change in CFGM logic => changeAdapter=FALSE. */ 890 mParent-> onNetworkAdapterChange(this, FALSE);890 mParent->i_onNetworkAdapterChange(this, FALSE); 891 891 } 892 892 … … 930 930 931 931 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 932 mParent-> setModified(Machine::IsModified_NetworkAdapters);932 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 933 933 mlock.release(); 934 934 935 935 /* No change in CFGM logic => changeAdapter=FALSE. */ 936 mParent-> onNetworkAdapterChange(this, FALSE);936 mParent->i_onNetworkAdapterChange(this, FALSE); 937 937 } 938 938 … … 981 981 982 982 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 983 mParent-> setModified(Machine::IsModified_NetworkAdapters);983 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 984 984 mlock.release(); 985 985 … … 988 988 adep.release(); 989 989 990 mParent-> onNetworkAdapterChange(this, fGenericChange);990 mParent->i_onNetworkAdapterChange(this, fGenericChange); 991 991 } 992 992 … … 1303 1303 { 1304 1304 ComObjPtr<BandwidthGroup> pBwGroup; 1305 hrc = mParent-> getBandwidthGroup(mData->mBandwidthGroup, pBwGroup, true /* fSetError */);1305 hrc = mParent->i_getBandwidthGroup(mData->mBandwidthGroup, pBwGroup, true /* fSetError */); 1306 1306 1307 1307 Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence … … 1335 1335 if (!strBwGroup.isEmpty()) 1336 1336 { 1337 HRESULT hrc = mParent-> getBandwidthGroup(strBwGroup, pBwGroup, false /* fSetError */);1337 HRESULT hrc = mParent->i_getBandwidthGroup(strBwGroup, pBwGroup, false /* fSetError */); 1338 1338 NOREF(hrc); 1339 1339 Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence … … 1348 1348 1349 1349 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 1350 mParent-> setModified(Machine::IsModified_NetworkAdapters);1350 mParent->i_setModified(Machine::IsModified_NetworkAdapters); 1351 1351 mlock.release(); 1352 1352 1353 1353 /* TODO: changeAdapter=???. */ 1354 mParent-> onNetworkAdapterChange(this, FALSE);1354 mParent->i_onNetworkAdapterChange(this, FALSE); 1355 1355 } 1356 1356 … … 1367 1367 if (!mData->mBandwidthGroup.isEmpty()) 1368 1368 { 1369 HRESULT hrc = mParent-> getBandwidthGroup(mData->mBandwidthGroup, pOldBwGroup, false /* fSetError */);1369 HRESULT hrc = mParent->i_getBandwidthGroup(mData->mBandwidthGroup, pOldBwGroup, false /* fSetError */); 1370 1370 NOREF(hrc); 1371 1371 Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of … … 1405 1405 hrc = mParent->COMGETTER(Name)(bstrName.asOutParam()); 1406 1406 LogRel(("VM '%ls' stops using NAT network '%s'\n", bstrName.raw(), networkName.c_str())); 1407 int natCount = mParent-> getVirtualBox()->i_natNetworkRefDec(Bstr(networkName).raw());1407 int natCount = mParent->i_getVirtualBox()->i_natNetworkRefDec(Bstr(networkName).raw()); 1408 1408 if (natCount == -1) 1409 1409 return E_INVALIDARG; /* no such network */ … … 1428 1428 hrc = mParent->COMGETTER(Name)(bstrName.asOutParam()); 1429 1429 LogRel(("VM '%ls' starts using NAT network '%s'\n", bstrName.raw(), aNatNetworkName.c_str())); 1430 int natCount = mParent-> getVirtualBox()->i_natNetworkRefInc(Bstr(aNatNetworkName).raw());1430 int natCount = mParent->i_getVirtualBox()->i_natNetworkRefInc(Bstr(aNatNetworkName).raw()); 1431 1431 if (natCount == -1) 1432 1432 return E_INVALIDARG; /* not found */ -
trunk/src/VBox/Main/src-server/ParallelPortImpl.cpp
r49871 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 229 229 230 230 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 231 m->pMachine-> setModified(Machine::IsModified_ParallelPorts);231 m->pMachine->i_setModified(Machine::IsModified_ParallelPorts); 232 232 mlock.release(); 233 233 234 m->pMachine-> onParallelPortChange(this);234 m->pMachine->i_onParallelPortChange(this); 235 235 } 236 236 … … 281 281 282 282 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 283 m->pMachine-> setModified(Machine::IsModified_ParallelPorts);283 m->pMachine->i_setModified(Machine::IsModified_ParallelPorts); 284 284 mlock.release(); 285 285 286 m->pMachine-> onParallelPortChange(this);286 m->pMachine->i_onParallelPortChange(this); 287 287 } 288 288 … … 324 324 325 325 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 326 m->pMachine-> setModified(Machine::IsModified_ParallelPorts);326 m->pMachine->i_setModified(Machine::IsModified_ParallelPorts); 327 327 mlock.release(); 328 328 329 m->pMachine-> onParallelPortChange(this);329 m->pMachine->i_onParallelPortChange(this); 330 330 } 331 331 … … 364 364 365 365 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 366 m->pMachine-> setModified(Machine::IsModified_ParallelPorts);366 m->pMachine->i_setModified(Machine::IsModified_ParallelPorts); 367 367 mlock.release(); 368 368 369 return m->pMachine-> onParallelPortChange(this);369 return m->pMachine->i_onParallelPortChange(this); 370 370 } 371 371 -
trunk/src/VBox/Main/src-server/Performance.cpp
r51092 r51498 5 5 6 6 /* 7 * Copyright (C) 2008-201 3Oracle Corporation7 * Copyright (C) 2008-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 260 260 ComPtr<IInternalSessionControl> directControl; 261 261 262 ret = mMachine-> getDirectControl(&directControl);262 ret = mMachine->i_getDirectControl(&directControl); 263 263 if (ret != S_OK) 264 264 return ret; … … 302 302 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 303 303 304 mMachineName = mMachine-> getName();304 mMachineName = mMachine->i_getName(); 305 305 306 306 ComPtr<IInternalSessionControl> directControl; 307 307 308 ret = mMachine-> getDirectControl(&directControl);308 ret = mMachine->i_getDirectControl(&directControl); 309 309 if (ret != S_OK) 310 310 return ret; -
trunk/src/VBox/Main/src-server/SerialPortImpl.cpp
r49806 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 206 206 207 207 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 208 m->pMachine-> setModified(Machine::IsModified_SerialPorts);208 m->pMachine->i_setModified(Machine::IsModified_SerialPorts); 209 209 mlock.release(); 210 210 211 m->pMachine-> onSerialPortChange(this);211 m->pMachine->i_onSerialPortChange(this); 212 212 } 213 213 … … 270 270 271 271 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 272 m->pMachine-> setModified(Machine::IsModified_SerialPorts);272 m->pMachine->i_setModified(Machine::IsModified_SerialPorts); 273 273 mlock.release(); 274 274 275 m->pMachine-> onSerialPortChange(this);275 m->pMachine->i_onSerialPortChange(this); 276 276 } 277 277 … … 324 324 325 325 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 326 m->pMachine-> setModified(Machine::IsModified_SerialPorts);326 m->pMachine->i_setModified(Machine::IsModified_SerialPorts); 327 327 mlock.release(); 328 328 329 m->pMachine-> onSerialPortChange(this);329 m->pMachine->i_onSerialPortChange(this); 330 330 } 331 331 … … 373 373 374 374 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 375 m->pMachine-> setModified(Machine::IsModified_SerialPorts);375 m->pMachine->i_setModified(Machine::IsModified_SerialPorts); 376 376 mlock.release(); 377 377 378 m->pMachine-> onSerialPortChange(this);378 m->pMachine->i_onSerialPortChange(this); 379 379 } 380 380 … … 413 413 414 414 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 415 m->pMachine-> setModified(Machine::IsModified_SerialPorts);415 m->pMachine->i_setModified(Machine::IsModified_SerialPorts); 416 416 mlock.release(); 417 417 418 m->pMachine-> onSerialPortChange(this);418 m->pMachine->i_onSerialPortChange(this); 419 419 } 420 420 … … 449 449 450 450 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 451 m->pMachine-> setModified(Machine::IsModified_SerialPorts);451 m->pMachine->i_setModified(Machine::IsModified_SerialPorts); 452 452 mlock.release(); 453 453 454 m->pMachine-> onSerialPortChange(this);454 m->pMachine->i_onSerialPortChange(this); 455 455 } 456 456 -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r50899 r51498 6 6 7 7 /* 8 * Copyright (C) 2006-201 3Oracle Corporation8 * Copyright (C) 2006-2014 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 329 329 m->strName = aName; 330 330 alock.release(); /* Important! (child->parent locks are forbidden) */ 331 rc = m->pMachine-> onSnapshotChange(this);331 rc = m->pMachine->i_onSnapshotChange(this); 332 332 } 333 333 … … 351 351 m->strDescription = aDescription; 352 352 alock.release(); /* Important! (child->parent locks are forbidden) */ 353 rc = m->pMachine-> onSnapshotChange(this);353 rc = m->pMachine->i_onSnapshotChange(this); 354 354 } 355 355 … … 746 746 // state file (only if this snapshot is online) 747 747 if (i_getStateFilePath().isNotEmpty()) 748 m->pMachine-> copyPathRelativeToMachine(i_getStateFilePath(), data.strStateFile);748 m->pMachine->i_copyPathRelativeToMachine(i_getStateFilePath(), data.strStateFile); 749 749 else 750 750 data.strStateFile.setNull(); 751 751 752 HRESULT rc = m->pMachine-> saveHardware(data.hardware, &data.debugging, &data.autostart);752 HRESULT rc = m->pMachine->i_saveHardware(data.hardware, &data.debugging, &data.autostart); 753 753 if (FAILED(rc)) return rc; 754 754 755 rc = m->pMachine-> saveStorageControllers(data.storage);755 rc = m->pMachine->i_saveStorageControllers(data.storage); 756 756 if (FAILED(rc)) return rc; 757 757 … … 858 858 859 859 // now call detachAllMedia on the snapshot machine 860 rc = m->pMachine-> detachAllMedia(writeLock,861 this /* pSnapshot */,862 cleanupMode,863 llMedia);860 rc = m->pMachine->i_detachAllMedia(writeLock, 861 this /* pSnapshot */, 862 cleanupMode, 863 llMedia); 864 864 if (FAILED(rc)) 865 865 return rc; … … 1168 1168 /* load hardware and harddisk settings */ 1169 1169 1170 HRESULT rc = loadHardware(hardware, pDbg, pAutostart);1170 HRESULT rc = i_loadHardware(hardware, pDbg, pAutostart); 1171 1171 if (SUCCEEDED(rc)) 1172 rc = loadStorageControllers(storage,1173 NULL, /* puuidRegistry */1174 &mSnapshotId);1172 rc = i_loadStorageControllers(storage, 1173 NULL, /* puuidRegistry */ 1174 &mSnapshotId); 1175 1175 1176 1176 if (SUCCEEDED(rc)) 1177 1177 /* commit all changes made during the initialization */ 1178 commit(); /// @todo r=dj why do we need a commit in init?!? this is very expensive1178 i_commit(); /// @todo r=dj why do we need a commit in init?!? this is very expensive 1179 1179 /// @todo r=klaus for some reason the settings loading logic backs up 1180 1180 // the settings, and therefore a commit is needed. Should probably be changed. … … 1234 1234 * @warning Caller must hold no locks when calling this. 1235 1235 */ 1236 HRESULT SnapshotMachine:: onSnapshotChange(Snapshot *aSnapshot)1236 HRESULT SnapshotMachine::i_onSnapshotChange(Snapshot *aSnapshot) 1237 1237 { 1238 1238 AutoMultiWriteLock2 mlock(this, aSnapshot COMMA_LOCKVAL_SRC_POS); … … 1244 1244 * modification of the current state flag, cause this snapshot data isn't 1245 1245 * related to the current state. */ 1246 mMachine-> setModified(Machine::IsModified_Snapshots, false /* fAllowStateModification */);1247 HRESULT rc = mMachine-> saveSettings(&fNeedsGlobalSaveSettings,1248 SaveS_Force); // we know we need saving, no need to check1246 mMachine->i_setModified(Machine::IsModified_Snapshots, false /* fAllowStateModification */); 1247 HRESULT rc = mMachine->i_saveSettings(&fNeedsGlobalSaveSettings, 1248 SaveS_Force); // we know we need saving, no need to check 1249 1249 mlock.release(); 1250 1250 … … 1312 1312 void handler() 1313 1313 { 1314 pMachine-> restoreSnapshotHandler(*this);1314 pMachine->i_restoreSnapshotHandler(*this); 1315 1315 } 1316 1316 }; … … 1330 1330 void handler() 1331 1331 { 1332 pMachine-> deleteSnapshotHandler(*this);1332 pMachine->i_deleteSnapshotHandler(*this); 1333 1333 } 1334 1334 … … 1434 1434 /* save all current settings to ensure current changes are committed and 1435 1435 * hard disks are fixed up */ 1436 HRESULT rc = saveSettings(NULL);1436 HRESULT rc = i_saveSettings(NULL); 1437 1437 // no need to check for whether VirtualBox.xml needs changing since 1438 1438 // we can't have a machine XML rename pending at this point … … 1454 1454 { 1455 1455 // creating a new online snapshot: we need a fresh saved state file 1456 composeSavedStateFilename(strStateFilePath);1456 i_composeSavedStateFilename(strStateFilePath); 1457 1457 } 1458 1458 } … … 1502 1502 // backup the media data so we can recover if things goes wrong along the day; 1503 1503 // the matching commit() is in fixupMedia() during endSnapshot() 1504 setModified(IsModified_Storage);1504 i_setModified(IsModified_Storage); 1505 1505 mMediaData.backup(); 1506 1506 1507 1507 /* Console::fntTakeSnapshotWorker and friends expects this. */ 1508 1508 if (mConsoleTaskData.mLastState == MachineState_Running) 1509 setMachineState(MachineState_LiveSnapshotting);1509 i_setMachineState(MachineState_LiveSnapshotting); 1510 1510 else 1511 setMachineState(MachineState_Saving); /** @todo Confusing! Saving is used for both online and offline snapshots. */1511 i_setMachineState(MachineState_Saving); /** @todo Confusing! Saving is used for both online and offline snapshots. */ 1512 1512 1513 1513 alock.release(); 1514 1514 /* create new differencing hard disks and attach them to this machine */ 1515 rc = createImplicitDiffs(aConsoleProgress,1516 1, // operation weight; must be the same as in Console::TakeSnapshot()1517 !!fTakingSnapshotOnline);1515 rc = i_createImplicitDiffs(aConsoleProgress, 1516 1, // operation weight; must be the same as in Console::TakeSnapshot() 1517 !!fTakingSnapshotOnline); 1518 1518 if (FAILED(rc)) 1519 1519 throw rc; … … 1531 1531 : mData->mMachineState == MachineState_Saving) 1532 1532 ) 1533 setMachineState(mConsoleTaskData.mLastState);1533 i_setMachineState(mConsoleTaskData.mLastState); 1534 1534 1535 1535 pSnapshot->uninit(); … … 1592 1592 && mConsoleTaskData.mLastState != MachineState_Running 1593 1593 ) 1594 setMachineState(mConsoleTaskData.mLastState);1594 i_setMachineState(mConsoleTaskData.mLastState); 1595 1595 1596 1596 ComObjPtr<Snapshot> pOldFirstSnap = mData->mFirstSnapshot; … … 1617 1617 flSaveSettings |= SaveS_ResetCurStateModified; 1618 1618 1619 rc = saveSettings(NULL, flSaveSettings);1619 rc = i_saveSettings(NULL, flSaveSettings); 1620 1620 } 1621 1621 … … 1623 1623 { 1624 1624 /* associate old hard disks with the snapshot and do locking/unlocking*/ 1625 commitMedia(fOnline);1625 i_commitMedia(fOnline); 1626 1626 1627 1627 /* inform callbacks */ … … 1636 1636 machineLock.release(); 1637 1637 1638 rollbackMedia();1638 i_rollbackMedia(); 1639 1639 1640 1640 mData->mFirstSnapshot = pOldFirstSnap; // might have been changed above … … 1766 1766 1767 1767 /* set the proper machine state (note: after creating a Task instance) */ 1768 setMachineState(MachineState_RestoringSnapshot);1768 i_setMachineState(MachineState_RestoringSnapshot); 1769 1769 1770 1770 /* return the progress to the caller */ … … 1791 1791 * @param aTask Task data. 1792 1792 */ 1793 void SessionMachine:: restoreSnapshotHandler(RestoreSnapshotTask &aTask)1793 void SessionMachine::i_restoreSnapshotHandler(RestoreSnapshotTask &aTask) 1794 1794 { 1795 1795 LogFlowThisFuncEnter(); … … 1823 1823 * the direct session. */ 1824 1824 if (mData->flModifications) 1825 rollback(false /* aNotify */);1825 i_rollback(false /* aNotify */); 1826 1826 1827 1827 /* Delete the saved state file if the machine was Saved prior to this … … 1835 1835 Utf8Str strStateFile(mSSData->strStateFilePath); 1836 1836 mSSData->strStateFilePath.setNull(); 1837 releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ );1837 i_releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ ); 1838 1838 1839 1839 aTask.modifyBackedUpState(MachineState_PoweredOff); 1840 1840 1841 rc = saveStateSettings(SaveSTS_StateFilePath);1841 rc = i_saveStateSettings(SaveSTS_StateFilePath); 1842 1842 if (FAILED(rc)) 1843 1843 throw rc; … … 1856 1856 1857 1857 /* copy all hardware data from the snapshot */ 1858 copyFrom(pSnapshotMachine);1858 i_copyFrom(pSnapshotMachine); 1859 1859 1860 1860 LogFlowThisFunc(("Restoring hard disks from the snapshot...\n")); 1861 1861 1862 1862 // restore the attachments from the snapshot 1863 setModified(IsModified_Storage);1863 i_setModified(IsModified_Storage); 1864 1864 mMediaData.backup(); 1865 1865 mMediaData->mAttachments.clear(); … … 1878 1878 alock.release(); 1879 1879 1880 rc = createImplicitDiffs(aTask.pProgress,1881 1,1882 false /* aOnline */);1880 rc = i_createImplicitDiffs(aTask.pProgress, 1881 1, 1882 false /* aOnline */); 1883 1883 if (FAILED(rc)) 1884 1884 throw rc; … … 1934 1934 * state accordingly no matter of the delete snapshot result */ 1935 1935 if (mSSData->strStateFilePath.isNotEmpty()) 1936 setMachineState(MachineState_Saved);1936 i_setMachineState(MachineState_Saved); 1937 1937 else 1938 setMachineState(MachineState_PoweredOff);1939 1940 updateMachineStateOnClient();1938 i_setMachineState(MachineState_PoweredOff); 1939 1940 i_updateMachineStateOnClient(); 1941 1941 stateRestored = true; 1942 1942 … … 1986 1986 // save machine settings, reset the modified flag and commit; 1987 1987 bool fNeedsGlobalSaveSettings = false; 1988 rc = saveSettings(&fNeedsGlobalSaveSettings,1989 SaveS_ResetCurStateModified);1988 rc = i_saveSettings(&fNeedsGlobalSaveSettings, 1989 SaveS_ResetCurStateModified); 1990 1990 if (FAILED(rc)) 1991 1991 throw rc; … … 2025 2025 2026 2026 /* undo all changes on failure */ 2027 rollback(false /* aNotify */);2027 i_rollback(false /* aNotify */); 2028 2028 2029 2029 if (!stateRestored) 2030 2030 { 2031 2031 /* restore the machine state */ 2032 setMachineState(aTask.machineStateBackup);2033 updateMachineStateOnClient();2032 i_setMachineState(aTask.machineStateBackup); 2033 i_updateMachineStateOnClient(); 2034 2034 } 2035 2035 } … … 2108 2108 2109 2109 ComObjPtr<Snapshot> pSnapshot; 2110 HRESULT rc = findSnapshotById(startId, pSnapshot, true /* aSetError */);2110 HRESULT rc = i_findSnapshotById(startId, pSnapshot, true /* aSetError */); 2111 2111 if (FAILED(rc)) return rc; 2112 2112 … … 2135 2135 if (mData->flModifications) 2136 2136 { 2137 rc = saveSettings(NULL);2137 rc = i_saveSettings(NULL); 2138 2138 // no need to change for whether VirtualBox.xml needs saving since 2139 2139 // we can't have a machine XML rename pending at this point … … 2219 2219 // set the proper machine state here now (note: after creating a Task instance) 2220 2220 if (mData->mMachineState == MachineState_Running) 2221 setMachineState(MachineState_DeletingSnapshotOnline);2221 i_setMachineState(MachineState_DeletingSnapshotOnline); 2222 2222 else if (mData->mMachineState == MachineState_Paused) 2223 setMachineState(MachineState_DeletingSnapshotPaused);2223 i_setMachineState(MachineState_DeletingSnapshotPaused); 2224 2224 else 2225 setMachineState(MachineState_DeletingSnapshot);2225 i_setMachineState(MachineState_DeletingSnapshot); 2226 2226 2227 2227 /* return the progress to the caller */ … … 2332 2332 */ 2333 2333 2334 void SessionMachine:: deleteSnapshotHandler(DeleteSnapshotTask &aTask)2334 void SessionMachine::i_deleteSnapshotHandler(DeleteSnapshotTask &aTask) 2335 2335 { 2336 2336 LogFlowThisFuncEnter(); … … 2369 2369 ComObjPtr<SnapshotMachine> pSnapMachine = aTask.pSnapshot->i_getSnapshotMachine(); 2370 2370 // no need to lock the snapshot machine since it is const by definition 2371 Guid machineId = pSnapMachine-> getId();2371 Guid machineId = pSnapMachine->i_getId(); 2372 2372 2373 2373 // save the snapshot ID (for callbacks) … … 2429 2429 // prevent online merging in general. 2430 2430 pOnlineMediumAttachment = 2431 findAttachment(mMediaData->mAttachments,2432 pAttach->i_getControllerName().raw(),2433 pAttach->i_getPort(),2434 pAttach->i_getDevice());2431 i_findAttachment(mMediaData->mAttachments, 2432 pAttach->i_getControllerName().raw(), 2433 pAttach->i_getPort(), 2434 pAttach->i_getDevice()); 2435 2435 if (pOnlineMediumAttachment) 2436 2436 { … … 2448 2448 2449 2449 treeLock.release(); 2450 rc = prepareDeleteSnapshotMedium(pHD, machineId, snapshotId,2451 fOnlineMergePossible,2452 pVMMALockList, pSource, pTarget,2453 fMergeForward, pParentForTarget,2454 pChildrenToReparent,2455 fNeedsOnlineMerge,2456 pMediumLockList,2457 pHDLockToken);2450 rc = i_prepareDeleteSnapshotMedium(pHD, machineId, snapshotId, 2451 fOnlineMergePossible, 2452 pVMMALockList, pSource, pTarget, 2453 fMergeForward, pParentForTarget, 2454 pChildrenToReparent, 2455 fNeedsOnlineMerge, 2456 pMediumLockList, 2457 pHDLockToken); 2458 2458 treeLock.acquire(); 2459 2459 if (FAILED(rc)) … … 2660 2660 1); // weight 2661 2661 2662 releaseSavedStateFile(stateFilePath, aTask.pSnapshot /* pSnapshotToIgnore */);2662 i_releaseSavedStateFile(stateFilePath, aTask.pSnapshot /* pSnapshotToIgnore */); 2663 2663 2664 2664 // machine will need saving now 2665 2665 machineLock.release(); 2666 mParent->i_markRegistryModified( getId());2666 mParent->i_markRegistryModified(i_getId()); 2667 2667 } 2668 2668 } … … 2730 2730 mConsoleTaskData.mDeleteSnapshotInfo = (void *)&(*it); 2731 2731 // online medium merge, in the direction decided earlier 2732 rc = onlineMergeMedium(it->mpOnlineMediumAttachment,2733 it->mpSource,2734 it->mpTarget,2735 it->mfMergeForward,2736 it->mpParentForTarget,2737 it->mpChildrenToReparent,2738 it->mpMediumLockList,2739 aTask.pProgress,2740 &fNeedsSave);2732 rc = i_onlineMergeMedium(it->mpOnlineMediumAttachment, 2733 it->mpSource, 2734 it->mpTarget, 2735 it->mfMergeForward, 2736 it->mpParentForTarget, 2737 it->mpChildrenToReparent, 2738 it->mpMediumLockList, 2739 aTask.pProgress, 2740 &fNeedsSave); 2741 2741 mConsoleTaskData.mDeleteSnapshotInfo = NULL; 2742 2742 } … … 2799 2799 if (fReparentTarget) 2800 2800 { 2801 pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments,2802 it->mpTarget);2801 pAtt = i_findAttachment(pSnapMachine->mMediaData->mAttachments, 2802 it->mpTarget); 2803 2803 it->mpTarget->i_removeBackReference(machineId, snapshotId); 2804 2804 } 2805 2805 else 2806 pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments,2807 it->mpSource);2806 pAtt = i_findAttachment(pSnapMachine->mMediaData->mAttachments, 2807 it->mpSource); 2808 2808 pSnapMachine->mMediaData->mAttachments.remove(pAtt); 2809 2809 … … 2820 2820 childSnapshotId = pChildSnapshot->i_getId(); 2821 2821 } 2822 pAtt = findAttachment(pMachine->mMediaData->mAttachments, it->mpSource);2822 pAtt = i_findAttachment(pMachine->mMediaData->mAttachments, it->mpSource); 2823 2823 if (pAtt) 2824 2824 { … … 2843 2843 2844 2844 // One attachment is merged, must save the settings 2845 mParent->i_markRegistryModified( getId());2845 mParent->i_markRegistryModified(i_getId()); 2846 2846 2847 2847 // prevent calling cancelDeleteSnapshotMedium() for this attachment … … 2863 2863 2864 2864 machineLock.release(); 2865 mParent->i_markRegistryModified( getId());2865 mParent->i_markRegistryModified(i_getId()); 2866 2866 } 2867 2867 } … … 2884 2884 it != toDelete.end(); 2885 2885 ++it) 2886 { 2887 cancelDeleteSnapshotMedium(it->mpHD, it->mpSource, 2888 it->mpChildrenToReparent, 2889 it->mfNeedsOnlineMerge, 2890 it->mpMediumLockList, it->mpHDLockToken, 2891 it->mMachineId, it->mSnapshotId); 2892 } 2886 i_cancelDeleteSnapshotMedium(it->mpHD, it->mpSource, 2887 it->mpChildrenToReparent, 2888 it->mfNeedsOnlineMerge, 2889 it->mpMediumLockList, it->mpHDLockToken, 2890 it->mMachineId, it->mSnapshotId); 2893 2891 } 2894 2892 … … 2902 2900 // restore the machine state that was saved when the 2903 2901 // task was started 2904 setMachineState(aTask.machineStateBackup);2905 updateMachineStateOnClient();2902 i_setMachineState(aTask.machineStateBackup); 2903 i_updateMachineStateOnClient(); 2906 2904 2907 2905 mParent->i_saveModifiedRegistries(); … … 2954 2952 * and every medium object on the merge chain for writing. 2955 2953 */ 2956 HRESULT SessionMachine:: prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,2957 const Guid &aMachineId,2958 const Guid &aSnapshotId,2959 bool fOnlineMergePossible,2960 MediumLockList *aVMMALockList,2961 ComObjPtr<Medium> &aSource,2962 ComObjPtr<Medium> &aTarget,2963 bool &aMergeForward,2964 ComObjPtr<Medium> &aParentForTarget,2965 MediumLockList * &aChildrenToReparent,2966 bool &fNeedsOnlineMerge,2967 MediumLockList * &aMediumLockList,2968 ComPtr<IToken> &aHDLockToken)2954 HRESULT SessionMachine::i_prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD, 2955 const Guid &aMachineId, 2956 const Guid &aSnapshotId, 2957 bool fOnlineMergePossible, 2958 MediumLockList *aVMMALockList, 2959 ComObjPtr<Medium> &aSource, 2960 ComObjPtr<Medium> &aTarget, 2961 bool &aMergeForward, 2962 ComObjPtr<Medium> &aParentForTarget, 2963 MediumLockList * &aChildrenToReparent, 2964 bool &fNeedsOnlineMerge, 2965 MediumLockList * &aMediumLockList, 2966 ComPtr<IToken> &aHDLockToken) 2969 2967 { 2970 2968 Assert(!mParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); … … 3247 3245 * @note Locks the medium tree and the hard disks in the chain for writing. 3248 3246 */ 3249 void SessionMachine:: cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,3250 const ComObjPtr<Medium> &aSource,3251 MediumLockList *aChildrenToReparent,3252 bool fNeedsOnlineMerge,3253 MediumLockList *aMediumLockList,3254 const ComPtr<IToken> &aHDLockToken,3255 const Guid &aMachineId,3256 const Guid &aSnapshotId)3247 void SessionMachine::i_cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD, 3248 const ComObjPtr<Medium> &aSource, 3249 MediumLockList *aChildrenToReparent, 3250 bool fNeedsOnlineMerge, 3251 MediumLockList *aMediumLockList, 3252 const ComPtr<IToken> &aHDLockToken, 3253 const Guid &aMachineId, 3254 const Guid &aSnapshotId) 3257 3255 { 3258 3256 if (aMediumLockList == NULL) … … 3343 3341 * @param pfNeedsMachineSaveSettings Whether the VM settings need to be saved (out). 3344 3342 */ 3345 HRESULT SessionMachine:: onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,3346 const ComObjPtr<Medium> &aSource,3347 const ComObjPtr<Medium> &aTarget,3348 bool fMergeForward,3349 const ComObjPtr<Medium> &aParentForTarget,3350 MediumLockList *aChildrenToReparent,3351 MediumLockList *aMediumLockList,3352 ComObjPtr<Progress> &aProgress,3353 bool *pfNeedsMachineSaveSettings)3343 HRESULT SessionMachine::i_onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment, 3344 const ComObjPtr<Medium> &aSource, 3345 const ComObjPtr<Medium> &aTarget, 3346 bool fMergeForward, 3347 const ComObjPtr<Medium> &aParentForTarget, 3348 MediumLockList *aChildrenToReparent, 3349 MediumLockList *aMediumLockList, 3350 ComObjPtr<Progress> &aProgress, 3351 bool *pfNeedsMachineSaveSettings) 3354 3352 { 3355 3353 AssertReturn(aSource != NULL, E_FAIL); -
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r50355 r51498 7 7 8 8 /* 9 * Copyright (C) 2008-201 3Oracle Corporation9 * Copyright (C) 2008-2014 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 90 90 pParent(aMachine) 91 91 { 92 unconst(pVirtualBox) = aMachine-> getVirtualBox();92 unconst(pVirtualBox) = aMachine->i_getVirtualBox(); 93 93 unconst(pSystemProperties) = pVirtualBox->i_getSystemProperties(); 94 94 } … … 147 147 if (FAILED(rc)) 148 148 return rc; 149 rc = aParent->getVirtualBox()->i_getSystemProperties()->GetMaxInstancesOfStorageBus(chipsetType, aStorageBus, &maxInstances); 149 rc = aParent->i_getVirtualBox()->i_getSystemProperties()-> 150 GetMaxInstancesOfStorageBus(chipsetType, aStorageBus, &maxInstances); 150 151 if (FAILED(rc)) 151 152 return rc; … … 544 545 alock.release(); 545 546 AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS); // m->pParent is const, needs no locking 546 m->pParent-> setModified(Machine::IsModified_Storage);547 m->pParent->i_setModified(Machine::IsModified_Storage); 547 548 mlock.release(); 548 549 549 m->pParent-> onStorageControllerChange();550 m->pParent->i_onStorageControllerChange(); 550 551 } 551 552 … … 601 602 alock.release(); 602 603 AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS); // m->pParent is const, needs no locking 603 m->pParent-> setModified(Machine::IsModified_Storage);604 m->pParent->i_setModified(Machine::IsModified_Storage); 604 605 mlock.release(); 605 606 606 m->pParent-> onStorageControllerChange();607 m->pParent->i_onStorageControllerChange(); 607 608 } 608 609 -
trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
r51092 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 471 471 472 472 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 473 pMachine-> setModified(Machine::IsModified_USB);473 pMachine->i_setModified(Machine::IsModified_USB); 474 474 mlock.release(); 475 475 … … 509 509 510 510 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 511 pMachine-> setModified(Machine::IsModified_USB);511 pMachine->i_setModified(Machine::IsModified_USB); 512 512 mlock.release(); 513 513 … … 625 625 626 626 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 627 pMachine-> setModified(Machine::IsModified_USB);627 pMachine->i_setModified(Machine::IsModified_USB); 628 628 mlock.release(); 629 629 … … 662 662 663 663 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 664 pMachine-> setModified(Machine::IsModified_USB);664 pMachine->i_setModified(Machine::IsModified_USB); 665 665 mlock.release(); 666 666 … … 814 814 815 815 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 816 pMachine-> setModified(Machine::IsModified_USB);816 pMachine->i_setModified(Machine::IsModified_USB); 817 817 mlock.release(); 818 818 … … 987 987 * to be our parent. 988 988 */ 989 RWLockHandle *HostUSBDeviceFilter:: i_lockHandle() const989 RWLockHandle *HostUSBDeviceFilter::lockHandle() const 990 990 { 991 991 return mParent->lockHandle(); -
trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
r50355 r51498 5 5 6 6 /* 7 * Copyright (C) 2005-201 3Oracle Corporation7 * Copyright (C) 2005-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 51 51 Data(Machine *pMachine) 52 52 : pParent(pMachine), 53 pHost(pMachine-> getVirtualBox()->i_host())53 pHost(pMachine->i_getVirtualBox()->i_host()) 54 54 { } 55 55 … … 389 389 alock.release(); 390 390 AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS); 391 m->pParent-> setModified(Machine::IsModified_USB);391 m->pParent->i_setModified(Machine::IsModified_USB); 392 392 mlock.release(); 393 393 … … 456 456 alock.release(); 457 457 AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS); 458 m->pParent-> setModified(Machine::IsModified_USB);458 m->pParent->i_setModified(Machine::IsModified_USB); 459 459 mlock.release(); 460 460 … … 826 826 827 827 if ( aFilter->mInList 828 && m->pParent->i sRegistered())828 && m->pParent->i_isRegistered()) 829 829 { 830 830 USBProxyService *pProxySvc = m->pHost->i_usbProxyService(); … … 881 881 882 882 /* It is not possible to work with USB device if there is no USB controller present. */ 883 if (!m->pParent->i sUSBControllerPresent())883 if (!m->pParent->i_isUSBControllerPresent()) 884 884 return false; 885 885 … … 922 922 923 923 /* It is not possible to work with USB device if there is no USB controller present. */ 924 if (!m->pParent->i sUSBControllerPresent())924 if (!m->pParent->i_isUSBControllerPresent()) 925 925 return false; 926 926 -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r51441 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 211 211 LogFlowThisFunc(("aMachine=%p{%s} aId={%RTuuid} aDone=%RTbool\n", 212 212 aMachine, 213 aMachine-> getName().c_str(),213 aMachine->i_getName().c_str(), 214 214 Guid(aId).raw(), 215 215 aDone)); … … 274 274 LogFlowThisFunc(("aMachine=%p{%s}\n", 275 275 aMachine, 276 aMachine-> getName().c_str()));276 aMachine->i_getName().c_str())); 277 277 278 278 /* … … 524 524 */ 525 525 ULONG ulMaskedIfs; 526 if (aMachine-> hasMatchingUSBFilter(aDevice, &ulMaskedIfs))526 if (aMachine->i_hasMatchingUSBFilter(aDevice, &ulMaskedIfs)) 527 527 { 528 528 /* try to capture the device */ -
trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp
r50914 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 274 274 275 275 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 276 mParent-> setModified(Machine::IsModified_VRDEServer);276 mParent->i_setModified(Machine::IsModified_VRDEServer); 277 277 mlock.release(); 278 278 279 /* Avoid deadlock when onVRDEServerChange eventually calls SetExtraData. */279 /* Avoid deadlock when i_onVRDEServerChange eventually calls SetExtraData. */ 280 280 adep.release(); 281 281 282 rc = mParent-> onVRDEServerChange(/* aRestart */ TRUE);282 rc = mParent->i_onVRDEServerChange(/* aRestart */ TRUE); 283 283 } 284 284 … … 404 404 405 405 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 406 mParent-> setModified(Machine::IsModified_VRDEServer);406 mParent->i_setModified(Machine::IsModified_VRDEServer); 407 407 mlock.release(); 408 408 409 /* Avoid deadlock when onVRDEServerChange eventually calls SetExtraData. */409 /* Avoid deadlock when i_onVRDEServerChange eventually calls SetExtraData. */ 410 410 adep.release(); 411 411 412 mParent-> onVRDEServerChange(/* aRestart */ TRUE);412 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); 413 413 } 414 414 } … … 435 435 436 436 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 437 mParent-> setModified(Machine::IsModified_VRDEServer);437 mParent->i_setModified(Machine::IsModified_VRDEServer); 438 438 mlock.release(); 439 439 440 /* Avoid deadlock when onVRDEServerChange eventually calls SetExtraData. */440 /* Avoid deadlock when i_onVRDEServerChange eventually calls SetExtraData. */ 441 441 adep.release(); 442 442 443 mParent-> onVRDEServerChange(/* aRestart */ TRUE);443 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); 444 444 } 445 445 } … … 536 536 { 537 537 #ifdef VBOX_WITH_EXTPACK 538 VirtualBox *pVirtualBox = mParent-> getVirtualBox();538 VirtualBox *pVirtualBox = mParent->i_getVirtualBox(); 539 539 ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager(); 540 540 vrc = pExtPackMgr->i_getVrdeLibraryPathForExtPack(&strExtPack, &strVrdeLibrary); … … 618 618 619 619 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 620 mParent-> setModified(Machine::IsModified_VRDEServer);620 mParent->i_setModified(Machine::IsModified_VRDEServer); 621 621 mlock.release(); 622 622 623 mParent-> onVRDEServerChange(/* aRestart */ TRUE);623 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); 624 624 } 625 625 … … 654 654 655 655 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 656 mParent-> setModified(Machine::IsModified_VRDEServer);656 mParent->i_setModified(Machine::IsModified_VRDEServer); 657 657 mlock.release(); 658 658 … … 677 677 /* Get the global setting. */ 678 678 ComPtr<ISystemProperties> systemProperties; 679 HRESULT hrc = mParent-> getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam());679 HRESULT hrc = mParent->i_getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 680 680 if (SUCCEEDED(hrc)) 681 681 { … … 711 711 712 712 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 713 mParent-> setModified(Machine::IsModified_VRDEServer);713 mParent->i_setModified(Machine::IsModified_VRDEServer); 714 714 mlock.release(); 715 715 716 mParent-> onVRDEServerChange(/* aRestart */ TRUE);716 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); 717 717 } 718 718 … … 748 748 749 749 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 750 mParent-> setModified(Machine::IsModified_VRDEServer);750 mParent->i_setModified(Machine::IsModified_VRDEServer); 751 751 mlock.release(); 752 752 753 mParent-> onVRDEServerChange(/* aRestart */ TRUE); // @todo does it need a restart?753 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); // @todo does it need a restart? 754 754 } 755 755 … … 783 783 784 784 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking 785 mParent-> setModified(Machine::IsModified_VRDEServer);785 mParent->i_setModified(Machine::IsModified_VRDEServer); 786 786 mlock.release(); 787 787 788 mParent-> onVRDEServerChange(/* aRestart */ TRUE); // @todo needs a restart?788 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); // @todo needs a restart? 789 789 } 790 790 … … 806 806 { 807 807 #ifdef VBOX_WITH_EXTPACK 808 ExtPackManager *pExtPackMgr = mParent-> getVirtualBox()->i_getExtPackManager();808 ExtPackManager *pExtPackMgr = mParent->i_getVirtualBox()->i_getExtPackManager(); 809 809 hrc = pExtPackMgr->i_checkVrdeExtPack(&strExtPack); 810 810 #else … … 819 819 /* Get the global setting. */ 820 820 ComPtr<ISystemProperties> systemProperties; 821 hrc = mParent-> getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam());821 hrc = mParent->i_getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 822 822 if (SUCCEEDED(hrc)) 823 823 { … … 851 851 { 852 852 #ifdef VBOX_WITH_EXTPACK 853 ExtPackManager *pExtPackMgr = mParent-> getVirtualBox()->i_getExtPackManager();853 ExtPackManager *pExtPackMgr = mParent->i_getVirtualBox()->i_getExtPackManager(); 854 854 hrc = pExtPackMgr->i_checkVrdeExtPack(&aExtPack); 855 855 #else … … 874 874 875 875 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 876 mParent-> setModified(Machine::IsModified_VRDEServer);876 mParent->i_setModified(Machine::IsModified_VRDEServer); 877 877 mlock.release(); 878 878 879 mParent-> onVRDEServerChange(/* aRestart */ TRUE);879 mParent->i_onVRDEServerChange(/* aRestart */ TRUE); 880 880 } 881 881 } -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r51441 r51498 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 921 921 AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 922 922 923 if (pMachine->i sAccessible())924 { 925 const StringsList &thisGroups = pMachine-> getGroups();923 if (pMachine->i_isAccessible()) 924 { 925 const StringsList &thisGroups = pMachine->i_getGroups(); 926 926 for (StringsList::const_iterator it2 = thisGroups.begin(); 927 927 it2 != thisGroups.end(); ++it2) … … 1091 1091 AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 1092 1092 1093 if (pMachine->i sAccessible())1094 { 1095 uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine-> getChipsetType());1093 if (pMachine->i_isAccessible()) 1094 { 1095 uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine->i_getChipsetType()); 1096 1096 for (ULONG i = 0; i < cNetworkAdapters; i++) 1097 1097 { … … 1142 1142 AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 1143 1143 1144 if (pMachine->i sAccessible())1145 { 1146 uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine-> getChipsetType());1144 if (pMachine->i_isAccessible()) 1145 { 1146 uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine->i_getChipsetType()); 1147 1147 for (ULONG i = 0; i < cNetworkAdapters; i++) 1148 1148 { … … 1610 1610 /* fire an event */ 1611 1611 if (SUCCEEDED(rc)) 1612 i_onMachineRegistered(pMachine-> getId(), TRUE);1612 i_onMachineRegistered(pMachine->i_getId(), TRUE); 1613 1613 1614 1614 return rc; … … 1680 1680 AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 1681 1681 1682 if (pMachine->i sAccessible())1683 { 1684 const StringsList &thisGroups = pMachine-> getGroups();1682 if (pMachine->i_isAccessible()) 1683 { 1684 const StringsList &thisGroups = pMachine->i_getGroups(); 1685 1685 for (StringsList::const_iterator it2 = thisGroups.begin(); 1686 1686 it2 != thisGroups.end(); … … 2986 2986 ComObjPtr<SessionMachine> sm; 2987 2987 ComPtr<IInternalSessionControl> ctl; 2988 if ((*it)->i sSessionOpen(sm, &ctl))2988 if ((*it)->i_isSessionOpen(sm, &ctl)) 2989 2989 { 2990 2990 aMachines.push_back(sm); … … 3046 3046 } 3047 3047 3048 if (pMachine-> getId() == aId)3048 if (pMachine->i_getId() == aId) 3049 3049 { 3050 3050 rc = S_OK; … … 3090 3090 3091 3091 AutoReadLock machLock(pMachine COMMA_LOCKVAL_SRC_POS); 3092 if (pMachine-> getName() == aName)3092 if (pMachine->i_getName() == aName) 3093 3093 { 3094 3094 rc = S_OK; … … 3097 3097 break; 3098 3098 } 3099 if (!RTPathCompare(pMachine-> getSettingsFileFull().c_str(), aName.c_str()))3099 if (!RTPathCompare(pMachine->i_getSettingsFileFull().c_str(), aName.c_str())) 3100 3100 { 3101 3101 rc = S_OK; … … 4005 4005 // save actual machine registry entry 4006 4006 settings::MachineRegistryEntry mre; 4007 rc = pMachine-> saveRegistryEntry(mre);4007 rc = pMachine->i_saveRegistryEntry(mre); 4008 4008 m->pMainConfigFile->llMachines.push_back(mre); 4009 4009 } … … 4098 4098 { 4099 4099 ComObjPtr<Machine> pMachine; 4100 rc = i_findMachine(aMachine-> getId(),4100 rc = i_findMachine(aMachine->i_getId(), 4101 4101 true /* fPermitInaccessible */, 4102 4102 false /* aDoSetError */, … … 4110 4110 return setError(E_INVALIDARG, 4111 4111 tr("Registered machine with UUID {%RTuuid} ('%s') already exists"), 4112 aMachine-> getId().raw(),4113 pMachine-> getSettingsFileFull().c_str());4112 aMachine->i_getId().raw(), 4113 pMachine->i_getSettingsFileFull().c_str()); 4114 4114 } 4115 4115 … … 4120 4120 if (autoCaller.state() != InInit) 4121 4121 { 4122 rc = aMachine-> prepareRegister();4122 rc = aMachine->i_prepareRegister(); 4123 4123 if (FAILED(rc)) return rc; 4124 4124 } … … 4512 4512 continue; 4513 4513 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 4514 rc = pMachine-> saveSettings(&fNeedsGlobalSettings,4515 Machine::SaveS_Force); // caller said save, so stop arguing4514 rc = pMachine->i_saveSettings(&fNeedsGlobalSettings, 4515 Machine::SaveS_Force); // caller said save, so stop arguing 4516 4516 } 4517 4517 } -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r50919 r51498 105 105 106 106 /* implement nsISupports parts of our objects with support for nsIClassInfo */ 107 NS_DECL_CLASSINFO(Machine)108 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Machine, IMachine)109 110 107 NS_DECL_CLASSINFO(SessionMachine) 111 108 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(SessionMachine, IMachine, IInternalMachineControl)
Note:
See TracChangeset
for help on using the changeset viewer.