The word EXE is short for executable. A .exe file is a program that can be executed on Microsoft Windows operating system. Application developers mostly publish their programs for Windows OS in executable format as exe files. It is the standard file format to run applications on Windows. Setup.exe, Install.exe and cmd.exe are some common and well familiar names of EXE files.
EXE File Format
MS-DOS compilers was introduced with the memory models having the 64K memory limitation. The general concept is to set different segment registers in the x86 CPU (CS, DS, ES, SS) to point to the different or same segments, therefore allowing various degrees of access to memory. Some specific memory models were:
Tiny: All memory accesses are 16-bit (segment registers unchanged). Produces a .COM file instead of an .EXE file.
Small: All memory accesses are 16-bit (segment registers unchanged).
Compact: Data addresses include both segment and offset, reloading the DS or ES registers on access and allowing up to 1M of data. Code accesses don’t change the CS register, allowing 64K of code.
Medium: Code addresses include the segment address, reloading CS on access and allowing up to 1M of code. Data accesses don’t change the DS and ES registers, allowing 64K of data.
Large: Both code and data addresses are (segment, offset) pairs, always reloading the segment addresses. The whole 1M byte memory space is available for both code and data.
Huge: Same as the large model, with additional arithmetic being generated by the compiler to allow access to arrays larger than 64K.
The developers have to decide that which model should be selected while creating an exe file.
Portable EXE File Format
The portable executable file format (PE) contains a number of informational headers, the following is the list of headers:
DOS header: MS-DOS header ensures either backwards compatibility, or graceful decline of new file types.
PE Header: At offset 60 (0x3C) from the beginning of the DOS header is a pointer to the PE File header
COFF Header: The COFF header has some information that is useful to an executable, and some information that is more useful to an object file.
PE Optional Header: The PE Optional Header occurs directly after the COFF header, and some sources even show the two headers as being part of the same structure.
Section Table: Immediately after the PE Optional Header we find a section table. The section table consists of an array of IMAGE_SECTION_HEADER structures.
Mappable Sections: Can save space in memory by mapping the code of a library into more than one process.
Can you run an EXE file on a Mac?
Exe files are not used as executables on Mac OS. However, if you want to run an exe file on Mac OS, the following methods can be used.
Wine - Wine is the perfect solution for people who want to use their PC applications on Mac systems. It’s an acronym that stands for “Wine Is Not A Emulator,” meaning. Wine creates the same environment of directories as used by Microsoft so you can run your Windows application using it.
Virtual Machines - Create a Windows Virtual Machine using Parallel Desktop or VM Virtual Box and run your application inside the virtual machine.
Boot Camp - Installing and configuring Windows Boot Camp on Mac OS lets you run the Windows OS on Mac machine.