Sign in to follow this  
Followers 0
KaFu

Compiling and Comments

25 posts in this topic

Hiho, based on a discussion about variable length and execution speed I wondered what happens to the comments in my scripts when compiling the source? Are they stripped?

Cheers

Share this post


Link to post
Share on other sites



Just tested, seems they are stripped, yes.

Share this post


Link to post
Share on other sites

What's to be agreed with? Speculation? You either know or not.

It would be nice if one of the devs would answer the question.

Btw, check Manadar's number of posts.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It's pretty easy to test. Just add an insane amount of comments to the script, compile, and see if the resulting EXE file's size changes appreciably. In my case, I added 40K of comments and the EXE size remained the same. Good enough for you?

And what does Manadar's post count have to do with anything?

Edited by wraithdu

Share this post


Link to post
Share on other sites

It's pretty easy to test. Just add an insane amount of comments to the script, compile, and see if the resulting EXE file's size changes appreciably. In my case, I added 40K of comments and the EXE size remained the same. Good enough for you?

And what does Manadar's post count have to do with anything?

What kind of comments? "#cs/#ce" or ";" or "#"

Always a speculation.

Look at the number of your posts, lol :D


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You can also compile to a3x and see what the resulting appended encrypted script is. It's obvious from that whenther there are comments in there. And I tested with ';' and #cs/#ce type comments. Both are stripped.

EDIT - wow, read that out of context apparently.

Edited by wraithdu

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

This thread is the spawn of satan. Both 6666 posts being reached and 666 posts being reached.

Edit: Clarified myself, sometimes I feel I've been struck with a confusion of tongues.

Edited by Manadar

Share this post


Link to post
Share on other sites

LOL

Share this post


Link to post
Share on other sites

You can also compile to a3x and see what the resulting appended encrypted script is. It's obvious from that whenther there are comments in there. And I tested with ';' and #cs/#ce type comments. Both are stripped.

EDIT - wow, read that out of context apparently.

Could you do it for this script:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_Type=a3x
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#   Local $hResourcesExe = Run("Resources.exe -add -compile MyRes.dll -res SomeAnimated.gif -type GIF -name 1 -lang 0", "", @SW_HIDE, 6); $STDERR_CHILD + $STDOUT_CHILD
#   Local $sLine, $sLineError
#
#   While 1
#       $sLineError = StderrRead($hResourcesExe)
#       If @error Then ExitLoop
#       If $sLineError Then
#           ConsoleWrite($sLineError)
#       EndIf
#       Sleep(100)
#   WEnd
#
#   While 1
#       $sLine = StdoutRead($hResourcesExe)
#       If @error Then ExitLoop
#       If $sLine Then
#           ConsoleWrite($sLine)
#       EndIf
#       Sleep(100)
#   WEnd

and this:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile_type=a3x
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

End-of-line comments do not seem to be stripped (adding a really long one increases a3x size). But '#' are not valid comments, at least not according to the help file, even though Au3Check and the interpreter seem to ignore them. Only ';' and #cs/#ce are documented and stripped.

Share this post


Link to post
Share on other sites

End-of-line comments do not seem to be stripped (adding a really long one increases a3x size). But '#' are not valid comments, at least not according to the help file, even though Au3Check and the interpreter seem to ignore them. Only ';' and #cs/#ce are documented and stripped.

If dev - Jos is using "#" to enter comments (from AutoIt's point of view) then I would say it can't be defined as invalid. AutoIt3Wrapper would call them "directives".

Au3Check.exe uses "#" too.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Pre-processor statements start with the # character, not comments. The AutoIt interpreter ignores pre-processor statements it doesn't recognize (rather than throwing an error). But they ARE NOT comments.

Edited by Valik

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Pre-processor statements start with the # character, not comments. The AutoIt interpreter ignores pre-processor statements it doesn't recognize (rather than throwing an error). But they ARE NOT comments.

Further to this statement. Comments begin with semi-colons ( ; ). If one of your pre-processor instructions actually matched a real pre-processor instruction, then that could cause the compiler to do weird things, depending on which on you actually matched.

#This is supposed to be a comment
#ce is used to end most comments.
; This is a real comment.

AutoIt would fail on the second line, because there was no #cs before it.

BTW, when you compile a script, the obfuscater strips all the comments, even ones at the end of lines.

Edited by Nutster
Smiley avoidance.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Okay here,

All comments are striped.

This include #cs #ce ;

But #Region and #EndRegion ARE NOT STRIPED.

See before compile

#Region
#AutoIt3Wrapper_Res_Comment=asdas
#AutoIt3Wrapper_Res_Description=asd
#AutoIt3Wrapper_Res_Fileversion=dasdasdsa
#AutoIt3Wrapper_Res_LegalCopyright=sdasd
#EndRegion

After Decompile

#Region
#AutoIt3Wrapper_Res_Comment=asdas
#AutoIt3Wrapper_Res_Description=asd
#AutoIt3Wrapper_Res_Fileversion=dasdasdsa
#AutoIt3Wrapper_Res_LegalCopyright=sdasd
#EndRegion

In any such case these things should be remove also, at all cost because they are useless in the program.

Edited by athiwatc

Share this post


Link to post
Share on other sites

Okay here,

All comments are striped.

This include #cs #ce ;

But #Region and #EndRegion ARE NOT STRIPPED.

#Region is a preprocessor statement, not a comment. Because preprocessor statements can change the behaviour of the compiler, they have to be left in after the preprocessor is done its job.

#cs - #ce and ; comments are recognized by the obfuscater and removed. Because the the obfuscater runs before the compiler, it must leave in all the other preprocessor statements for the compiler to deal with.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

#Region is a preprocessor statement, not a comment. Because preprocessor statements can change the behaviour of the compiler, they have to be left in after the preprocessor is done its job.

Example:

#forceref $hWnd, $Msg, $iIDTimer, $dwTime

used in timer callback functions, this statement is necessary for the callback to work, thus I assume it must not be stripped.

#cs - #ce and ; comments are recognized by the obfuscater and removed. Because the the obfuscater runs before the compiler, it must leave in all the other preprocessor statements for the compiler to deal with.

You mention the obfuscater... but what does the compiler do? I have some scripts using call() and isdecleared() which I can't preprocess before compiling using the obfuscater, so what does the standard au compiler do to the comments? And also what wraithdu mentioned

End-of-line comments do not seem to be stripped (adding a really long one increases a3x size).

is this true?

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

In any case everyone should use Obfuscator anyway before you release.

<<<< Final Mr.Wolf said so.

All test.

This explain that Obfuscator DOES remove some part and some part the compiler remove them by default.

#region --- ScriptWriter generated code Start ---
$test = "hi"
#EndRegion
#region
$testttt = "hi"
#EndRegion
;Hi
$tests = "tetste" ; Hiiiiii
#cs
fsfrfrgd
#ce

After

#Region - - - ScriptWriter generated code Start - - -
$TEST = "hi"
#EndRegion
#Region
$TESTTTT = "hi"
#EndRegion
$TESTS = "tetste"

With Obfuscator (No obfuscate)

$test = "hi"
$testttt = "hi"
$tests = "tetste"

Clear by my water pool!

Edited by athiwatc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0