From fc3a789adc4ad42ea9d077227594f299b84a6c9c Mon Sep 17 00:00:00 2001 From: Max Kirillov Date: Fri, 27 Oct 2017 19:46:46 +0300 Subject: [PATCH] mingw: use CreateHardLink directly It was observed that the current implementation of of get_proc_addr() fails to load the kernel32.dll with code ERROR_INVALID_PARAMETER. Probably the reason is that kernel32.dll is already loaded. The behavior was seen at Windows SP1, both 32bit and 64bit. Probably it would behave same way in some or all other Windows versions. This breaks all usages of "clone --local", including the automatic tests where they call it. The function CreateHardLink is available in all supported Windows versions (since Windows XP), so there is no more need to resolve it in runtime. Signed-off-by: Max Kirillov --- compat/mingw.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 4d771dc9fb..46e7646989 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2666,13 +2666,8 @@ int mingw_raise(int sig) int link(const char *oldpath, const char *newpath) { - DECLARE_PROC_ADDR(kernel32.dll, BOOL, CreateHardLinkW, - LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES); wchar_t woldpath[MAX_LONG_PATH], wnewpath[MAX_LONG_PATH]; - if (!INIT_PROC_ADDR(CreateHardLinkW)) - return -1; - if (xutftowcs_long_path(woldpath, oldpath) < 0 || xutftowcs_long_path(wnewpath, newpath) < 0) return -1;