Line numbering in the source code
The obfuscated code retains the line positions of the source code. In VBA, each line of source code can be numbered at the start of the line, using an integer followed by by a colon (such 110:). When a runtime error occurs, the Erl system variable returns an integer indicating the line number of the last statement executed.
Once you know the line number in the obfuscated code where the error occurred, go to the corresponding line in the source code to see the faulty statement. Obfuscat does not alter the order of the lines related to the source code.
It is simpler not to set line numbering when programming, as best practice is to maintain ascending numbering (preferably matching the line number). Duplicate numbers are not permitted. The Obfuscat programme has an optional numbering function that automatically includes the consecutive number for each line in the code, removing all previous numbering. This feature means the programmer does not have to worry about numbering.
When programming common modules, it is sometimes necessary to exclude specific functions or instructions depending on the final use (for example, version for demo or version for production ).
The numbering function allows you to export multiple versions of the same source module, excluding specific lines based on the presence of certain keywords (which identify the different versions) in each line of the source code.
The numbering function also allows you to force the end of the source module file in advance, excluding all lines from that point onwards, based on the presence of certain keywords (which identify the different versions) in the line of source code that acts as the end of the file. Everything from that last line onwards is ignored.
Note: For the sake of simplicity, the numbering function treats lines that continue onto the next line (that is, those ending with an underscore “_”) as a single line of source code.
Parametrization in Dashboard
In the ‘Numbering phase’ section, there are several rows; each one can generate a different file containing numbered lines of source code, depending on the parameters set. Empty rows (where the ‘Renumber’ option is set to ‘No’ and other parameters are empty) are ignored. If all rows are ignored, the imported file remains unchanged for further process.
Yes/No: Select ‘Yes’to renumber the lines of VBA code, so that the line number corresponds to the line’s ordinal position within the program. In VBA, each line may have a numeric label on the left, ending with a colon, such as ‘123: ……’ This is useful for programmatically detecting the line on which an error occurs and generating the error message. Non-numeric line labels (which are usually used for GoTo) are not changed. Select ‘No’ to retain the original line numbering.
File name: Name of the exported file after this numbering phase with the parameters in this row. The export folder is the same that the imported file. If ommited, the default is the imported file name ending in ‘.num.vb’
Keywords to skip a line: Lines to be ignored. Keywords that, when appears, forces ignore the line. Used to remove specific line/s of debug or source code that you do not want to move to production. The line of source code is ignored (as if it had never existed in the import file) if one of the keywords appears in the text of that line of source code.
Keywords to end the file: Anticipated end of source code. Keywords that, when appears, forces ignore from that line and all subsequent lines. It is equivalent to a source code End Of File. Useful to remove debug code or source code at then end of the fille that you do not want to move to production. Any lines of source code from this point onwards will be ignored (as if they had never existed in the import file) if one of these keywords appears in the text of that line of source code.
