Windows Prefetch File Format

Windows Prefetch File Format

A Windows Prefetch file consists of one file header and multiple file sections with different content. Not all content has an obvious forensic value.

As far as have been possible to ascertain, there is no public description of the format. The description below has been synthesised from examinationof multiple prefetch files.

Contents

Characteristics

Integersstored in little-endian
StringsStored as UTF-16 little-endian without a byte-order-mark (BOM).
TimestampsStored as Windows FILETIME in UTC.

File header

The file header is 84 bytes of size and consists of:

FieldOffsetLengthTypeNotes
H10x00004DWORDFormat version (see format version section below)
H20x00044DWORDSignature 'SCCA' (or in hexadecimal representation 0x53 0x43 0x43 0x4)
H30x00084DWORD?Unknown - Values observed: 0x0F - Windows XP, 0x11 - Windows 7, Windows 8.1
H40x000C4DWORDPrefetch file size (or length) (sometimes referred to as End of File (EOF)).
H50x001060USTRThe name of the (original) executable as a Unicode (UTF-16 litte-endian string), up to 29 characters and terminated by an end-of-string character (U+0000). This name should correspond with the one in the prefetch file filename.
H60x004C4DWORDThe prefetch hash. This hash value should correspond with the one in the prefetch file filename.
H70x00504?Unknown (flags)? Values observed: 0 for almost all prefetch files (XP); 1 for NTOSBOOT-B00DFAAD.pf (XP)

It's worth noting that the name of a carved prefetch file can be restored using the information in field H5 and H6, and its size can be determined by field H4.

Format version

ValueWindows version
17 (0x11)Windows XP, Windows 2003
23 (0x17)Windows Vista, Windows 7
26 (0x1a)Windows 8.1 (note this could be Windows 8 as well but has not been confirmed)

File information

The format of the file information is version dependent.

Note that some other format specifications consider the file information part of the file header.

File information - version 17

The file information – version 17 is 68 bytes of size and consists of:

FieldOffsetLengthTypeNotes
 0x00544DWORDThe offset to section A. The offset is relative from the start of the file.
 0x00584DWORDThe number of entries in section A.
 0x005C4DWORDThe offset to section B. The offset is relative from the start of the file.
 0x00604DWORDThe number of entries in section B.
 0x00644DWORDThe offset to section C. The offset is relative from the start of the file.
 0x00684DWORDLength of section C.
 0x006C4DWORDOffset to section D. The offset is relative from the start of the file.
 0x00704DWORDThe number of entries in section D.
 0x00744DWORDLength of section D.
 0x00788FILETIMELatest execution time (or run time) of executable (FILETIME)
 0x008016 ?Unknown ? Possibly structured as 4 DWORD. Observed values: /0x00000000 0x00000000 0x00000000 0x00000000/, /0x47868c00 0x00000000 0x47860c00 0x00000000/ (don't exclude the possibility here that this is remnant data)
 0x00904DWORDExecution counter (or run count)
 0x00944DWORD?Unknown ? Observed values: 1, 2, 3, 4, 5, 6 (XP)
File information - version 23

The file information – version 23 is 156 bytes of size and consists of:

FieldOffsetLengthTypeNotes
 0x00544DWORDThe offset to section A. The offset is relative from the start of the file.
 0x00584DWORDThe number of entries in section A.
 0x005C4DWORDThe offset to section B. The offset is relative from the start of the file.
 0x00604DWORDThe number of entries in section B.
 0x00644DWORDThe offset to section C. The offset is relative from the start of the file.
 0x00684DWORDLength of section C.
 0x006C4DWORDOffset to section D. The offset is relative from the start of the file.
 0x00704DWORDThe number of entries in section D.
 0x00744DWORDLength of section D.
 0x00788?Unknown
 0x00808FILETIMELatest execution time (or run time) of executable (FILETIME)
 0x008816 ?Unknown
 0x00984DWORDExecution counter (or run count)
 0x009C4DWORD?Unknown
 0x00A080?Unknown
File information - version 26

The file information – version 26 is 224 bytes of size and consists of:

FieldOffsetLengthTypeNotes
 0x00544DWORDThe offset to section A. The offset is relative from the start of the file.
 0x00584DWORDThe number of entries in section A.
 0x005C4DWORDThe offset to section B. The offset is relative from the start of the file.
 0x00604DWORDThe number of entries in section B.
 0x00644DWORDThe offset to section C. The offset is relative from the start of the file.
 0x00684DWORDLength of section C.
 0x006C4DWORDOffset to section D. The offset is relative from the start of the file.
 0x00704DWORDThe number of entries in section D.
 0x00744DWORDLength of section D.
 0x00788 ?Unknown
 0x00808FILETIMELatest execution time (or run time) of executable (FILETIME)
 0x00887 x 8 = 56FILETIMEOlder (most recent) latest execution time (or run time) of executable (FILETIME)
 0x00C016?Unknown
 0x00D04DWORDExecution counter (or run count)
 0x00D44?Unknown
 0x00D84?Unknown
 0x00DC88?Unknown

Section A - Metrics array

Metrics entry record - version 17

The metrics entry records – version 17 is 20 bytes in size and consists of:

FieldOffsetLengthTypeNotes
 04DWORDStart time in ms
 44DWORDDuration in ms
 84DWORDFilename string offset
The offset is relative to the start of the filename string section (section C)
 124DWORDFilename string number of characters without end-of-string character
 164DWORDUnknown, flags?
Metrics entry record - version 23

The metrics entry records – version 23 is 32 bytes in size and consists of:

FieldOffsetLengthTypeNotes
 04DWORDStart time in ms
 44DWORDDuration in ms
 84DWORDAverage duration in ms?
 124DWORDFilename string offset
The offset is relative to the start of the filename string section (section C)
 164DWORDFilename string number of characters without end-of-string character
 204DWORDUnknown, flags?
 248 NTFS file reference
0 if not set.
Metrics entry record - version 26

The metrics entry record – version 26 appears to be similar to metrics entry record – version 23.

Section B - Trace chains array

This section contains an array with 12 byte (version 17, 23 and 26) entry records.

FieldOffsetLengthTypeNotes
 04 Next array entry index
Contains the next trace chain array entry index in the chain, where the first entry index starts with 0, or -1 (0xffffffff) for the end-of-chain.
 44 Total block load count
Number of blocks loaded (or fetched)
The block size 512k (512 x 1024) bytes
 81 Unknown
 91 Sample duration in ms?
 102 Unknown

Section C - Filename strings

This section contains filenames strings, it consists of an array of UTF-16 little-endian formatted strings with end-of-string characters (U+0000).

At the end of the section there seems to be alignment padding that can contain remnant values.

Section D - Volumes information (block)

Section D contains one or more subsections, each subsection refers to directories on a volume.

If all the executables and libraries referenced in the C section are from one single disk volume, there will be only one section in the D section. If multiple volumes are referenced by section C, section D will contain multiple sections. (A simple way to force this situation is to copy, say, NOTEPAD.EXE to a USB drive, and start it from that volume. The corresponding prefetch file will have one D header referring to, e.g. \DEVICE\HARDDISK1\DP(1)0-0+4 (the USB drive), and one to, e.g. \DEVICE\HARDDISKVOLUME1\ (where the .DLLs and other support files were found).

In this section, all offsets are assumed to be counted from the start of the D section.

Volume information

The structure of the volume information is version dependent.

Volume information - version 17

The volume information – version 17 is 40 bytes in size and consists of:

FieldOffsetLengthTypeNotes
VI1+0x00004DWORDOffset to volume device path (Unicode, terminated by U+0000)
VI2+0x00044DWORDLength of volume device path (nr of characters, including terminating U+0000)
VI3+0x00088FILETIMEVolume creation time.
VI4+0x00104DWORDVolume serial number of volume indicated by volume string
VI5+0x00144DWORDOffset to sub section E
VI6+0x00184DWORDLength of sub section E (in bytes)
VI7+0x001C4DWORDOffset to sub section F
VI8+0x00204DWORDNumber of strings in sub section F
VI9+0x00244 ?Unknown
Volume information - version 23

The volume information entry – version 23 is 104 bytes in size and consists of:

FieldOffsetLengthTypeNotes
VI1+0x00004DWORDOffset to volume device path (Unicode, terminated by U+0000)
VI2+0x00044DWORDLength of volume device path (nr of characters, including terminating U+0000)
VI3+0x00088FILETIMEVolume creation time.
VI4+0x00104DWORDVolume serial number of volume indicated by volume string
VI5+0x00144DWORDOffset to sub section E
VI6+0x00184DWORDLength of sub section E (in bytes)
VI7+0x001C4DWORDOffset to sub section F
VI8+0x00204DWORDNumber of strings in sub section F
VI9+0x00244 ?Unknown
VI10+0x002828?Unknown
VI11+0x00444?Unknown
VI12+0x004828?Unknown
VI13+0x00644?Unknown
Volume information - version 26

The volume information entry – version 26 appears to be similar to volume information – version 23.

Sub section E - NTFS file references

This sub section can contain NTFS file references.

For more information see Windows Prefetch File (PF) format.

Sub section F - Directory strings

This sub sections contains directory strings. The number of strings is stored in the volume information.

A directory string is stored in the following structure:

FieldOffsetLengthTypeNotes
 0x00002DWORDNumber of characters (WORDs) of the directory name. The value does not include the end-of-string character.
 0x0002 USTRThe directory name as a Unicode (UTF-16 litte-endian string) terminated by an end-of-string character (U+0000).

See Also

External Links

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在语言中,prefetch是一种优化技术,用于预先加载数据到CPU缓存中,以减少访存延迟和提高程序性能。它可以在循环迭代或函数调用之前,先将未来循环迭代或函数调用中可能需要的数据加载到CPU缓存中。 在C语言中,使用预处理器指`#pragma`来指定prefetch的相关操作。具体的实现方式可能因为编译器和硬件平台的不同而有所差异。 下面是一个简单的示例代码,展示了如何使用prefetch来提高数据访问效率: ```c #include <stdio.h> #define PREFETCH_DISTANCE 4 void prefetch_example(int* array, int size) { int i; // Prefetch the data for future iterations for (i = 0; i < size; i += PREFETCH_DISTANCE) { __builtin_prefetch(&array[i + PREFETCH_DISTANCE]); } // Process the data for (i = 0; i < size; i++) { // Access array[i] here printf("%d ", array[i]); } } int main() { int array[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int size = sizeof(array) / sizeof(array[0]); prefetch_example(array, size); return 0; } ``` 在上面的代码中,我们使用`__builtin_prefetch`函数来进行数据预取。在循环中,我们通过指定一个距离`PREFETCH_DISTANCE`来控制预取的间隔。这样,循环中的每个迭代都会预先加载未来迭代可能需要的数据到CPU缓存中,以提高访问效率。 需要注意的是,prefetch的效果可能因为硬件平台和具体的应用场景而有所不同。因此,在使用prefetch时,需要进行实际测试和性能评估,以确保它能够带来实际的性能提升。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值