[NTOS:MM] PeFmtCreateSection(): Improve AMD64 image failure case
[reactos.git] / ntoskrnl / mm / section.c
index a8d2945..69ffe53 100644 (file)
@@ -358,18 +358,17 @@ l_ReadHeaderFromFile:
 
     switch(piohOptHeader->Magic)
     {
-    case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
-#ifdef _WIN64
-    case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
-#endif // _WIN64
-        break;
-
+        case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
 #ifndef _WIN64
-    case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
-        nStatus = STATUS_INVALID_IMAGE_WIN_64;
+            nStatus = STATUS_INVALID_IMAGE_WIN_64;
+            DIE(("Win64 optional header, unsupported\n"));
+#else
+            // Fall through.
 #endif
-    default:
-        DIE(("Unrecognized optional header, Magic is %X\n", piohOptHeader->Magic));
+        case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
+            break;
+        default:
+            DIE(("Unrecognized optional header, Magic is %X\n", piohOptHeader->Magic));
     }
 
     if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SectionAlignment) &&