Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp	(revision 44364)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp	(revision 44365)
@@ -373,8 +373,16 @@
     {
         ComPtr<IProgress> progress;
+        com::SafeArray<MediumVariant_T> l_variants(sizeof(MediumVariant_T)*8);
+
+        for (unsigned int i = 0; i < l_variants.size(); ++i)
+        {
+            MediumVariant_T temp = DiskVariant;
+            l_variants [i] = (temp & (1<<i));
+        }
+
         if (fBase)
-            CHECK_ERROR(hardDisk, CreateBaseStorage(size, DiskVariant, progress.asOutParam()));
+            CHECK_ERROR(hardDisk, CreateBaseStorage(size, ComSafeArrayAsInParam(l_variants), progress.asOutParam()));
         else
-            CHECK_ERROR(parentHardDisk, CreateDiffStorage(hardDisk, DiskVariant, progress.asOutParam()));
+            CHECK_ERROR(parentHardDisk, CreateDiffStorage(hardDisk, ComSafeArrayAsInParam(l_variants), progress.asOutParam()));
         if (SUCCEEDED(rc) && progress)
         {
@@ -677,5 +685,13 @@
 
         ComPtr<IProgress> progress;
-        CHECK_ERROR_BREAK(srcDisk, CloneTo(dstDisk, DiskVariant, NULL, progress.asOutParam()));
+        com::SafeArray<MediumVariant_T> l_variants(sizeof(MediumVariant_T)*8);
+
+        for (unsigned int i = 0; i < l_variants.size(); ++i)
+        {
+            MediumVariant_T temp = DiskVariant;
+            l_variants [i] = (temp & (1<<i));
+        }
+
+        CHECK_ERROR_BREAK(srcDisk, CloneTo(dstDisk, ComSafeArrayAsInParam(l_variants), NULL, progress.asOutParam()));
 
         rc = showProgress(progress);
@@ -1001,6 +1017,12 @@
         hardDisk->COMGETTER(Format)(format.asOutParam());
         RTPrintf("Storage format:       %ls\n", format.raw());
-        ULONG variant;
-        hardDisk->COMGETTER(Variant)(&variant);
+
+        com::SafeArray<MediumVariant_T> safeArray_variant;
+
+        hardDisk->COMGETTER(Variant)(ComSafeArrayAsOutParam(safeArray_variant));
+        ULONG variant=0;
+        for (size_t i = 0; i < safeArray_variant.size(); i++)
+            variant |= safeArray_variant[i];
+
         const char *variantStr = "unknown";
         switch (variant & ~(MediumVariant_Fixed | MediumVariant_Diff))
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp	(revision 44364)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp	(revision 44365)
@@ -142,5 +142,11 @@
         mHardDiskFormat = mMedium.GetFormat();
         mHardDiskType = vboxGlobal().mediumTypeString (mMedium);
-        mStorageDetails = gpConverter->toString((KMediumVariant)mMedium.GetVariant());
+
+        QVector<KMediumVariant> mediumVariants_QVector = mMedium.GetVariant();
+        qlonglong mediumVariants_qlonglong = 0;
+        for (int i = 0; i < mediumVariants_QVector.size(); i++)
+            mediumVariants_qlonglong |= mediumVariants_QVector[i];
+
+        mStorageDetails = gpConverter->toString((KMediumVariant)mediumVariants_qlonglong);
         mIsReadOnly = mMedium.GetReadOnly();
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp	(revision 44364)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp	(revision 44365)
@@ -71,6 +71,14 @@
     }
 
+    QVector<KMediumVariant> l_variants(sizeof(uVariant)*8);
+
+    for (int i = 0; i < l_variants.size(); ++i)
+    {
+        qulonglong temp = uVariant;
+        l_variants [i] = (KMediumVariant)(temp & (1<<i));
+    }
+
     /* Copy existing virtual-disk to the new virtual-disk: */
-    progress = sourceVirtualDisk.CloneTo(virtualDisk, uVariant, CMedium());
+    progress = sourceVirtualDisk.CloneTo(virtualDisk, l_variants, CMedium());
     if (!virtualDisk.isOk())
     {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp	(revision 44364)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp	(revision 44365)
@@ -74,6 +74,15 @@
     }
 
+    QVector<KMediumVariant> l_variants(sizeof(qulonglong)*8);
+
+    for (int i = 0; i < l_variants.size(); ++i)
+    {
+        qulonglong temp = uVariant;
+        l_variants [i] = (KMediumVariant)(temp & (1<<i));
+    }
+
     /* Create base storage for the new hard disk: */
-    progress = virtualDisk.CreateBaseStorage(uSize, uVariant);
+    progress = virtualDisk.CreateBaseStorage(uSize, l_variants);
+
     if (!virtualDisk.isOk())
     {
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 44364)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 44365)
@@ -12039,5 +12039,5 @@
   <interface
     name="IMedium" extends="$unknown"
-    uuid="29989373-b111-4654-8493-2e1176cba890"
+    uuid="86fd6208-4c8c-40c2-a4e3-f6b47ac6ef07"
     wsmap="managed"
     >
@@ -12244,5 +12244,5 @@
     </attribute>
 
-    <attribute name="variant" type="unsigned long" readonly="yes">
+    <attribute name="variant" type="MediumVariant" safearray="yes" readonly="yes">
       <desc>
         Returns the storage format variant information for this medium
@@ -12955,5 +12955,5 @@
         <desc>Maximum logical size of the medium in bytes.</desc>
       </param>
-      <param name="variant" type="unsigned long" dir="in">
+      <param name="variant" type="MediumVariant" safearray="yes" dir="in">
         <desc>Exact image variant which should be created (as a combination of
           <link to="MediumVariant" /> flags).</desc>
@@ -13038,5 +13038,5 @@
         <desc>Target medium.</desc>
       </param>
-      <param name="variant" type="unsigned long" dir="in">
+      <param name="variant" type="MediumVariant" safearray="yes" dir="in">
         <desc>Exact image variant which should be created (as a combination of
           <link to="MediumVariant" /> flags).</desc>
@@ -13166,5 +13166,5 @@
         <desc>Target medium.</desc>
       </param>
-      <param name="variant" type="unsigned long" dir="in">
+      <param name="variant" type="MediumVariant" safearray="yes" dir="in">
         <desc>Exact image variant which should be created (as a combination of
           <link to="MediumVariant" /> flags).</desc>
@@ -13215,7 +13215,6 @@
     <desc>Target medium.</desc>
     </param>
-    <param name="variant" type="unsigned long" dir="in">
-    <desc>Exact image variant which should be created (as a combination of
-    <link to="MediumVariant" /> flags).</desc>
+    <param name="variant" type="MediumVariant" safearray="yes" dir="in">
+    <desc><link to="MediumVariant" /> flags).</desc>
     </param>
     <param name="progress" type="IProgress" dir="return">
Index: /trunk/src/VBox/Main/include/MediumImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MediumImpl.h	(revision 44364)
+++ /trunk/src/VBox/Main/include/MediumImpl.h	(revision 44365)
@@ -104,5 +104,5 @@
     STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
     STDMETHOD(COMGETTER(State))(MediumState_T *aState);
-    STDMETHOD(COMGETTER(Variant))(ULONG *aVariant);
+    STDMETHOD(COMGETTER(Variant))(ComSafeArrayOut(MediumVariant_T, aVariant));
     STDMETHOD(COMGETTER(Location))(BSTR *aLocation);
     STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation);
@@ -145,14 +145,14 @@
                              ComSafeArrayIn(IN_BSTR, aValues));
     STDMETHOD(CreateBaseStorage)(LONG64 aLogicalSize,
-                                 ULONG aVariant,
+                                 ComSafeArrayIn(MediumVariant_T, aVariant),
                                  IProgress **aProgress);
     STDMETHOD(DeleteStorage)(IProgress **aProgress);
     STDMETHOD(CreateDiffStorage)(IMedium *aTarget,
-                                 ULONG aVariant,
+                                 ComSafeArrayIn(MediumVariant_T, aVariant),
                                  IProgress **aProgress);
     STDMETHOD(MergeTo)(IMedium *aTarget, IProgress **aProgress);
-    STDMETHOD(CloneTo)(IMedium *aTarget, ULONG aVariant,
+    STDMETHOD(CloneTo)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant),
                         IMedium *aParent, IProgress **aProgress);
-    STDMETHOD(CloneToBase)(IMedium *aTarget, ULONG aVariant,
+    STDMETHOD(CloneToBase)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant),
                            IProgress **aProgress);
     STDMETHOD(Compact)(IProgress **aProgress);
Index: /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 44364)
+++ /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 44365)
@@ -1870,6 +1870,8 @@
     if (strSourceOVF.isEmpty())
     {
+        com::SafeArray<MediumVariant_T>  mediumVariant;
+        mediumVariant.push_back(MediumVariant_Standard);
         /* Create a dynamic growing disk image with the given capacity. */
-        rc = pTargetHD->CreateBaseStorage(di.iCapacity / _1M, MediumVariant_Standard, ComPtr<IProgress>(pProgress).asOutParam());
+        rc = pTargetHD->CreateBaseStorage(di.iCapacity / _1M, ComSafeArrayAsInParam(mediumVariant), ComPtr<IProgress>(pProgress).asOutParam());
         if (FAILED(rc)) throw rc;
 
Index: /trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp	(revision 44364)
+++ /trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp	(revision 44365)
@@ -1097,5 +1097,8 @@
                         p->mParent->getDefaultHardDiskFormat(strDefaultFormat);
                         Bstr bstrSrcFormat(strDefaultFormat);
+
                         ULONG srcVar = MediumVariant_Standard;
+                        com::SafeArray <MediumVariant_T> mediumVariant;
+
                         /* Is the source file based? */
                         if ((uSrcCaps & MediumFormatCapabilities_File) == MediumFormatCapabilities_File)
@@ -1105,6 +1108,12 @@
                             rc = pMedium->COMGETTER(Format)(bstrSrcFormat.asOutParam());
                             if (FAILED(rc)) throw rc;
-                            rc = pMedium->COMGETTER(Variant)(&srcVar);
+
+                            rc = pMedium->COMGETTER(Variant)(ComSafeArrayAsOutParam(mediumVariant));
                             if (FAILED(rc)) throw rc;
+                            else
+                            {
+                                for (size_t i = 0; i < mediumVariant.size(); i++)
+                                    srcVar |= mediumVariant[i];
+                            }
                         }
 
Index: /trunk/src/VBox/Main/src-server/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 44364)
+++ /trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 44365)
@@ -1532,7 +1532,7 @@
 }
 
-STDMETHODIMP Medium::COMGETTER(Variant)(ULONG *aVariant)
-{
-    CheckComArgOutPointerValid(aVariant);
+STDMETHODIMP Medium::COMGETTER(Variant)(ComSafeArrayOut(MediumVariant_T, aVariant))
+{
+    CheckComArgOutSafeArrayPointerValid(aVariant);
 
     AutoCaller autoCaller(this);
@@ -1540,9 +1540,17 @@
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    *aVariant = m->variant;
+
+    SafeArray<MediumVariant_T> variants(sizeof(MediumVariant_T)*8);
+
+    for (unsigned int i = 0; i < variants.size(); ++i)
+    {
+        MediumVariant_T temp = m->variant;
+        variants [i] = (temp & (1<<i));
+    }
+
+    variants.detachTo(ComSafeArrayOutArg(aVariant));
 
     return S_OK;
 }
-
 
 STDMETHODIMP Medium::COMGETTER(Location)(BSTR *aLocation)
@@ -2493,7 +2501,8 @@
 
 STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize,
-                                       ULONG aVariant,
+                                       ComSafeArrayIn(MediumVariant_T, aVariant),
                                        IProgress **aProgress)
 {
+    CheckComArgSafeArrayNotNull(aVariant);
     CheckComArgOutPointerValid(aProgress);
     if (aLogicalSize < 0)
@@ -2511,11 +2520,22 @@
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        aVariant = (MediumVariant_T)((unsigned)aVariant & (unsigned)~MediumVariant_Diff);
-        if (    !(aVariant & MediumVariant_Fixed)
+        ULONG mediumVariantFlags = 0;
+
+        if (aVariant)
+        {
+            com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
+            for (size_t i = 0; i < variants.size(); i++)
+                mediumVariantFlags |= variants[i];
+        }
+
+        mediumVariantFlags &= ((unsigned)~MediumVariant_Diff);
+
+        if (    !(mediumVariantFlags & MediumVariant_Fixed)
             &&  !(m->formatObj->getCapabilities() & MediumFormatCapabilities_CreateDynamic))
             throw setError(VBOX_E_NOT_SUPPORTED,
                            tr("Medium format '%s' does not support dynamic storage creation"),
                            m->strFormat.c_str());
-        if (    (aVariant & MediumVariant_Fixed)
+
+        if (    (mediumVariantFlags & MediumVariant_Fixed)
             &&  !(m->formatObj->getCapabilities() & MediumFormatCapabilities_CreateDynamic))
             throw setError(VBOX_E_NOT_SUPPORTED,
@@ -2529,5 +2549,5 @@
         rc = pProgress->init(m->pVirtualBox,
                              static_cast<IMedium*>(this),
-                             (aVariant & MediumVariant_Fixed)
+                             (mediumVariantFlags & MediumVariant_Fixed)
                                ? BstrFmt(tr("Creating fixed medium storage unit '%s'"), m->strLocationFull.c_str()).raw()
                                : BstrFmt(tr("Creating dynamic medium storage unit '%s'"), m->strLocationFull.c_str()).raw(),
@@ -2538,5 +2558,6 @@
         /* setup task object to carry out the operation asynchronously */
         pTask = new Medium::CreateBaseTask(this, pProgress, aLogicalSize,
-                                           (MediumVariant_T)aVariant);
+                                           (MediumVariant_T)mediumVariantFlags);
+                                           //(MediumVariant_T)aVariant);
         rc = pTask->rc();
         AssertComRC(rc);
@@ -2582,9 +2603,10 @@
 
 STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget,
-                                       ULONG aVariant,
-                                       IProgress **aProgress)
+                                         ComSafeArrayIn(MediumVariant_T, aVariant),
+                                         IProgress **aProgress)
 {
     CheckComArgNotNull(aTarget);
     CheckComArgOutPointerValid(aProgress);
+    CheckComArgSafeArrayNotNull(aVariant);
 
     AutoCaller autoCaller(this);
@@ -2649,5 +2671,14 @@
     ComObjPtr <Progress> pProgress;
 
-    rc = createDiffStorage(diff, (MediumVariant_T)aVariant, pMediumLockList,
+    ULONG mediumVariantFlags = 0;
+
+    if (aVariant)
+    {
+        com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
+        for (size_t i = 0; i < variants.size(); i++)
+            mediumVariantFlags |= variants[i];
+    }
+
+    rc = createDiffStorage(diff, (MediumVariant_T)mediumVariantFlags, pMediumLockList,
                            &pProgress, false /* aWait */);
     if (FAILED(rc))
@@ -2694,16 +2725,20 @@
 
 STDMETHODIMP Medium::CloneToBase(IMedium   *aTarget,
-                                 ULONG     aVariant,
-                                 IProgress **aProgress)
+                                  ComSafeArrayIn(MediumVariant_T, aVariant),
+                                  IProgress **aProgress)
 {
      int rc = S_OK;
      CheckComArgNotNull(aTarget);
      CheckComArgOutPointerValid(aProgress);
-     rc =  CloneTo(aTarget, aVariant, NULL, aProgress);
+     CheckComArgSafeArrayNotNull(aVariant);
+
+     com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
+
+     rc =  CloneTo(aTarget, ComSafeArrayAsInParam(variants), NULL, aProgress);
      return rc;
 }
 
 STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
-                             ULONG aVariant,
+                             ComSafeArrayIn(MediumVariant_T, aVariant),
                              IMedium *aParent,
                              IProgress **aProgress)
@@ -2711,4 +2746,6 @@
     CheckComArgNotNull(aTarget);
     CheckComArgOutPointerValid(aProgress);
+    CheckComArgSafeArrayNotNull(aVariant);
+
     ComAssertRet(aTarget != this, E_INVALIDARG);
 
@@ -2808,7 +2845,16 @@
         }
 
+        ULONG mediumVariantFlags = 0;
+
+        if (aVariant)
+        {
+            com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
+            for (size_t i = 0; i < variants.size(); i++)
+                mediumVariantFlags |= variants[i];
+        }
+
         /* setup task object to carry out the operation asynchronously */
         pTask = new Medium::CloneTask(this, pProgress, pTarget,
-                                      (MediumVariant_T)aVariant,
+                                      (MediumVariant_T)mediumVariantFlags,
                                       pParent, UINT32_MAX, UINT32_MAX,
                                       pSourceMediumLockList, pTargetMediumLockList);
