Skip to content

PsfRuntime Dll and PsfRunDll exe

Tim Mangan (MVP) edited this page Apr 6, 2022 · 3 revisions

The PSF includes some required elements in order to use the PSF.

PsfRuntime Dll

The PsfRuntime32.dll and PsfRuntime64.dll files are required any time the PSF is in use. This dll module is used in two ways:

  1. It is automatically loaded by PsfLauncher processes to read in the applications section of the config.json file to locate the appropriate configuration for this instance of PsfLauncher.
    • It will start any monitor defined in the configuration (like PsfMonitor).
    • It will run any start script defined in the configuration.
    • It will run the target application defined in the configuration.
    • It will inject a copy of PsfRuntime dll into this target application process before the process runs.
    • It will run any end script defined in the configuration.
  2. When injected into a process running inside the container, this dll will also read the config.json file to locate the appropriate process configuration. This configuration may consist of a variety of fixups, which are the FixupDlls to also be injected into this process before allowing the process to run. It will also add a dll intercept to the Windows API that starts new processes so that it may inject another copy of PsfRuntime into any process started in the container.

The copy of the PsfRuntime dll used by PsfLauncher must always be the same bitness as that of the PsfLauncher which should also match that of the target application process.

PsfRunDll Exe

There are times when different processes inside the container may run under different bitnesses. This may be due to vendor design, or due to AnyCPU executables that may run differently on different systems. As dlls must always match the bitness of the process they are in, this means that there are times a PsfRuntime of one bitness must inject a PsfRuntime of a different bitness into a new process.

When this situation arises, the PsfRuntime will attempt to use PsfRun32.exe or PsfRun64.exe The bitness of the PsfRun process requested will match that of the new process needing a copy of PsfRuntime, and this PsfRun process will be able to perform the injection.

It is common practice to include copies of multiple bitnesses of PsfComponents, including PsfRuntime Dll and PsfRunDll Exe in the package to ensure that the package can run on any system/configuration.