summaryrefslogtreecommitdiff
path: root/legacy/evil/src/lib
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2011-10-05 22:08:13 +0000
committerVincent Torri <vincent.torri@gmail.com>2011-10-05 22:08:13 +0000
commit98b3d37f907da2ff57df441d0df58a7f0068d5cd (patch)
treed0f0b3cf43d9c525f7d7047e3d0c2f007c2f8a58 /legacy/evil/src/lib
parent3e2c4c377e469feeba817250f2e021d5f554ee5d (diff)
Evil: add RTLD_DEFAULT support in dlsym() on Windows CE
SVN revision: 63847
Diffstat (limited to 'legacy/evil/src/lib')
-rw-r--r--legacy/evil/src/lib/dlfcn/Makefile.am2
-rw-r--r--legacy/evil/src/lib/dlfcn/dlfcn.c27
2 files changed, 27 insertions, 2 deletions
diff --git a/legacy/evil/src/lib/dlfcn/Makefile.am b/legacy/evil/src/lib/dlfcn/Makefile.am
index cfb35a6663..65409973fd 100644
--- a/legacy/evil/src/lib/dlfcn/Makefile.am
+++ b/legacy/evil/src/lib/dlfcn/Makefile.am
@@ -11,5 +11,5 @@ libdl_la_SOURCES = dlfcn.c
11 11
12libdl_la_CPPFLAGS = @win32_cppflags@ -DEFL_EVIL_DLFCN_BUILD -DPSAPI_VERSION=1 12libdl_la_CPPFLAGS = @win32_cppflags@ -DEFL_EVIL_DLFCN_BUILD -DPSAPI_VERSION=1
13libdl_la_CFLAGS = @win32_cflags@ 13libdl_la_CFLAGS = @win32_cflags@
14libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la $(EFL_MPATROL_LIBS) -lpsapi 14libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la $(EFL_MPATROL_LIBS) @win32_libs@
15libdl_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@ 15libdl_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@
diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.c b/legacy/evil/src/lib/dlfcn/dlfcn.c
index f08c905af5..9daa94675b 100644
--- a/legacy/evil/src/lib/dlfcn/dlfcn.c
+++ b/legacy/evil/src/lib/dlfcn/dlfcn.c
@@ -9,7 +9,11 @@
9#endif /* __MINGW32CE__ || _MSC_VER */ 9#endif /* __MINGW32CE__ || _MSC_VER */
10 10
11#include <windows.h> 11#include <windows.h>
12#include <psapi.h> /* EnumProcessModules(Ex) */ 12#ifdef _WIN32_WCE
13# include <tlhelp32.h> /* CreateToolhelp32Snapshot */
14#else
15# include <psapi.h> /* EnumProcessModules(Ex) */
16#endif
13 17
14#include "../Evil.h" 18#include "../Evil.h"
15 19
@@ -131,6 +135,26 @@ dlsym(void *handle, const char *symbol)
131 135
132 if (handle == RTLD_DEFAULT) 136 if (handle == RTLD_DEFAULT)
133 { 137 {
138#ifdef _WIN32_WCE
139 HANDLE snapshot;
140 MODULEENTRY32 module;
141
142 snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS |
143 TH32CS_SNAPMODULE |
144 TH32CS_GETALLMODS,
145 0);
146 if (!snapshot)
147 return NULL;
148
149 module.dwSize = sizeof(module);
150 if (Module32First(snapshot, &module))
151 do {
152 fp = GetProcAddress(module.hModule, new_symbol);
153 if (fp) break;
154 } while (Module32Next(snapshot, &module));
155
156 CloseToolhelp32Snapshot(snapshot);
157#else
134 HMODULE modules[1024]; 158 HMODULE modules[1024];
135 DWORD needed; 159 DWORD needed;
136 DWORD i; 160 DWORD i;
@@ -145,6 +169,7 @@ dlsym(void *handle, const char *symbol)
145 fp = GetProcAddress(modules[i], new_symbol); 169 fp = GetProcAddress(modules[i], new_symbol);
146 if (fp) break; 170 if (fp) break;
147 } 171 }
172#endif
148 } 173 }
149 else 174 else
150 fp = GetProcAddress(handle, new_symbol); 175 fp = GetProcAddress(handle, new_symbol);