Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 35039)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 35040)
@@ -7546,4 +7546,24 @@
                 }
 
+                if (medium->getType() == MediumType_MultiAttach)
+                {
+                    if (isSnapshotMachine())
+                        return setError(E_FAIL,
+                                        tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} "
+                                           "of the virtual machine '%s' ('%s')"),
+                                        medium->getLocationFull().c_str(),
+                                        dev.uuid.raw(),
+                                        puuidSnapshot->raw(),
+                                        mUserData->s.strName.c_str(),
+                                        mData->m_strConfigFileFull.c_str());
+
+                    return setError(E_FAIL,
+                                    tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s')"),
+                                    medium->getLocationFull().c_str(),
+                                    dev.uuid.raw(),
+                                    mUserData->s.strName.c_str(),
+                                    mData->m_strConfigFileFull.c_str());
+                }
+
                 if (    !isSnapshotMachine()
                      && medium->getChildren().size() != 0
Index: /trunk/src/VBox/Main/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MediumImpl.cpp	(revision 35039)
+++ /trunk/src/VBox/Main/MediumImpl.cpp	(revision 35040)
@@ -1646,10 +1646,13 @@
 
     /* Cannot change the type of a medium being in use by more than one VM.
-     * If the change is to Immutable then it must not be attached to any VM,
-     * otherwise assumptions elsewhere are violated and the VM becomes
-     * inaccessible. Attaching an immutable medium triggers the diff creation,
-     * and this is vital for the correct operation. */
+     * If the change is to Immutable or MultiAttach then it must not be
+     * directly attached to any VM, otherwise the assumptions about indirect
+     * attachment elsewhere are violated and the VM becomes inaccessible.
+     * Attaching an immutable medium triggers the diff creation, and this is
+     * vital for the correct operation. */
     if (   m->backRefs.size() > 1
-        || (aType == MediumType_Immutable && m->backRefs.size() > 0))
+        || (   (   aType == MediumType_Immutable
+                || aType == MediumType_MultiAttach)
+            && m->backRefs.size() > 0))
         return setError(VBOX_E_INVALID_OBJECT_STATE,
                         tr("Cannot change the type of medium '%s' because it is attached to %d virtual machines"),
@@ -1660,4 +1663,5 @@
         case MediumType_Normal:
         case MediumType_Immutable:
+        case MediumType_MultiAttach:
         {
             /* normal can be easily converted to immutable and vice versa even
@@ -3423,4 +3427,5 @@
         }
         case MediumType_Immutable:
+        case MediumType_MultiAttach:
             return true;
         case MediumType_Writethrough:
@@ -4237,4 +4242,8 @@
                                tr("Medium '%s' is immutable"),
                                m->strLocationFull.c_str());
+            if (m->type == MediumType_MultiAttach)
+                throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                               tr("Medium '%s' is multi-attach"),
+                               m->strLocationFull.c_str());
         }
         else
@@ -4251,4 +4260,8 @@
                 throw setError(VBOX_E_INVALID_OBJECT_STATE,
                                tr("Medium '%s' is immutable"),
+                               pTarget->m->strLocationFull.c_str());
+            if (pTarget->m->type == MediumType_MultiAttach)
+                throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                               tr("Medium '%s' is multi-attach"),
                                pTarget->m->strLocationFull.c_str());
         }
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 35039)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 35040)
@@ -8793,5 +8793,5 @@
   <enum
     name="MediumType"
-    uuid="19388a99-8e70-4bd4-9a95-90cbc513ef6d"
+    uuid="fe663fb5-c244-4e1b-9d81-c628b417dd04"
     >
     <desc>
@@ -8827,4 +8827,13 @@
       <desc>
         A readonly medium, which can of course be used by several machines.
+        <note>Present and accepted since VirtualBox 4.0.</note>
+      </desc>
+    </const>
+    <const name="MultiAttach"       value="5">
+      <desc>
+        A medium which is is indirectly attached, so that one base medium can
+        be used for several VMs which have their own differencing medium to
+        store their modifications. In some sense a variant of Immutable
+        with unset AutoReset flag in each differencing medium.
         <note>Present and accepted since VirtualBox 4.0.</note>
       </desc>
Index: /trunk/src/VBox/Main/xml/Settings.cpp
===================================================================
--- /trunk/src/VBox/Main/xml/Settings.cpp	(revision 35039)
+++ /trunk/src/VBox/Main/xml/Settings.cpp	(revision 35040)
@@ -678,6 +678,8 @@
             else if (strType == "READONLY")
                 med.hdType = MediumType_Readonly;
+            else if (strType == "MULTIATTACH")
+                med.hdType = MediumType_MultiAttach;
             else
-                throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute must be one of Normal, Immutable or Writethrough"));
+                throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute must be one of Normal, Immutable, Writethrough, Shareable, Readonly or MultiAttach"));
         }
     }
@@ -1037,5 +1039,7 @@
             mdm.hdType == MediumType_Writethrough ? "Writethrough" :
             mdm.hdType == MediumType_Shareable ? "Shareable" :
-            mdm.hdType == MediumType_Readonly ? "Readonly" : "INVALID";
+            mdm.hdType == MediumType_Readonly ? "Readonly" :
+            mdm.hdType == MediumType_MultiAttach ? "MultiAttach" :
+            "INVALID";
         pelmMedium->setAttribute("type", pcszType);
     }
@@ -4482,4 +4486,12 @@
     }
 
+    // Settings version 1.11 is required if Readonly/MultiAttach media
+    // are present.
+    if (m->sv < SettingsVersion_v1_11)
+    {
+        /// @todo add code going over all medium attachments and check if
+        // they are of type Readonly or MultiAttach.
+    }
+
     // settings version 1.9 is required if there is not exactly one DVD
     // or more than one floppy drive present or the DVD is not at the secondary
Index: /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
===================================================================
--- /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd	(revision 35039)
+++ /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd	(revision 35040)
@@ -308,4 +308,7 @@
             <xsd:enumeration value="Immutable"/>
             <xsd:enumeration value="Writethrough"/>
+            <xsd:enumeration value="Shareable"/>
+            <xsd:enumeration value="Readonly"/>
+            <xsd:enumeration value="MultiAttach"/>
           </xsd:restriction>
         </xsd:simpleType>
