Any Cygwin tool to change .exe subsystem type ?

Christian Franke Christian.Franke@t-online.de
Sat Mar 21 16:24:00 GMT 2009


Charles Wilson wrote:
> Dave Korn wrote:
>   
>> Christian Franke wrote:
>>     
>>> Is there any tool in the Cygwin distro that allows to change subsystem
>>> type (Console, GUI, ...) of an already linked .exe ?
>>>
>>> Same operation as e.g. 'editbin /subsystem:windows ...', but without the
>>> need to have MS tools installed.
>>>
>>>       
>>   Not yet, but it would make a great PTC for the new 'peflags' tool recently
>> discussed on this list.
>>     
>
>   

If desired, I can later provide a patch that adds some 'peflags 
--subsystem=...'.


For now, I use a quick hack within the project's Makefile.
It first checks the header magic number and then:

$ echo -ne '\002\000' | dd bs=1 count=2 seek=220 conv=notrunc of=file.exe

:-)

This works because apparently all cygwin and mingw compiled .exe have 
the optional header at the same position.


> Actually, I think THIS functionality, as well as the ability to set the
> date field of a PE object as recently mentioned on the gcc list, is a
> better fit for objdump.

I agree, but shouldn't this be a function of objcopy ?

-- 
Christian Franke


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list