When tracking down a crash in the kernel32 loader test, Dmitry found a
bug in the Mac OS loader when Wine tried to load his dummy PE file.
Upon further research I found that the Mac loader seems to have its
own undocumented PE loader built in. I did some further testing with a
windows binary and got some really interesting results....
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char **argv) {
void *handle;
const char *error;
// handle = dlopen("./ldr330e.tmp", RTLD_NOW | RTLD_FIRST );
handle = dlopen("./procexp.exe", RTLD_NOW | RTLD_FIRST );
if (!handle) {
fputs (dlerror(), stderr);
printf("I guess it didn't load\n");
exit(1);
}
printf("I guess it loaded\n");
dlclose(handle);
}
Its trying to load the dlls. I get this output
steven-edwardss-imac:temp sedwards$ ./a.out
dlopen(./procexp.exe, 258): Library not loaded: WS2_32.dll
Referenced from: /Users/sedwards/Library/Application
Support/CrossOver/Bottles/winetest/drive_c/windows/temp/procexp.exe
Reason: image not foundI guess it didn't load
steven-edwardss-imac:temp sedwards$ file procexp.exe
procexp.exe: MS-DOS executable PE for MS Windows (GUI) Intel 80386 32-bit
steven-edwardss-imac:temp sedwards$ open .
steven-edwardss-imac:temp sedwards$ ./a.out
dlopen(./procexp.exe, 258): Library not loaded: MPR.dll
Referenced from: /Users/sedwards/Library/Application
Support/CrossOver/Bottles/winetest/drive_c/windows/temp/procexp.exe
Reason: image not foundI guess it didn't load
steven-edwardss-imac:temp sedwards$ ./a.out
dlopen(./procexp.exe, 258): Library not loaded: MPR.dll
So this leads to the question. Whats going on? Is this a hold over
from EFI which
is PE by default? Why would the OS need to load the EFI files? Maybe
just for easy
of development and testing? Or is something else going on? Is Apple going to be
adding a win32 compatibility layer to OS X? Is having a native PE
loader of any use
to us?
Thanks
Steven
--
Steven Edwards
"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo