[SETUPLIB] Introduce and use a UnMapAndCloseFile() macro that calls UnMapFile() and...
[reactos.git] / base / setup / lib / osdetect.c
index 928b6a7..a82b04c 100644 (file)
@@ -284,7 +284,7 @@ CheckForValidPEAndVendor(
     {
         DPRINT1("File '%S' does not seem to be a valid PE, bail out\n", PathNameToFile);
         Status = STATUS_INVALID_IMAGE_FORMAT;
-        goto UnmapFile;
+        goto UnmapCloseFile;
     }
 
     /*
@@ -295,7 +295,7 @@ CheckForValidPEAndVendor(
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("Failed to get version resource for file '%S', Status 0x%08lx\n", PathNameToFile, Status);
-        goto UnmapFile;
+        goto UnmapCloseFile;
     }
 
     Status = NtVerQueryValue(VersionBuffer, L"\\VarFileInfo\\Translation", &pvData, &BufLen);
@@ -333,10 +333,9 @@ CheckForValidPEAndVendor(
     if (!NT_SUCCESS(Status))
         DPRINT1("No version vendor found for file '%S'\n", PathNameToFile);
 
-UnmapFile:
+UnmapCloseFile:
     /* Finally, unmap and close the file */
-    UnMapFile(SectionHandle, ViewBase);
-    NtClose(FileHandle);
+    UnMapAndCloseFile(FileHandle, SectionHandle, ViewBase);
 
     return Success;
 }