[SETUPLIB][USETUP] Refactor the DoesFileExist() function so that it now looks closer to DoesPathExist() and use it almost everywhere.

- Adjust also its callers, adjust OpenAndMapFile() parameters.
- Related to that, simplify IsValidNTOSInstallation() parameters & introduce a IsValidNTOSInstallation_UStr()
  that does the same, but takes a UNICODE_STRING instead.
- Simplify CheckForValidPEAndVendor().

Now only exactly 5 calls use the "old" 'DoesFileExist' syntax, using a temporarily auxiliary function "DoesFileExist_2"...

svn path=/branches/setup_improvements/; revision=74641
This commit is contained in:
Hermès Bélusca-Maïto 2017-05-24 16:37:49 +00:00
parent d27ef70aab
commit b53b7b11e3
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
5 changed files with 110 additions and 119 deletions

View file

@ -51,6 +51,11 @@ DoesPathExist(
BOOLEAN
DoesFileExist(
IN HANDLE RootDirectory OPTIONAL,
IN PCWSTR PathNameToFile);
// FIXME: DEPRECATED! HACKish function that needs to be deprecated!
BOOLEAN
DoesFileExist_2(
IN PCWSTR PathName OPTIONAL,
IN PCWSTR FileName);
@ -64,8 +69,7 @@ NtPathToDiskPartComponents(
NTSTATUS
OpenAndMapFile(
IN HANDLE RootDirectory OPTIONAL,
IN PCWSTR PathName OPTIONAL,
IN PCWSTR FileName, // OPTIONAL
IN PCWSTR PathNameToFile,
OUT PHANDLE FileHandle, // IN OUT PHANDLE OPTIONAL
OUT PHANDLE SectionHandle,
OUT PVOID* BaseAddress,