* [PATCH 0/1] Load system libraries the recommended way on Windows
@ 2018-10-23 10:51 Johannes Schindelin via GitGitGadget
2018-10-23 10:51 ` [PATCH 1/1] mingw: load system libraries the recommended way Johannes Schindelin via GitGitGadget
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2018-10-23 10:51 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
The search order for DLLs on Windows is a bit funny, and for system
libraries, it is recommended to use a strict search path.
In practice, this should not make a difference, as the library has been
loaded into memory already, and therefore the LoadLibrary() call would just
return the handle instead of loading the library again.
Johannes Schindelin (1):
mingw: load system libraries the recommended way
compat/mingw.c | 3 ++-
contrib/credential/wincred/git-credential-wincred.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
base-commit: c4df23f7927d8d00e666a3c8d1b3375f1dc8a3c1
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-55%2Fdscho%2Fmingw-load-sys-dll-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-55/dscho/mingw-load-sys-dll-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/55
--
gitgitgadget
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] mingw: load system libraries the recommended way
2018-10-23 10:51 [PATCH 0/1] Load system libraries the recommended way on Windows Johannes Schindelin via GitGitGadget
@ 2018-10-23 10:51 ` Johannes Schindelin via GitGitGadget
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2018-10-23 10:51 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Johannes Schindelin
From: Johannes Schindelin <johannes.schindelin@gmx.de>
When we access IPv6-related functions, we load the corresponding system
library using the `LoadLibrary()` function, which is not the recommended
way to load system libraries.
In practice, it does not make a difference: the `ws2_32.dll` library
containing the IPv6 functions is already loaded into memory, so
LoadLibrary() simply reuses the already-loaded library.
Still, recommended way is recommended way, so let's use that instead.
While at it, also adjust the code in contrib/ that loads system libraries.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
compat/mingw.c | 3 ++-
contrib/credential/wincred/git-credential-wincred.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 18caf2196..9fd7db571 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1577,7 +1577,8 @@ static void ensure_socket_initialization(void)
WSAGetLastError());
for (name = libraries; *name; name++) {
- ipv6_dll = LoadLibrary(*name);
+ ipv6_dll = LoadLibraryExA(*name, NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!ipv6_dll)
continue;
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index 86518cd93..5bdad41de 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -75,7 +75,8 @@ static CredDeleteWT CredDeleteW;
static void load_cred_funcs(void)
{
/* load DLLs */
- advapi = LoadLibrary("advapi32.dll");
+ advapi = LoadLibraryExA("advapi32.dll", NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!advapi)
die("failed to load advapi32.dll");
--
gitgitgadget
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-23 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-23 10:51 [PATCH 0/1] Load system libraries the recommended way on Windows Johannes Schindelin via GitGitGadget
2018-10-23 10:51 ` [PATCH 1/1] mingw: load system libraries the recommended way Johannes Schindelin via GitGitGadget
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.