Branch


Log

Author Commit Date CI Message
Silvio Traversaro 048bff80 2023-07-30T17:41:14 Merge pull request #110 from dlfcn-win32/traversaro-patch-1 Add some contributors
Silvio Traversaro 057dcdd6 2023-07-04T08:57:43 Merge pull request #111 from pali/master Add missing check that section index in get_image_section() is valid
Pali Rohár fc7c011d 2023-07-03T18:34:23 Add missing check that section index in get_image_section() is valid Number is stored in NumberOfRvaAndSizes and it may be less than IMAGE_NUMBEROF_DIRECTORY_ENTRIES.
Silvio Traversaro 3b28a159 2023-05-25T10:45:07 Add some contributors
Silvio Traversaro 90773552 2023-05-25T10:28:38 Merge pull request #109 from dlfcn-win32/updatecontrib Cleanup README and add CODEOWNERS file
Silvio Traversaro 2abc22ea 2023-05-25T10:25:32 Cleanup README and add CODEOWNERS file
Silvio Traversaro f70fe95c 2023-05-25T10:06:21 Merge pull request #108 from pali/master Fix compilation with older SDK and older MSVC
Pali Rohár 519400bf 2023-05-21T14:26:47 Fix compilation with the first NT SDK First NT SDK available in the first 32-bit MSVC NT compiler does not provide some defines. Add them for compatibility.
Pali Rohár 236d0f5e 2023-05-21T14:23:11 Fix compilation with old MSVC compiler Old pre-4.0 MSVC does not support _ReturnAddress() intrinsic. Provide for it simple implementation via inline assembly.
Pali Rohár 1beb65cd 2023-05-21T12:11:20 Fix compilation with older SDK Do not use SIZE_T which is not defined in older SDK. There is only size_t type, so use it instead. Do not use IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR which is not defined in older SDK. Use IMAGE_NUMBEROF_DIRECTORY_ENTRIES macro for checking if directory index is valid. In all SDKs is DataDirectory[] array size defined from IMAGE_NUMBEROF_DIRECTORY_ENTRIES macro. Cast members in IMAGE_EXPORT_DIRECTORY and IMAGE_DIRECTORY_ENTRY_IMPORT to DWORD as in older SDK they are defined as PDWORD and compiler throws error 'cannot add two pointers'.
Silvio Traversaro 6444294e 2022-12-28T15:23:51 Merge pull request #107 from driver1998/arm64 Add Windows ARM64 support
GH Cao d78c6266 2022-12-08T21:37:10 Add Windows ARM64 support
Silvio Traversaro 8dceebda 2022-12-02T00:39:04 Merge pull request #106 from szanni/cmake-fix-wrapper-include Fix CMake include directive when using wrappers like meson.
Angelo Haller f5cf3313 2022-12-01T14:05:37 Fix CMake include directive when using wrappers like meson.
Silvio Traversaro 9d0ef119 2022-04-08T19:13:40 Merge pull request #103 from pali/master Replace magic numbers by sdk macros in get_image_section()
Pali Rohár e34fb598 2022-03-11T22:50:30 Replace magic numbers by sdk macros in get_image_section()
Silvio Traversaro 123c7461 2022-01-05T18:35:13 Merge pull request #102 from pali/master Prefer usage of thread-safe function SetThreadErrorMode() instead of process-global function SetErrorMode()
Pali Rohár 318030d5 2021-12-21T01:09:09 Prefer usage of thread-safe function SetThreadErrorMode() instead of process-global function SetErrorMode() Use GetProcAddress() wrapper as SetThreadErrorMode() is not available on older Windows versions.
Pali Rohár fe1e4751 2021-12-21T01:07:19 Try to avoid compile warning: cast between incompatible function types from ‘FARPROC’ warning: cast between incompatible function types from ‘FARPROC’ {aka ‘long long int (*)()’} to ‘BOOL (*)(DWORD, const CHAR *, struct HINSTANCE__ **)’ {aka ‘int (*)(long unsigned int, const char *, struct HINSTANCE__ **)’} [-Wcast-function-type]
Silvio Traversaro 01096907 2021-04-29T09:44:52 Merge pull request #99 from xantares/wine cmake: use CROSSCOMPILING_EMULATOR
Silvio Traversaro 020e3142 2021-04-28T08:34:45 Merge pull request #96 from xantares/patch-2 CMake: Bump version
xantares cf64370e 2021-02-27T11:00:21 CMake: Bumpr version Silents warnings, cmake 3.2 is available in distros since many years
Michel Zou a1308877 2021-03-15T11:26:44 cmake: use CROSSCOMPILING_EMULATOR
Silvio Traversaro 4b34d7ae 2021-04-11T13:00:31 Merge pull request #98 from xantares/const dladdr: const void *addr
Michel Zou 36b92340 2021-03-15T11:21:09 dladdr: const void *addr on unix the addr argument seems to be const fix that for consistency
Silvio Traversaro 522c301e 2021-02-24T09:54:51 Merge pull request #95 from pali/master Various fixes
Pali Rohár 9e40646c 2021-02-03T21:01:24 Fix noinline for older compiler versions (e.g. Visual Studio 6.0) Visual Studio 6.0 does not support __declspec(noinline) and throw error. Add checks for compilers which support noinline to prevent compile errors.
Pali Rohár 7da10545 2021-02-03T21:00:56 Define ULONG_PTR for older SDK If compiling with _WIN32_WINNT target prior 0x0500 then SDK does not define ULONG_PTR type. Such systems are only 32bit so define it explicitly to 32bit type ULONG.
Pali Rohár d1a0d28f 2021-02-03T21:00:28 Fix MSVC 14.00 compile warning: warning C4244: '=' : conversion from 'ULONG_PTR' to 'char', possible loss of data
Pali Rohár 06fea3fe 2021-02-03T20:59:58 Add helper function MyGetModuleHandleFromAddress() This function implements calling GetModuleHandleExA() with correct flags to retrieve hModule from passed address. To allow compilation also with older compilers and environments (like WDK) with any _WIN32_WINNT value, retrieve pointer to this function via GetProcAddress(). And as a fallback implementation use old code via VirtualQuery() which was there prior commit 8ec5ffef2eca.
Pali Rohár 0e9d85a9 2021-02-03T20:59:18 Fix helper function MyEnumProcessModules() Call SetErrorMode(SEM_FAILCRITICALERRORS) prior opening Psapi.dll library to avoid GUI error messages. Close Psapi.dll library via FreeLibrary() if symbol was not retrieved to prevent possible memory leaks. Try to get K32EnumProcessModules symbol from Kernel32.dll library as it is preferred way how to call EnumProcessModules() on Windows 7 and newer versions. If retrieving EnumProcessModules symbol failed with both methods then do not try it again on next MyEnumProcessModules() function call.
Pali Rohár c172ee21 2021-02-03T20:58:39 Avoid calling SetLastError() and GetLastError() internally There is no need for propagating internal errors via SetLastError() and GetLastError() calls. Just use additional argument for save_err_str() function. Also dlfcn API is POSIX and does not use GetLastError().
Pali Rohár b89f8932 2021-02-03T20:58:15 Move hCurrentProc variable to scope where is used
Pali Rohár f7e7a5d7 2021-02-03T20:57:40 Fix some style issues
Silvio Traversaro 3ec513f9 2021-02-03T18:33:32 Merge pull request #94 from pali/dladdr dladdr() - Retrieve symbol name and address from export table
Pali Rohár b46da884 2021-01-29T14:00:30 Remove duplicate checks for NULL pointers is_valid_address() already rejects NULL addresses, so there is no need to check address for NULL.
Pali Rohár e53ecd53 2021-01-29T13:59:41 Remove code for finding symbol name in import table It is not required as import table can use only symbols which are exported and therefore are in export table. So if symbol is not found in export table it cannot be in import table.
Pali Rohár 86a41b92 2021-01-25T23:27:22 Function dladdr() now retrieve symbol name and symbol address from both export and import tables dladdr tests for Windows now should always pass like on other systems.
Silvio Traversaro a5af061c 2021-01-25T21:44:50 Merge pull request #72 from rhabacker/master Add function dladdr()
Ralf Habacker 3a016513 2020-12-28T12:29:13 CI: Add static building for cmake
Ralf Habacker ebd7badd 2021-01-17T12:51:08 cmake: add support to build test-dladdr on unix like os This is used to obtain test result references.
Ralf Habacker 0ea2334d 2020-12-11T14:32:52 Add function dladdr() and associated test application test-dladdr
Silvio Traversaro 06ffb62a 2020-12-22T17:31:32 Merge pull request #93 from rhabacker/travis-cmake-support Add cmake build support to travis CI
Ralf Habacker 38ea653d 2020-12-22T10:57:10 Add cmake build support to travis CI
Silvio Traversaro 1f0a9b1b 2020-12-13T19:02:34 Merge pull request #90 from pali/master Rewrite function save_err_ptr_str() to not use sprintf()
Pali Rohár d230e1ca 2020-12-13T14:48:44 Rewrite function save_err_ptr_str() to not use sprintf() sprintf() is marked by MSVC as unsafe and suppressing compile warning does not work. It is still generated on AppVeyor. So rewrite code for converting pointer number to string via open coded for-loop and do not use unsafe sprintf() function anymore. New code correctly handles both 32bit and 64bit variants and does not use any #ifdef _MSC_VER anymore.
Silvio Traversaro b1b55b2a 2020-12-13T12:10:41 Merge pull request #89 from pali/master Add _CRT_SECURE_NO_WARNINGS for test.c to disable MSVC deprecation warnings
Pali Rohár e042c1de 2020-12-13T02:22:06 Add _CRT_SECURE_NO_WARNINGS for test.c to disable MSVC deprecation warnings
Silvio Traversaro 5f1c9149 2020-12-13T01:29:18 Merge pull request #88 from pali/master Run Travis tests also under i586-mingw32msvc-gcc compiler
Pali Rohár 22020637 2020-12-12T02:47:24 ci-build.sh: Move install_prefix to cmake place where it is used
Pali Rohár 3cddb7b9 2020-12-12T01:02:47 Run Travis tests also under i586-mingw32msvc-gcc compiler Beware that i586-mingw32msvc-gcc is sometimes just a symlink to i686-w64-mingw32-gcc. Real i586-mingw32msvc-gcc compiler is available in mingw32 package only in dist trusty.
Silvio Traversaro 008df693 2020-11-26T11:16:05 Merge pull request #85 from rhabacker/cmake-wine-support Add support to use wine to run cross compiled tests for cmake
Ralf Habacker 49c3a337 2020-11-03T14:43:41 cmake: Keep warning in sync with Makefile based build system
Ralf Habacker 90302fc5 2020-11-03T10:05:33 Add cmake building support to Travis CI To make it easier to extend the CI support and to be able to execute the contained tests locally, a dedicated shell script tools/ci_build.sh was added to execute the tests.
Ralf Habacker 2821345e 2020-11-02T13:06:55 cmake: add option ENABLE_WINE to enable support for running cross compiled tests with wine For details about the ENABLE_WINE option, which support three modes AUTO|ON|OFF see the documentation of cmake macro check_auto_option(). A custom path for the wine executable can be specified by adding -DWINE_EXECUTABLE=<path> to the cmake command line. The cmake related macros were copied from https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/cmake/modules/Macros.cmake
Ralf Habacker 53b1d71a 2020-11-03T10:45:36 cmake: separate targets in tests subdir for reasier reading
Ralf Habacker 3292a137 2020-11-02T12:50:41 cmake: Let make target 'test' be accessable from topmost build directory The cmake command enable_testing() must be placed in the topmost CMakeLists.txt so that the make target 'test' is available in the topmost build directory.
Silvio Traversaro 0b899996 2020-11-08T11:48:21 Merge pull request #86 from pali/master Change order of variables in appveyor build matrix
Pali Rohár 214d5668 2020-11-04T18:12:50 Change order of variables in appveyor build matrix This change no function effect as it changes only order of defined variables. The only visible change is on appveyor web where variables are printed in other as they are defined. If list of variables is too long, variables defined later are hidden on the web interface. Variable APPVEYOR_BUILD_WORKER_IMAGE was moved to the end of list as it is less important to know as variable GENERATOR (defines which compiler is used).
Ralf Habacker 11c80b8e 2020-11-02T12:37:36 cmake: place all generated binaries into one place This is required for running test applications, because by default cmake places binaries into the associated subdir.
Silvio Traversaro d640d80f 2020-09-21T22:31:41 Merge pull request #79 from rhabacker/cmake-refactoring CMake build system fixes
Silvio Traversaro 33e2fdc2 2020-09-21T22:29:54 Merge pull request #82 from rhabacker/drop-obsolete-vcproj-files Drop obsolete visual studio related files
Ralf Habacker ff6060ba 2020-09-06T23:13:47 Drop obsolete visual studio related files These files can be easily recreated with cmake on the fly, which is already used by CI-system.
Ralf Habacker faa2ff80 2020-09-14T12:21:55 Makefile: Adjust paths of source files, which are now located in subdirectories
Ralf Habacker 218e7785 2020-08-25T23:24:25 Fix cmake warning 'No project() command is present'
Ralf Habacker f0ac8495 2020-08-25T23:34:19 Move cmake targets into sub directories
Ralf Habacker 5ead6f2d 2020-08-25T23:31:13 Update minimum required cmake version to 2.8.11 to simplify code According to https://cmake.org/pipermail/cmake/2013-May/054792.html cmake 2.8.11 was released in 2013, so we can assume that no older version will be used anymore.
Silvio Traversaro c5a5e6d5 2020-09-13T19:35:47 Merge pull request #81 from ramiropolla/master Relicense to MIT
Silvio Traversaro d240aff1 2020-09-13T19:26:54 Rephrase configure script copyright notice
Silvio Traversaro f601b05f 2020-09-13T19:11:46 Merge pull request #80 from pali/master Add Travis CI testing
Ramiro Polla 4583f267 2020-08-30T13:43:50 Relicense to MIT The licensing note in the configure script has been reworked, similarly to how libvpx did it (they were also based on FFmpeg's configure script and also use a more permissive license).
Pali Rohár 48d16ae0 2020-08-26T19:27:28 Add Travis CI testing
Silvio Traversaro e5d9fab4 2020-08-05T08:50:41 Merge pull request #76 from pali/master Fix compilation with older environments
Pali Rohár e1d593d9 2020-08-04T18:35:01 Fix compilation with older environments This change should fix following compile error: dlfcn.c: In function 'dlsym': dlfcn.c:374:14: warning: implicit declaration of function 'GetModuleHandleExA' dlfcn.c: undefined reference to `GetModuleHandleExA' Documentation for function GetModuleHandleExA() says: To compile an application that uses this function, define _WIN32_WINNT as 0x0501 or later. Fixes: https://github.com/dlfcn-win32/dlfcn-win32/issues/75
Silvio Traversaro 0a494c01 2020-07-15T08:07:53 Merge pull request #74 from pali/master Replace VirtualQueryEx() call by GetModuleHandleExA() call
Pali Rohár 8ec5ffef 2020-07-14T21:14:56 Replace VirtualQueryEx() call by GetModuleHandleExA() call Usage of VirtualQueryEx() call is needed for retrieving HMODULE of passed function address and it is just an undocumented hack. Based on @rhabacker's tests it is unstable and does not work correctly. https://github.com/dlfcn-win32/dlfcn-win32/pull/72#issuecomment-656581418 So replace VirtualQueryEx() call by standard GetModuleHandleExA() function with special GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS flag which should do the same thing but it is documented and it is working correctly.
Silvio Traversaro 61ad60f5 2020-03-24T16:54:12 Merge pull request #69 from reborn2266/fix_mmleak fix memory leak in dlsym()
Mars Cheng cea65639 2020-03-24T20:05:29 fix memory leak in dlsym()
Silvio Traversaro 32be0765 2020-02-22T13:54:54 Merge pull request #68 from pali/master Show "(null)" in error message when passed filname to dlopen() was NULL and error occurred
Pali Rohár 70c5c20a 2020-02-19T22:39:29 Show "(null)" in error message when passed filname to dlopen() was NULL and error occurred It does not make sense to pass file variable (which is NULL) to function save_err_ptr_str() which converts its argument to string. We can call directly save_err_str() with string value. Also it is highly unexpected that GetModuleHandle(NULL) call fails.
Silvio Traversaro 974b39c7 2019-10-13T09:43:21 Merge pull request #67 from pali/master Add test which check that dlopen() can open same files as open()
Pali Rohár ab246dbf 2019-09-12T16:37:03 Add test which check that dlopen() can open same files as open() This ensures that dlopen() expects filenames encoded in same codepage as WinAPI's open() function.
Silvio Traversaro 07ef52a5 2019-09-01T14:35:56 Merge pull request #65 from pali/master Update documentation in dlfcn.h, specially for RTLD_LAZY
Pali Rohár 5d576e6d 2019-08-29T21:07:32 Update documentation in dlfcn.h, specially for RTLD_LAZY
Silvio Traversaro e7fef1b5 2019-08-23T10:19:56 Merge pull request #63 from pali/master Makefile: Fix building both static and shared library at the same time
Pali Rohár 2b342400 2019-08-22T23:36:22 Makefile: Fix building both static and shared library at the same time Static library libdl.a must be build without -DSHARED flag for obvious reason. So -DSHARED cannot be in global CFLAGS. Define also two separate test targets: test.exe for shared library and test-static.exe for static library.
Silvio Traversaro 1dfd103a 2019-08-22T23:05:54 Merge pull request #62 from pali/master Reduce memory usage by 64K
Pali Rohár 588b5782 2019-08-22T17:25:11 Reduce memory usage by 64K One buffer for error message is enough.
Silvio Traversaro 7f1a5e55 2019-08-21T10:48:49 Merge pull request #59 from pali/master Fix compile warnings
Pali Rohár ff302674 2019-07-26T18:21:30 Fix more gcc warnings ISO C90 forbids mixed declarations and code ISO C++ forbids converting a string constant to 'char*'
Pali Rohár 2bb5f487 2019-07-25T20:34:46 Fix gcc warning: ISO C forbids return between function pointer and void * Instead of using compiler specific pragma to disable particular warning, rewrite code which cast from function pointer to data pointer according to POSIX dlopen() documentation. This also fix compile warning under MSVC. According to the ISO C standard, casting between function pointers and 'void *', as done above, produces undefined results. POSIX.1-2003 and POSIX.1-2008 accepted this state of affairs and proposed the following workaround: *(void **) (&cosine) = dlsym(handle, "cos"); This (clumsy) cast conforms with the ISO C standard and will avoid any compiler warnings.
Pali Rohár 403b240f 2019-07-25T20:34:28 Fix gcc warning: comparison between signed and unsigned integer expressions GetTempPathA() returns DWORD (32/64bit unsigned integer) and not int (32 signed integer).
Pali Rohár 39ff58c2 2019-07-25T20:32:53 Do not include intrin.h file Include file intrin.h is not needed for compiling dlfcn.c as _ReturnAddress intrinsic is defined in dlfcn.c manually. Moreover _ReturnAddress is available only as an intrinsic, there is no function implementation. So even including intrin.h file does not provide function variant for _ReturnAddress. More important, include file intrin.h is not available in older Windows Driver Kit 7.1.0. So removing usage of intrin.h file makes compilation of dlfcn-win32 also under these older WDK versions.
Silvio Traversaro e476c014 2019-07-25T16:59:14 Merge pull request #58 from pali/master Correctly process malloc() error in dlsym()
Pali Rohár 242b94ac 2019-07-24T23:06:57 Correctly process malloc() error in dlsym() malloc() may fail, so propagate this error to caller.
Silvio Traversaro 4e17b083 2019-07-23T18:00:04 Merge pull request #55 from pali/master Turn off GUI error messages around LoadLibraryA also in test
Pali Rohár 5c2ec8f9 2019-06-11T00:54:38 Turn off GUI error messages around LoadLibraryA also in test Otherwise running test show GUI error messages which needs to be closed.
Silvio Traversaro 11ff86bf 2019-06-11T00:19:48 Merge pull request #54 from pali/master Correctly process and indicate errors
Pali Rohár e646c9ab 2019-05-23T20:24:17 Add test for non-library file
Pali Rohár 27319bfc 2019-05-23T20:24:12 Add tests for non-existent file and file with too long name