Modifying Subsystem in Winelib executables

Greg Geldorp ggeldorp at vmware.com
Tue Sep 29 05:11:24 CDT 2009


To fix one of the tests (shell32:shlexec) I'd like to copy the test executable
and change the Subsystem type from IMAGE_SUBSYSTEM_WINDOWS_CUI (console app) to
IMAGE_SUBSYSTEM_WINDOWS_GUI (GUI app) in the copy. Piece of cake for PE files,
get the IMAGE_DOS_HEADER, follow it to the IMAGE_NT_HEADERS and just patch the
OptionalHeaders.Subsystem field.
My limited understanding of the structure of Winelib executables makes doing
the same for testing on Wine quite a bit harder. I assume there's still a
IMAGE_NT_HEADERS structure in there somewhere and with some research I'll
probably be able to locate it in Linux ELF Winelib executables. What I'm
wondering about is how big the can of worms I'm trying to open is? Is the
encapsulation of PE headers in "native" executables the same for all OSes
supported by Wine? Is changing a PE header field in (a copy of) a Winelib
executable doomed to fail or is it a walk in the park?

Ge.



More information about the wine-devel mailing list