Author Topic: Use global declarations at compile time to combat decompilation  (Read 1069 times)

0 Members and 1 Guest are viewing this topic.

baitang36

  • Bull Frog
  • Posts: 213
Let's start with a simple example
Code - Auto/Visual Lisp: [Select]
  1. (defun t1 () (princ "t1"))
  2.  (defun t4()
  3.          (defun t2 () (princ "t2"))
  4.          (defun t3 () (princ "t1"))
  5.          (princ "t4")
  6.  )      
  7.  (defun t5 ()(t1)(t2)(t3)(t4)
  8.  )
After normal compilation, you can decompile perfectly. The obtained LSP can run normally, and the source code is no different.
If you choose optimization when compiling, edit the global declaration again, drop t2, t3, t4, and decompile with some popular decompile software after compiling, you will get the following results:
Code: [Select]
(DEFUN T1() (PRINC "t1" )  )
 (DEFUN C:XXXXXXXXX() (DEFUN C:XXXXXXXXX() (PRINC "t2" )  ) (DEFUN C:XXXXXXXXX() (PRINC "t1" )  ) (PRINC "t4" )  )
 nil
 (DEFUN T5() (T1 ) (&H24 ) (&H43 ) (&H14 )  )
As you can see, t2, t3, and t4 have changed and are not the original code.
Functions defined in the function, only to the program call, such a function drop is safe. If you consider calling a function to another program, you must not drop, or else the other program can not find, will error.

T1.gld is the configuration file required for project t1 compilation. Click edit global declaration and it will be generated automatically.




EDIT (John): Added code tags.
« Last Edit: March 17, 2020, 08:44:48 AM by John Kaul (Se7en) »