sqlite: Add hack for 32-bit to properly get address of SetDllDirectoryW

This commit is contained in:
Alexpux
2014-11-08 22:33:03 +03:00
parent 3a181c50a9
commit 690efeaada
4 changed files with 71 additions and 29 deletions

21
sqlite/getproc-hack.patch Normal file
View File

@@ -0,0 +1,21 @@
--- sqlite-autoconf-3080701/sqlite3.c.orig 2014-11-08 12:11:35.808800000 +0300
+++ sqlite-autoconf-3080701/sqlite3.c 2014-11-08 12:14:39.748400000 +0300
@@ -38546,9 +38546,17 @@
#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
if( cygwin_conv_path ){
WCHAR buf[MAX_PATH];
+ BOOL WINAPI (*set_dll_directory)(LPCWSTR);
cygwin_conv_path(CCP_POSIX_TO_WIN_W, "/usr/bin",
buf, MAX_PATH*sizeof(WCHAR));
- osSetDllDirectoryW(buf);
+ HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
+ if (k32)
+ set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) GetProcAddress (k32, "SetDllDirectoryW");
+ if (!set_dll_directory)
+ set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) -1;
+ else
+ set_dll_directory (buf);
+ //osSetDllDirectoryW(buf);
#ifdef _WIN32
}else if( cygwin_conv_to_full_win32_path ){
WCHAR buf[MAX_PATH];