Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 55677)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 55678)
@@ -4001,24 +4001,14 @@
         }
 #endif /* VBOX_GUI_WITH_PIDFILE */
+        /* Visual state type options: */
         else if (!::strcmp(arg, "-normal") || !::strcmp(arg, "--normal"))
-        {
             visualStateType = UIVisualStateType_Normal;
-        }
         else if (!::strcmp(arg, "-fullscreen") || !::strcmp(arg, "--fullscreen"))
-        {
             visualStateType = UIVisualStateType_Fullscreen;
-        }
         else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless"))
-        {
             visualStateType = UIVisualStateType_Seamless;
-        }
         else if (!::strcmp(arg, "-scale") || !::strcmp(arg, "--scale"))
-        {
             visualStateType = UIVisualStateType_Scale;
-        }
-        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
-        {
-            ++i;
-        }
+        /* Passwords: */
         else if (!::strcmp (arg, "--settingspw"))
         {
@@ -4063,4 +4053,7 @@
             }
         }
+        /* Misc options: */
+        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
+            ++i;
         else if (!::strcmp(arg, "--no-startvm-errormsgbox"))
             mShowStartVMErrors = false;
@@ -4071,4 +4064,16 @@
         else if (!::strcmp(arg, "--restore-current"))
             mRestoreCurrentSnapshot = true;
+        /* Ad hoc VM reconfig options: */
+        else if (!::strcmp(arg, "--fdc"))
+        {
+            if (++i < argc)
+                m_strFloppyImage = qApp->argv()[i];
+        }
+        else if (!::strcmp(arg, "--dvd") || !::strcmp(arg, "--cdrom"))
+        {
+            if (++i < argc)
+                m_strDvdImage = qApp->argv()[i];
+        }
+        /* VMM Options: */
         else if (!::strcmp(arg, "--disable-patm"))
             mDisablePatm = true;
@@ -4089,4 +4094,5 @@
         }
 #ifdef VBOX_WITH_DEBUGGER_GUI
+        /* Debugger/Debugging options: */
         else if (!::strcmp(arg, "-dbg") || !::strcmp (arg, "--dbg"))
             setDebuggerVar(&m_fDbgEnabled, true);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h	(revision 55677)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h	(revision 55678)
@@ -156,4 +156,9 @@
     void setShouldRestoreCurrentSnapshot(bool fRestore) { mRestoreCurrentSnapshot = fRestore; }
 
+    bool hasFloppyImageToMount() const    { return !m_strFloppyImage.isEmpty(); }
+    bool hasDvdImageToMount() const       { return !m_strDvdImage.isEmpty(); }
+    QString const &getFloppyImage() const { return m_strFloppyImage; }
+    QString const &getDvdImage() const    { return m_strDvdImage; }
+
     bool isPatmDisabled() const { return mDisablePatm; }
     bool isCsamDisabled() const { return mDisableCsam; }
@@ -481,4 +486,13 @@
     /** The --restore-current option. */
     bool mRestoreCurrentSnapshot;
+    /** @name Ad-hoc VM reconfiguration.
+     * @{ */
+    /** Floppy image. */
+    QString m_strFloppyImage;
+    /** DVD image. */
+    QString m_strDvdImage;
+    /** @} */
+    /** @name VMM options
+     * @{ */
     /** The --disable-patm option. */
     bool mDisablePatm;
@@ -493,4 +507,5 @@
     /** The --warp-factor option value. */
     uint32_t mWarpPct;
+    /** @} */
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
Index: /trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/main.cpp	(revision 55677)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/main.cpp	(revision 55678)
@@ -241,4 +241,6 @@
             "  --restore-current          restore the current snapshot before starting\n"
             "  --no-aggressive-caching    delays caching media info in VM processes\n"
+            "  --fdc <image|none>         Mount the specified floppy image\n"
+            "  --dvd <image|none>         Mount the specified DVD image\n"
 # ifdef VBOX_GUI_WITH_PIDFILE
             "  --pidfile <file>           create a pidfile file when a VM is up and running\n"
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 55677)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 55678)
@@ -197,4 +197,10 @@
             debugger().SetVirtualTimeRate(vboxGlobal().getWarpPct());
     }
+
+    /* Apply ad-hoc reconfigurations from the command line. */
+    if (vboxGlobal().hasFloppyImageToMount())
+        mountAdHocImage(KDeviceType_Floppy, UIMediumType_Floppy, vboxGlobal().getFloppyImage());
+    if (vboxGlobal().hasDvdImageToMount())
+        mountAdHocImage(KDeviceType_DVD, UIMediumType_DVD, vboxGlobal().getDvdImage());
 
     /* Power UP if this is NOT separate process: */
@@ -1842,4 +1848,65 @@
 }
 
+bool UISession::mountAdHocImage(KDeviceType enmDeviceType, UIMediumType enmMediumType, QString const &strImage)
+{
+    /*
+     * The 'none' image name means ejecting what ever is in the drive, so leave
+     * the image variables null.
+     */
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    UIMedium uiImage;
+    if (strImage != "none")
+    {
+        /*
+         * Open the image.
+         */
+        QString strMediumID;
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        CMedium vboxImage = vbox.OpenMedium(strImage, enmDeviceType, KAccessMode_ReadWrite, false /* fForceNewUuid */);
+        if (!vbox.isOk() || vboxImage.isNull())
+        {
+            msgCenter().cannotOpenMedium(vbox, enmMediumType, strImage, mainMachineWindow());
+            return false;
+        }
+
+        /*
+         * Work the cache and use the cached image if possible.
+         */
+        uiImage = vboxGlobal().medium(vboxImage.GetId());
+        if (uiImage.isNull())
+        {
+            uiImage = UIMedium(vboxImage, enmMediumType, KMediumState_Created);
+            vboxGlobal().createMedium(uiImage);
+        }
+    }
+    if (vbox.isOk())
+    {
+        /*
+         * Find suitable storage controller.
+         */
+        foreach (const CStorageController &controller, machine().GetStorageControllers())
+        {
+            foreach (const CMediumAttachment &attachment, machine().GetMediumAttachmentsOfController(controller.GetName()))
+            {
+                if (attachment.GetType() == enmDeviceType)
+                {
+                    /*
+                     * Mount the image.
+                     */
+                    machine().MountMedium(controller.GetName(), attachment.GetPort(), attachment.GetDevice(), uiImage.medium(), true /* force */);
+                    if (machine().isOk())
+                        return true;
+                    msgCenter().cannotRemountMedium(machine(), uiImage, !uiImage.isNull() /*mount*/, false /* retry? */, mainMachineWindow());
+                    return false;
+                }
+            }
+        }
+        msgCenter().cannotRemountMedium(machine(), uiImage, !uiImage.isNull() /*mount*/, false /* retry? */, mainMachineWindow());
+    }
+    else
+        msgCenter().cannotOpenMedium(vbox, enmMediumType, strImage, mainMachineWindow());
+    return false;
+}
+
 bool UISession::postprocessInitialization()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 55677)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 55678)
@@ -27,4 +27,5 @@
 /* GUI includes: */
 #include "UIExtraDataDefs.h"
+#include "UIMediumDefs.h"
 
 /* COM includes: */
@@ -379,4 +380,5 @@
     void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight);
     bool preprocessInitialization();
+    bool mountAdHocImage(KDeviceType enmDeviceType, enum UIMediumDefs::UIMediumType enmMediumType, QString const &strImage);
     bool postprocessInitialization();
     int countOfVisibleWindows();
