Index: /trunk/src/VBox/Storage/VD.cpp
===================================================================
--- /trunk/src/VBox/Storage/VD.cpp	(revision 85940)
+++ /trunk/src/VBox/Storage/VD.cpp	(revision 85941)
@@ -6226,4 +6226,12 @@
         /* sanity check */
         AssertPtrBreakStmt(pDisk, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pszBackend, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pszFilename, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pPCHSGeometry, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pLCHSGeometry, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pUuid, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pVDIfsImage, rc = VERR_INVALID_PARAMETER);
+        AssertPtrBreakStmt(pVDIfsOperation, rc = VERR_INVALID_PARAMETER);
+
         AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature));
 
@@ -6235,8 +6243,8 @@
                            ("pszFilename=%#p \"%s\"\n", pszFilename, pszFilename),
                            rc = VERR_INVALID_PARAMETER);
-        AssertMsgBreakStmt(cbSize,
+        AssertMsgBreakStmt(cbSize || (uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK),
                            ("cbSize=%llu\n", cbSize),
                            rc = VERR_INVALID_PARAMETER);
-        if (cbSize % 512)
+        if (cbSize % 512 && !(uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK))
         {
             rc = vdError(pDisk, VERR_VD_INVALID_SIZE, RT_SRC_POS,
@@ -6248,6 +6256,10 @@
                            ("uImageFlags=%#x\n", uImageFlags),
                            rc = VERR_INVALID_PARAMETER);
+        AssertMsgBreakStmt(   !(uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK)
+                           || !(uImageFlags & ~(VD_VMDK_IMAGE_FLAGS_RAWDISK | VD_IMAGE_FLAGS_FIXED)),
+                           ("uImageFlags=%#x\n", uImageFlags),
+                           rc = VERR_INVALID_PARAMETER);
         /* The PCHS geometry fields may be 0 to leave it for later. */
-        AssertMsgBreakStmt(   VALID_PTR(pPCHSGeometry)
+        AssertMsgBreakStmt(   VALID_PTR(pPCHSGeometry) /** @todo r=bird: will crash in assert message formatting if invalid. duh. */
                            && pPCHSGeometry->cHeads <= 16
                            && pPCHSGeometry->cSectors <= 63,
@@ -6257,5 +6269,5 @@
                            rc = VERR_INVALID_PARAMETER);
         /* The LCHS geometry fields may be 0 to leave it to later autodetection. */
-        AssertMsgBreakStmt(   VALID_PTR(pLCHSGeometry)
+        AssertMsgBreakStmt(   VALID_PTR(pLCHSGeometry) /** @todo r=bird: will crash in assert message formatting if invalid. duh. */
                            && pLCHSGeometry->cHeads <= 255
                            && pLCHSGeometry->cSectors <= 63,
@@ -6336,5 +6348,6 @@
         if (   (   (uImageFlags & VD_VMDK_IMAGE_FLAGS_SPLIT_2G)
                 && !(pImage->Backend->uBackendCaps & VD_CAP_CREATE_SPLIT_2G))
-            || (   (uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED)
+            || (   (uImageFlags & (  VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED
+                                   | VD_VMDK_IMAGE_FLAGS_RAWDISK))
                 && RTStrICmp(pszBackend, "VMDK")))
         {
Index: /trunk/src/VBox/Storage/testcase/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Storage/testcase/Makefile.kmk	(revision 85940)
+++ /trunk/src/VBox/Storage/testcase/Makefile.kmk	(revision 85941)
@@ -111,4 +111,6 @@
  vbox-img_TEMPLATE = VBoxR3Static
  vbox-img_DEFS += IN_VBOXDDU IN_VBOXDDU_STATIC VBOX_HDD_NO_DYNAMIC_BACKENDS
+ vbox-img_INCS += \
+	../../Main/include
  vbox-img_SOURCES = \
 	vbox-img.cpp \
