AndyFul / Hard_Configurator

GUI to Manage Software Restriction Policies and harden Windows Home OS
Other
499 stars 43 forks source link

Source code can not compile #9

Closed TrashAccount3424 closed 2 years ago

TrashAccount3424 commented 2 years ago

What should this even be? This is not valid code, its just a number.

https://github.com/AndyFul/Hard_Configurator/blob/c7975776fe193c71c7431da7fe8e5c540aadd944/src/Hard_Configurator/ConfigureDefender/ConfigureDefender.au3#L1050

AndyFul commented 2 years ago

As it has been stated in the How2build_H_C.txt: "The code was tested on Autoit ver. 3.3.14.2 and SciTE4AutoIt3 ver 16.612.1119.0". This version of AutoIt can be downloaded from: https://www.autoitscript.com/autoit3/files/archive/autoit/autoit-v3.3.14.2-setup.exe

The old version of SciTE4AutoIt3 is not available now, but it is not necessary - one can use the Autoit options "Compile Script (x64)" or "Compile Script (x86)". I updated today the How2build_H_C.txt to include this.

The Hard_Configurator scripts do not work with newer versions of AutoIt. But, ConfigureDefender can be compiled successfully also with the current Autoit v3.3.14.5 (tested today).

The line with 333333 is not necessary (can be deleted), but it is ignored by the compilator, anyway (I used this line as a marker).

TrashAccount3424 commented 2 years ago

Its not really compiled its interpreted. And the interpreter usually just skips over stuff it does not know. But AutoIt comes with a tool named AU3Check which tells you beforehand which code the interpreter can not process. If you "run" code that does not follow the AutoIt syntax or otherwise is not valid code for the interpreter, you get undefined behavior. If you skip the checks that basically the same as turning the errors/warnings off it runs but when it reaches invalid code you dont know what it will do. Some stuff will crash the interpreter.

There are plenty other warnings beside that line I just pointed out the obvious one that does not represent valid code.

The version of AutoIt does not seem to matter. The latest stable version an beta has no problem "compiling" it, If errors and warnings are simply ignored. But that's kinda meaningless it would do that with a random text file too.

AndyFul commented 2 years ago

The executable is "compiled" in the way described by AutoIt creators: https://www.autoitscript.com/autoit3/docs/intro/compiler.htm

You are right that the line with 333333 is not necessary, Originally the line started with ";" and should be ignored by the interpreter. Because it is not necessary I have removed today the whole line from the code.

TrashAccount3424 commented 2 years ago

The word used doesn't matter. The code is interpreted and there are huge amounts of errors and warnings if you run it trough AU3Check which is the official tool that make sure the code can be interpreted correctly. Its the equivalent of compiler errors/warnings for if you like that wording better.

Either way it seem like you dont want to use AU3Check or fix the errors and warning so feel free to close this issue.

AndyFul commented 2 years ago

There is nothing to fix in the ConfigureDefender code. If you use the recommended version of AutoIt + Au3Check.exe, then the check does not show any error. It shows 6 warnings, like: "$MainDefenderGUI: possibly used before declaration". All these warnings are incorrect because the variables are correctly declared as global variables at the beginning of the program.

Anyway, by using Au3Check I found a few minor errors in Hard_Configurator code. They will be removed soon.