Sign in to follow this  
Followers 0

AutoIt3Wrapper can not run Obfuscator if the SciTE.exe does not exists.

30 posts in this topic

Posted

Hi guys,

I just found out that the latest beta of AutoIt3Wrapper (v2.1.0.17) can not run Obfuscator if the SciTE.exe does not exists.

This is because of this condition in the source (lines 205-207 from http://www.autoitscript.com/autoit3/scit...ad/beta_SciTE4AutoIt3/AutoIt3W):

If Not FileExists($SciTE_Dir & "\SciTE.exe") Then
   $SciTE_Dir = StringReplace(SendSciTE_GetInfo($My_Hwnd, $SciTE_hwnd, "askproperty:SciteDefaultHome"), "\\", "\")
EndIf

The above code always returns empty string for me.

And the compiled version (12/12/2011 - v2.1.0.7) available here: http://www.autoitscript.com/site/autoit-script-editor/downloads/ also has this problem, even though it is under the "Included Utilities I’ve created for those running other editors:" statement.

I'm using the PSPad editor and I'm currently unable to use the latest AutoIt3Wrapper with Obfuscator. I'll try to tamper with its source and compile an EXE for temporary use, but an official fix would be appreciated. :)

Share this post


Link to post
Share on other sites



Posted (edited)

Did you fix this by something like this after the shown files?

If Not FileExists($SciTE_Dir) Then
	$SciTE_Dir = ".." & @ScriptDir
EndIf

I am trying to keep the utilities portable...

Edited by Jos

Share this post


Link to post
Share on other sites

Posted

What I did when working with a portable version of AutoIt/SciTe/Etc. I modified the wrapper so that it wouldn't look in the registry for the scite folder's location, and used an environment variable that pointed to where I had it, because the thumb drive letter changes depending upon which computer I'm plugged into. Then modified the wrapper to use that environment variable as the location of the Scite folder.

Share this post


Link to post
Share on other sites

Posted

I am assuming the directory structure and use that. In case that SciTE isn't found it will "ask" the running SciTE program.

In the above case, SciTE doesn't exists, so I have to assume that the Editor program directory is "one up" from the AutoIt3Wrapper directory.

Don't like that idea that you need to set an Environment variable before this works.

Share this post


Link to post
Share on other sites

Posted (edited)

I think the best way would be to add a compiler directive for the Obfuscator path. Maybe something like:

#AutoIt3Wrapper_ObfuscatorEXE=...

Because I usually put these tools in my AutoIt folder, instead of the editor folder.

Just a thought... :)

Edit: My temporary fix is just to comment these 3 lines, because they do not really matter to me.

Edited by dv8

Share this post


Link to post
Share on other sites

Posted

So that means that the original value set is working for you and should be restored when SciTE.exe doesn't exists and SciTE not running:

Global $SciTE_Dir = _PathFull(@ScriptDir & "....")

Not going to add a directive for this and think it is fair that Obfuscator is assumed to be in the relative path of AutoIt3Wrapper in that way.

Jos

Share this post


Link to post
Share on other sites

Posted

Just give the current Beta a try....

Share this post


Link to post
Share on other sites

Posted

Yeap, the relative path works for me, but I had to look into the source to figure out where it expects the file to be.

It was only showing the "ObfuscatorObfuscator.exe" in the error message during the wrapping. But I guess now that it is set up correctly it should give the expected path in that error message.

Let me try the beta and I'll let you know... :)

Share this post


Link to post
Share on other sites

Posted

Yes! ;)

Works like a charm! And displays the whole path in the error message so people will know where to put it...

Thank you VERY MUCH for the extremely fast reply and fix! You guys are amazing!

I just scheduled another small donation for tomorrow, when my paycheck arrives. :)

Share this post


Link to post
Share on other sites

Posted

I am assuming the directory structure and use that. In case that SciTE isn't found it will "ask" the running SciTE program.

In the above case, SciTE doesn't exists, so I have to assume that the Editor program directory is "one up" from the AutoIt3Wrapper directory.

Don't like that idea that you need to set an Environment variable before this works.

This was done before the latest updates to the program, prior to the 3.3.8.0 release, because before that it wouldn't work if I had the program on a thumb drive.

Share this post


Link to post
Share on other sites

Posted

This was done before the latest updates to the program, prior to the 3.3.8.0 release, because before that it wouldn't work if I had the program on a thumb drive.

Agree and that is one of the modifications in the latest versions of AutoIt3Wrapper to allow portability and running it from any directory or drive without the need to update the registry or config files.

Share this post


Link to post
Share on other sites

Posted

Hey guys, while I have you reading this topic, may I ask you the question that started all this Obfuscator adventure for me?

The main purpose for me to start using the Obfuscator was to have obfuscated source and hopefully be able to match the line number of the error message given by the compiled EXE with the obfuscated source.

This was suggested in this thread:

I just tried that approach and tested it by intentionally adding a buggy line in my code, and the error was reported on the 14111 line, but the buggy line in the obfuscated code is 14366. :)

So my main question that started this all was:

Is there any way I can get the final source code with all the includes added, just the way it is composed by the Aut2exe so I can find the error reported by the EXE file on the same line number?

I really hope someone can suggest a straightforward way to do that.

Share this post


Link to post
Share on other sites

Posted

I think that may be related to lines that are continued on the line(s) below it, the program sees it as one long line while the code is written on several lines. So what that does is it pushes your error line down in the editor but not in the actual script as far as the interpreter sees it.

Share this post


Link to post
Share on other sites

Posted (edited)

Actually the reported line (14111) is above the actual line in the script (14366). And according to your theory it should be the other way around...

EDIT: Sorry, I just reread your post and saw I misunderstood you... Please disregard the above line.

I'm thinking, what good is the reported line number for, if there is no way you can actually match it, unless your script has only a few lines and no includes.

And since Aut2Exe is preparing this whole bunch of code before the actual compilation, why isn't there a compiler option to save a copy of this code to a file for error tracking purposes?

I don't have any knowledge about the internals of the compilers, so excuse me if this question seams silly to you. That's just my logic talking...

Edited by dv8

Share this post


Link to post
Share on other sites

Posted

Run this on your script source generated by Obfuscator and see if the line number are correct now:

$SourceFileName = FileOpenDialog("Specify the file to be processed", @ScriptDir, "AutoIt3 Script (*.au3)", 3)
If @error Then Exit
;
$ScriptData = Fileread($SourceFileName)
;Merge Continuation line into one line
$ScriptData = StringRegExpReplace($ScriptData, "( _rn)", "")
$TargetFileName = StringReplace($SourceFileName,".","_N.",-1)
FileDelete($TargetFileName)
FileWrite($TargetFileName, $ScriptData)
ConsoleWrite("> newfile: " & $TargetFileName & @crlf )

Share this post


Link to post
Share on other sites

Posted

Actually I just counted the "_"s at the end of the lines in it and they were exactly 255 (14366-14111) :)

But thanks for the script! I'll use it in the future. ;)

Thank you guys once again! I spent almost the entire day on these issues and finally I feel there is a progress here!

I appreciate your help!

If any of you finds himself in Plovdiv - Bulgaria, drop me a PM here and I'll be glad to meet you and buy you a lunch or dinner! ;) I'm serious!

Share this post


Link to post
Share on other sites

Posted

Jos,

Do you think you can consider adding a new /SILENT command line option in the wrapper to prevent the progress from popping up and taking the focus from the current window? :)

I've set up some BAT files to batch compile multiple scripts in the background and it is just annoying when these progresses start popping up and taking the focus while I'm typing or doing something else.

I really hope you find this suggestion reasonable. ;)

Share this post


Link to post
Share on other sites

Posted

Want fries and mayo with that? :)

Current Beta has the following addition:

- Added /NoStatus commandline option to suppress the Progress window.

Enjoy,

Jos

Share this post


Link to post
Share on other sites

Posted

THANK YOU! You are the man! :)

Share this post


Link to post
Share on other sites

Posted

Guys I just wanted to let you know that the Donation page and button are currently nowhere to be seen on the site through the available links (except on the "AutoIt Tools: Logoff Screensaver" page). I had to do a search for "donation" in order to find the donation page.

You may want to fix that, because it may lower the number of donations for you...

Thank you, once again.

Share this post


Link to post
Share on other sites

Posted

Agree and that is one of the modifications in the latest versions of AutoIt3Wrapper to allow portability and running it from any directory or drive without the need to update the registry or config files.

I ran into one issue with SciTE, not an AutoIt3 issue, when using it from a USB drive. If you don't have the environment variable "SciTE_HOME" set to where you have the SciTE program running from, in my case it's set to the directory the program I use to start SciTE and set the variable, SciTE defaults to looking for the "SciTEGlobal.properties" in the folder that SciTE is running from, but the "SciTEUser.properties" file is automatically assumed to be found in the current user's user profile directory on Win7 it's "C:User<username>" and doesn't read the one in the SciTE folder. The SciTEConfig program that comes with the full editor always defaults to the user profile folder and ignores the "SciTE_HOME" environment variable.

That was what I was attempting to avoid by using guinness' Portable AutoIt a while ago. Like I said, this is by design in SciTE, so all that is really needed now is a batch file to set the environment variable that keeps running until SciTE is closed, the environment variable set by a batch file only lives as long as the batch file runs.

Share this post


Link to post
Share on other sites

Posted (edited)

True that the SciTEConfig isn't looking at these and that is something to look at for me. :)

On Windows, the global properties file is located in the directory of the executable. The user properties file is looked for in the user profile directory as set in the USERPROFILE environment variable, or in the directory of the executable if USERPROFILE is not set. For GTK+ the user properties file is found in the user's home directory and the global properties in a directory set at build time - normally /usr/share/scite. If the "SciTE_HOME" environment variable is set on either Windows or GTK+ then it is where both the global and user properties files are found.

Just for my interest: Why do you set this SciTE_HOME variable for the portable version?

Edited by Jos

Share this post


Link to post
Share on other sites

Posted

I set the env. variable so that Scite looks for the user.properties file in it's folder rather than the User profile on the computer. Because of the way that Scite looks for it's files it's the only way for it to be able to find the portable SciteUser.properties file on the thumb drive, and that's because on every computer I've used the USERPROFILE environment variable has been set, and it looks like Scite looks at them in order

1) SciTE_Home variable

2) UserProfile variable

3) Folder that Scite is run from if 1 or 2 isn't set.

Share this post


Link to post
Share on other sites

Posted

Guys I just wanted to let you know that the Donation page and button are currently nowhere to be seen on the site through the available links (except on the "AutoIt Tools: Logoff Screensaver" page). I had to do a search for "donation" in order to find the donation page. You may want to fix that, because it may lower the number of donations for you...

There's also a button on the front-page of the forum (Help the website!).

Share this post


Link to post
Share on other sites

Posted

I too did some testing the same as BrewManNH and the only way I've found is setting the SciTE_Home environment variable and then executing SciTE, though the script doesn't have to continue running once SciTE is loaded.

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




  • Recently Browsing   0 members

    No registered users viewing this page.