Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Sun, 12 Nov 2000 16:52:47 -0500
Message-Id: <200011122152.QAA14305@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj@envy.delorie.com using -f
From: DJ Delorie <dj@delorie.com>
To: cygwin@cygwin.com
In-reply-to: <20001112131900.A29324@redhat.com> (message from Christopher
	Faylor on Sun, 12 Nov 2000 13:19:00 -0500)
Subject: Re: Updated: Cygwin 1.1.5-7
References: <200011120904.KAA19949@madrid.cdc.u-cergy.fr> <20001112131900.A29324@redhat.com>


> >How can we read this `magic number' ?
> 
> Huh?  Use 'read()', I guess.  Is this a trick question?

It is if you don't know where or what to read.

Here are some details:

open the file in binary mode.

Read the first two characters.

If they are "MZ" or "ZM" then you have an MS-DOS executable.

One of the fields in the DOS header has a pointer to a *second* magic
number.  If this second magic number is "PE\0\0" then you have a
32-bit Windows executable.

If you need more information than that, look up Ralf Brown's interrupt
list, which details all the executable header types.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

