APC useage

The A3C_APC build option is used to choose the program container mode.

Currently there are two internal loaders spread across three options or modes:

Loader 1 - Mode A (default)
* Compatible with 3.3.8.0 and older AutoIt standalones.
* Supports standalone interpreter being packed/protected before being embedded.
* Does not support being packed/protected after final exe creation.

Minimal Example:
Compressing the interpreter before apc embedding. Supports old and new AutoIt standalones.
A3C_IN   = MyScript.au3
A3C_APC  = A
[A3C_PBE]
UPX D = <<
@UPX> } --best -q -f "@BIN>" } @TMPD> } 0 } D

Loader 1 - Mode B
* Supports being packed/protected after final exe creation by some armoring tools; but it is not compatible with AutoIt standalones older than 3.3.10.0 if you do so.
* Other than the above it is identical to mode A.

Example:
Compressing interpreter before apc embedding and compressing output after. New (Resource) AutoIt standalones only.
A3C_IN   = MyScript.au3
A3C_APC  = B
[A3C_PBE]
UPX D = << @UPX> } --best -q -f "@BIN>" } @TMPD> } 0 } D
UPX A = << @UPX> } --best -q -f "@OUT>" } @TMPD> } 0 } A

Loader 2 - Mode C
* Supports being packed/protected after final exe creation by some armoring tools; but it is not compatible with AutoIt standalones older than 3.3.10.0 if you do so.
* Supports directing the standalone to a different resource embedded a3x from the commandline.

For the A3X redirection procedure to work the following conditions are required:


* The standalone interpreter must be version 3.3.10.0 or newer.
* The standalone interpreter cannot be packed/protected before being added to the loader.
* The A3X file(s) must be created with the same temporary builder as the main application.
* The resource index name of the A3X file cannot exceed 6 characters in length.

Example:
Multiple A3X files and compressing output after. New (Resource) AutoIt standalones only.
A3C_IN   = MyScript.au3
A3C_OUT  = MyApp.exe
A3C_APC  = C
[A3C_RES]
Embed A3X  = RC  }
EA3X1 } 0 } 1.a3x
[A3C_PBE]
A3X 1 = @A2E> } /in "1.au3" /out "1.a3x" } @SD> } 0 } I
      = |F    } DELETE , @SD>1.a3x       }      }   } B
UPX A = << @UPX> } --best -q -f "@OUT>} @SD> } 0 } A

Once the output exe has been built to instruct the loader which a3x should be executed a special commandline switch is required: ~$RESIND , where RESIND is the 6 characters or less resource index.

Using the example above as a reference to ex
ecute its embedded a3x.
MyApp.exe ~$EA3X1
The switch is removed from the commandline that the interpreter is executed with so it has no impact on any parameters you pass to the A3X.
MyApp.exe ~$EA3X1 "Parameter 1" /Parameter2 ...

It is recommended that the switch be used as the first parameter to get it out of the way; however it can be used anywhere.
When not present the default application A3X will be executed as you would expect.

This method is a mere prototype for the experimental user, the loader does not actually check that the interpreter contains the indicated resource, so the interpreter will display an error message if the parameter does not match a valid resource name.

For this reason this particular loader is not really recommended for distributable standalones.



Notes

Above upx.exe is referenced as an executable compressor, however what tool you actually use is up to you.

Executable compressors are sometimes used in conjunction with AutoIt standalones because each one contains all the power and potential of AutoIt3.exe plus your sourcecode plus any resources you add which often leads to a justifyably larger program than most expect.

Unfortunately regardless of innocence or guilt these tools are often falsly flagged by wayward antivirus utilities as malicious so it is important you understand this before you start publicly distributing packed applications.

If the APC loader supports the interpreter being packed before embedding and you do so and don't use a packer afterward; sometimes it is possible to lower the number of false positives normally associated with that packer. However the loaders have problems of their own with antiviruses which is a trade off that should be considered and experimented with by the user.

Not all types of packed or protected standalones support being executed from memory by the loader, similarly not all packers can compress the output loader package even when the loader supports it.