How can I find out if an application is a console app or a windows app.
I realize that if there the header starts with 0xd4 0x5a it cannot be
run in "DOS" mode but that not mean a windows 2000 console app. I have
win2k console apps and they also start with 0x4d 0x5a.

thanks for the help


john

Re: Console App - howto determine if an app is a console app by Igor

Igor
Thu Jun 02 06:56:01 CDT 2005

<tendengarci@yahoo.com> wrote in message
news:1117711356.717282.298980@g49g2000cwa.googlegroups.com
> How can I find out if an application is a console app or a windows
> app. I realize that if there the header starts with 0xd4 0x5a it
> cannot be run in "DOS" mode but that not mean a windows 2000 console
> app. I have win2k console apps and they also start with 0x4d 0x5a.

The PE (Portable Executable) file format is described here:

http://msdn.microsoft.com/library/en-us/dndebug/html/msdn_peeringpe.asp

You need to look at IMAGE_OPTIONAL_HEADER::Subsystem field.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: Console App - howto determine if an app is a console app by Jochen

Jochen
Thu Jun 02 07:07:45 CDT 2005

Hi tendengarci!
> How can I find out if an application is a console app or a windows app.
> I realize that if there the header starts with 0xd4 0x5a it cannot be
> run in "DOS" mode but that not mean a windows 2000 console app. I have
> win2k console apps and they also start with 0x4d 0x5a.

The offical way is to use the "ImageNtHeader" function and look into the
"IMAGE_NT_HEADERS" and here into "IMAGE_OPTIONAL_HEADER" and then
check the "Subsystem" value (IMAGE_SUBSYSTEM_WINDOWS_CUI).

See: ImageNtHeader
http://msdn.microsoft.com/library/en-us/debug/base/imagentheader.asp

See: IMAGE_NT_HEADERS
http://msdn.microsoft.com/library/en-us/debug/base/image_nt_headers_str.asp

See: IMAGE_OPTIONAL_HEADER
http://msdn.microsoft.com/library/en-us/debug/base/image_optional_header_str.asp

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Re: Console App - howto determine if an app is a console app by Jochen

Jochen
Thu Jun 02 07:22:30 CDT 2005

Hi Igor!
> The PE (Portable Executable) file format is described here:
> http://msdn.microsoft.com/library/en-us/dndebug/html/msdn_peeringpe.asp

And the (latest) specification is here:
http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Re: Console App - howto determine if an app is a console app by Alex

Alex
Thu Jun 02 07:42:17 CDT 2005

tendengarci@yahoo.com wrote:
> How can I find out if an application is a console app or
> a windows app.

KB90493 - "HOWTO: How To Determine Whether an Application is
Console or GUI"
http://support.microsoft.com/default.aspx?scid=kb;en-us;90493