Introduction
A .pif file tells Windows how to run an MS-DOS program: which program, what
memory it wants, whether it runs in a window, and what its title is. The format
started with TopView and was taken up and extended by DESQview and Windows.
Microsoft never published it, and said so (Knowledge Base Q101416: the format will not be
published). What is known comes from four public sources: the DESQview .PIF header
in Ralf Brown’s interrupt list, Michael Maurice’s PIFSTRUC.H in Dr. Dobb’s
Journal (July 1993: the classic header and the Windows 3.x and NT 3.1 sections), Sergey
Merzlikin’s table of every section including those of Windows 95 and NT 4.0 (experimentally
derived, as he says), and the real files. These pages describe every field of every section
known, checked against 165 distinct real PIF files from Windows 3.1, 95 and NT 4.0 era
systems; fields no source names are marked unknown, with the values seen.
A .pif file dropped on any page opens in the explorer. It shows the title,
program, directory and parameters, the memory, display, key and mouse settings, the hot key,
the icon reference, every flag bit that is set, and the sections of the file; the tree tab
shows every field against its bytes. A .pif file that is really a DOS or Windows
program (it starts with MZ) opens in the program
viewer; one that is neither says so.
Versions
| Written by | Size | Sections |
|---|---|---|
| TopView, DESQview, Windows 1.x and 2.x | 0x171 (369) | none: the header only |
| Windows 3.x | 0x221 (545) in 27 of the real files | 386, 286 (in either order) |
| Windows 95 and 98 | 0x3C7 (967) in 118 files | 386, VMM 4.0; with MS-DOS mode also CONFIG SYS 4.0 and AUTOEXECBAT 4.0 |
| Windows NT 3.1 | varies | 386, 286, NT 3.1 |
| Windows NT 4.0, 2000 and later | 0xB0D (2829) in 14 files | 386, VMM 4.0, NT 4.0, NT 3.1 |
Telling a PIF from something else
A real PIF starts with a zero byte, is at least 0x171 bytes long, and has
MICROSOFT PIFEX and a zero byte at 0x171 (a file of exactly 0x171 bytes with
a zero first byte and a printable title is a header-only PIF). Windows runs a file by its
contents, not its extension: a .pif file that starts with MZ is a DOS
or Windows program, and Windows runs it as one. That is why mail filters block the extension:
malware renamed .exe to .pif. The explorer reads such a file as the
program it is, and says so; a text file or any other data named .pif is
reported as not being a program information file.
Structure
Every PIF starts with a fixed classic
header of 0x171 (369) bytes. After it comes a chain of
named sections. The first heading is always
at 0x171 and is called MICROSOFT PIFEX; the others hold settings for each
version of Windows.
0Classic header title, memory, program path, directory, parameters, screen settings0x1710x171MICROSOFT PIFEX the first section heading; its data is the classic header22…WINDOWS 386 3.0 heading and data, for Windows enhanced modevaries…more sections: WINDOWS 286 3.0, WINDOWS VMM 4.0, WINDOWS NT 3.1, WINDOWS NT 4.0, CONFIG SYS 4.0, AUTOEXECBAT 4.0varies
Not described
Known, not yet covered
- Viewer: the icon is shown as a file name and an index (usually icon
0ofPIFMGR.DLL); the picture is not drawn. - Viewer: OEM text (title, program, directory, parameters, batch file) is shown in code page 437; a PIF written on a machine with another OEM code page (850, 866 and so on) shows its accented letters wrongly, and there is no option to choose the page.
- Reference and viewer: DESQview’s
.DVPcontinuation of the header (menu keys, script buffer, version, serial-port use, protection level, the DESQview/XXDVPrecords) is documented by Ralf Brown’s interrupt list (tables 00427 to 00432) but is a different format with its own extension; a.piffile that continues the header that way is not read as a PIF.
Unknown
- Reference: which of bits 6 and 7 of the flags byte at
0x63is COM1 and which COM2: Dr. Dobb’s and Merzlikin disagree and none of the 165 real files sets either. - Reference and viewer: the fields no source names, shown as “Unknown” with the values seen: VMM 4.0 offsets 0x00 (88 bytes), 0xAC, 0xBA, 0xC6, the seven words at 0xC8 (always 5, 25, 3, 200, 1000, 2, 10), 0xD8, 0xE0, 0x12A, 0x152 and 0x1AA, and bit 0 of 0x12C; 386 section offsets 0x16, 0x20, 0x22 and 0x24; NT 3.1 bytes 0x02 to 0x0B and the last word; NT 4.0 offsets 0x000, 0x184 (240 bytes) and 0x56E (286 bytes). They are zero (or constant) in every real file, so nothing says what they hold when set.
- Reference: the
CONFIG SYS 4.0andAUTOEXECBAT 4.0sections come from Merzlikin only; none of the 165 real files has one, so the viewer’s reading of them is tested on built files. - Reference: searched for more: Microsoft’s Windows 3.1 and 95 resource kit pages (they describe the PIF editor’s dialogs, not the bytes; Knowledge Base Q101416 says the format is not published), Dr. Dobb’s listings, Merzlikin’s page (read from the Internet Archive copy), Ralf Brown’s interrupt list 61 (the DESQview header and the shell’s flag tables), Wikipedia, and a search for open-source readers (Wine, ReactOS and Kaitai Struct’s gallery have none).
Links
Software
- Windows File Explorer – edits a PIF in the Properties of its file (Windows)
- PIF Editor – the settings editor of Windows 3.x (Windows)
Reference
- The PIF File Format – Michael Maurice’s article in Dr. Dobb’s Journal, July 1993, the source for the classic header and the Windows 3.x sections, with the
PIFSTRUC.Hlisting - The PIF file format in various Windows versions – Sergey Merzlikin’s table of every section (Internet Archive copy)
- Ralf Brown’s Interrupt List – the DESQview .PIF/.DVP header (INT 15/AX=102Ch, table 00427) and the Windows shell flag tables
- Q101416: .PIF File Format Unavailable – Microsoft’s statement that the format is not published
- Program information file – Wikipedia