Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 357)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 358)
@@ -1188,8 +1188,11 @@
         {
             Bstr loc;
-            hdd->COMGETTER(Location)(loc.asOutParam());
+            hdd->COMGETTER(Location) (loc.asOutParam());
+            Bstr errMsg;
+            hdd->COMGETTER(LastAccessError) (errMsg.asOutParam());
             return setError (E_FAIL,
-                tr ("VM cannot start because the hard disk '%ls' is not accessible"),
-                loc.raw());
+                tr ("VM cannot start because the hard disk '%ls' is not accessible "
+                    "(%ls)"),
+                loc.raw(), errMsg.raw());
         }
     }
@@ -1209,4 +1212,6 @@
             Bstr filePath;
             dvdImage->COMGETTER(FilePath)(filePath.asOutParam());
+            /// @todo (r=dmik) grab the last access error once
+            //  IDVDImage::lastAccessError is there
             return setError (E_FAIL,
                 tr ("VM cannot start because the DVD image '%ls' is not accessible"),
@@ -1229,4 +1234,6 @@
             Bstr filePath;
             floppyImage->COMGETTER(FilePath)(filePath.asOutParam());
+            /// @todo (r=dmik) grab the last access error once
+            //  IDVDImage::lastAccessError is there
             return setError (E_FAIL,
                 tr ("VM cannot start because the floppy image '%ls' is not accessible"),
Index: /trunk/src/VBox/Main/HardDiskImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/HardDiskImpl.cpp	(revision 357)
+++ /trunk/src/VBox/Main/HardDiskImpl.cpp	(revision 358)
@@ -1265,4 +1265,6 @@
         CheckComRCBreakRC (rc);
 
+        Assert (mId.isEmpty());
+        
         if (aFilePath && *aFilePath)
         {
@@ -1273,5 +1275,17 @@
              * it is the only way to get the UUID of the existing VDI and
              * initialize the vital mId property. */
-            rc = queryInformation (NULL);
+            Bstr errMsg;
+            rc = queryInformation (&errMsg);
+            if (SUCCEEDED (rc))
+            {
+                /* We are constructing a new HVirtualDiskImage object. If there
+                 * is a fatal accessibility error (we cannot read image UUID),
+                 * we have to fail. We do so even on non-fatal errors as well,
+                 * because it's not worth to keep going with the inaccessible
+                 * image from the very beginning (when nothing else depends on
+                 * it yet). */
+                if (!errMsg.isNull())
+                    rc = setErrorBstr (E_FAIL, errMsg);
+            }
         }
         else
@@ -1556,8 +1570,4 @@
     {
         return queryInformation (&aAccessError);
-        /* if we fail here, this means something like UUID mismatch.
-         * Do nothing, just return the failure (error info is already
-         * set by queryInformation()), in hope that one of subsequent
-         * attempts to check for acessibility will succeed */
     }
 
@@ -2204,4 +2214,5 @@
 
     Utf8Str filePath = mFilePathFull;
+    Bstr errMsg;
 
     do
@@ -2213,14 +2224,5 @@
 
         if (VBOX_FAILURE (vrc))
-        {
-            /* mId is empty only when constructing a HVirtualDiskImage object
-             * from an existing file image which UUID is not known. If we can't
-             * read it, we have to fail. */
-            if (mId.isEmpty())
-                rc = setError (E_FAIL,
-                    tr ("Could not open the hard disk image '%s' (%Vrc)"),
-                    filePath.raw(), vrc);
             break;
-        }
 
         if (!mId.isEmpty())
@@ -2229,5 +2231,5 @@
             if (mId != id)
             {
-                rc = setError (E_FAIL,
+                errMsg = Utf8StrFmt (
                     tr ("Actual UUID {%Vuuid} of the hard disk image '%s' doesn't "
                         "match UUID {%Vuuid} stored in the registry"),
@@ -2248,5 +2250,5 @@
             if (mParent->id() != parentId)
             {
-                rc = setError (E_FAIL,
+                errMsg = Utf8StrFmt (
                     tr ("UUID {%Vuuid} of the parent image '%ls' stored in "
                         "the hard disk image file '%s' doesn't match "
@@ -2259,5 +2261,5 @@
         else if (!parentId.isEmpty())
         {
-            rc = setError (E_FAIL,
+            errMsg = Utf8StrFmt (
                 tr ("Hard disk image '%s' is a differencing image and "
                     "cannot be opened directly"),
@@ -2308,15 +2310,20 @@
     clearBusy();
     
-    if (VBOX_FAILURE (vrc) || FAILED (rc))
-    {
-        Log (("HVirtualDiskImage::queryInformation(): "
-              "WARNING: '%ls' is not accessible (%Vrc) (rc=%08X)\n",
-              mFilePathFull.raw(), vrc, rc));
-
-        if (VBOX_FAILURE (vrc) && aAccessError)
-            *aAccessError =
-                Utf8StrFmt ("Error accessing hard disk image '%ls' (%Vrc)",
-                            mFilePathFull.raw(), vrc);
-
+    if (FAILED (rc) || VBOX_FAILURE (vrc) || !errMsg.isNull())
+    {
+        LogWarningFunc (("'%ls' is not accessible "
+                         "(rc=%08X, vrc=%Vrc, errMsg='%ls')\n",
+                         mFilePathFull.raw(), rc, vrc, errMsg.raw()));
+
+        if (aAccessError)
+        {
+            if (!errMsg.isNull())
+                *aAccessError = errMsg;
+            else if (VBOX_FAILURE (vrc))
+                *aAccessError = Utf8StrFmt (
+                    tr ("Could not access hard disk image '%ls' (%Vrc)"),
+                        mFilePathFull.raw(), vrc);
+        }
+        
         /* downgrade to not accessible */
         mState = Created;
@@ -2537,7 +2544,14 @@
         task->vdi->mState = HVirtualDiskImage::Created;
         /* update VDI data fields */
-        rc = task->vdi->queryInformation (NULL);
-        /* complete the progress object */
-        task->progress->notifyComplete (rc);
+        Bstr errMsg;
+        rc = task->vdi->queryInformation (&errMsg);
+        /* we want to deliver the access check result to the caller
+         * immediately, before he calls HardDisk::GetAccssible() himself. */
+        if (SUCCEEDED (rc) && !errMsg.isNull())
+            task->progress->notifyCompleteBstr (
+                E_FAIL, COM_IIDOF (IVirtualDiskImage), getComponentName(),
+                errMsg);
+        else
+            task->progress->notifyComplete (rc);
     }
     else
