[misc] try to support folks who use a symlink for their temp dir

* Microsoft's WIM mounting APIs can't use symlinked directories and
  some folks want to use a symlinked temp dir...
* Closes #2084
This commit is contained in:
Pete Batard 2023-06-05 14:08:25 +01:00
parent 71e99add76
commit 3e81b38c2d
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 42 additions and 6 deletions

View file

@ -724,6 +724,21 @@ static __inline DWORD GetModuleFileNameExU(HANDLE hProcess, HMODULE hModule, cha
return ret;
}
static __inline DWORD GetFinalPathNameByHandleU(HANDLE hFile, char* lpszFilePath, DWORD cchFilePath, DWORD dwFlags)
{
DWORD ret = 0, err = ERROR_INVALID_DATA;
walloc(lpszFilePath, cchFilePath);
ret = GetFinalPathNameByHandleW(hFile, wlpszFilePath, cchFilePath, dwFlags);
err = GetLastError();
if ((ret != 0)
&& ((ret = wchar_to_utf8_no_alloc(wlpszFilePath, lpszFilePath, cchFilePath)) == 0)) {
err = GetLastError();
}
wfree(lpszFilePath);
SetLastError(err);
return ret;
}
static __inline DWORD GetFileVersionInfoSizeU(const char* lpFileName, LPDWORD lpdwHandle)
{
DWORD ret = 0, err = ERROR_INVALID_DATA;