diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 8940911236..a2134fe006 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,9 @@ +2010-01-19 Vincent Torri + + * src/lib/dlfcn/dlfcn.c: + Fix dladdr() on Windows CE: use the calling process + address to get the path. + 2009-12-19 Vincent Torri * Makefile.am: diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.c b/legacy/evil/src/lib/dlfcn/dlfcn.c index 201ce90c38..fd55a917e3 100644 --- a/legacy/evil/src/lib/dlfcn/dlfcn.c +++ b/legacy/evil/src/lib/dlfcn/dlfcn.c @@ -144,22 +144,28 @@ dladdr (const void *addr __UNUSED__, Dl_info *info) size_t length; int ret = 0; - if (!info) - return 0; + if (!info) + return 0; - length = VirtualQuery(addr, &mbi, sizeof(mbi)); - if (!length) - return 0; +#ifdef _WIN32_WINNT + length = VirtualQuery(addr, &mbi, sizeof(mbi)); + if (!length) + return 0; - if (mbi.State != MEM_COMMIT) - return 0; + if (mbi.State != MEM_COMMIT) + return 0; - if (!mbi.AllocationBase) - return 0; + if (!mbi.AllocationBase) + return 0; - ret = GetModuleFileName((HMODULE)mbi.AllocationBase, (LPTSTR)&tpath, PATH_MAX); + ret = GetModuleFileName((HMODULE)mbi.AllocationBase, (LPTSTR)&tpath, PATH_MAX); if (!ret) return 0; +#else + ret = GetModuleFileName(NULL, (LPTSTR)&tpath, PATH_MAX); + if (!ret) + return 0; +#endif #ifdef UNICODE path = evil_wchar_to_char(tpath);