Index: /trunk/include/VBox/VBoxHDD.h
===================================================================
--- /trunk/include/VBox/VBoxHDD.h	(revision 31184)
+++ /trunk/include/VBox/VBoxHDD.h	(revision 31185)
@@ -467,7 +467,9 @@
 
 /** Open the storage readonly. */
-#define VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY RT_BIT(0)
+#define VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY  RT_BIT(0)
 /** Create the storage backend if it doesn't exist. */
-#define VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE RT_BIT(1)
+#define VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE    RT_BIT(1)
+/** Don't write lock the opened file. */
+#define VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK RT_BIT(2)
 
 /**
Index: /trunk/src/VBox/Devices/Storage/DrvVD.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvVD.cpp	(revision 31184)
+++ /trunk/src/VBox/Devices/Storage/DrvVD.cpp	(revision 31185)
@@ -348,5 +348,9 @@
                                    : 0;
                 if (pThis->fShareable)
+                {
+                    Assert(fFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK);
+
                     fFlags |= PDMACEP_FILE_FLAGS_DONT_LOCK;
+                }
                 else
                     fFlags |= PDMACEP_FILE_FLAGS_CACHING;
Index: /trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/VBoxHDD.cpp	(revision 31184)
+++ /trunk/src/VBox/Devices/Storage/VBoxHDD.cpp	(revision 31185)
@@ -1612,4 +1612,5 @@
                 /* Set the state to growing. */
                 LogFlowFunc(("Disk is growing because of pIoCtx=%#p pIoCtxWrite=%#p\n",
+
                              pIoCtx, pIoCtxWrite));
                 ASMAtomicWriteBool(&pDisk->fGrowing, true);
@@ -1824,7 +1825,14 @@
 
     if (uOpenFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY)
-        fOpen |= RTFILE_O_READ      | RTFILE_O_DENY_NONE;
+        fOpen |= RTFILE_O_READ | RTFILE_O_DENY_NONE;
     else
-        fOpen |= RTFILE_O_READWRITE | RTFILE_O_DENY_WRITE;
+    {
+        fOpen |= RTFILE_O_READWRITE;
+
+        if (uOpenFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK)
+            fOpen |= RTFILE_O_DENY_NONE;
+        else
+            fOpen |= RTFILE_O_DENY_WRITE;
+    }
 
     if (uOpenFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE)
Index: /trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp	(revision 31184)
+++ /trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp	(revision 31185)
@@ -102,4 +102,7 @@
     if (fCreate)
         uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
+
+    if (fShareable)
+        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK;
 
     rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
Index: /trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp	(revision 31184)
+++ /trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp	(revision 31185)
@@ -284,4 +284,7 @@
     if (fCreate)
         uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
+
+    if (fShareable)
+        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK;
 
     rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
Index: /trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp	(revision 31184)
+++ /trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp	(revision 31185)
@@ -628,4 +628,6 @@
     if ((fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE)
         uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
+    if ((fOpen & RTFILE_O_DENY_MASK) == RTFILE_O_DENY_NONE)
+        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK;
 
     rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
@@ -2057,4 +2059,5 @@
     rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor,
                            VMDK_DDB_GEO_LCHS_HEADS,
+
                            pLCHSGeometry->cHeads);
     if (RT_FAILURE(rc))
@@ -2257,4 +2260,5 @@
         else
             return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
+
         if (pImage->pExtents[i].enmType == VMDKETYPE_ZERO)
         {
@@ -4066,4 +4070,5 @@
 
     if (RT_FAILURE(rc))
+
         goto out;
 
