The fixed part every PIF starts with. It is 0x171 bytes long. It is inherited from TopView, and Windows uses only part of it.
Microsoft has not published this layout. It is the DESQview .PIF header, which
Ralf Brown’s interrupt list (table 00427) documents field by field; the names below follow
that list and Michael Maurice’s PIFSTRUC.H (Dr. Dobb’s Journal, July 1993), and
Sergey Merzlikin’s table gives what Windows does with each field. Every field was checked
against 165 distinct real PIFs. Files of exactly 0x171 bytes, with no sections, are the
Windows 1.x and 2.x PIFs (and plain TopView or DESQview ones); the Windows PIFs of every later
version continue with the section chain.
DESQview’s own .DVP files continue this header with their own fields from 0x171
(menu keys, script buffer, version, serial ports, protection level and for DESQview/X an
XDVP record list at 0x19C; Ralf Brown’s list gives them), which is why a PIF
for Windows starts its chain at the same place: a .DVP file is a different
format and is not read here.
Text fields (title, program, directory, parameters, shared names) are in the OEM character set, zero-terminated and zero-padded; the title is padded with spaces by Windows 95 and later and with zeros by Windows 3.x. All numbers are little-endian.
Fields
0x00Reserved and checksum1 + 10x02Title, padded with spaces300x20Maximum and minimum memory2 + 20x24Program path630x63Flags and a drive byte1 + 10x65Start directory, then parameters64 + 640xE5screen, interrupts, window position and system memory100xEFShared program name and data file64 + 640x16Ftwo flag bytes1 + 1
| Offset | Size | Name | Description |
|---|---|---|---|
0x00 | 1 | Reserved | Zero in Windows PIFs. |
0x01 | 1 | Checksum | The byte sum of 0x02 to 0x170, modulo 256 (DESQview, Dr. Dobb’s), written by the Windows 3.x PIF editor. Windows 95 and later always write 78, whatever the contents, and nothing checks it. Of 165 real files 27 hold the sum, 132 hold 78 and 6 hold something else (4 hold 00). |
0x02 | 30 | Title | The window title, padded with spaces (Windows 95 and later) or zeros (Windows 3.x). |
0x20 | 2 | Maximum memory | KB of conventional memory. 0x0280 (640) in Windows 95 and later, 0x0080 in Windows 3.x, 0x0034 in Windows 1.x and 2.x. Set by the PIF editor only in standard mode and Windows 1.x/2.x; otherwise the default. |
0x22 | 2 | Minimum memory | KB. 0 in Windows 95 and later, 0x0080 in Windows 3.x, 0x0034 in Windows 1.x/2.x. |
0x24 | 63 | Program path | The program, without parameters; a full path, or a long file name without quotes. DESQview’s path is 64 bytes: its last byte is the Windows flags byte below. |
0x63 | 1 | Flags | See Flags. |
0x64 | 1 | Default drive | DESQview: the default drive letter. Zero in every real Windows PIF; Windows does not use it. |
0x65 | 64 | Start directory | The working directory; a long path without quotes. |
0xA5 | 64 | Parameters | The program’s parameters. In 32-bit Windows and Windows 3.x enhanced mode they are read from the 386 section instead when there is one. |
0xE5 | 1 | Initial screen mode | DESQview: 0 to 7. 00 or 7F in real files (7F in 11 of 165). Not used. |
0xE6 | 1 | Text pages | The number of text pages used; 1. Not used. |
0xE7 | 1 | First interrupt | The number of the first interrupt to save; 0. Not used. |
0xE8 | 1 | Last interrupt | The number of the last interrupt to save; FF. Not used. |
0xE9 | 1 | Rows | Rows of the virtual screen buffer; 25. Not used. |
0xEA | 1 | Columns | Columns of the virtual screen buffer; 80. Not used. |
0xEB | 1 | Window row | DESQview: the window’s initial row; 0. |
0xEC | 1 | Window column | DESQview: the initial column; 0. |
0xED | 2 | System memory | DESQview: system memory in KB. 7 in every real file (Merzlikin reads it as the number of the last text video page). |
0xEF | 64 | Shared program name | DESQview’s shared program. Zero in every real file. |
0x12F | 64 | Shared data file | Its data file. Zero in every real file. |
0x16F | 2 | Flags 2 | Two flag bytes: 0x16F is DESQview’s program flags 1, 0x170 its flags 2. See Flags 2. Windows 3.x writes 0x20E0 (26 files) or 0x60E0 (3), Windows 95 and later 0000. |
Flags
The bits of the flags byte at 0x63. Only Close on exit is used in 386 enhanced
mode and by Windows 95 and later; the others belong to standard mode and Windows 1.x and 2.x.
In real files the byte is 00 (131 of 165) or 10 (34). The names are Dr. Dobb’s
(Graph286 and so on); the descriptions are Merzlikin’s.
| Bit | Mask | Name | Meaning |
|---|---|---|---|
| 0 | 0x01 | (unused in Dr. Dobb’s) | Directly modify memory (Windows 1.x/2.x) |
| 1 | 0x02 | Graph286 | Screen exchange: graphics or multiple text |
| 2 | 0x04 | PreventSwitch | Prevent program switch |
| 3 | 0x08 | NoScreenExch | No screen exchange |
| 4 | 0x10 | Close_OnExit | Close the window on exit |
| 6 | 0x40 | Com2 | Direct use of COM2 (Dr. Dobb’s) |
| 7 | 0x80 | Com1 | Direct use of COM1 (Dr. Dobb’s) |
Merzlikin gives bits 6 and 7 the other way round (COM1 and COM2). No real file here sets either, so the conflict is not settled by a file; the viewer follows Dr. Dobb’s, who tested their tool against Windows 3.1 and NT.
Flags 2
The two bytes at 0x16F read as one little-endian word. The low byte is
DESQview’s program flags 1 (Ralf Brown’s table 00428), the high byte its flags 2.
| Mask | Meaning |
|---|---|
| 0x0001 | Swappable (DESQview) |
| 0x0010 | Accesses the system keyboard buffer directly |
| 0x0020 | Uses the maths coprocessor |
| 0x0040 | Runs in the foreground only (Windows standard mode: stop in background; Windows 1.x/2.x set 0x0080 and 0x0040 together) |
| 0x0080 | Writes text directly to the screen |
| 0x2000 | Swaps interrupt vectors (flags 2 bit 5) |
| 0x4000 | Uses the parameters in the field at 0xA5 (flags 2 bit 6) |
Windows 3.x writes 0x20E0 (26 of 165 real files) or 0x60E0 (3);
Windows 1.x and 2.x 0x60E0, and the other real files hold 0000.
Example
The start of DOSPRMPT.PIF from Windows 3.1:
000000 00 00 4D 53 2D 44 4F 53 20 50 72 6F 6D 70 74 00 reserved, checksum 00, title "MS-DOS Prompt"
000020 80 02 80 00 43 4F 4D 4D 41 4E 44 2E 43 4F 4D 00 max 0x0280, min 0x0080, program "COMMAND.COM"