Index: dlls/kernel/module.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/module.c,v retrieving revision 1.9 diff -u -r1.9 module.c --- dlls/kernel/module.c 3 Jun 2004 00:25:08 -0000 1.9 +++ dlls/kernel/module.c 11 Jul 2004 15:30:57 -0000 @@ -44,6 +44,8 @@ #include "wine/unicode.h" #include "wine/server.h" +#include "wine/emu.h" + WINE_DEFAULT_DEBUG_CHANNEL(module); WINE_DECLARE_DEBUG_CHANNEL(loaddll); @@ -181,7 +183,7 @@ /* Not ELF, try DOS */ - if (header.mz.e_magic == IMAGE_DOS_SIGNATURE) + if (header.mz.e_magic == swap_word_from_le(IMAGE_DOS_SIGNATURE)) { union { @@ -196,7 +198,7 @@ * 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, swap_dword_from_le(header.mz.e_lfanew), NULL, SEEK_SET ) == -1) return BINARY_DOS; if (!ReadFile( hfile, &ext_header, sizeof(ext_header), &len, NULL ) || len < 4) return BINARY_DOS; @@ -210,10 +212,10 @@ { if (len < sizeof(ext_header.nt)) /* clear remaining part of header if missing */ memset( (char *)&ext_header.nt + len, 0, sizeof(ext_header.nt) - len ); - if (res_start) *res_start = (void *)ext_header.nt.OptionalHeader.ImageBase; - if (res_end) *res_end = (void *)(ext_header.nt.OptionalHeader.ImageBase + - ext_header.nt.OptionalHeader.SizeOfImage); - if (ext_header.nt.FileHeader.Characteristics & IMAGE_FILE_DLL) return BINARY_PE_DLL; + if (res_start) *res_start = (void *)swap_dword_from_le(ext_header.nt.OptionalHeader.ImageBase); + if (res_end) *res_end = (void *)(swap_dword_from_le(ext_header.nt.OptionalHeader.ImageBase) + + swap_dword_from_le(ext_header.nt.OptionalHeader.SizeOfImage)); + if (swap_word_from_le(ext_header.nt.FileHeader.Characteristics) & IMAGE_FILE_DLL) return BINARY_PE_DLL; return BINARY_PE_EXE; } return BINARY_DOS;