Jump to content

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


dv8
 Share

Recommended Posts

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. :)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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... :)

Link to comment
Share on other sites

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.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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 )

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

  • Developers

Want fries and mayo with that? :)

Current Beta has the following addition:

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

Enjoy,

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...