Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp	(revision 54752)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp	(revision 54753)
@@ -96,5 +96,5 @@
       * @param pParent          being passed to the base-class,
       * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
-    UIEncryptionDataModel(QObject *pParent, const EncryptedMediumsMap &encryptedMediums);
+    UIEncryptionDataModel(QObject *pParent, const EncryptedMediumMap &encryptedMediums);
 
     /** Returns the shallow copy of the encryption password map instance. */
@@ -123,5 +123,5 @@
 
     /** Holds the encrypted medium map reference. */
-    const EncryptedMediumsMap &m_encryptedMediums;
+    const EncryptedMediumMap &m_encryptedMediums;
 
     /** Holds the encryption password map instance. */
@@ -140,5 +140,5 @@
     /** Constructor.
       * @param pParent being passed to the base-class. */
-    UIEncryptionDataTable(const EncryptedMediumsMap &encryptedMediums);
+    UIEncryptionDataTable(const EncryptedMediumMap &encryptedMediums);
 
     /** Returns the shallow copy of the encryption password map
@@ -152,5 +152,5 @@
 
     /** Holds the encrypted medium map reference. */
-    const EncryptedMediumsMap &m_encryptedMediums;
+    const EncryptedMediumMap &m_encryptedMediums;
 
     /** Holds the encryption-data model instance. */
@@ -183,5 +183,5 @@
 }
 
-UIEncryptionDataModel::UIEncryptionDataModel(QObject *pParent, const EncryptedMediumsMap &encryptedMediums)
+UIEncryptionDataModel::UIEncryptionDataModel(QObject *pParent, const EncryptedMediumMap &encryptedMediums)
     : QAbstractTableModel(pParent)
     , m_encryptedMediums(encryptedMediums)
@@ -312,5 +312,5 @@
 }
 
-UIEncryptionDataTable::UIEncryptionDataTable(const EncryptedMediumsMap &encryptedMediums)
+UIEncryptionDataTable::UIEncryptionDataTable(const EncryptedMediumMap &encryptedMediums)
     : m_encryptedMediums(encryptedMediums)
     , m_pModelEncryptionData(0)
@@ -374,5 +374,5 @@
 }
 
-UIAddDiskEncryptionPasswordDialog::UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumsMap &encryptedMediums)
+UIAddDiskEncryptionPasswordDialog::UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumMap &encryptedMediums)
     : QIWithRetranslateUI<QDialog>(pParent)
     , m_encryptedMediums(encryptedMediums)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h	(revision 54752)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h	(revision 54753)
@@ -31,5 +31,5 @@
 
 /* Type definitions: */
-typedef QMultiMap<QString, QString> EncryptedMediumsMap;
+typedef QMultiMap<QString, QString> EncryptedMediumMap;
 typedef QMap<QString, QString> EncryptionPasswordsMap;
 
@@ -45,5 +45,5 @@
       * @param pParent          being passed to the base-class,
       * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
-    UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumsMap &encryptedMediums);
+    UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumMap &encryptedMediums);
 
     /** Returns the shallow copy of the encryption password map
@@ -60,5 +60,5 @@
 
     /** Holds the encrypted medium map reference. */
-    const EncryptedMediumsMap &m_encryptedMediums;
+    const EncryptedMediumMap &m_encryptedMediums;
 
     /** Holds the description label instance. */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 54752)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 54753)
@@ -65,4 +65,5 @@
 # include "UIMedium.h"
 # include "UIExtraDataManager.h"
+# include "UIAddDiskEncryptionPasswordDialog.h"
 # ifdef Q_WS_MAC
 #  include "DockIconPreview.h"
@@ -653,4 +654,9 @@
 void UIMachineLogic::sltRuntimeError(bool fIsFatal, const QString &strErrorId, const QString &strMessage)
 {
+    /* Preprocess known runtime error types: */
+    if (strErrorId == "DrvVD_DEKMISSING")
+        return askUserForTheDiskEncryptionPasswords();
+
+    /* Show runtime error: */
     msgCenter().showRuntimeError(console(), fIsFatal, strErrorId, strMessage);
 }
@@ -2407,4 +2413,49 @@
 }
 
+void UIMachineLogic::askUserForTheDiskEncryptionPasswords()
+{
+    /* Prepare the map of the encrypted mediums: */
+    EncryptedMediumMap encryptedMediums;
+    foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
+    {
+        /* Acquire hard-drive attachments only: */
+        if (attachment.GetType() == KDeviceType_HardDisk)
+        {
+            /* Get the attachment medium: */
+            const CMedium medium = attachment.GetMedium();
+            /* Update the map with this medium if necessary: */
+            const QString strKeyId = medium.GetProperty("CRYPT/KeyId");
+            if (!strKeyId.isEmpty())
+                encryptedMediums.insert(strKeyId, medium.GetId());
+        }
+    }
+
+    /* Ask for the disk encryption passwords if necessary: */
+    EncryptionPasswordsMap encryptionPasswords;
+    if (!encryptedMediums.isEmpty())
+    {
+        /* Create corresponding dialog: */
+        QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
+             new UIAddDiskEncryptionPasswordDialog(activeMachineWindow(), encryptedMediums);
+        /* Execute it and acquire the result: */
+        if (pDlg->exec() == QDialog::Accepted)
+            encryptionPasswords = pDlg->encryptionPasswords();
+        /* Delete dialog if still valid: */
+        if (pDlg)
+            delete pDlg;
+    }
+
+    /* Add the disk encryption passwords if necessary: */
+    if (!encryptionPasswords.isEmpty())
+    {
+        foreach (const QString &strKey, encryptionPasswords.keys())
+        {
+            console().AddDiskEncryptionPassword(strKey, encryptionPasswords.value(strKey), false);
+            if (!console().isOk())
+                msgCenter().cannotAddDiskEncryptionPassword(console());
+        }
+    }
+}
+
 int UIMachineLogic::searchMaxSnapshotIndex(const CMachine &machine,
                                            const CSnapshot &snapshot,
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 54752)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 54753)
@@ -336,4 +336,7 @@
     void showGlobalPreferences(const QString &strCategory = QString(), const QString &strControl = QString());
 
+    /** Asks user for the disks encryption passwords. */
+    void askUserForTheDiskEncryptionPasswords();
+
     /* Helpers: */
     static int searchMaxSnapshotIndex(const CMachine &machine, const CSnapshot &snapshot, const QString &strNameTemplate);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 54752)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 54753)
@@ -44,5 +44,4 @@
 # include "UIFrameBuffer.h"
 # include "UISettingsDialogSpecific.h"
-# include "UIAddDiskEncryptionPasswordDialog.h"
 # ifdef VBOX_WITH_VIDEOHWACCEL
 #  include "VBoxFBOverlay.h"
@@ -252,32 +251,4 @@
 bool UISession::powerUp()
 {
-    /* Prepare map of the encrypted ids: */
-    EncryptedMediumsMap encryptedPasswordIds;
-    foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
-    {
-        /* Acquire hard-drives only: */
-        if (attachment.GetType() == KDeviceType_HardDisk)
-        {
-            /* Get attachment medium: */
-            const CMedium medium = attachment.GetMedium();
-            /* Append our map if this medium has encryption: */
-            const QString strKeyId = medium.GetProperty("CRYPT/KeyId");
-            if (!strKeyId.isEmpty())
-                encryptedPasswordIds.insert(strKeyId, medium.GetId());
-        }
-    }
-    /* Ask for disk encryption passwords if necessary: */
-    EncryptionPasswordsMap encryptionPasswords;
-    if (!encryptedPasswordIds.isEmpty())
-    {
-        QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
-             new UIAddDiskEncryptionPasswordDialog(machineLogic()->activeMachineWindow(),
-                                                   encryptedPasswordIds);
-        if (pDlg->exec() == QDialog::Accepted)
-            encryptionPasswords = pDlg->encryptionPasswords();
-        if (pDlg)
-            delete pDlg;
-    }
-
     /* Power UP machine: */
 #ifdef VBOX_WITH_DEBUGGER_GUI
@@ -316,15 +287,4 @@
             msgCenter().cannotStartMachine(progress, machineName());
         return false;
-    }
-
-    /* Add the disk encryption passwords: */
-    if (!encryptionPasswords.isEmpty())
-    {
-        foreach (const QString &strKey, encryptionPasswords.keys())
-        {
-            console().AddDiskEncryptionPassword(strKey, encryptionPasswords.value(strKey), true);
-            if (!console().isOk())
-                msgCenter().cannotAddDiskEncryptionPassword(console());
-        }
     }
 
