The PIF file format in various Windows versions

The files of a described format are applied in all existing on the today Windows versions. Earlier files of a similar format were applied in TopView and DesqView products.These files are intended to store start parameters of the DOS applications in environment of the appropriate operation systems and graphic shells.

Officially format of a PIF file is not documented. The format described in the present document is received by an experimental way. The author does not responsible for probable discrepancies in the given document, and also for any damage caused by application of the items of information, given in the present document.

In Windows 1.X, 2.X, and also in TopView and DesqView the PIF file consisted only of the basic section of the length 0171h bytes. Subsequently, since Windows 3.0, in PIF file the additional sections have appeared. For compatibility with earlier versions the heading of the basic section has been placed after the section data, at offset 0171h from the beginning of a file. All sections, except for basic, may be missed. In these cases the missing data accept default values or undertake from other sections. All sections, except for basic, may be placed in any order. The data of the basic section always is placed at the beginning of a file. The minimal length of a PIF file accepted by all Windows versions - 0187h bytes (the basic section and it’s heading). All Windows versions, except for NT and 2000, normally accept PIF files of length 0171h bytes.

The structure of a PIF file can be presented as follows:

Offset from the beginning of a file Length The file part
0000h 0171h Basic section
0171h 0016h Heading of the basic section
0187h 0016h Heading of the first section
019Dh   First section
  0016h Heading of the second section
    Second section
    ...
  0016h Heading of the last section
    Last section
The reading of a PIF file should be begun from finding out of it’s length. If it is equal0171h, means, it is a PIF file in Windows 1.X format. In this case it is necessary to read the data of the basic section from the beginning of a file. If length exceeds 0171h,it is necessary to read heading of the basic section at offset 0171hfrom the beginning of a file. The further reading should be performed based on the data from the heading of the basic section.

On the present moment the following sections of a PIF file are known:

Section name Data length Apply to
MICROSOFT PIFEX 0171h The basic section, all OS
WINDOWS 286 3.0 0006h Windows 3.X in standard mode
WINDOWS 386 3.0 0068h Windows 3.X in enhanced mode, 95, 98, NT, 2000
WINDOWS NT  3.1 008Eh Windows NT, 2000
WINDOWS NT  4.0 068Ch Windows NT 4.0, 2000
WINDOWS VMM 4.0 01ACh Windows 95, 98, NT 4.0, 2000
CONFIG  SYS 4.0 Variable Windows 95, 98
AUTOEXECBAT 4.0 Variable Windows 95, 98
The contents of a PIF file sections are described in the following table.

Conditional designations in column “Applicability to the Windows versions”:

Offset from the begin-
ning of section data
Length Default value Accepted values Purpose Applicability to the Windows versions Comment
1.X, 2.X 3.X in mode: 95, 98 NT, 2000
Stan-
dard
Ex-
ten-
ded
Heading of the section. Length - 0016h
0000h 16     Name of the section   S X 95 NT ANSI character set, is trailed by a null symbol.
0010h 2     Offset of heading of the next section from the beginning of the file   S X 95 NT In last section accepts value FFFFh.
0012h 2     Offset of the beginning of the section data from the beginning of the file   S X 95 NT  
0014h 2     Section data length   S X 95 NT In bytes.
Basic section. Length - 0171h
0000h 1 00h   Not used            
0001h 1 78h   Checksum 1 S X 95 NT In Windows 95/98 - always 78h, in other OS - the value varies. Never is checked.
0002h 30     Window title 1 S X 95 NT The OEM character set. Is padded by blanks up to 30 symbols.
0020h 2 0280h in 32-bit OS, 0080h in Windows 3.X, 0034h in Windows 1.X, 2.X.   Maximal amount of the conventional memory in kilobytes 1 S X 95 NT Is set by the PIF-editor only in Windows 1.X, 2.X and Windows 3.X in standard mode, in other cases accepts a default value.
0022h 2 0000h in 32-bit OS, 0080h in Windows 3.X, 0034h in Windows 1.X, 2.X.   Minimal amount of the conventional memory in kilobytes 1 S X 95 NT
0024h 63     The program filename without parameters 1 S X 95 NT Can contain complete path, long filename without quotes, trailed by a null symbol, OEM character set.
0063h 2 0000h In 32-bit OS, 0010h in others 0001h Directly modify memory 1         Bit mask. In Windows 1.X, 2.X bit 02h concerns to parameter Screen Exchange - Graphics / Text.
0002h Graphics / Multiple Text mode 1 S      
0004h Prevent program switch 1 S      
0008h No screen exchange 1 S      
0010h Close window on exit 1 S X 95 NT
0040h Direct interaction with COM1 1 S      
0080h Direct interaction with COM2 1 S      
0065h 64     The working directory 1 S X 95 NT Long pathname without quotes, trailed by a null symbol, OEM character set.
00A5h 64     Parameters string 1 S   95 NT Is trailed by a null symbol. OEM character set. In 32-bit OS and in enhanced mode of Windows 3.X this value is used only if there is no section containing a parameters string for given OS.
00E5h 1 00h In 32-bit OS, 7Fh in others   ?? Video mode 1 S X     Not used.
00E6h 1 01h   ?? Quantity of the allocated text video pages 1 S X 95 NT Not used.
00E7h 1 00h   ?? The first used interrupt 1 S X 95 NT Not used.
00E8h 1 FFh   ?? Last used interrupt 1 S X 95 NT Not used.
00E9h 1 19h   ?? Height of the screen in symbols 1 S X 95 NT Not used.
00EAh 1 50h   ?? Width of the screen in symbols 1 S X 95 NT Not used.
00EBh 1 00h   ?? Horizontal window position           Not used.
00ECh 1 00h   ?? Vertical window position            Not used.
00EDh 2 0007h 0007h ?? Number of last text video page 1 S X 95 NT Number of last text video page is not used. In Windows 1.X, 2.X bit 0010h concerns to parameter Program Switch - Graphics / Multiple Text.
0010h Graphics / Multiple Text mode 1 S      
00EFh 128 00...0000h   Not used            
016Fh 2 0000h In Windows 95/98, 20E0h in Windows NT/2000 and Windows 3.X, 60E0h in Windows 1.X, 2.X. 0010h Direct interaction with the keyboard 1 S       Bit mask. In Windows 1.X, 2.X bit 4000h is always set, when the parameter Directly Modify Screen is changed the bits 0080h and 0040h are set simulta-
neously.
0020h ?? Use coprocessor 1 S X   NT
0040h ?? Stop in background mode 1 S X   NT
0080h Directly modify screen 1 S X   NT
2000h ?? Exchange interrupt vectors 1 S X   NT
4000h There are parameters in the command line 1 S      
Section “WINDOWS 386 3.0”. Data length - 0068h.
0000h 2 0280h   Maximal amount of the conventional memory in kilobytes, which can occupy the application     X 95 NT For 32-bit OS auto - 640 and more, for Windows 3.X to allocate all memory – FFFFh.
0002h 2 0000h In 32-bit OS, 0080h in Windows 3.X   Required amount of the conventional memory in kilobytes     X 95 NT For 32-bit OS auto - 0, for Windows 3.X to allocate all memory - FFFFh.
0004h 2 0064h   Active priority     X 95 NT Range of values: 1-10000.
0006h 2 0032h   Background priority     X 95 NT
0008h 2 FFFFh in 32-bit OS, 0400h in Windows 3.X   Maximal amount of EMS memory in kilobytes, which can occupy the application     X 95 NT The maximal value - 16384, auto for 32-bit OS or to allocate all for Windows 3.X - FFFFh.
000Ah 2 0000h   Required amount of EMS memory     X 95 NT The maximal value - 16384, auto for 32-bit OS - 0 to allocate all for Windows 3.X - FFFFh.
000Ch 2 FFFFh in 32-bit OS, 0400h in Windows 3.X   Maximal amount of XMS memory in kilobytes, which can occupy the application     X 95 NT The maximal value - 16384, auto for 32-bit OS or to allocate all for Windows 3.X - FFFFh.
000Eh 2 0000h   Required amount of XMS memory     X 95 NT The maximal value - 16384, auto for 32-bit OS - 0 to allocate all for Windows 3.X - FFFFh.
0010h 4 00021002h 00000001h Permit an exit when is active     X     Bit mask. In 32-bit OS the bit 00001000h is set to zero when the maximal priority is set.
00000002h Continuation of work in a background mode     X 95 NT
00000004h Exclusive run mode     X    
00000008h Full-screen mode     X 95 NT
00000020h Not use Alt+Tab     X 95 NT
00000040h Not use Alt+Esc     X 95 NT
00000080h Not use Alt+Space     X 95 NT
00000100h Not use Alt+Enter     X 95 NT
00000200h Not use Alt+PrtSc     X 95 NT
00000400h Not use PrtSc     X 95 NT
00000800h Not use Ctrl+Esc     X 95 NT
00001000h Detect idle time     X 95 NT
00002000h Not use HMA     X 95 NT
00004000h Use shortcut key     X 95 NT
00008000h EMS memory is locked     X    
00010000h XMS memory is locked     X    
00020000h Use fast paste     X 95 NT
00040000h Lock application memory     X    
00080000h Memory protection       95 NT
00100000h Minimized window     X 95 NT
00200000h Maximized window     X 95 NT
00800000h MS-DOS mode       95  
01000000h Prevent Windows detection       95  
04000000h Not automatically offer transition in a MS-DOS mode       95  
10000000h Not warn before transition in a MS-DOS mode       95  
0014h 2 001Fh 0001h Video ROM emulation     X 95 NT Bit mask.
0002h Do not check ports: text     X 95 NT
0004h Do not check ports: low graphics     X 95 NT
0008h Do not check ports: high graphics     X 95 NT
0010h Video memory: text     X 95 NT
0020h Video memory: low graphics     X    
0040h Video memory: high graphics     X    
0080h Retain video memory     X    
0018h 2 0000h   Scan code of a shortcut key.     X 95 NT See Microsoft KB Q37617.
001Ah 2 0000h 0003h Shortcut key modifier: Shift     X 95 NT Bit mask.
0004h Shortcut key modifier: Ctrl     X 95 NT
0008h Shortcut key modifier: Alt     X 95 NT
001Ch 2 0000h 000Fh Use shortcut key     X 95 NT  
001Eh 2 0000h 0001h The shortcut key scan code is extended     X 95 NT  
0020h 2 0000h, 0064h in Windows NT   Unknown         NT  
0022h 2 0000h, 0032h in Windows NT   Unknown         NT  
0024h 4 00000000h   Unknown            
0028h 64     Parameters string     X 95 NT Is trailed by a null symbol. OEM character set. There is a bug in Windows 95/98/NT/2000, due to which the parameters string saves in the ANSI charset, besides in Windows 95/98 this value passes to program once again converted into the ANSI charset.
Section “WINDOWS 286 3.0”. Data length - 0006h.
0000h 2 0400h   Maximal amount of XMS memory   S       The maximal value – 16384, to allocate all - FFFFh.
0002h 2 0000h   Required volume of XMS memory   S       The maximal value – 16384, to allocate all - FFFFh.
0004h 2 0000h 0001h Not use Alt+Tab   S       Bit mask.
0002h Not use Alt+Esc   S      
0004h Not use Alt+PrtSc   S      
0008h Not use PrtSc   S      
0010h Not use Ctrl+Esc   S      
0020h Not keep the screen   S      
4000h Direct interaction with COM3   S      
8000h Direct interaction with COM4   S      
Section “WINDOWS VMM 4.0”. Data length - 01ACh.
0000h 88 00...0000h   Unknown            
0058h 80 PIFMGR.DLL   Name of the file containing an icon       95 NT ANSI character set, long filename without quotes, can contain a complete path, is trailed by a null symbol.
00A8h 2 0000h   Number of an icon       95 NT The first icon in a file has number 0.
00AAh 2 0002h 0002h Continue to run in background mode       95 NT Bit mask.
0010h Not warn on exit       95 NT
0020h Disallow Screen Saver       95 NT
00ACh 10 00...0000h   Unknown            
00B6h 2 0032h   Priority       95 NT Number from 0 up to 100, 0 - maximal priority, 100 - minimal.
00B8h 2 0001h 0001h Video-ROM emulation       95 NT Bit mask.
0080h Do not dynamically allocate video memory        95 NT
0100h Full-screen mode       95 NT
00BAh 8 00...0000h   Unknown            
00C2h 2 0000h   Number of text lines in a window       95   Auto - 0, or appropriate number (25, 43 or 50).
00C4h 2 0001h 0001h Fast paste       95 NT Bit mask.
0020h Not use Alt+Tab       95 NT
0040h Not use Alt+Esc       95 NT
0080h Not use Alt+Space       95 NT
0100h Not use Alt+Enter       95 NT
0200h Not use Alt+PrtSc       95 NT
0400h Not use PrtSc       95 NT
0800h Not use Ctrl+Esc       95 NT
00C6h 2 0000h   Unknown            
00C8h 2 0005h   Unknown       95 NT  
00CAh 2 0019h   Unknown       95 NT  
00CCh 2 0003h   Unknown       95 NT  
00CEh 2 00C8h   Unknown       95 NT  
00D0h 2 03E8h   Unknown       95 NT  
00D2h 2 0002h   Unknown       95 NT  
00D4h 2 000Ah   Unknown       95 NT  
00D6h 2 0001h 0001h Not use the mouse for selection       95   Bit mask.
0002h Exclusive use of the mouse       95 NT
00D8h 6 00...0000h   Unknown            
00DEh 2 001Ch 0004h Use raster fonts       95 NT Bit mask.
0008h Use TrueType fonts       95 NT
0010h Automatically choose the font size       95 NT
0400h The current font is raster       95 NT
0800h The current font is TrueType       95 NT
00E0h 2 0000h   Unknown            
00E2h 2 0000h   Horizontal size of the current font (only for raster fonts).       95 NT Auto or TrueType - 0000h, raster font - horizontal size in pixels.
00E4h 2 0000h   Vertical size of the current font.       95 NT Auto - any value, otherwise vertical size in pixels.
00E6h 2 0000h   Horizontal size of the current font.       95 NT Auto - any value, otherwise horizontal size in pixels.
00E8h 2 0000h   Vertical size of the current font.       95 NT Auto - any value, otherwise vertical size in pixels.
00EAh 32 Terminal   The name of a raster font       95 NT Not used, trailed by a null symbol.
010Ah 32 Lucida Console   The name of a TrueType font       95 NT Not used, trailed by a null symbol.
012Ah 2 04E3h in Windows NT/2000, 0000h in Windows 95/98   Unknown         NT  
012Ch 2 0003h 0001h Unknown       95 NT Bit mask.
0002h Show toolbar       95 NT
012Eh 2 0000h 0001h Not restore settings at startup       95 NT  
0130h 2 0000h   ?? The horizontal size of the screen in symbols       95   After the first start of the program the value becomes equal to 80.
0132h 2 0000h   ?? The vertical size of the screen in symbols       95   After the first start of the program the value becomes equal to 25.
0134h 2 0000h   The horizontal size of the window client area       95   In pixels.
0136h 2 0000h   The vertical size of the window client area       95   In pixels.
0138h 2 0000h   The horizontal size of the window       95   In pixels.
013Ah 2 0000h   The vertical size of the window       95   In pixels.
013Ch 2 0016h   Unknown       95 NT  
013Eh 2 0000h 0002h At last start the window was maximized       95   Bit mask. If the given value is not set, the value at offset 0140h is not interpreted.
0140h 2 0001h 0001h At last start the window was of the normal size       95   Is not a bit mask. The value 0002h is interpreted as the maximized window.
0002h At last start the window was minimized       95  
0003h At last start the window was maximized       95  
0142h 2 FFFFh   Unknown       95    
0144h 2 FFFFh   Unknown       95    
0146h 2 FFFFh   The right window border position in maximized window       95   In pixels, if the given value is less than or equal to the left border position, and the values at offsets 013Eh, 0140h specify that the window was maximized, it is considered, that the parameters of the window were not saved, and the default values are used.
0148h 2 FFFFh   The bottom window border position in maximized window       95   In pixels, if the given value is less than or equal to the top border position, and the values at offsets 013Eh, 0140h specify that the window was maximized, it is considered, that the parameters of the window were not saved, and the default values are used.
014Ah 2 0000h   Left window border position       95   In pixels.
014Ch 2 0000h   Top window border position       95   In pixels.
014Eh 2 0000h   The right window border position in normal window       95   In pixels, if the given value is less than or equal to the left border position, and the values at offsets 013Eh, 0140h specify that the window was not maximized, it is considered, that the parameters of the window were not saved, and the default values are used.
0150h 2 0000h   The bottom window border position in normal window       95   In pixels, if the given value is less than or equal to the top border position, and the values at offsets 013Eh, 0140h specify that the window was not maximized, it is considered, that the parameters of the window were not saved, and the default values are used.
0152h 4 00000000h   Unknown            
0156h 80     Name of the BAT file       95 NT OEM character set. Can contain a complete path. If the long filename contains spaces, it must be enclosed in quotes. Is trailed by a null symbol.
01A6h 2 0000h   Memory amount for environment       95 NT Auto - 0, otherwise amount of memory in kilobytes, max - 4096.
01A8h 2 0000h   Volume of memory DPMI       95 NT Auto - 0, otherwise amount of memory in kilobytes, max - 16384.
01AAh 2 0001h   Unknown       95 NT  
Section “CONFIG  SYS 4.0”
0000h       Contents of the file Config.sys       95   ANSI character set, each line trailed by a sequence 0D0Ah.
Section “AUTOEXECBAT 4.0”
0000h       Contents of the file Autoexec.bat        95   ANSI character set, each line trailed by a sequence 0D0Ah
Section “WINDOWS NT  3.1”. Data length - 008Eh
0000h 2 0000h 0010h Compatible hardware timer emulation         NT Bit mask.
0002h 10 00.. 0000h   Unknown            
000Ch 64 %SystemRoot%\SYSTEM32\CONFIG.NT   The name of a file used in place of Config.sys         NT ANSI character set, trailed by a null symbol.
004Ch 64 %SystemRoot%\SYSTEM32\AUTOEXEC.NT   The name of a file used in place of Autoexec.bat          NT ANSI character set, trailed by a null symbol.
008Ch 2 0000h   Unknown            
Section “WINDOWS NT  4.0”. Data length – 068Ch
0000h 4 00000000h   Unknown            
0004h 256     The command line with parameters         NT Unicode character set, is trailed by a null symbol, can contain a full path, if the long filename contains spaces, it must be enclosed in quotes. This parameter is used only if the value at offset 0104h coincides (after charset conversion) with value constituted of the filename from the basic section and parameters string from the section “WINDOWS VMM 4.0”, if this section exists, or from the basic section otherwise.
0104h 128     The command line with parameters         NT ANSI character set, is trailed by a null symbol, can contain a full path, if the long filename contains spaces, it must be enclosed in quotes. See comment to the value at offset 0004h.
0184h 240 Varies   Unknown         NT Most likely, casual values
0274h 160     The filename of PIF file         NT Unicode character set, is trailed by a null symbol, contains a full path, the long filename without quotes.
0314h 80     The filename of PIF file         NT ANSI character set, is trailed by a null symbol, contains a full path, the long filename without quotes.
0364h 60     Window title         NT Unicode character set, is trailed by a null symbol. This parameter is used only if the value at offset 03A0h coincides (after charset conversion) with the window title from the basic section.
03A0h 30     Window title         NT ANSI character set, is trailed by a null symbol. See comment to the value at offset 0364h.
03BEh 160 PIFMGR.DLL   Name of the file containing an icon         NT Unicode character set, is trailed by a null symbol, can contain a full path, the long filename without quotes. This parameter is used only if the value at offset 045Eh coincides (after charset conversion) with value from the section “WINDOWS VMM 4.0”, or if this section is missing.
045Eh 80 PIFMGR.DLL   Name of the file containing an icon         NT ANSI character set, is trailed by a null symbol, can contain a full path, the long filename without quotes. See comment to the value at offset 036Eh.
04AEh 128     Working directory         NT Unicode character set, is trailed by a null symbol, if the long pathname contains spaces, it must be enclosed in quotes. This parameter is used only if the value at offset 052Eh coincides (after charset conversion) with corresponding value from the basic section.
052Eh 64     Working directory         NT ANSI character set, is trailed by a null symbol, if the long pathname contains spaces, it must be enclosed in quotes. See comment to the value at offset 04AEh.
056Eh 286 00...0000h   Unknown