Can we have multiple fixes at the same time

Copper Contributor

Dear Experts,

 

Assume i have a msix package that needs multiple fixes like

1)FRF

2)Registry

3)Trace

 

Can we have the three fixes together ?

 

i have been trying this but was not lucky enough..

 

Below is the config.json i was trying

 

{
    "applications": [
        {
            "id""MyPackagex64",
            "executable""VFS/ProgramFilesX64/ConEmu/MyPackage64.exe",
            "workingDirectory""VFS/ProgramFilesX64/MyPackage"
        },
        {
            "id""ConEmuAAx64A1",
            "executable""VFS/ProgramFilesX64/ConEmu/MyPackage64.exe",
            "workingDirectory""VFS/ProgramFilesX64/MyPackage"
        }
    ],
    "processes": [
        {
            "executable""MyPackage64",
            "fixups": [
                {
                    "dll""FileRedirectionFixup64.dll",
                    "config": {
                        "redirectedPaths": {
                            "knownFolders": [
                                {
                                    "id""ProgramFilesX64",
                                    "relativePaths": [
                                        {
                                            "base""MyPackage/",
                                            "patterns": [
                                                ".*"
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                },
                {
                    "dll""TraceFixup64.dll",
                        "config": {
                            "traceMethod""outputDebugString",
                            "traceLevels": {
                                "default""always"
                            },
                            "breakOn": {
                                "filesystem""unexpectedFailures"
                            }
                        }
                    }
            ]
        },
        {
            "executable""MyPackage64",
            "fixups": [
                {
                    "dll""FileRedirectionFixup64.dll",
                    "config": {
                        "redirectedPaths": {
                            "knownFolders": [
                                {
                                    "id""ProgramFilesX64",
                                    "relativePaths": [
                                        {
                                            "base""MyPackage/",
                                            "patterns": [
                                                ".*"
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                },
                {
                    "dll""TraceFixup64.dll",
                        "config": {
                            "traceMethod""outputDebugString",
                            "traceLevels": {
                                "default""always"
                            },
                            "breakOn": {
                                "filesystem""unexpectedFailures"
                            }
                        }
                    }
            ]
        }
    ]
}
28 Replies

@tester2420 The fixups are applied and configured on the basis of the filename of the launched process, so while you can use the launcher for different command arguments to the same target process, the target process will get the same fixups and fixup configuration.  But you really should be able to have a single configuration that works for both launch points.

@tester2420   Regarding your Notepad++ json.  The item in Bold below is the issue.  That field is a RegEx pattern field so the ++ are special characters.  Replace with something like "Notepad$" (meaning any process name starting with the character string "Notepad") and you should be fine.

 


@tester2420 wrote:

@TIMOTHY MANGAN 

 

I am having another encoding problem with notepad++

 

my config.json looks like this

"applications": [
{
"id": "PSFLAUNCHERSIXFOUR",
"executable": "VFS/ProgramFilesX86/Notepad++/notepad++.exe",
"workingDirectory": "VFS/ProgramFilesX86/Notepad++"
}
],
"processes": [
{
"executable": "notepad++",

...

 


 

Like @TIMOTHY MANGAN  replied, but with a short extra bit of info. You can use Notepad$ to indicate everything that ends with Notepad, or ^Notepad to indicate things that start with Notepad. Plus (+) is a special regexp character denoting one or more repetitions of the previous token, so you cannot use it literally. Instead, you should escape it by escaping it with a backslash character. However, since JSON file on its own uses backslash as an escaping sequence you should actually use two backslashes, like:

 

executable: "Notepad\\+\\+"

 

This should produce a correct regex for PSF runtime.

For anyone wanting to know the full syntax, you can search the web for Regex syntax info, but keep in mind that there are several dialects; Microsoft is using the ECM variant. https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-options 

Thank you @TIMOTHY MANGAN ,

 

The suggested fix worked well for Notepad++, I have two more questions,

1)Its possible to have processor architecture as "neutral", in that case, what should be the bitness of our fix.

2) it's possible that MSIX does not have any folder inside and all exe's and Manifest(AppxManifest.xml) can be on the same level, so while applying fix what should be the value of "workingDirectory"

{
"id": "PSFLAUNCHERTHREETWO",
"executable": "MyTestExe.exe",
"workingDirectory": "??"
}

 

Thank you so much in advance, have a nice day.

 

Kind Regards,

Vikas

@tester2420 Some thoughts on those questions...

1) The term AnyCPU is what I think you mean by neutral, a single exe that can either run as 32 or 64 bit. This is only possible with .Net based executables, and the Psf components (except for PsfMonitor) are all written in "unmanaged" code, meaning that those components must be built in a specific bitness.

 

So you have to determine what bittness will be used and then use those components. MSIX has a concept of a bundle, so you can build two packages, one with the 32bit and one with the x64 ones, and then combine them into a bundle. When the bundle gets delivered, the appropriate package for the target architecture will be applied.

 

2) If you exclude the entire entry for WorkingDirectory, the PSFLauncher will launch your program using the MSIX default of the System32 folder.  If you have an entry, but with an empty value, PsfLauncher will use the directory of the PsfLauncher instead.  If you have a non empty value, it may be an absolute reference to a folder, or a relative one from the root of the package.

Dear @TIMOTHY MANGAN 

 

Good Morning,

 

I was trying with applications that have flatten structure and everything ie executable, appxmanifest.xml, and config.json is on the same level.

 

i have tried both

---------------------------------------------------------------------------------

{
"applications": [
{
"id": "PSFLAUNCHERTHREETWOONE",
"executable": "MyApps.exe"

"workingDirectory": ""
}
],
"processes": [
{
"executable": "MyApps",

 

------------------------------------------------------------------

and this 

--------------------------------------------------------------------

{
"applications": [
{
"id": "PSFLAUNCHERTHREETWOONE",
"executable": "MyApps.exe"
}
],
"processes": [
{
"executable": "MyApps",

---------------------------------------------------------------

 

but I see the same error in both case.

 

---------------------------
Package Support Framework
---------------------------
ERROR: Failed to create detoured process
Path: "MyApps.exe"
Error: The system cannot find the file specified (2)
---------------------------
OK
---------------------------

 

please let me know if i am missing anything

 

Thanks,

Vikas

 

 

@tester2420 The syntax looks OK (assuming the filename for the launcher is PsfLauncher321.exe); the concept of flattening the structure to have everything at the root of the package is OK. So it is something else.  

 

A ProcessMonitor trace of the file activity should help. 

 

Alternative debug output is available from the launcher includes diagnostic telemetry that is output to the debug port -- use DebugView to see that. [Note: For this type of problem you don't need the Debug PSF build to get good info into DebugView. PsfLauncher emits in both release and debug builds; the other fixup dlls only emit in debug builds].

@TIMOTHY MANGAN 

 

Thank you so much Tim, it worked well.