PcaGeneralDb Files: Fields, Record Types and Paths
How to read PcaGeneralDb0.txt and PcaGeneralDb1.txt on Windows 11: the eight fields, record types 0 to 4, redacted paths, rotation, and what is still unknown.
TL;DR. PcaGeneralDb0.txt and PcaGeneralDb1.txt, in C:\Windows\appcompat\pca\ on Windows 11 22H2 and later, are a UTF-16LE log written by the Program Compatibility Assistant. Each line is one record of eight pipe-separated fields: time (UTC), record type (0 to 4), path (lowercased, drive letter removed, user names redacted), product name, company name, product version, program ID (the same format as in Amcache) and message. Type 2, abnormal process exit with the exit code, is by far the most common. The two files rotate at about 2 MB, so two to four megabytes of history remain. Meanings come from research, mostly Sygnia's, not from Microsoft, and type 4 is still unexplained. PCA Parser reads both files and joins their records to the launch log.
Two files, one log
Sygnia describes the rotation this way. PcaGeneralDb0.txt starts as the primary file. New records are appended to the primary file while it is smaller than two million bytes. When it reaches that size, the secondary file is cleared and becomes the primary. So at any time the folder holds between two and four megabytes of records, and the oldest are lost at each switch.
Consequences:
- Collect both files, always. The newer records can be in either one. One community Velociraptor artifact reads only
PcaGeneralDb0.txtby default. - An empty
PcaGeneralDb1.txtis normal on a young system. Rathbun's clean test VM did not write to it during his tests. - A gap in time between the two files is the cleared history, not tampering.
Encoding and line format
Both files are UTF-16LE. Sygnia specifies UTF-16LE "allowing unpaired surrogates", which a strict decoder rejects. The copies Rathbun published in his DFIRArtifactMuseum have no byte order mark. Sygnia describes CRLF line endings; the published copies end their lines with a bare LF. A parser should accept both and should not expect a BOM.
Opened as ANSI, the files show a space or a box between every character. In PowerShell:
Get-Content C:\Windows\appcompat\pca\PcaGeneralDb0.txt -Encoding Unicode
The eight fields
A record from Rathbun's published file:
2022-12-28 16:07:48.536|3|\musicbee\musicbee.exe|musicbee|steven mayall|3.5.8384.15210|0006a2b3f09d33ba959e68a41198809627dc00000000|PCA resolve is called, resolver name: DetectorShim_KernelDriver, result: 0
| # | Field (Sygnia's name) | Content |
|---|---|---|
| 1 | Creation time | When the record was written, UTC, YYYY-MM-DD HH:MM:SS.fff |
| 2 | Record type | 0 to 4, see below |
| 3 | File path | Executable path, lowercased, without the drive letter, with placeholders |
| 4 | Product name | From the PE version information, lowercased |
| 5 | Company name | From the PE version information, lowercased |
| 6 | Product version | From the PE version information |
| 7 | Program ID | Same format as the ProgramId in Amcache |
| 8 | Message | What happened, in English text |
Sources name the fields differently. Rathbun and Gonzalez, in the first AboutDFIR post, call them run time, run status, executable path, description, software vendor, file version, an unknown value and exit code. Costas K later identified the unknown value as the Amcache program ID. Whether field 4 comes from the PE ProductName or FileDescription resource is not settled by these sources; the observed values look like product names.
For executables run from a UNC path, Sygnia found that fields 4 to 7 are empty. A parser must accept empty fields.
Record types
| Type | Meaning | Confidence |
|---|---|---|
| 0 | Installer failed | Sygnia observed it when an installer was terminated mid-install, but only for some installers, and once for Sysinternals Disk2vhd, which is not an installer |
| 1 | Driver was blocked | Sygnia's inference from the code that writes it (UddpShowBlockedDriverDialog) and its messages BlockReasonCet, BlockReasonHvci, BlockReasonOther. A vulnerable-driver test with EDRSandblast produced no record |
| 2 | Abnormal process exit | Observed: the program exited with a non-zero code, given in hex in the message |
| 3 | PCA resolve is called | Observed: the message names a resolver and a result. What triggers it is not known |
| 4 | Unknown | Sygnia could not find its meaning. Kaspersky labels it "value not set", without detail |
One more disagreement: a community Velociraptor artifact, Windows.System.AppCompatPCAExtend, labels type 1 as "Launched". That does not match Sygnia's reverse engineering, and no public sample shows a type 1 record for a plain launch. Read type 1 as Sygnia does until someone shows otherwise.
Messages
The message text seen in public samples:
Abnormal process exit with code 0x2
Abnormal process exit with code 0xc000042c
PCA resolve is called, resolver name: DetectorShim_KernelDriver, result: 0
Exit codes are whatever the process returned. Small values such as 0x1 and 0x2 are defined by each program. Values starting with 0xc0000 are usually NTSTATUS codes: 0xc000042c is STATUS_ELEVATION_REQUIRED (in Rathbun's files, for a Snagit helper), and 0xc0000135 is STATUS_DLL_NOT_FOUND, found six times for clang-tidy.exe in the Magnet Virtual Summit 2023 CTF image.
Paths are rewritten
PcaSvc changes paths before writing them. Sygnia's rules:
- the path is lowercased and the drive letter removed: a program run as
E:\Tools\Scan.exewould be written\tools\scan.exe; - known folders become environment variables:
%programfiles%,%programfiles(x86)%,%commonprogramfiles%,%USERPROFILE%; - for every user with a profile on the machine, the first occurrence of that user name in the path becomes
%USERNAME%, whoever ran the program; - a folder that follows a folder named
Users(any case) is replaced byxcharacters, and so is a file name sitting directly in aUsersfolder.
So %USERPROFILE%\appdata\roaming\a.exe does not say whose profile, and \tools\a.exe does not say which drive. Rathbun's files show how to bridge the gap: the record path \musicbee\musicbee.exe matches the launch log line K:\MusicBee\MusicBee.exe, and the two times are a quarter of a second apart (16:07:48.304 and 16:07:48.536). Join on the end of the path, case-insensitively, and treat the result as a likely match, not a proof.
The program ID
The seventh field, for example 0006ea6a66e62a303f7b974dc4952647a80300000904, has the format of the ProgramId that Amcache stores for installed programs and files. Sygnia quotes Blanche Lagny's Amcache analysis: the ID is not explained, is supposed to be a hash of name, version, publisher and language, and is the same for the same software version on different machines. Use it to:
- find the same program in Amcache, with its SHA-1 and install data;
- search for the same program across hosts.
Do not try to recompute it.
What it covers
Sygnia found that programs started from the command line are not recorded here either, and that some built-in programs are not recorded from their original folder. But the public samples show records for programs a person rarely starts by hand: git.exe exiting with 0x1 and 0x80 under GitHub Desktop in Rathbun's files, and clang-tidy.exe in the CTF image. Both were most likely started by another program. So the set of programs in PcaGeneralDb is not the same as the set in PcaAppLaunchDic.txt, and which processes PCA follows is not documented. Search both.
Sygnia also found a reference to a third file, PcaGeneralDic.txt, in the service binaries, but never saw it written.
What a record proves
- Type 2: the program ran and ended with a non-zero code. The record time is when the record was written, which for an exit is about when the process ended. With the launch time from PcaAppLaunchDic.txt, it gives a rough run time, as Sygnia points out.
- Type 3: Sygnia calls these "clear evidence of program execution", even though their trigger is unknown.
- Type 0: an installer started and did not finish, by PCA's reckoning.
- Absence: proves nothing. Most programs exit with code 0 and leave no record.
Two patterns are worth a look in an intrusion: a tool in a user-writable folder that keeps exiting abnormally (crashes, or killed by security software), and a STATUS_ELEVATION_REQUIRED exit followed by a RUNASADMIN layer on the same path in a user's hive, which reads as someone retrying with elevation. See AppCompatFlags Layers.
FAQ
What does record type 2 mean in PcaGeneralDb?
Abnormal process exit: the program ended with a non-zero exit code, which the message gives in hex, for example Abnormal process exit with code 0x2. It shows that the program ran and when the record was written.
Why are the paths in PcaGeneralDb lowercase and without a drive letter?
PcaSvc rewrites them before writing: it lowercases the path, removes the drive letter, replaces known folders with environment variables, and replaces user names with %USERNAME% or a run of x characters. Sygnia documented the rules. The original drive and, in some cases, the original folder cannot be recovered from the record alone.
Why is PcaGeneralDb1.txt empty?
PcaGeneralDb0.txt is the active file until it reaches about 2 MB. Only then does PcaGeneralDb1.txt take over. On a recent or quiet system, the second file can be empty, as Andrew Rathbun found on a clean virtual machine.
What is the long hex value in the seventh field?
A program ID in the same format as the ProgramId in Amcache. Sygnia and Costas K identified it. How Windows computes it is not documented, but the same software version gives the same ID on different machines, so it can be searched in Amcache and across hosts.
Related articles
Frequently asked questions
What does record type 2 mean in PcaGeneralDb?
Abnormal process exit: the program ended with a non-zero exit code, which the message gives in hex, for example Abnormal process exit with code 0x2. It shows that the program ran and when the record was written.
Why are the paths in PcaGeneralDb lowercase and without a drive letter?
PcaSvc rewrites them before writing: it lowercases the path, removes the drive letter, replaces known folders with environment variables, and replaces user names with %USERNAME% or a run of x characters. Sygnia documented the rules. The original drive and, in some cases, the original folder cannot be recovered from the record alone.
Why is PcaGeneralDb1.txt empty?
PcaGeneralDb0.txt is the active file until it reaches about 2 MB. Only then does PcaGeneralDb1.txt take over. On a recent or quiet system, the second file can be empty, as Andrew Rathbun found on a clean virtual machine.
What is the long hex value in the seventh field?
A program ID in the same format as the ProgramId in Amcache. Sygnia and Costas K identified it. How Windows computes it is not documented, but the same software version gives the same ID on different machines, so it can be searched in Amcache and across hosts.