delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/12/16:54:33

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT 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 AT envy DOT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: cygwin AT cygwin DOT 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 DOT KAA19949 AT madrid DOT cdc DOT u-cergy DOT fr> <20001112131900 DOT A29324 AT redhat DOT 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019