Skip to content

daemondevin/pac-man

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PortableApps Compiler - Development Branch


This branch is meant for the cutting-edge of development. Don't expect this version to work flawlessly. There may be bugs hidden throughout this experimental version of PortableApps Compiler. With this branch you will find the coding practices of Chris Morgan, FukenGruven, Azure Zanculmarktum, and myself (daemon.devin). You will also see minor influence from contributors like LegendaryHawk, DoomStorm, and other fellow developers as well. So you can expect to see great things to come out of this experimental build.

With all that said, enjoy the fresh ideas which are currently being worked out.

CHANGES


Environment Variables
  • All environment variables that start with PAL have been changed to PAC
    • I.E. %PAL:AppDir% is now %PAC:AppDir% and so on..
  • All environment variables that start with PortableApps.com have been changed to PortableApps
    • I.E. %PortableApps.comDocuments% is now %PortableAppsDocuments% and so on..
Folder Structure
  • I've changed the folder structure. To illustrate the new directory layout let's imagine we're looking at a portable version of 7-Zip which was compiled using this new design layout.

Example Directory Tree:

7-ZipPortable (Root)
      |   7-ZipPortable.exe (Portable Launcher)
      |   7-ZipPortable.ini (User Config File)
      |   
      +---app
      |    +---AppInfo    (Kept for Compatibility with PA.c Menu)
      |    |       AppIcon.ico            (Needed with PA.c Menu)
      |    |       AppIcon_128.png          ' '     ' '     ' '
      |    |       AppIcon_16.png           ' '     ' '     ' '
      |    |       AppIcon_32.png           ' '     ' '     ' '
      |    |       AppInfo.ini              ' '     ' '     ' '
      |    |       Installer.ini
      |    |       EULA.txt
      |    |       ExtendWrapper.nsh       (Formally Custom.nsh)
      |    |       Wrapper.ini            (Formally Launcher.ini)
      |    |       
      |    \---DefaultConfig (Formally DefaultData)
      |        |   DEFAULT 7-ZIP SETTINGS HERE
      |        |
      |        \---Settings
      |            7-Zip.reg
      |               
      +---bin
      |    +---7-Zip (32-Bit Program Files)
      |    |   |   7-zip.dll
      |    |   |   7z.dll
      |    |   |   7z.exe
      |    |   |   7zFM.exe
      |    |   |   '' '' ''
      |    |   |   
      |    |   \---Lang
      |    |        af.txt
      |    |        an.txt
      |    |        ar.txt
      |    |        ''  ''
      |    |
      |    +---7-Zip64 (64-Bit Program Files)
      |        |    7-zip.dll
      |        |    7z.dll
      |        |    7z.exe
      |        |    7zFM.exe
      |        |    '' '' ''
      |        |   
      |        \---Lang
      |             af.txt
      |             an.txt
      |             ar.txt
      |             ''  ''
      |
      |---cfg (Formally Data)
      |    +--Settings
      |            7-Zip.reg
      |            7-ZipPortableSettings.ini
      |
      \---etc
           7-ZipPortable.ini
           README
           UNLICENSE (using Unlicense.org/ now)
PAF to PAC Conversion
  • The compiler can now handle converting PAF PortableApps to the above folder layout. Everything is handled automatically so you do not need to manually set the files in the correct place. I also added support for converting FukenGruven's old PAFs as well.
  • Do not expect the PA.c Installer to work out of the box for this new folder structure. Since I've renamed and moved around the applicable configuration files, PA.c Installer won't be able to locate the right files any more and most likely won't be able to pack your portable. However, I haven't tested this out yet.

Features


The following is a list of features that is currently available with PortableApps Compiler. Everything listed here has been tested and is in working order.

  • Everything that is available with PortableApps.com Launcher is also available with PortableApps Compiler.
  • Minipulating Windows Services.
  • Dealing with Windows Tasks.
  • Registering DLL files.
  • Registry redirection support.
  • File-system redirection support.
  • Automatic code-signing.
  • Font support for apps that make use of fonts.
  • DualMode—For a x86_64 hybrid wrapper. (Launching 32/64 bit programs with one launcher)
  • More feature soon to come!

Launcher.ini

Environment Variables

  • %PAL:DataDir%/%PAC:DataDir% has been changed to %PAC:ConfigDir%
  • %PROGRAMDATA% has now been added and kept %ALLUSERSAPPDATA% for backwards compatibility. Both can be used anywhere you can use an evironment variable.
  • %PAC:CommonFiles% may now be used within the Launcher.ini configuration file. This environment variable will point to ..\PortableApps\CommonFiles if applicable. Can be used anywhere you can use an environment variable.

Example:

[Environment]
PATH=%PATH%;%PAC:CommonFiles%\AndroidSDK
JAVA_HOME=%PAC:CommonFiles%\Java64

Added new keys to the [Activate] section. They are as follows (a short description of what each key means or does can be found further below):

Note: You should only use the following keys if you need them, otherwise they should be omitted entirely.

[Activate]
DualMode=7-ZIP
Registry=true
RegRedirection=true
RegCopyKeys=true
Redirection=true
ForceRedirection=true
ExecAsUser=true
Services=true
RegDLLs=true
Tasks=true
Java=true
JDK=true
XML=true
Ghostscript=true
FontsFolder=true
FileCleanup=true
DirectoryCleanup=true
  • DualMode: For a x86_64 hybrid wrapper. If you want to run 32-bit/64-bit side-by-side in "Dual Mode". Just specify a short name (usually the AppID in all caps) in which you may use inside the Wrapper.ini as an environment variable. (e.g. %7-ZIP%)

  • Registry: Add support for manipulating the Windows Registry.

  • RegRedirection: Enable support for enabling/disabling registry redirection.

  • RegCopyKeys: Enable support for copying registry keys to a special hive (HKCU\Software\PortableApps.com) before launching the application and restoring the keys after the application exits. See RegistryCopyKeys.nsh in the Segments directory.

To use this feature add the section [RegistryCopyKeys] to the Wrapper.ini file. Each entry should be the path to the registry key to be copied back and forth. Example usage:

[RegistryCopyKeys]
1=HKCU\Software\MyProgram\ExtraCareNeededKey
2=HKLM\SOFTWARE\MyProgram\AnotherFragileKey
  • Redirection: Enable support for enabling/disabling file system redirection.

  • ForceRedirection: Checks using the variable $Bit to disable/enable file system redirection.

  • ExecAsUser: For applications which need to run as normal user but need the wrapper to have elevated privileges. Read this for more information on this concept.

  • Services: Add support for handling Windows Services.

To use this feature add the section [Service1] (numerical ordering) to the Wrapper.ini file. Each entry supports six keys which are as follows:

Key Value
Name The local/portable service name.
Path The path to the portable service executable. Supports environment variables.
Type Specify whether you are dealing with a service, a kernel driver or a file system driver, etc.
Choose from: own, share, interact, kernel, filesys, rec
Start Specify when the service is supposed to start.
Choose from: boot, system, auto, demand, disabled, delayed-auto
Depend List any dependencies here separated by / (forward slash).
IfExists If the service already exists, you can either skip it or replace it with the portable version of the service (the original service will be restored afterwards).
Choose from: skip, replace

Example usage:

[Service1]
Name=SomeServiceName
Path=%PAC:AppDir%\MyProgram\service32.sys
Type=kernel
Start=auto
Depend=
IfExists=replace

[Service2]
Name=AnotherService
Path=%PAC:ConfigDir%\service64.exe
Type=own
Start=demand
Depend=
IfExists=skip
  • RegDLLs: Add support for handling library (DLLs) file registration.

To use this feature add the section [RegisterDLL1] (numerical ordering) to the Wrapper.ini file. Each entry supports two keys; Type and File. All available values for Type are as follows: REGDLL, REGTLB for user, REGTLB, REGDLLTLB, and REGEXE. Refer to the TypeLib.nsh file for reference. Example usage:

[RegisterDLL1]
Tyoe=REGEXE
File=%PAC:AppDir%\MyProgram\MyProgram.exe

[RegisterDLL2]
Tyoe=REGDLL
File=%PAC:ConfigDir%\dynlib.dll
  • Tasks: Enable the TaskCleanup segment for removing any Windows Tasks that were added during runtime.

To use this feature add the section [TaskCleanup] to the Wrapper.ini file. Each entry should be the Windows Task name to be removed. Example usage:

[TaskCleanup]
1=MyAppTask1
2=Another Task w/ Spaces
  • Java: Add support for the Java Runtime Environment.

  • JDK: Add support for the Java Development Kit.

  • XML: Add XML support.

  • Ghostscript: Add Ghostscript support.

  • FontsFolder: Allows the portable application to support fonts within the directory ..\Data\Fonts. Any fonts added in this folder will be added and are available for usage during runtime. Be aware, the more fonts to process the longer it will take for the wrapper to load and unload these fonts.

Supported Fonts:

  • .fon
  • .fnt
  • .ttf
  • .ttc
  • .fot
  • .otf
  • .mmm
  • .pfb
  • .pfm
  • FileCleanup: Enable support for adding the section [FilesCleanup] in Wrapper.ini. See FilesCleanup.nsh in the Segments directory.

To use this feature add the section [FilesCleanup] to the Wrapper.ini file. Each entry should be the path to the file that needs deleting. Supports environment variables. Example usage:

[FilesCleanup]
1=%PAC:ConfigDir%\uselessUpgradeFile.xml
2=%APPDATA%\MyProgram\purposelessCfg.ini
  • DirectoryCleanup: Enable support for the sections [DirectoriesCleanupIfEmpty] and [DirectoriesCleanupForce] in Wrapper.ini. See DirectoriesCleanup.nsh in the Segments directory.

AppInfo.ini

Added the section [Team] for use with code signing and application specifications. New keys are as follows (a short description of what each key means or does can be found further below):

Note: You should only use the following keys if you need them, otherwise they should be omitted entirely.

[Team]
Developer=demon.devin
Contributors=DoomStorm
Creator=FukenGruven
CertSigning=true
CertExtension=p12
CertTimestamp=VeriSign
  • Developer: The name of the developer that created the portable application.

  • Contributors: Specify here anyone who has helped with the creation of the portable application.

  • Creator: Specify here the original developer of the PAF if you're updating someone else's work.

  • CertSigning: If set to true, the Wrapper.exe will automatically be signed using dual signature hashing algorithm standards (SHA256 and SHA1). I decided to use dual signing because Windows 8 supports SHA256 Code Signing Certificates (SHA-2 hashing algorithm); whereas, Windows 7 may only support SHA-1 Code Signing Certificates (SHA-1 hashing algorithm). It should be noted that Windows 10 has stopped accepting SHA-1 certificates and certificate chains for Authenticode-signed binaries (unless a timestamp marked the binary as being signed before 1/1/2016). You can visit this Microsoft Security Advisory article on the availability of SHA-2 code signing support for Windows 7 and Windows Server 2008 R2 for more information about this topic.

ATTENTION: As it is written right now, the PortableApps.comLauncherGenerator.exe expects the certificate file to be the developer's name (same as the [Team]Developer key's value) and located in ..\Other\Source\Contrib\certificates.

NOTE: If your certificate requires you to use a password, refer to lines 741 and 742 and input your password on column 62. Be sure it is similar to something like this: /p "PASSWORD" where PASSWORD is your password.

  • CertExtension: If the key CertSigning is set to true then this should be set to the certificate's file extension without the period (e.g. "pfx" not ".pfx").
  • CertTimestamp: Here you can choose which time-stamping service you would like to use. Refer to the table below for a small list of available services and their available hashing algorithms. I would recommend using a service which uses both signature hashes. Be aware that this key is case-sensitive. If this key is omitted, the compiler will default to using Comodo.
CertTimestamp=Value Timestamp Service Algorithms
Comodo Comodo Group, Inc. SHA-1 & SHA-2
Verisign Verisign, Inc. SHA-1 & SHA-2
GlobalSign GMO GlobalSign, Inc. SHA-1 & SHA-2
DigiCert DigiCert, Inc. SHA-1 & SHA-2
Starfield Starfield Technologies, LLC. SHA-1 & SHA-2
SwissSign SwissSign AG SHA-2

I've added several new keys to the [Dependencies] section. These newly added keys act like on/off switches to allow support for certain plugins and/or macros/functions (a short description of what each key means or does can be found further below):

Note: You should only use the following keys if you need them, otherwise they should be omitted entirely.

[Dependencies]
ElevatedPrivileges=true
UsesJava=true
UsesGhostscript=true
UsesDotNetVersion=4.5
UseStdUtils=true
InstallINF=true
RegistryValueWrite=true
FileWriteReplace=true
FileLocking=true
Firewall=true
Junctions=true
ACLRegSupport=true
ACLDirSupport=true
RMEmptyDir=true
LocalLow=true
PublicDoc=true
CompareVersions=true
ConfigFunctions=true
CloseWindow=true
JSONSupport=true
RestartSleep=500
WinMessages=true
LineWrite=true
TrimString=true
CloseProcess=true
Include64=true
IncludeWordRep=true
GetBetween=true
  • ElevatedPrivileges: For launchers which need to run with elevated privileges.

  • UsesJava: Specifies whether the portable application makes use of Java Portable.

  • UsesGhostscript: Specifies whether the portable application makes use of Ghostscript Portable.

  • UsesDotNetVersion: Specify the minimum required version of the .NET framework the portable application needs. Values can be from 1.0 thru 4.7 (e.g. UsesDotNetVersion=1.1 or UsesDotNetVersion=4.6.2).

  • UseStdUtils: Include the StdUtils plug-in without ExecAsUser

  • InstallINF: Add support and macros for INF installation. Refer to the Services.nsh file in the Segments directory for reference.

  • RegistryValueWrite: If you're using [RegistryValueWrite] than set this to true otherwise the function is inaccurate.

  • FileWriteReplace: Enables the Replace functionality in [FileWrite]

  • FileLocking: Enable this to prevent ejection/unplugging problems for USB devices. Windows Explorer tend to lock application's DLL(s). Note: As of right now, this only enables support for using ${If} ${FileLocked} and/or ${IfNot} ${FileLocked} in the custom.nsh file. ToDo: Handle without the use of custom.nsh. (Got a couple ideas already. Check back soon.)

  • Firewall: Enable Firewall support.

  • Junctions: Enable support for Junctions (SymLinks) functionality.

  • ACLRegSupport: Enable support for AccessControl on registry keys.

  • ACLDirSupport: Enable support for AccessControl on directories.

  • RMEmptyDir: Enable the function RMEmptyDir. See the Core.nsh segment on line 1192 for reference.

  • LocalLow: Enable the function GetLocalAppDataLow. See the Core.nsh segment on line 1351 for reference.

  • PublicDoc: Enable the function GetPublicDoc. See the Core.nsh segment on line 1427 for reference.

  • CompareVersions: Enable the function Compare. See the Core.nsh segment on line 141 for reference.

  • ConfigFunctions: Enable Write(S) and Read(S) functions (4 total). See the Core.nsh segment on line 236 for reference.

  • CloseWindow: Enable Close function. See the Core.nsh segment on line 1288 for reference.

  • JSONSupport: Include the nsJSON plugin allowing nsJSON::Get, nsJSON::Set, and nsJSON::Serialize for use within custom.nsh.

  • RestartSleep: Set this to a numerical value (in milliseconds) to set a sleep value for applications that need to restart (i.e. Notepad++ after installing new plugins).

  • WinMessages: Include the WinMessages.nsh file.

  • LineWrite: Include the LineWrite.nsh file.

  • TrimString: Enable the function Trim. See the Core.nsh segment on line 1093 for reference.

  • CloseProcess: Enable the function CloseX. See the Core.nsh segment on line 1125 for reference.

  • Include64: Include the 64.nsh file.

  • IncludeWordRep: Include both WordRepS and WordRep functions. See the Core.nsh segment on line 608 for reference.

  • GetBetween: Include the GetBetween.nsh file.

Visit the Docs: The PAF Docs

Contributors


This project has been started by daemon.devin and hopefully maintained on a regular basis. However, if you would like to be a part of this then please do not hesitate on getting involved! I'm always open to new ideas and a willingness for the betterment of all things code. =)

Thanks to DoomStorm for all the suggestions and heavily testing for bugs.

Thank you to the following people; Dave Green (RIP), HandyPAF, all those on the Discord Workbench and anyone else who makes use of this version to port and let portable!

A special thanks to FukenGruven. His codebase was the skeleton which was used to start this project.


=)

About

A better alternative to the PA.c Launcher—PortableApps Compiler & Management

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7