* autoload.cc (EnumProcessModules): Add.
* dlfcn.cc (dlsym): Handle RTLD_DEFAULT using EnumProcessModules(). * include/dlfcn.h (RTLD_DEFAULT): Define to NULL.
This commit is contained in:
parent
fc3a42749f
commit
599b41c4ec
@ -1,3 +1,9 @@
|
|||||||
|
2004-09-14 Sam Steingold <sds@gnu.org>
|
||||||
|
|
||||||
|
* autoload.cc (EnumProcessModules): Add.
|
||||||
|
* dlfcn.cc (dlsym): Handle RTLD_DEFAULT using EnumProcessModules().
|
||||||
|
* include/dlfcn.h (RTLD_DEFAULT): Define to NULL.
|
||||||
|
|
||||||
2004-09-13 Christopher Faylor <cgf@timesys.com>
|
2004-09-13 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* fork.cc (slow_pid_reuse): Temporarily double the number of pids held
|
* fork.cc (slow_pid_reuse): Temporarily double the number of pids held
|
||||||
|
@ -391,6 +391,7 @@ LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
|
|||||||
LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1)
|
LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1)
|
||||||
LoadDLLfuncEx (RtlIsDosDeviceName_U, 4, ntdll, 1)
|
LoadDLLfuncEx (RtlIsDosDeviceName_U, 4, ntdll, 1)
|
||||||
|
|
||||||
|
LoadDLLfuncEx (EnumProcessModules, 16, psapi, 1)
|
||||||
LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1)
|
LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1)
|
||||||
|
|
||||||
LoadDLLfuncEx (LsaDeregisterLogonProcess, 4, secur32, 1)
|
LoadDLLfuncEx (LsaDeregisterLogonProcess, 4, secur32, 1)
|
||||||
|
@ -9,6 +9,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
#include <psapi.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -112,7 +113,27 @@ dlopen (const char *name, int)
|
|||||||
void *
|
void *
|
||||||
dlsym (void *handle, const char *name)
|
dlsym (void *handle, const char *name)
|
||||||
{
|
{
|
||||||
void *ret = (void *) GetProcAddress ((HMODULE) handle, name);
|
void *ret = NULL;
|
||||||
|
if (handle == RTLD_DEFAULT)
|
||||||
|
{ /* search all modules */
|
||||||
|
HANDLE cur_proc = GetCurrentProcess ();
|
||||||
|
HMODULE *modules;
|
||||||
|
DWORD needed, i;
|
||||||
|
if (!EnumProcessModules (cur_proc, NULL, 0, &needed))
|
||||||
|
{
|
||||||
|
dlsym_fail:
|
||||||
|
set_dl_error ("dlsym");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
modules = (HMODULE*) alloca (needed);
|
||||||
|
if (!EnumProcessModules (cur_proc, modules, needed, &needed))
|
||||||
|
goto dlsym_fail;
|
||||||
|
for (i = 0; i < needed / sizeof (HMODULE); i++)
|
||||||
|
if ((ret = (void *) GetProcAddress (modules[i], name)))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret = (void *) GetProcAddress ((HMODULE)handle, name);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
set_dl_error ("dlsym");
|
set_dl_error ("dlsym");
|
||||||
debug_printf ("ret %p", ret);
|
debug_printf ("ret %p", ret);
|
||||||
|
@ -28,6 +28,7 @@ extern char *dlerror (void);
|
|||||||
extern void dlfork (int);
|
extern void dlfork (int);
|
||||||
|
|
||||||
/* following doesn't exist in Win32 API .... */
|
/* following doesn't exist in Win32 API .... */
|
||||||
|
#define RTLD_DEFAULT NULL
|
||||||
|
|
||||||
/* valid values for mode argument to dlopen */
|
/* valid values for mode argument to dlopen */
|
||||||
#define RTLD_LAZY 1 /* lazy function call binding */
|
#define RTLD_LAZY 1 /* lazy function call binding */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user