Index: /trunk/src/VBox/Main/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MediumImpl.cpp	(revision 35125)
+++ /trunk/src/VBox/Main/MediumImpl.cpp	(revision 35126)
@@ -1639,4 +1639,18 @@
     }
 
+    DeviceType_T devType = getDeviceType();
+    // DVD media can only be readonly.
+    if (devType == DeviceType_DVD && aType != MediumType_Readonly)
+        return setError(VBOX_E_INVALID_OBJECT_STATE,
+                        tr("Cannot change the type of DVD medium '%s'"),
+                        m->strLocationFull.c_str());
+    // Floppy media can only be writethrough or readonly.
+    if (   devType == DeviceType_Floppy
+        && aType != MediumType_Writethrough
+        && aType != MediumType_Readonly)
+        return setError(VBOX_E_INVALID_OBJECT_STATE,
+                        tr("Cannot change the type of floppy medium '%s'"),
+                        m->strLocationFull.c_str());
+
     /* cannot change the type of a differencing medium */
     if (m->pParent)
@@ -1697,4 +1711,13 @@
                                     m->strLocationFull.c_str());
             }
+            else if (aType == MediumType_Readonly && devType == DeviceType_HardDisk)
+            {
+                // Readonly hard disks are not allowed, this medium type is reserved for
+                // DVDs and floppy images at the moment. Later we might allow readonly hard
+                // disks, but that's extremely unusual and many guest OSes will have trouble.
+                return setError(VBOX_E_INVALID_OBJECT_STATE,
+                                tr("Cannot change type for medium '%s' to 'Readonly' since it is a hard disk"),
+                                m->strLocationFull.c_str());
+            }
             break;
         }
@@ -1703,9 +1726,7 @@
     }
 
-    if (    aType == MediumType_MultiAttach
-         || aType == MediumType_Readonly
-       )
-    {
-        // These two types are new with VirtualBox 4.0 and therefore require settings
+    if (aType == MediumType_MultiAttach)
+    {
+        // This type is new with VirtualBox 4.0 and therefore requires settings
         // version 1.11 in the settings backend. Unfortunately it is not enough to do
         // the usual routine in MachineConfigFile::bumpSettingsVersionIfNeeded() for
@@ -1719,5 +1740,5 @@
         if (isInRegistry(uuidGlobalRegistry))
             return setError(VBOX_E_INVALID_OBJECT_STATE,
-                            tr("Cannot change type for medium '%s': the media types 'MultiAttach' and 'Readonly' can only be used "
+                            tr("Cannot change type for medium '%s': the media type 'MultiAttach' can only be used "
                                "on media registered with a machine that was created with VirtualBox 4.0 or later"),
                             m->strLocationFull.c_str());
