Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Windows Prefetch

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Windows Prefetch (.pf) files: an SCCA header (format version 17, 23, 26, 30, 31) with executable name, hash, run count and last run times; on Windows 10 and later wrapped in a MAM Xpress Huffman compressed container.

Prefetch files in C:\Windows\Prefetch record that an executable ran, when (up to 8 last run times from version 26), how often, and which files and volumes it touched. Layout from libscca (libyal, LGPL), documentation/Windows Prefetch File (PF) format.asciidoc. Little endian; times are FILETIME.

Identification

  • Compressed (Windows 10 and later): bytes 4D 41 4D 04 ("MAM" + 0x04), then a 4-byte uncompressed size, then Xpress Huffman data; see Format:Xpress. The source stresses this is the Huffman variant, not the plain LZ77 Xpress.
  • Uncompressed: format version at offset 0, then 53 43 43 41 ("SCCA") at offset 4.
  • File name: <EXECUTABLE NAME truncated to 29 chars>-<8 hex digit hash>.pf; the hash is repeated in the header at offset 76.

File header (84 bytes)

Offset Size Field
0 4 format version
4 4 signature SCCA
8 4 unknown (0x0F or 0x11 seen)
12 4 file size
16 60 executable name, UTF-16LE (max 29 chars + NUL; unused bytes may hold remnants)
76 4 prefetch hash
80 4 unknown, flags? (the source marks 0x01 as boot prefetch, seen in NTOSBOOT-B00DFAAD.pf and in Op-EXPLORER.EXE-A80E4F97-000000F5.pf, and itself flags this as unconfirmed)

Format versions

17 = Windows XP and 2003, 23 = Vista and 7, 26 = Windows 8.0 and 8.1, 30 = Windows 10, 31 = Windows 11.

File information (follows the header)

All versions start with: file metrics array offset and entry count, trace chains array offset and count, filename strings offset and size, volumes information offset, volume count and size (nine 32-bit values, offsets from file start). Then:

Version Info size Last run time(s) Run count Extra
17 68 1 FILETIME at +36 +60
23 156 1 FILETIME at +44 +68
26 220 8 FILETIMEs at +44 (first = most recent) +124
30 variant 1 220 8 at +44 +124 hash string offset and size at +136, +140
30 variant 2 and 31 212 8 at +44 +116 hash string offset and size at +128, +132

The metrics array offset is 152 (v17), 240 (v23), 304 (v26 and v30 variant 1), 296 (v30 variant 2). Version 31 is described as similar to variant 2.

Other sections

File metrics array (one entry per file loaded: trace chain index, entry count, filename string offset and length in the strings area; later versions add an NTFS file reference of 6-byte MFT index + 2-byte sequence), trace chains array, filename strings (UTF-16LE, NUL separated), volumes information (device path, creation time, serial number, directory strings).

Flags (libscca documentation, same path): file metrics flags 0x1 do not prefetch, 0x2 load as resource, 0x200 load as executable. The trace chains array holds one chain per file metrics entry, chained like FAT with 0xFFFFFFFF as end-of-chain; trace chain entry: total block load count u32 (blocks of 512 KiB per the source), flags u8 (0x1 do not prefetch, read from disk; 0x2 load as executable; 0x4 load as resource; 0x8 must be prefetched), unknown u8, block used bits u8 and block prefetched bits u8 (one bit per each of the last 8 runs); version 17 and 23 entries put the load count and flags at other offsets (see the source). Volume information entry sizes: 40 bytes (version 17), 104 (versions 23 and 26), 96 (version 30; 31 not stated). Filename strings may contain unpaired surrogates (U+D800).

Code & repositories

  • https://github.com/libyal/libscca @ dacbc4adb90aeb428830fcb2b31c1388860d7c30 · license: LGPL-3.0-or-later (declared by the contributor; GitHub's detector did not recognize COPYING)
    libyal C library and tools (sccainfo) with the Windows Prefetch format specification in documentation/.
    Tested on: source read, not run: source read, not run · checked 2026-10-18

Pitfalls

  • Prefetch files may also exist as NTFS alternate data streams named like notepad.exe:evil.pf (noted in the source).
  • The run-time array holds 8 entries; older times are lost.

See also

Format:Xpress, Format:Windows Shell Link (LNK), Format:Windows Jump Lists, Format:Windows Registry hive (REGF).