libwine: Work around the Mac OS dynamic loader support for PE files.

This commit is contained in:
Alexandre Julliard 2007-11-29 15:32:49 +01:00
parent b314f13219
commit 6475603985
1 changed files with 19 additions and 0 deletions

View File

@ -668,6 +668,25 @@ void *wine_dlopen( const char *filename, int flag, char *error, size_t errorsize
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
void *ret; void *ret;
const char *s; const char *s;
#ifdef __APPLE__
/* the Mac OS loader pretends to be able to load PE files, so avoid them here */
unsigned char magic[2];
int fd = open( filename, O_RDONLY );
if (fd != -1)
{
if (pread( fd, magic, 2, 0 ) == 2 && magic[0] == 'M' && magic[1] == 'Z')
{
static const char msg[] = "MZ format";
size_t len = min( errorsize, sizeof(msg) );
memcpy( error, msg, len );
error[len - 1] = 0;
close( fd );
return NULL;
}
close( fd );
}
#endif
dlerror(); dlerror(); dlerror(); dlerror();
#ifdef __sun #ifdef __sun
if (strchr( filename, ':' )) if (strchr( filename, ':' ))