Index: /trunk/include/VBox/com/string.h
===================================================================
--- /trunk/include/VBox/com/string.h	(revision 31280)
+++ /trunk/include/VBox/com/string.h	(revision 31281)
@@ -321,7 +321,7 @@
 
     /**
-     *  Static immutable null object. May be used for comparison purposes.
-     */
-    static const Bstr Null;
+     *  Static immutable empty-string object. May be used for comparison purposes.
+     */
+    static const Bstr Empty;
 
 protected:
@@ -546,7 +546,7 @@
 
     /**
-     *  Static immutable null object. May be used for comparison purposes.
-     */
-    static const Utf8Str Null;
+     *  Static immutable empty-string object. May be used for comparison purposes.
+     */
+    static const Utf8Str Empty;
 
 protected:
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 31280)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 31281)
@@ -3216,5 +3216,5 @@
                 {
                     /* find a DVD image by UUID */
-                    rc = mParent->findDVDImage(&uuid, NULL, true /* aSetError */, &medium);
+                    rc = mParent->findDVDOrFloppyImage(DeviceType_DVD, &uuid, Utf8Str::Empty, true /* aSetError */, &medium);
                     if (FAILED(rc)) return rc;
                 }
@@ -3249,5 +3249,5 @@
                 {
                     /* find a floppy image by UUID */
-                    rc = mParent->findFloppyImage(&uuid, NULL, true /* aSetError */, &medium);
+                    rc = mParent->findDVDOrFloppyImage(DeviceType_Floppy, &uuid, Utf8Str::Empty, true /* aSetError */, &medium);
                     if (FAILED(rc)) return rc;
                 }
@@ -3693,13 +3693,16 @@
     {
         case DeviceType_DVD:
+        case DeviceType_Floppy:
             if (!uuid.isEmpty())
             {
-                /* find a DVD by host device UUID */
-                MediaList llHostDVDDrives;
-                rc = mParent->host()->getDVDDrives(llHostDVDDrives);
+                // check if the UUID refers to a host DVD or floppy drive
+                MediaList llHostDrives;
+                rc = (mediumType == DeviceType_DVD)
+                        ? mParent->host()->getDVDDrives(llHostDrives)
+                        : mParent->host()->getFloppyDrives(llHostDrives);
                 if (SUCCEEDED(rc))
                 {
-                    for (MediaList::iterator it = llHostDVDDrives.begin();
-                         it != llHostDVDDrives.end();
+                    for (MediaList::iterator it = llHostDrives.begin();
+                         it != llHostDrives.end();
                          ++it)
                     {
@@ -3712,36 +3715,12 @@
                     }
                 }
-                /* find a DVD by UUID */
+
                 if (medium.isNull())
-                    rc = mParent->findDVDImage(&uuid, NULL, true /* aDoSetError */, &medium);
+                    // UUID was not a host drive:
+                    rc = mParent->findDVDOrFloppyImage(mediumType, &uuid, Utf8Str::Empty, true /* aDoSetError */, &medium);
             }
             if (FAILED(rc)) return rc;
-            break;
-        case DeviceType_Floppy:
-            if (!uuid.isEmpty())
-            {
-                /* find a Floppy by host device UUID */
-                MediaList llHostFloppyDrives;
-                rc = mParent->host()->getFloppyDrives(llHostFloppyDrives);
-                if (SUCCEEDED(rc))
-                {
-                    for (MediaList::iterator it = llHostFloppyDrives.begin();
-                         it != llHostFloppyDrives.end();
-                         ++it)
-                    {
-                        ComObjPtr<Medium> &p = *it;
-                        if (uuid == p->getId())
-                        {
-                            medium = p;
-                            break;
-                        }
-                    }
-                }
-                /* find a Floppy by UUID */
-                if (medium.isNull())
-                    rc = mParent->findFloppyImage(&uuid, NULL, true /* aDoSetError */, &medium);
-            }
-            if (FAILED(rc)) return rc;
-            break;
+        break;
+
         default:
             return setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -7168,5 +7147,5 @@
                 /* find a floppy by UUID */
                 if (!dev.uuid.isEmpty())
-                    rc = mParent->findFloppyImage(&dev.uuid, NULL, true /* aDoSetError */, &medium);
+                    rc = mParent->findDVDOrFloppyImage(DeviceType_Floppy, &dev.uuid, Utf8Str::Empty, true /* aDoSetError */, &medium);
                 /* find a floppy by host device name */
                 else if (!dev.strHostDriveSrc.isEmpty())
@@ -7194,5 +7173,5 @@
                 /* find a DVD by UUID */
                 if (!dev.uuid.isEmpty())
-                    rc = mParent->findDVDImage(&dev.uuid, NULL, true /* aDoSetError */, &medium);
+                    rc = mParent->findDVDOrFloppyImage(DeviceType_DVD, &dev.uuid, Utf8Str::Empty, true /* aDoSetError */, &medium);
                 /* find a DVD by host device name */
                 else if (!dev.strHostDriveSrc.isEmpty())
Index: /trunk/src/VBox/Main/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MediumImpl.cpp	(revision 31280)
+++ /trunk/src/VBox/Main/MediumImpl.cpp	(revision 31281)
@@ -4850,5 +4850,5 @@
              ++it)
         {
-            m->properties.insert(std::make_pair(it->name, Bstr::Null));
+            m->properties.insert(std::make_pair(it->name, Bstr::Empty));
         }
     }
Index: /trunk/src/VBox/Main/SystemPropertiesImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SystemPropertiesImpl.cpp	(revision 31280)
+++ /trunk/src/VBox/Main/SystemPropertiesImpl.cpp	(revision 31281)
@@ -84,9 +84,9 @@
     unconst(mParent) = aParent;
 
-    setDefaultMachineFolder(Utf8Str::Null);
-    setDefaultHardDiskFolder(Utf8Str::Null);
-    setDefaultHardDiskFormat(Utf8Str::Null);
-
-    setRemoteDisplayAuthLibrary(Utf8Str::Null);
+    setDefaultMachineFolder(Utf8Str::Empty);
+    setDefaultHardDiskFolder(Utf8Str::Empty);
+    setDefaultHardDiskFormat(Utf8Str::Empty);
+
+    setRemoteDisplayAuthLibrary(Utf8Str::Empty);
 
     m->ulLogHistoryCount = 3;
Index: /trunk/src/VBox/Main/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 31280)
+++ /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 31281)
@@ -1551,5 +1551,5 @@
     Guid id(aId);
     ComObjPtr<Medium> image;
-    HRESULT rc = findDVDImage(&id, NULL, true /* setError */, &image);
+    HRESULT rc = findDVDOrFloppyImage(DeviceType_DVD, &id, Utf8Str::Empty, true /* setError */, &image);
 
     /* the below will set *aDVDImage to NULL if image is null */
@@ -1569,5 +1569,5 @@
 
     ComObjPtr<Medium> image;
-    HRESULT rc = findDVDImage(NULL, aLocation, true /* setError */, &image);
+    HRESULT rc = findDVDOrFloppyImage(DeviceType_DVD, NULL, aLocation, true /* setError */, &image);
 
     /* the below will set *aDVDImage to NULL if dvd is null */
@@ -1628,5 +1628,5 @@
     Guid id(aId);
     ComObjPtr<Medium> image;
-    HRESULT rc = findFloppyImage(&id, NULL, true /* setError */, &image);
+    HRESULT rc = findDVDOrFloppyImage(DeviceType_Floppy, &id, Utf8Str::Empty, true /* setError */, &image);
 
     /* the below will set *aFloppyImage to NULL if image is null */
@@ -1647,5 +1647,5 @@
 
     ComObjPtr<Medium> image;
-    HRESULT rc = findFloppyImage(NULL, aLocation, true /* setError */, &image);
+    HRESULT rc = findDVDOrFloppyImage(DeviceType_Floppy, NULL, aLocation, true /* setError */, &image);
 
     /* the below will set *aFloppyImage to NULL if img is null */
@@ -2755,8 +2755,10 @@
 /**
  * Searches for a Medium object with the given ID or location in the list of
- * registered DVD images. If both ID and file path are specified, the first
- * object that matches either of them (not necessarily both) is returned.
- *
- * @param aId       ID of the DVD image (unused when NULL).
+ * registered DVD or floppy images, depending on the @a mediumType argument.
+ * If both ID and file path are specified, the first object that matches either
+ * of them (not necessarily both) is returned.
+ *
+ * @param mediumType Must be either DeviceType_DVD or DeviceType_Floppy.
+ * @param aId       ID of the image file (unused when NULL).
  * @param aLocation Full path to the image file (unused when NULL).
  * @param aSetError If @c true, the appropriate error info is set in case when
@@ -2764,47 +2766,83 @@
  * @param aImage    Where to store the found image object (can be NULL).
  *
- * @return S_OK when found or E_INVALIDARG when not found.
+ * @return S_OK when found or E_INVALIDARG or VBOX_E_OBJECT_NOT_FOUND when not found.
  *
  * @note Locks the media tree for reading.
  */
-HRESULT VirtualBox::findDVDImage(const Guid *aId,
-                                 CBSTR aLocation,
-                                 bool aSetError,
-                                 ComObjPtr<Medium> *aImage /* = NULL */)
-{
-    AssertReturn(aId || aLocation, E_INVALIDARG);
+/**
+ *
+ * @param aId
+ * @param aLocation
+ * @param aSetError
+ * @param aImage
+ * @return
+ */
+HRESULT VirtualBox::findDVDOrFloppyImage(DeviceType_T mediumType,
+                                         const Guid *aId,
+                                         const Utf8Str &aLocation,
+                                         bool aSetError,
+                                         ComObjPtr<Medium> *aImage /* = NULL */)
+{
+    AssertReturn(aId || !aLocation.isEmpty(), E_INVALIDARG);
 
     Utf8Str location;
-
-    if (aLocation != NULL)
-    {
-        int vrc = calculateFullPath(Utf8Str(aLocation), location);
+    if (!aLocation.isEmpty())
+    {
+        int vrc = calculateFullPath(aLocation, location);
         if (RT_FAILURE(vrc))
             return setError(VBOX_E_FILE_ERROR,
                             tr("Invalid image file location '%ls' (%Rrc)"),
-                            aLocation,
+                            aLocation.c_str(),
                             vrc);
     }
 
-    AutoReadLock alock(m->allDVDImages.getLockHandle() COMMA_LOCKVAL_SRC_POS);
+    MediaOList *pMediaList;
+
+    switch (mediumType)
+    {
+        case DeviceType_DVD:
+            pMediaList = &m->allDVDImages;
+        break;
+
+        case DeviceType_Floppy:
+            pMediaList = &m->allFloppyImages;
+        break;
+
+        default:
+            return E_INVALIDARG;
+    }
+
+    AutoReadLock alock(pMediaList->getLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     bool found = false;
 
-    for (MediaList::const_iterator it = m->allDVDImages.begin();
-         it != m->allDVDImages.end();
-         ++ it)
-    {
-        /* no AutoCaller, registered image life time is bound to this */
-        AutoReadLock imageLock(*it COMMA_LOCKVAL_SRC_POS);
-
-        found = (aId && (*it)->getId() == *aId) ||
-                (aLocation != NULL &&
-                 RTPathCompare(location.c_str(),
-                               (*it)->getLocationFull().c_str()
-                              ) == 0);
+    for (MediaList::const_iterator it = pMediaList->begin();
+         it != pMediaList->end();
+         ++it)
+    {
+        // no AutoCaller, registered image life time is bound to this
+        Medium *pMedium = *it;
+        AutoReadLock imageLock(pMedium COMMA_LOCKVAL_SRC_POS);
+        const Utf8Str &strLocationFull = pMedium->getLocationFull();
+
+        found =     (    aId
+                      && pMedium->getId() == *aId)
+                 || (    !aLocation.isEmpty()
+                      && RTPathCompare(location.c_str(),
+                                       strLocationFull.c_str()) == 0);
         if (found)
         {
+            if (pMedium->getType() != mediumType)
+            {
+                if (mediumType == DeviceType_DVD)
+                    return setError(E_INVALIDARG,
+                                    "Cannot mount DVD medium '%s' as floppy", strLocationFull.c_str());
+                else
+                    return setError(E_INVALIDARG,
+                                    "Cannot mount floppy medium '%s' as DVD", strLocationFull.c_str());
+            }
+
             if (aImage)
-                *aImage = *it;
+                *aImage = pMedium;
             break;
         }
@@ -2817,88 +2855,11 @@
         if (aId)
             setError(rc,
-                     tr("Could not find a CD/DVD image with UUID {%RTuuid} in the media registry ('%s')"),
+                     tr("Could not find an image file with UUID {%RTuuid} in the media registry ('%s')"),
                      aId->raw(),
                      m->strSettingsFilePath.raw());
         else
             setError(rc,
-                     tr("Could not find a CD/DVD image with location '%ls' in the media registry ('%s')"),
-                     aLocation,
-                     m->strSettingsFilePath.raw());
-    }
-
-    return rc;
-}
-
-/**
- * Searches for a Medium object with the given ID or location in the
- * collection of registered DVD images. If both ID and file path are specified,
- * the first object that matches either of them (not necessarily both) is
- * returned.
- *
- * @param aId       ID of the DVD image (unused when NULL).
- * @param aLocation Full path to the image file (unused when NULL).
- * @param aSetError If @c true, the appropriate error info is set in case when
- *                  the image is not found.
- * @param aImage    Where to store the found image object (can be NULL).
- *
- * @return S_OK when found or E_INVALIDARG when not found.
- *
- * @note Locks the media tree for reading.
- */
-HRESULT VirtualBox::findFloppyImage(const Guid *aId,
-                                    CBSTR aLocation,
-                                    bool aSetError,
-                                    ComObjPtr<Medium> *aImage /* = NULL */)
-{
-    AssertReturn(aId || aLocation, E_INVALIDARG);
-
-    Utf8Str location;
-
-    if (aLocation != NULL)
-    {
-        int vrc = calculateFullPath(Utf8Str(aLocation), location);
-        if (RT_FAILURE(vrc))
-            return setError(VBOX_E_FILE_ERROR,
-                            tr("Invalid image file location '%ls' (%Rrc)"),
-                            aLocation, vrc);
-    }
-
-    AutoReadLock alock(m->allFloppyImages.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-
-    bool found = false;
-
-    for (MediaList::const_iterator it = m->allFloppyImages.begin();
-         it != m->allFloppyImages.end();
-         ++ it)
-    {
-        /* no AutoCaller, registered image life time is bound to this */
-        AutoReadLock imageLock(*it COMMA_LOCKVAL_SRC_POS);
-
-        found = (aId && (*it)->getId() == *aId) ||
-                (aLocation != NULL &&
-                 RTPathCompare(location.c_str(),
-                               (*it)->getLocationFull().c_str()
-                              ) == 0);
-        if (found)
-        {
-            if (aImage)
-                *aImage = *it;
-            break;
-        }
-    }
-
-    HRESULT rc = found ? S_OK : VBOX_E_OBJECT_NOT_FOUND;
-
-    if (aSetError && !found)
-    {
-        if (aId)
-            setError(rc,
-                     tr("Could not find a floppy image with UUID {%RTuuid} in the media registry ('%s')"),
-                     aId->raw(),
-                     m->strSettingsFilePath.raw());
-        else
-            setError(rc,
-                     tr("Could not find a floppy image with location '%ls' in the media registry ('%s')"),
-                     aLocation,
+                     tr("Could not find an image file with location '%ls' in the media registry ('%s')"),
+                     aLocation.c_str(),
                      m->strSettingsFilePath.raw());
     }
@@ -3090,5 +3051,5 @@
     {
         ComObjPtr<Medium> image;
-        rc = findDVDImage(&aId, bstrLocation, false /* aSetError */, &image);
+        rc = findDVDOrFloppyImage(DeviceType_DVD, &aId, bstrLocation, false /* aSetError */, &image);
         if (SUCCEEDED(rc))
         {
@@ -3104,5 +3065,5 @@
     {
         ComObjPtr<Medium> image;
-        rc = findFloppyImage(&aId, bstrLocation, false /* aSetError */, &image);
+        rc = findDVDOrFloppyImage(DeviceType_Floppy, &aId, bstrLocation, false /* aSetError */, &image);
         if (SUCCEEDED(rc))
         {
Index: /trunk/src/VBox/Main/glue/string.cpp
===================================================================
--- /trunk/src/VBox/Main/glue/string.cpp	(revision 31280)
+++ /trunk/src/VBox/Main/glue/string.cpp	(revision 31281)
@@ -34,8 +34,8 @@
 
 /* static */
-const Bstr Bstr::Null; /* default ctor is OK */
+const Bstr Bstr::Empty; /* default ctor is OK */
 
 /* static */
-const Utf8Str Utf8Str::Null; /* default ctor is OK */
+const Utf8Str Utf8Str::Empty; /* default ctor is OK */
 
 #if defined (VBOX_WITH_XPCOM)
Index: /trunk/src/VBox/Main/include/VirtualBoxImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 31280)
+++ /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 31281)
@@ -223,8 +223,9 @@
     HRESULT findHardDisk(const Guid *aId, CBSTR aLocation,
                           bool aSetError, ComObjPtr<Medium> *aHardDisk = NULL);
-    HRESULT findDVDImage(const Guid *aId, CBSTR aLocation,
-                         bool aSetError, ComObjPtr<Medium> *aImage = NULL);
-    HRESULT findFloppyImage(const Guid *aId, CBSTR aLocation,
-                            bool aSetError, ComObjPtr<Medium> *aImage = NULL);
+    HRESULT findDVDOrFloppyImage(DeviceType_T mediumType,
+                                 const Guid *aId,
+                                 const Utf8Str &aLocation,
+                                 bool aSetError,
+                                 ComObjPtr<Medium> *aImage = NULL);
 
     HRESULT findGuestOSType(const Bstr &bstrOSType,
