Windows’ modern operating system harbors a lesser-known feature known as the StateRepository, pivotal in integrating modern applications upon their installation. Here’s a comprehensive breakdown of its functionality and significance.
Traditional vs. Modern Application Integration
Historically, traditional applications (built using Win32 or .Net Framework API sets) integrated into the OS by placing files in specific directories or writing into select parts of the Windows Registry. For instance:
- An app installer might write a .lnk file into a start menu folder to add a shortcut.
- Registering a COM component would involve writing registry entries under the CLASSES keys.
On the other hand, modern applications like UWP, MSIX, and Packaged Apps use an internal file, AppXManifest.xml, for defining integrations. Unlike traditional methods, the Desktop AppInstaller integrates these applications differently, looking for integrations in new areas, ensuring seamless installations, uninstalls, and provision for isolations.
Discovering the StateRepository
The StateRepository, hidden within the Operating System, houses crucial integration data. Found under C:\ProgramData\Microsoft\Windows\AppRepository, the StateRepository can be witnessed being written during the installation of modern applications. Notably, it comprises:
- Cached AppXManifest file.
- Per-package/per-user .pckgdep file.
- StateRepository files with .srd extensions (StateRepository-Machine.srd and StateRepository-Deployment.srd), which are SqlLite databases.
These databases can be accessed using open-source tools such as DB Browser for SQLite.
The Deployment database is especially pertinent for potential updating issues. In contrast, the Machine database holds information more related to integrations, especially regarding application and package extensions. These databases appear optimized for swift lookups, often using succinct ID fields. Interestingly, many of these IDs mirror entries in new Registry locations.
While it’s still early days for practical examples on how viewing this database might be beneficial, it provides insights into whether newly added entries, particularly for newer schemas, are correctly implemented post-package installation.
Tampering with the information in these databases or the mentioned registry locations isn’t recommended. However, the StateRepository offers a treasure trove of data that could potentially be harnessed for enhancing application integration. One idea being considered is to expand the AppModel api interface utilized by the PSF, providing more information about package-associated containerized applications.