45 for( pobject = &first_object; pobject ; pobject = pobject->
next )
46 if( pobject->
hModule == hModule )
66 for( pobject = &first_object; pobject->
next ; pobject = pobject->
next );
76 pobject->
next = nobject;
110 static int copy_string(
char *dest,
int dest_size,
const char *src )
118 for( i = 0 ; i < dest_size-1 ; i++ )
135 dwMessageId = GetLastError( );
137 if( dwMessageId == 0 )
146 pos += FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwMessageId,
147 MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
164 sprintf( ptr_buf,
"0x%p", ptr );
169 void *
dlopen(
const char *file,
int mode )
177 uMode = SetErrorMode( SEM_FAILCRITICALERRORS );
189 hModule = GetModuleHandle( NULL );
196 char lpFileName[MAX_PATH];
200 for( i = 0 ; i <
sizeof(lpFileName)-1 ; i++ )
204 else if( file[i] ==
'/' )
205 lpFileName[i] =
'\\';
207 lpFileName[i] = file[i];
209 lpFileName[i] =
'\0';
216 hModule = LoadLibraryEx( (LPSTR) lpFileName, NULL,
217 LOAD_WITH_ALTERED_SEARCH_PATH );
233 SetErrorMode( uMode );
240 HMODULE
hModule = (HMODULE) handle;
245 ret = FreeLibrary( hModule );
261 void *
dlsym(
void *handle,
const char *name )
267 symbol = GetProcAddress( handle, name );
277 hModule = GetModuleHandle( NULL );
279 if( hModule == handle )
283 for( pobject = &first_object; pobject ; pobject = pobject->
next )
287 symbol = GetProcAddress( pobject->
hModule, name );
301 return (
void*) symbol;
313 return error_pointer;
void * dlsym(void *handle, const char *name)
static void save_err_ptr_str(const void *ptr)
struct global_object global_object
static char * current_error
static global_object * global_search(HMODULE hModule)
static void global_add(HMODULE hModule)
void * dlopen(const char *file, int mode)
int dlclose(void *handle)
static void save_err_str(const char *str)
static int copy_string(char *dest, int dest_size, const char *src)
static global_object first_object
static char error_buffer[65535]
static void global_rem(HMODULE hModule)
struct global_object * next
struct global_object * previous