Skip to content

Commit

Permalink
fixup! http: support lazy-loading libcurl also on Windows
Browse files Browse the repository at this point in the history
Allow `libcurl-4.dll` to be located in a path containing non-ASCII
characters.

This fixes git-for-windows#4573.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Aug 28, 2023
1 parent b295827 commit 55a4fd4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compat/lazyload-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ static void *load_library(const char *name)
memcpy(dll_path + len + 1, name, name_size);

if (!access(dll_path, R_OK)) {
void *res = (void *)LoadLibraryExA(dll_path, NULL, 0);
wchar_t wpath[MAX_PATH];
int wlen = MultiByteToWideChar(CP_UTF8, 0, dll_path, -1, wpath, ARRAY_SIZE(wpath));
void *res = wlen ? (void *)LoadLibraryExW(wpath, NULL, 0) : NULL;
if (!res) {
DWORD err = GetLastError();
char buf[1024];
Expand Down

0 comments on commit 55a4fd4

Please sign in to comment.