EXE and COM files

EXE and COM files

Post by FREDERICO COS » Thu, 26 May 1994 18:24:01



        I want to add two instrutions in assembly to a program
        that i only have the EXE file. These instrutions had
        to be on the begining of the program. Can somemone
        help ?
        How can i obtain some information about the format
        of the files .EXE and .COM, like headers,format, etc

--
________________________________________________________
DETUA/UA                                        |
Universidade de Aveiro          | Frederico Pereira da Costa
3800 Aveiro                     | EMAIL:

________________________________________________________

 
 
 

EXE and COM files

Post by Arne Bakkeb » Fri, 27 May 1994 17:16:05


Quote:>        I want to add two instrutions in assembly to a program
>        that i only have the EXE file. These instrutions had

Adding something to an EXE-file is very difficult, and not adviceable,
as DOS puts in lots of pointer-info. for jumps and calls when it executs
the program.

Quote:>        How can i obtain some information about the format
>        of the files .EXE and .COM, like headers,format, etc

COM-files dont have an actual format, WhatYouSeeIsWhatYouGet :)) .
The program is just loaded and startet at the first byte.(Which is adr.100h)
I dont have the EXE-format on hand right now, but I suppose you could find
it on some FTP on machinereadable form somewhere.


VERY regular IRC-user (Bratt on #Norge) :) /   your duty to remember!

Oh...and what is the meaning of life?

 
 
 

EXE and COM files

Post by Paul Francis Gilbe » Wed, 01 Jun 1994 14:04:15



>    I want to add two instrutions in assembly to a program
>    that i only have the EXE file. These instrutions had
>    to be on the begining of the program. Can somemone
>    help ?
>    How can i obtain some information about the format
>    of the files .EXE and .COM, like headers,format, etc
>--
>________________________________________________________
>DETUA/UA                                    |
>Universidade de Aveiro              | Frederico Pereira da Costa
>3800 Aveiro                         | EMAIL:

>________________________________________________________

I'd recommend the following (and you'll need Assembly experience for this):

1) Dissassemble the code with a dissassembler.

        Under DEBUG, you could find the section of the program with the
code, and the parts with data, and create a small DEBUG script to dump
these, redirecting screen output to a file.

        Another valuable program is CRACKER, included as part of the
shareware package CrackAid (a game unprotector sort of like Nevelok).

2) Once you have a listing, edit out any non assembly language
instructions, convert memory references to labels (say 'Data1' as first,
but can be changed when it's function is worked out). Translate data areas
to text strings with db, or data bytes with db. As you work out what each
data area is for, you can break down the db statements into individual
storage locations.

3) Finially, add on appropriate segment codings and recompile it.

---------------------

This method basically works by reverse-engineering the code. It may also
be feasible to redirect the program start to your instructions, then have
a jump to the program. Hell, viruses do it all the time. Don't have info
on the EXE headers with me at the moment, sorry.

Hope this helps anyway.

Paul.

 
 
 

EXE and COM files

Post by David Smi » Thu, 02 Jun 1994 17:12:03



: >  I want to add two instrutions in assembly to a program
: >  that i only have the EXE file. These instrutions had
: >  to be on the begining of the program. Can somemone
: >  help ?
: >  How can i obtain some information about the format
: >  of the files .EXE and .COM, like headers,format, etc

You'll need to perform some minor surgery on the exe file to accomplish this.

First off the structure of an exe header:

offset           field
----------------------------------------------------------------
00h              Link program .exe file signature
02h              Length of image
04h              Size of file in 512-byte pages
06h              Number of relocatable-table items
08h              Size of header in paragraphs
0Ah              minimun number of paragraphs required
0Ch              Maximum number of paragraphs wanted
0Eh              Displacement of stack segment in paragraphs
10h              Offset in SP ragister
12h              Word checksum
14h              IP register offset
16h              Code segment displacement
18h              Displacement of first relocation item
1Ah              Overlay number
---------------------------------------------------------------

What you need to do is add the two instructions to the end of the exe file.
Follow it with a FAR JMP to the CS:IP given in the header.  Then change the
IP and CS fields to indicate the relative location in the program of your new
starting point.  Add a relocation entry corresponding to the location of the
JMP CS:IP so the loader can set the segment properly when you load up.  
Fix the length of the file, length of image, size of the header and the
number of relocation items and you should be all set.  You mightH need to fix
the word checksum, but I think that is actually unused.  

If you get it to work let me know!

 
 
 

EXE and COM files

Post by Anders Erikss » Sat, 11 Jun 1994 15:58:17



:       Another valuable program is CRACKER, included as part of the
: shareware package CrackAid (a game unprotector sort of like Nevelok).

Sounds cool, where do I find these utilities? Archie gives me zip.

Rgds,
Anders

--
      ____________________________________________________________________
     /                                                                  / \
    / Anders Eriksson               Fax:        +46 920 75490          /___\

    | Snail mail: Telia Research AB, Aurorum 6, S-977 75 Lulea, Sweden |
    |                                                                  |
    | Dogs crawl under fences, software crawls under Windows.          |
 _ /_________________________________________________________________  /
 \___________________________________________________________________\/

 
 
 

1. converting batch files to com/exe files

  Hello Netters,

  I have a question for anyone that can answer it.  I want to write a
  program which converts a batch file in to an exe file, but I don't
  know how to do  this.  If any one has any idea on how to do this or
  know where I can get my hands on a source code to refer to, please
  share this info with me.

                                                ThankX in advance.
                                                Mayank

  ps.  I don't read this news groop often so please e-mail me any info.

2. GA in Smalltalk

3. Can I split my EXE-file into a EXE-file and a OBJ-file?

4. choosing mutt terminal via toolbar-mail-reader

5. Com&Exe files

6. Calling DOS programs from Win32(s)

7. Help Writing .bat/.com/.exe File?

8. Looking for a good Avenue Programming Book

9. Executing .EXE and .COM files from assembly language

10. .com and .exe files

11. Add an exe file within an exe file?