|
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()
|
|
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.
|
|
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]
|
|
01096907
|
2021-04-29T09:44:52
|
|
Merge pull request #99 from xantares/wine
cmake: use CROSSCOMPILING_EMULATOR
|
|
020e3142
|
2021-04-28T08:34:45
|
|
Merge pull request #96 from xantares/patch-2
CMake: Bump version
|
|
cf64370e
|
2021-02-27T11:00:21
|
|
CMake: Bumpr version
Silents warnings, cmake 3.2 is available in distros since many years
|
|
a1308877
|
2021-03-15T11:26:44
|
|
cmake: use CROSSCOMPILING_EMULATOR
|
|
4b34d7ae
|
2021-04-11T13:00:31
|
|
Merge pull request #98 from xantares/const
dladdr: const void *addr
|
|
36b92340
|
2021-03-15T11:21:09
|
|
dladdr: const void *addr
on unix the addr argument seems to be const
fix that for consistency
|
|
522c301e
|
2021-02-24T09:54:51
|
|
Merge pull request #95 from pali/master
Various fixes
|
|
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.
|
|
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.
|
|
d1a0d28f
|
2021-02-03T21:00:28
|
|
Fix MSVC 14.00 compile warning: warning C4244: '=' : conversion from 'ULONG_PTR' to 'char', possible loss of data
|
|
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.
|
|
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.
|
|
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().
|
|
b89f8932
|
2021-02-03T20:58:15
|
|
Move hCurrentProc variable to scope where is used
|
|
f7e7a5d7
|
2021-02-03T20:57:40
|
|
Fix some style issues
|
|
3ec513f9
|
2021-02-03T18:33:32
|
|
Merge pull request #94 from pali/dladdr
dladdr() - Retrieve symbol name and address from export table
|
|
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.
|
|
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.
|
|
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.
|
|
a5af061c
|
2021-01-25T21:44:50
|
|
Merge pull request #72 from rhabacker/master
Add function dladdr()
|
|
3a016513
|
2020-12-28T12:29:13
|
|
CI: Add static building for cmake
|
|
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.
|
|
0ea2334d
|
2020-12-11T14:32:52
|
|
Add function dladdr() and associated test application test-dladdr
|
|
06ffb62a
|
2020-12-22T17:31:32
|
|
Merge pull request #93 from rhabacker/travis-cmake-support
Add cmake build support to travis CI
|
|
38ea653d
|
2020-12-22T10:57:10
|
|
Add cmake build support to travis CI
|
|
1f0a9b1b
|
2020-12-13T19:02:34
|
|
Merge pull request #90 from pali/master
Rewrite function save_err_ptr_str() to not use sprintf()
|
|
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.
|
|
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
|
|
e042c1de
|
2020-12-13T02:22:06
|
|
Add _CRT_SECURE_NO_WARNINGS for test.c to disable MSVC deprecation warnings
|
|
5f1c9149
|
2020-12-13T01:29:18
|
|
Merge pull request #88 from pali/master
Run Travis tests also under i586-mingw32msvc-gcc compiler
|
|
22020637
|
2020-12-12T02:47:24
|
|
ci-build.sh: Move install_prefix to cmake place where it is used
|
|
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.
|
|
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
|
|
49c3a337
|
2020-11-03T14:43:41
|
|
cmake: Keep warning in sync with Makefile based build system
|
|
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.
|
|
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
|
|
53b1d71a
|
2020-11-03T10:45:36
|
|
cmake: separate targets in tests subdir for reasier reading
|
|
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.
|
|
0b899996
|
2020-11-08T11:48:21
|
|
Merge pull request #86 from pali/master
Change order of variables in appveyor build matrix
|
|
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).
|
|
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.
|
|
d640d80f
|
2020-09-21T22:31:41
|
|
Merge pull request #79 from rhabacker/cmake-refactoring
CMake build system fixes
|
|
33e2fdc2
|
2020-09-21T22:29:54
|
|
Merge pull request #82 from rhabacker/drop-obsolete-vcproj-files
Drop obsolete visual studio related files
|
|
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.
|
|
faa2ff80
|
2020-09-14T12:21:55
|
|
Makefile: Adjust paths of source files, which are now located in subdirectories
|
|
218e7785
|
2020-08-25T23:24:25
|
|
Fix cmake warning 'No project() command is present'
|
|
f0ac8495
|
2020-08-25T23:34:19
|
|
Move cmake targets into sub directories
|
|
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.
|
|
c5a5e6d5
|
2020-09-13T19:35:47
|
|
Merge pull request #81 from ramiropolla/master
Relicense to MIT
|
|
d240aff1
|
2020-09-13T19:26:54
|
|
Rephrase configure script copyright notice
|
|
f601b05f
|
2020-09-13T19:11:46
|
|
Merge pull request #80 from pali/master
Add Travis CI testing
|
|
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).
|
|
48d16ae0
|
2020-08-26T19:27:28
|
|
Add Travis CI testing
|
|
e5d9fab4
|
2020-08-05T08:50:41
|
|
Merge pull request #76 from pali/master
Fix compilation with older environments
|
|
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
|
|
0a494c01
|
2020-07-15T08:07:53
|
|
Merge pull request #74 from pali/master
Replace VirtualQueryEx() call by GetModuleHandleExA() call
|
|
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.
|
|
61ad60f5
|
2020-03-24T16:54:12
|
|
Merge pull request #69 from reborn2266/fix_mmleak
fix memory leak in dlsym()
|
|
cea65639
|
2020-03-24T20:05:29
|
|
fix memory leak in dlsym()
|
|
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
|
|
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.
|
|
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()
|
|
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.
|
|
07ef52a5
|
2019-09-01T14:35:56
|
|
Merge pull request #65 from pali/master
Update documentation in dlfcn.h, specially for RTLD_LAZY
|
|
5d576e6d
|
2019-08-29T21:07:32
|
|
Update documentation in dlfcn.h, specially for RTLD_LAZY
|
|
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
|
|
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.
|
|
1dfd103a
|
2019-08-22T23:05:54
|
|
Merge pull request #62 from pali/master
Reduce memory usage by 64K
|
|
588b5782
|
2019-08-22T17:25:11
|
|
Reduce memory usage by 64K
One buffer for error message is enough.
|
|
7f1a5e55
|
2019-08-21T10:48:49
|
|
Merge pull request #59 from pali/master
Fix compile warnings
|
|
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*'
|
|
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.
|
|
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).
|
|
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.
|
|
e476c014
|
2019-07-25T16:59:14
|
|
Merge pull request #58 from pali/master
Correctly process malloc() error in dlsym()
|
|
242b94ac
|
2019-07-24T23:06:57
|
|
Correctly process malloc() error in dlsym()
malloc() may fail, so propagate this error to caller.
|
|
4e17b083
|
2019-07-23T18:00:04
|
|
Merge pull request #55 from pali/master
Turn off GUI error messages around LoadLibraryA also in test
|
|
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.
|
|
11ff86bf
|
2019-06-11T00:19:48
|
|
Merge pull request #54 from pali/master
Correctly process and indicate errors
|
|
e646c9ab
|
2019-05-23T20:24:17
|
|
Add test for non-library file
|
|
27319bfc
|
2019-05-23T20:24:12
|
|
Add tests for non-existent file and file with too long name
|
|
f6f6dd2d
|
2019-05-23T20:24:05
|
|
Test that dlerror() returns non-NULL error for failed calls
|
|
207311ce
|
2019-05-23T20:23:58
|
|
Correctly process and indicate error when file name is too long
|
|
44589dba
|
2019-05-23T20:23:50
|
|
Correctly process malloc() error in local_add()
malloc() may fail, so propagate this error to caller of dlopen().
|
|
4fe419ca
|
2019-05-23T20:23:33
|
|
Correctly process and indicate error in dlsym() function
Function save_err_str() checks for error by GetLastError() call. So ensure
that last error is always set when error occurs.
|
|
a5c0031e
|
2019-05-23T20:22:44
|
|
Correctly process and indicate error from LoadLibraryExA() function
Function save_err_str() checks for error by GetLastError() call. Calling
EnumProcessModules() may change or reset it. So call save_err_str()
immediately after LoadLibraryExA().
|
|
1488731c
|
2019-05-21T18:55:39
|
|
Merge pull request #52 from pali/master
Call FormatMessage() with FORMAT_MESSAGE_IGNORE_INSERTS
|
|
9ce1ba6f
|
2019-05-21T00:35:11
|
|
Call FormatMessage() with FORMAT_MESSAGE_IGNORE_INSERTS
Documentation says: In particular, it is unsafe to take an arbitrary system
error code returned from an API and use FORMAT_MESSAGE_FROM_SYSTEM without
FORMAT_MESSAGE_IGNORE_INSERTS.
|
|
0fc1d9de
|
2019-05-20T23:41:19
|
|
Merge pull request #51 from pali/master
Load Psapi.dll at runtime, this avoids linking caveat
|
|
f3da31d7
|
2019-05-06T21:47:33
|
|
Load Psapi.dll at runtime, this avoids linking caveat
|
|
84295c9a
|
2019-05-06T21:02:00
|
|
Merge pull request #50 from pali/master
Simplify UNICODE build
|
|
e0a58321
|
2019-04-25T20:01:34
|
|
Test also UNICODE builds on AppVeyor CI
|
|
83add392
|
2019-04-25T19:36:57
|
|
Simplify implementation of save_err_str()
Check return value of FormatMessageA() function and remove copy_string()
function as it is not needed.
|
|
d9d49f2d
|
2019-04-25T19:26:23
|
|
Remove ifdef hack for snprintf()
Old version of MSVC does not support snprintf() function and sprintf_s() is
not replacement for C99 snprintf(). As the only usage of snprintf() is to
format void* pointer we can use sprintf() with enough long buffer.
|
|
04bbf248
|
2019-04-25T18:18:31
|
|
Simplify code around #ifdef UNICODE
The whole dlfcn.h API works with char* (ANSI) strings. For WINAPI UNICODE
builds it is still possible to call WINAPI ANSI functions with -A suffix.
E.g. LoadLibraryExA() instead of LoadLibraryEx() or FormatMessageA()
instead of FormatMessage().
This simplify whole implementation when compiling with UNICODE support as
there is no need to do conversion from wchar_t to char and vice-versa.
|
|
278c782a
|
2019-02-14T14:57:29
|
|
Merge pull request #44 from pali/master
Fix resolving global symbols and implement RTLD_DEFAULT and RTLD_NEXT
|
|
63d7bda4
|
2019-01-29T22:57:04
|
|
Implement support for dlsym() with RTLD_DEFAULT and RTLD_NEXT
dlsym() with RTLD_DEFAULT handle behaves in same way like with global handle
returned by dlopen() with NULL file name.
dlsym() with RTLD_NEXT handle search for next loaded module which provides
specified symbol. "Next" means module which in EnumProcessModules() result
after the module which called dlsym().
To get caller function of dlsym() use _ReturnAddress() intrinsic. To get
module where is caller function use the fact that HMODULE is the same value
as the module's base address.
When compiling under gcc, defines _ReturnAddress() macro via gcc's builtin
as it does not provide MSC's specific _ReturnAddress() intrinsic.
Added tests demonstrate that both RTLD_DEFAULT and RTLD_NEXT are working as
expected.
|