This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
A computer file format in which each character position can hold any one of 256 different binary codes is called a binary file. Binary files can be compared to ASCII files, which contain a smaller set of codes for only alphabetic letters, numeric digits, special symbols and a few control codes.
Since binary files use all eight bits of the byte, they can contain both ASCII and almost all the other codes. ASCII file uses only seven bits of the byte and therefore they can be used in binary files too.
Executable software (machine language programs), most word processing files and database, spreadsheet and multimedia files are binary files. However, text and source program files as well as HTML and XML files are ASCII text files, not binary. ASCII text files are different than binary files.
WINDOWS BINARY FILE FORMAT
The binary file format used by Microsoft Windows operating system is called the Windows New Executable (NE). This file format is also known as segmented executable. This Binary File Format was defined and made keeping in mind the applications and dynamic link libraries (DLL). The NE is an extension to the old MSDOS EXE Binary File Format. Extra information about the codes, data, and resources of windows is contained. There are two headers for the NE: the old-style MSDOS header and the new segmented header.
The information for a MS DOS executable file is contained in the old MS-DOS file header. The top four parts of the NE BFF describes a stub MS-DOS program. If this file is run in real mode MS-DOS (without Windows) the stub program is executed, usually displaying this message - "This program must be run under Microsoft Windows".
The information for the loader in Microsoft Windows is contained in the Windows new segmented header. This header is recognized as the new segment header if it contains the signature word - "NE". Information like - entry table offsets, flags, linker version number, etc is contained in the new executable format (EXE). The Windows loader copies this header into the system's module table. Information is managed and support for dynamic linking is provided in the module table.
LINUX BINARY FILE FORMAT
The structure of executable and linking format (ELF) of Linux is organised in a very general manner. Sun Sparcs and Intel x86 machines which run the Solaris operating system can use this binary file format. The Executable and Linking Format provides a parallel view of the file's contents: one for program linking and the other for program execution.
The ELF format has replaced older executable formats such as a.out and COFF in many Unix-like operating systems such as Linux, Solaris, IRIX, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Syllable, and HP-UX.
Each ELF file is made up of basically two components. First is the ELF header which is followed by data to be contained in the file. The file data can include:
- Program header table, describing zero or more segments
- Section header table, describing zero or more sections
- Data referred to by entries in the program header table, or the section header table
The segments contain information that is necessary for runtime execution of the file, while sections contain important data for linking and relocation. There can be some orphan bytes, which are not covered by any section. Otherwise each byte in the entire file is taken by no more than one section at a time. In the normal case of a UNIX executable one or more sections are enclosed in one segment.
GENERAL STRUCTURE OF BINARY FILE FORMAT
The general structure of a BFF object can be seen to be made up by the following abstraction:
- A header that contains general information and information that is required to access various parts of the file.
- A number of sections holding code and data (raw data).
- Relocation tables.
- Symbol table information.
Most BFF objects can be mapped to the general model shown in the above figure. Information regarding sections, symbol table etc. usually are identified within the file header.
WINDOWS BFF STRUCTURE
The following figure shows the structure of the Windows New Extension (NE) format.
LINUX BFF STRUCTURE
The following figure shows the structure of executable and linking format (ELF) which is a Linux binary file format.