Index: dlls/kernel/module.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/module.c,v retrieving revision 1.6 diff -u -r1.6 module.c --- dlls/kernel/module.c 15 Apr 2004 00:04:05 -0000 1.6 +++ dlls/kernel/module.c 29 Apr 2004 21:24:23 -0000 @@ -181,8 +181,15 @@ } /* Not ELF, try DOS */ +#ifdef __powerpc__ +#define SwapWORD(a) (((a & 0xff00) >> 8) | ((a & 0x00ff) << 8)) +#define SwapDWORD(a) ( ((a & 0xff000000) >> 24) | ((a & 0x00ff0000) >> 8) | ((a & 0x0000ff00) << 8) | ((a & 0x000000ff) << 24) ) +#else +#define SwapWORD(a) a +#define SwapDWORD(a) a +#endif - if (header.mz.e_magic == IMAGE_DOS_SIGNATURE) + if (SwapWORD(header.mz.e_magic) == IMAGE_DOS_SIGNATURE) { /* We do have a DOS image so we will now try to seek into * the file by the amount indicated by the field @@ -191,22 +198,22 @@ * This will tell us if there is more header information * to read or not. */ - if (SetFilePointer( hfile, header.mz.e_lfanew, NULL, SEEK_SET ) == -1) + if (SetFilePointer( hfile, SwapDWORD(header.mz.e_lfanew), NULL, SEEK_SET ) == -1) return BINARY_DOS; if (!ReadFile( hfile, magic, sizeof(magic), &len, NULL ) || len != sizeof(magic)) return BINARY_DOS; - /* Reading the magic field succeeded so * we will try to determine what type it is. */ + if (!memcmp( magic, "PE\0\0", 4 )) { IMAGE_FILE_HEADER FileHeader; if (ReadFile( hfile, &FileHeader, sizeof(FileHeader), &len, NULL ) && len == sizeof(FileHeader)) { - if (FileHeader.Characteristics & IMAGE_FILE_DLL) return BINARY_PE_DLL; - return BINARY_PE_EXE; + if (SwapDWORD(FileHeader.Characteristics) & IMAGE_FILE_DLL) return BINARY_PE_DLL; + return BINARY_PE_EXE; } return BINARY_DOS; }