GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Two — Language Overview (continued)
Overview
The ScriptCrunch function preprocesses a script and crunches the result. In addition, the script can be signed and encrypted.
Syntax/Parameters
Syntax
int = ScriptCrunch ( string source, string destination, [dword options] );
Parameters
source
A string containing a qualified filename for the script to crunch.
destination
A string containing a qualified filename to write the crunched script. The script must have full read/write access to the file. If the string is empty, the source filename is used to write back the crunched data.
options
An optional dword containing option flags for the crunch process. If omitted, the default is to encrypt the script, SCRIPT_CRUNCH_ENCRYPT.
Return Value
Returns an int as ERROR_NONE or a formatted error code on failure. The error code can have additional bits set to indicate an issue for the source or destination file or signing issues. If the script fails to preprocess, an ERROR_SYNTAX will be returned. Use the GetLastErrorLog function to get a log of errors and locations.
Remarks
By crunching a script, a programmer can either significantly reduce the human code readability and code size or make it completely unreadable. This is similar to code obfuscation in other programming languages.
The ScriptCrunch function undertakes a number of steps to crunch a script. Depending on the options selected, the following is performed:
– Source code is preprocessed.
– Combine code is crunched.
– The code is optionally signed.
– The code is optionally compressed and encrypted.
The act of “crunching code” removes all comments and unnecessary spaces, tabs and other superfluous information from the code. Any text included such as resources and other information is embedded during the crunch process.
If the code is encrypted, it can only be executed. The resulting file is not editable.
The option codes are as follows:
SDK Definition | Code/Bits | Description | |||
SCRIPT_CRUNCH_WANT_LOG | 0x00000001 | Return Pointer to Log (caller owns) | |||
SCRIPT_CRUNCH_SIGN | 0x00000002 | Sign Code | |||
SCRIPT_CRUNCH_ENCRYPT | 0x00000004 | Encrypt Code | |||
SCRIPT_CRUNCH_DEBUG_INFO | 0x00000008 | Add Debug Info (reserved for future use) |
Programmers should not crunch source scripts and return the crunched data to the source file. The file will be overwritten.
When the sign code option is enabled (using the SCRIPT_CRUNCH_SIGN bit), a signature is added using an available code signing certificate. See ScriptSign. If the source script is sign, the certification information and signature will be stripped during the processing process. (Since a signature is stored as comments, they are removed as part of the crunch process. Therefore, any signature from the source is essentially ignored,)
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.