Learn · Operating systems

Windows

The registry is a file system inside files, Explorer counts what you start, shortcuts remember USB sticks, and prefetch notes every program run. All of it in little-endian bytes with FILETIME stamps.

1 Where the artefacts live

ArtefactLocationTells you
System hivesC:\Windows\System32\config\ SYSTEM, SOFTWARE, SAM, SECURITYcomputer name, time zone, users, services, USB devices, network history
User hivesC:\Users\<user>\NTUSER.DAT, …\AppData\Local\Microsoft\Windows\UsrClass.datautostarts, UserAssist, recent documents, typed paths, ShellBags
AmcacheC:\Windows\appcompat\Programs\Amcache.hveprograms present (with SHA-1), installed apps, drivers
PrefetchC:\Windows\Prefetch\*.pfprogram runs: count, last 8 times, files loaded
Shortcuts, Jump Lists…\AppData\Roaming\Microsoft\Windows\Recent\ (+ AutomaticDestinations\)files and folders opened, also on removable and network drives
Recycle BinC:\$Recycle.Bin\<SID>\$I… and $R…deleted files: original path, size, time
Event logsC:\Windows\System32\winevt\Logs\*.evtxlogons, services, process starts (if audited), log clearing
SRUMC:\Windows\System32\sru\SRUDB.dat (ESE database)per-app network and energy use, hour by hour, for about 30 days

2 A registry hive in hex

What regedit shows as one tree is stored in several hive files. Each hive starts with a 4 KiB base block (signature regf), followed by hive bins (hbin, 4 KiB or larger) that hold cells. Every key, value, list and piece of data is a cell. Cells point to each other with offsets counted from the first hive bin:

Base block0x0000regf, sequence numbers, root cell, checksum
Hive bin(s)0x1000 …cells: nk (key), vk (value), lh (subkey list), value lists, data, sk (security)
file offset of a cell = 0x1000 + cell offset

The sample is a small NTUSER.DAT-style hive. Below is the start of its hive bin: the security cell, the root key and the path Software\Microsoft\Windows\CurrentVersion. Follow Subkey list offset from one key to its lh list and on to the next key. Each cell starts with its size as a signed number: negative means in use.

One timestamp per key: keys have a LastWrite time, values have no time at all. If a key holds many values, LastWrite tells you when one of them last changed, not which one.

3 Autostarts and a deleted value

Malware and unwanted tools like to start with the user. The classic places are the Run and RunOnce keys under HKCU and HKLM\Software\Microsoft\Windows\CurrentVersion, services (HKLM\SYSTEM\CurrentControlSet\Services) and scheduled tasks. In the sample the Run key holds one value, SyncHelper. Its LastWrite time is 2026-09-14 16:05:42 UTC.

Look at the cells after the value list: their size is positive, so they are free. One is still a complete vk cell named Updater, and its data cell holds the program path. When the value was deleted, Windows only flipped the sign of the cell sizes. Registry tools that walk the tree never show it; tools that scan all cells (e.g. yarp, Registry Explorer's "deleted" view) do.

What a registry viewer reports (builder output)

4 UserAssist: what the user started

Explorer counts the programs a user starts from the Start menu, the desktop or a double-click, in NTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{GUID}\Count. Each value is one program; the value name is ROT13-encoded and the 72-byte data holds a run count, focus time and the last run as FILETIME.

ROT13 decoder

The GUID at the start is a known folder: Windows stores {6D809377-…} instead of C:\Program Files so the entry survives a different drive letter. Programs started from a command line or by another program are not counted here; prefetch (section 7) sees those too.

5 Shortcut files remember the target

When a user opens a file, Windows creates a shortcut in the Recent folder. The .lnk file copies the target's timestamps and size, the full path, and the type and serial number of the volume it was on. If the target was on a USB stick that is long gone, the shortcut still says so.

The tracker block at the end names the machine (ash-lt07) and holds version-1 GUIDs, which contain a creation time and the MAC address of the computer that made them. The shortcut's own creation time (first opened) and modification time (last opened) are in the file system, not in the file: record them when you collect it. Note the target times: the target was on a FAT volume, so its modification time has 2-second steps and its access time is a date only (shown as 00:00:00).

What LECmd would report (builder output)

6 The Recycle Bin

Deleting a file in Explorer moves it to C:\$Recycle.Bin\<SID>\ and renames it to $R + six random characters. Next to it Windows writes a small $I file with the same suffix that records where the file came from, its size and when it was deleted. The folder name, a user's SID, tells you which account deleted it. Emptying the bin deletes both, but their MFT records may remain.

What RBCmd would report (builder output)

7 Prefetch: every program run

To start programs faster, Windows records which files a program loads in its first seconds and stores them in C:\Windows\Prefetch\<EXE>-<HASH>.pf. For an examiner it is a run log: run count, the last eight run times, the files the program touched and the volumes they were on. On Windows 10 and 11 the files are compressed (signature MAM\x04); the view below shows the content after decompression, trimmed to the parts that matter.

The file name list is where prefetch gets interesting: SDELETE64.EXE, a secure-deletion tool, ran from the Downloads folder and opened \USERS\ROBIN\DESKTOP\CONTACTS_OLD.ZIP while starting. The \VOLUME{…} prefix is the volume's creation FILETIME and serial number in hex.

What PECmd would report (builder output)
Is prefetch on? It is on by default on Windows client versions, also on SSDs, and off by default on Windows Server. Check SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters\EnablePrefetcher before concluding that "no prefetch file" means "never ran".

8 Event logs and other sources

Event logs (.evtx) are binary XML; read them with Event Viewer on a copy, EvtxECmd or python-evtx. A short list of events worth knowing by number:

LogEvent IDMeaning
Security4624 / 4625 / 4634, 4647logon succeeded / failed / logoff (the logon type says how: 2 console, 3 network, 10 Remote Desktop)
Security4672logon with administrator-level privileges
Security4688process created (only if process auditing is enabled; command lines need an extra setting)
Security4720 / 4732user account created / added to a security group
Security4698scheduled task created
Security1102the Security log was cleared (System log: 104)
System7045a service was installed
Microsoft-Windows-Partition/Diagnostic1006a disk was connected, with vendor, model and serial

Other execution and device sources: BAM (SYSTEM\…\Services\bam\State\UserSettings\<SID>, last run per program), Amcache (programs and their SHA-1), ShimCache (programs Windows checked for compatibility), USBSTOR and setupapi.dev.log (every USB storage device ever connected, with serial and first-connect time), ShellBags (folders a user browsed, even on removed drives).

9 Try it yourself

Answer from the hex views above. Numbers can be typed in decimal or hex (0x…).

How many times did robin start 7-Zip (7zFM.exe) through Explorer?

Decode the value names in section 4 with ROT13, then go to that value's data cell. Skip the 4-byte cell size: the run count is the second 4-byte number of the data (little-endian).

The second value decodes to {6D809377-…}\7-Zip\7zFM.exe. Its data cell at 0x1540 starts with the cell size B0 FF FF FF; the data from 0x1544 reads 00 00 00 00 | 04 00 00 00: session 0, run count 4 (at 0x1548). Its last run is 2026-09-14 16:58:21 UTC, which is also the LastWrite time of the Count key.

Which autostart entry was deleted from the Run key, and how can you tell?

Look at the first 4 bytes of each cell in section 3. Which ones are positive?

The cell at 0x16D0 starts 20 00 00 00 = +32: a free cell. It still holds a complete vk for Updater pointing to a free data cell with C:\Users\robin\AppData\Local\Updater\upd.exe /silent. SyncHelper is live (size D8 FF FF FF = −40). The Run key's LastWrite (16:05:42) dates only its last change: adding SyncHelper or deleting Updater, whichever came later. The hive alone cannot date the other one. regedit had started at 16:03:10 (UserAssist).

A USB stick is seized. Which volume serial number must it have if it is the stick the shortcut points to? (8 hex digits)

LinkInfo → Volume ID, 4 bytes after the drive type. Remember to read them little-endian.

The bytes at 0x70 are D6 B3 41 8E; read little-endian that is 0x8E41B3D6, shown by Windows as 8E41-B3D6.

How many seconds passed between moving contacts_export.csv to the Recycle Bin and the last run of SDELETE64.EXE?

Take the deletion time from the $I file (section 6) and the "Last run" field of the prefetch file (section 7).

Deleted 17:40:12, last run 17:42:05 (both UTC): 1 min 53 s = 113 s. Two artefacts from different subsystems, one sequence: delete, then wipe. Note the wording in a report: prefetch proves the tool ran and touched CONTACTS_OLD.ZIP; it does not prove what it wiped.

These are the first 40 bytes of the $I file. Edit them and watch the decoded record:

  • Change the last byte of the deletion time (at 0x17, 01) to 02. How far does the date jump? Why does the top byte of a FILETIME matter so much?
  • Reset, then change the path length at 0x18 from 2B to 10. What does the decoder show now, and where does the rest of the path go?
  • Reset, then change the version at 0x00 from 02 to 01. Version 1 has no length field: which bytes are now read as the start of the path?