mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[SETUPLIB] Introduce and use a UnMapAndCloseFile() macro that calls UnMapFile() and NtClose() on handles returned by the OpenAndMapFile() function.
svn path=/branches/setup_improvements/; revision=75651 svn path=/branches/setup_improvements/; revision=75657
This commit is contained in:
parent
29fe31df1b
commit
a80f803a2a
5 changed files with 18 additions and 12 deletions
|
@ -461,8 +461,9 @@ OpenIniBootLoaderStore(
|
|||
DPRINT1("IniCacheLoadFromMemory() failed (Status 0x%08lx)\n", Status);
|
||||
|
||||
/* Finally, unmap and close the file */
|
||||
UnMapFile(BootStore->SectionHandle, BootStore->ViewBase);
|
||||
NtClose(BootStore->FileHandle);
|
||||
UnMapAndCloseFile(BootStore->FileHandle,
|
||||
BootStore->SectionHandle,
|
||||
BootStore->ViewBase);
|
||||
|
||||
RtlFreeHeap(ProcessHeap, 0, BootStore);
|
||||
return Status;
|
||||
|
@ -715,8 +716,9 @@ Quit:
|
|||
if (BootStore->SectionHandle)
|
||||
{
|
||||
/* Finally, unmap and close the file */
|
||||
UnMapFile(BootStore->SectionHandle, BootStore->ViewBase);
|
||||
NtClose(BootStore->FileHandle);
|
||||
UnMapAndCloseFile(BootStore->FileHandle,
|
||||
BootStore->SectionHandle,
|
||||
BootStore->ViewBase);
|
||||
}
|
||||
else // if (BootStore->FileHandle)
|
||||
{
|
||||
|
|
|
@ -100,4 +100,10 @@ UnMapFile(
|
|||
IN HANDLE SectionHandle,
|
||||
IN PVOID BaseAddress);
|
||||
|
||||
#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress) \
|
||||
do { \
|
||||
UnMapFile((SectionHandle), (BaseAddress)); \
|
||||
NtClose(FileHandle); \
|
||||
} while (0)
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -841,7 +841,7 @@ SetDiskSignature(
|
|||
continue;
|
||||
}
|
||||
|
||||
/* check if the signature already exist */
|
||||
/* Check if the signature already exist */
|
||||
/* FIXME:
|
||||
* Check also signatures from disks, which are
|
||||
* not visible (bootable) by the bios.
|
||||
|
|
|
@ -373,8 +373,7 @@ Quit:
|
|||
}
|
||||
|
||||
/* Finally, unmap and close the file */
|
||||
UnMapFile(SectionHandle, ViewBase);
|
||||
NtClose(UnattendFileHandle);
|
||||
UnMapAndCloseFile(UnattendFileHandle, SectionHandle, ViewBase);
|
||||
|
||||
NtClose(FileHandle);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue