What’s new in the PSF for July 2020

Hurray! Another Pull Request of mine has been accepted into the Package Support Framework Develop branch. This one, PR #150, adds another new registry fixup.

The Issue:

The MSIX runtime protects the registry assets of the package from deletion.  This can be a problem for applications that assume that they can remove registry keys and items.  In the normal Win32 runtime, an application is normally allowed to delete keys and items that are located within the HKEY_CURRENT_USER hive.  But under MSIX, the same call will result in ACCESS DENIED.  The application might handle the situation properly, or you might get something like this:

In this particular case, the exception is generated by the .Net API called by the application.  Yes, the developer could have added an exception handler around that call, but this access error would never have occurred before. 

If you don’t have source code for the app and are repackaging into MSIX, the Package Support Framework (PSF) can now solve this issue for you.

Last month I created the new RegLegacyFixups shim to solve issues with Registry Open/Create calls requesting too many permissions.  This shim supports a fix type called “ModifyKeyAccess” that looks at attempts to open or create keys with more permissions than MSIX will allow.  Fiddler also needs this for other issues, but that fix type doesn’t address attempts to call various forms of registry deletion.

The Fix:

So this PR adds a new type called “FakeDelete”, which will return success when the delete fails.  Of course there is no guarantee the app won’t have a different issue later on, but if the app was just cleaning up some unneeded items, it probably will solve the issue and won’t cause any new harm.

Here is the appropriate part of the config.json file I use for Fiddler:

 

{
   "dll": "RegLegacyFixups.dll",
   "config": [
      {
        "remediation": [
          {
            "type": "ModifyKeyAccess",
            "hive": "HKCU",
            "patterns": [
              "^[Ss][Oo][Ff][Tt][Ww][Aa][Rr][Ee]\\\\[Mm]icrosoft\\\\[Ff]iddler2\\\\.*"
            ],
            "access": "Full2MaxAllowed"
          },
          {
            "type": "FakeDelete",
            "hive": "HKCU",
            "patterns": [
              "^[Ss][Oo][Ff][Tt][Ww][Aa][Rr][Ee]\\\\[Mm]icrosoft\\\\[Ff]iddler2\\\\.*"
            ]
          }
        ]
      }
    ]
}

The Future:

Version 4.0 of PsfTooling will be released soon, so keep an eye out for that announcement.  That version will include the latest changes to the PSF, as well as a rewritten “simplified” version of the user interface.

By Tim Mangan

Tim is a Microsoft MVP, and a Citrix CTP Fellow. He is an expert in App-V and MSIX.