Commit 64012fdbe67641b778cdef83583b337c079f83c2

Patrick Pokatilo 2013-02-08T03:24:45

Replace LoadLibrary with GetModuleHandle, since kernel32 is loaded by default As requested

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index ca24448..fa5f4fb 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -173,10 +173,10 @@ int p_readlink(const char *link, char *target, size_t target_len)
 	 * it is not available in platforms older than Vista
 	 */
 	if (pGetFinalPath == NULL) {
-		HINSTANCE library = LoadLibrary("kernel32");
+		HMODULE module = GetModuleHandle("kernel32");
 
-		if (library != NULL)
-			pGetFinalPath = (fpath_func)GetProcAddress(library, "GetFinalPathNameByHandleW");
+		if (module != NULL)
+			pGetFinalPath = (fpath_func)GetProcAddress(module, "GetFinalPathNameByHandleW");
 
 		if (pGetFinalPath == NULL) {
 			giterr_set(GITERR_OS,