diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-03 02:21:17 -0700 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-10-20 05:50:20 -0700 |
| commit | 307712613b77e8290a2c5d08ef3ae81c1e3139f3 (patch) | |
| tree | 0aafd1c38d7cd146021e0f82c0061249ad5e7268 /src/win32 | |
| parent | b8bdffb55b4b249ab445d420038a1a97a8dcab5e (diff) | |
| download | libgit2-307712613b77e8290a2c5d08ef3ae81c1e3139f3.tar.gz | |
win32: use GetFinalPathNameByHandle directly
Now that we've updated to WIN32_WINNT version of Vista or better, we
don't need to dynamically load GetFinalPathNameByHandle and can simply
invoke it directly.
Diffstat (limited to 'src/win32')
| -rw-r--r-- | src/win32/posix_w32.c | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index 8617e45e9..1b7b9392f 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -35,9 +35,6 @@ */ #define WIN32_MODE_MASK (_S_IREAD | _S_IWRITE) -/* GetFinalPathNameByHandleW signature */ -typedef DWORD(WINAPI *PFGetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD, DWORD); - unsigned long git_win32__createfile_sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE; int git_win32__retries = 10; @@ -598,40 +595,13 @@ int p_getcwd(char *buffer_out, size_t size) return 0; } -/* - * Returns the address of the GetFinalPathNameByHandleW function. - * This function is available on Windows Vista and higher. - */ -static PFGetFinalPathNameByHandleW get_fpnbyhandle(void) -{ - static PFGetFinalPathNameByHandleW pFunc = NULL; - PFGetFinalPathNameByHandleW toReturn = pFunc; - - if (!toReturn) { - HMODULE hModule = GetModuleHandleW(L"kernel32"); - - if (hModule) - toReturn = (PFGetFinalPathNameByHandleW)GetProcAddress(hModule, "GetFinalPathNameByHandleW"); - - pFunc = toReturn; - } - - assert(toReturn); - - return toReturn; -} - static int getfinalpath_w( git_win32_path dest, const wchar_t *path) { - PFGetFinalPathNameByHandleW pgfp = get_fpnbyhandle(); HANDLE hFile; DWORD dwChars; - if (!pgfp) - return -1; - /* Use FILE_FLAG_BACKUP_SEMANTICS so we can open a directory. Do not * specify FILE_FLAG_OPEN_REPARSE_POINT; we want to open a handle to the * target of the link. */ @@ -642,7 +612,7 @@ static int getfinalpath_w( return -1; /* Call GetFinalPathNameByHandle */ - dwChars = pgfp(hFile, dest, GIT_WIN_PATH_UTF16, FILE_NAME_NORMALIZED); + dwChars = GetFinalPathNameByHandleW(hFile, dest, GIT_WIN_PATH_UTF16, FILE_NAME_NORMALIZED); CloseHandle(hFile); if (!dwChars || dwChars >= GIT_WIN_PATH_UTF16) |
