Running NT PPC with wine
emmanuel maillard
e.rsz at libertysurf.fr
Fri Apr 30 03:52:39 CDT 2004
Hi,
i forget to attache one patch yesterday.
For winimage you need to add RtlCopyMemory in kernel32.dll, wich is
define as a macro in wine.
MSDN said that function is part of Windows DDK, declared in wdm.h and
ntddk.h.
(more info here :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
kmarch/hh/kmarch/k109_0zzm.asp)
emmanuel
-------------- next part --------------
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;
}
-------------- next part --------------
Le 29 avr. 04, ? 23:04, emmanuel maillard a ?crit :
> Hi all,
>
> I'm looking for people using wine on linuxPPC who want try my patches
> to run a NT PPC exe.
> (i plan to reinstall linux/ppc to make my tests but i need to
> rearrange my HDs before, and it will
> take times )
> This doesn't work for me on MacOSX but this could be due to our port
> for darwin, this why i need to have feedback
> from linux/ppc users.
>
> PE headers are store in little endian even for an PPC file, so I test
> endiannes and swap PE infos if needed.
>
> For my test i use winimage 3.0 for NT PPC, available here :
> http://www.winimage.com/download.htm
>
> map_image seems good :
>
> trace:module:map_image mapped PE file at 0x4f000-0xe5000
> Trying to load PE image for unsupported architecture (PowerPC)
> trace:module:map_image mapping section .text at 0x50000 off 400 size
> 6c600 flags 60000020
> trace:module:map_image mapping section .rdata at 0xbd000 off 6ca00
> size 1c00 flags 40000040
> trace:module:map_image mapping section .data at 0xbf000 off 6e600 size
> 3600 flags c0000040
> trace:module:map_image clearing 0xc2600 - 0xc3000
> trace:module:map_image mapping section .pdata at 0xc8000 off 71c00
> size 5c00 flags 40000040
> trace:module:map_image mapping section .idata at 0xce000 off 77800
> size 3000 flags c0000040
> trace:module:map_image mapping section .reldata at 0xd1000 off 7a800
> size 200 flags c0000040
> trace:module:map_image mapping section .rsrc at 0xd2000 off 7aa00 size
> e000 flags 40000040
> trace:module:map_image mapping section .reloc at 0xe0000 off 88a00
> size 5000 flags 42000040
> trace:module:do_relocations relocating from 0x400000-0x496000 to
> 0x4f000-0xe5000
> trace:module:do_relocations 1848 relocations for page 6e000
> trace:module:do_relocations 816 relocations for page 6f000
> trace:module:do_relocations 80 relocations for page 70000
> trace:module:do_relocations 40 relocations for page 71000
> trace:module:do_relocations 80 relocations for page 72000
> trace:module:do_relocations 32 relocations for page 73000
> trace:module:do_relocations 1236 relocations for page 79000
> trace:module:do_relocations 1240 relocations for page 7a000
> trace:module:do_relocations 1240 relocations for page 7b000
> trace:module:do_relocations 1236 relocations for page 7c000
> trace:module:do_relocations 1240 relocations for page 7d000
> trace:module:do_relocations 796 relocations for page 7e000
> trace:module:do_relocations 1316 relocations for page 7f000
> trace:module:do_relocations 704 relocations for page 80000
> trace:module:do_relocations 184 relocations for page 82000
>
> But when process start :
> ....
> trace:module:MODULE_InitDLL entry : 0x0(L"WINIMAGE.exe",0x1) - END
> 0009:Starting process L"F:\\Desktop\\wimapp30\\WINIMAGE.exe"
> (entryproc=0xbe750)
>
> wait few seconds ...
>
> wine: Unhandled exception (thread 0009), starting debugger...
>
> i test it with mosaic too but failed due to an undefined symbol in
> iphlpapi.dll
> "err:module:load_builtin_dll failed to load .so lib for builtin
> L"iphlpapi.dll": dlcompat: dyld: wine Undefined symbols:
> _res_9_init"
>
> If someone with a Linux/x86 want to launch winimage PPC with +module
> enable to send me the output to see if my changes
> give right values it will be helpfull to.
>
> Thanks in advance
>
> emmanuel
>
> the patches (kernel/process.c, ntdll/loader.c, ntdll/virtual.c,
> server/mapping.c and winedump/pe.c) : <swap_them_all.tgz>
> full winimage output with +module :<Winimage3.0-NT-PPC.log.gz>
More information about the wine-devel
mailing list