Changeset 98787 in vbox
- Timestamp:
- Feb 28, 2023 3:58:27 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156098
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98786 r98787 744 744 { 745 745 return uisession()->storageDevices(enmDeviceType, guiStorageDevices); 746 } 747 748 bool UIMachine::acquireEncryptedMedia(EncryptedMediumMap &media) 749 { 750 return uisession()->acquireEncryptedMedia(media); 746 751 } 747 752 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98786 r98787 37 37 38 38 /* GUI includes: */ 39 #include "UIAddDiskEncryptionPasswordDialog.h" 39 40 #include "UIExtraDataDefs.h" 40 41 #include "UIMachineDefs.h" … … 513 514 bool storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices); 514 515 516 /** Acquires encrypted media map. */ 517 bool acquireEncryptedMedia(EncryptedMediumMap &media); 515 518 /** Adds encryption password. */ 516 519 bool addEncryptionPassword(const QString &strId, const QString &strPassword, bool fClearOnSuspend); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r98784 r98787 2914 2914 /* Prepare the map of the encrypted media: */ 2915 2915 EncryptedMediumMap encryptedMedia; 2916 foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments()) 2917 { 2918 /* Acquire hard-drive attachments only: */ 2919 if (attachment.GetType() == KDeviceType_HardDisk) 2920 { 2921 /* Get the attachment medium base: */ 2922 const CMedium medium = attachment.GetMedium(); 2923 /* Update the map with this medium if it's encrypted: */ 2924 QString strCipher; 2925 const QString strPasswordId = medium.GetEncryptionSettings(strCipher); 2926 if (medium.isOk()) 2927 encryptedMedia.insert(strPasswordId, medium.GetId()); 2928 } 2929 } 2916 if (!uimachine()->acquireEncryptedMedia(encryptedMedia)) 2917 return; 2930 2918 2931 2919 /* Ask for the disk encryption passwords if necessary: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98786 r98787 638 638 } 639 639 640 bool UISession::acquireEncryptedMedia(EncryptedMediumMap &media) 641 { 642 EncryptedMediumMap encryptedMedia; 643 CMachine comMachine = machine(); 644 const CMediumAttachmentVector comAttachments = comMachine.GetMediumAttachments(); 645 bool fSuccess = comMachine.isOk(); 646 if (!fSuccess) 647 UINotificationMessage::cannotAcquireMachineParameter(comMachine); 648 else 649 { 650 foreach (const CMediumAttachment &comAttachment, comAttachments) 651 { 652 const KDeviceType enmType = comAttachment.GetType(); 653 fSuccess = comAttachment.isOk(); 654 if (!fSuccess) 655 { 656 UINotificationMessage::cannotAcquireMediumAttachmentParameter(comAttachment); 657 break; 658 } 659 660 /* Look for hard-drive attachments only: */ 661 if (enmType != KDeviceType_HardDisk) 662 continue; 663 664 /* Get the attachment medium: */ 665 const CMedium comMedium = comAttachment.GetMedium(); 666 fSuccess = comAttachment.isOk(); 667 if (!fSuccess) 668 { 669 UINotificationMessage::cannotAcquireMediumAttachmentParameter(comAttachment); 670 break; 671 } 672 673 /* Get the medium ID: */ 674 const QUuid uId = comMedium.GetId(); 675 fSuccess = comMedium.isOk(); 676 if (!fSuccess) 677 { 678 UINotificationMessage::cannotAcquireMediumParameter(comMedium); 679 break; 680 } 681 682 /* Update the map with this medium if it's encrypted: */ 683 QString strCipher; 684 const QString strPasswordId = comMedium.GetEncryptionSettings(strCipher); 685 if (comMedium.isOk()) // GetEncryptionSettings failure is a valid case 686 encryptedMedia.insert(strPasswordId, uId); 687 } 688 } 689 690 if (fSuccess) 691 media = encryptedMedia; 692 return fSuccess; 693 } 694 640 695 bool UISession::addEncryptionPassword(const QString &strId, const QString &strPassword, bool fClearOnSuspend) 641 696 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98786 r98787 39 39 40 40 /* GUI includes: */ 41 #include "UIAddDiskEncryptionPasswordDialog.h" 41 42 #include "UIExtraDataDefs.h" 42 43 #include "UIMachineDefs.h" … … 326 327 bool storageDevices(KDeviceType enmDeviceType, QList<StorageDeviceInfo> &guiStorageDevices); 327 328 329 /** Acquires encrypted media map. */ 330 bool acquireEncryptedMedia(EncryptedMediumMap &media); 328 331 /** Adds encryption password. */ 329 332 bool addEncryptionPassword(const QString &strId, const QString &strPassword, bool fClearOnSuspend);
Note:
See TracChangeset
for help on using the changeset viewer.