User:Learn more/Appcompat

From ReactOS Wiki
Jump to: navigation, search

What is it?

The Application Compatibility Framework is a mechanism designed to work around bugs in applications. It can happen after upgrading your operating system that applications suddenly stop working. A common reason for this is because the application (unknowningly to the author) relies on a bug in the operating system. Once this bug is fixed, the application suddenly stops working, and without an update from the author would not be usable anymore. Because an author might not be available to create an update (or might not even be aware of the problem), the Application Compatiblity Framework has mitigations to work around common errors.

The part most visible to the user is the 'Compatibility' tab presented in the properties dialog.

caption Example from Windows 10

How does it work?


There are various techniques used to 'fix' applications:

  • Call a specific function
    • For example: If an application needs to run in 640x480, a fix will call a function at process start to change the resolution.
  • Alter the behavior of a function.
    • For example: If an application cannot properly handle disks above 2GB, a fix can make it appear as if there was only 2GB available.
  • Alter the (percieved) environment of the application.
    • For example: If an application checks that it is running on a certain version of windows, a fix can make it appear to the application as if it is running on this version.

Technical details


Outlined below is a rough outline of the initialization of the shim engine. (...) is used as a placeholder to indicate some omitted (non-relevant) function calls

Parent process

This is where the shim engine checks if there should be a shim applied.

  • CreateProcess
    • CreateProcessInternal
    • (...)
    • BasepCheckBadapp
      • BaseCheckAppcompatCache
      • BaseCheckRunApp
        • ApphelpCheckRunApp[Ex]
    • (...)
    • NtCreateProcessEx
    • (...)
      • BasePushProcessParameters
        • (...)
        • NtAllocateVirtualMemory (Peb->pShimData)
        • NtWriteVirtualMemory (Peb->pShimData)

Child process, initialization

  • PspUserThreadStartup
    • (...)
    • LdrInitializeThunk
      • (...)
      • LdrpInit
        • (...)
        • LdrpInitializeProcess
          • (...)
          • LdrpLoadShimEngine (Peb->pShimData)
            • (...)
            • SE_InstallbeforeInit

Child process, execution

Current state

Implemented shims

Framework status