This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Updated: Cygwin 1.1.5-7



> >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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]