Jump to content

Code Scanner


RTFC
 Share

Recommended Posts

Nope, it should run out of the box. Let me try and see if I can reproduce your issue in a newly-installed test environment...

EDIT: And it does run out of the box, for me, running on v.3.3.14.5. And for me to fix anything, I need to be able to see it break in my own environment.:( Maybe retry after restarting your OS afresh, or testing on another machine. Not sure what else to suggest, sorry.

Edited by RTFC
Link to comment
Share on other sites

same issue on another system, what Version of windows are you running this on

After doing more digging appears to fail in AES on code below

Local $Ret = DllCall("user32.dll", "uint", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer) + $AP_Decompress, _
                                                    "ptr", DllStructGetPtr($Output) + 4, _
                                                    "ptr", DllStructGetPtr($Result), _
                                                    "int", 0, _
                                                    "int", 0)

Link to comment
Share on other sites

I'm on W10Pro/x64.

Just a wild guess: you're running in an x64 environment, and it's the test script that's crashing, not CodeScanner.

Edited by RTFC
typo
Link to comment
Share on other sites

Yes im running in x64 , but it is codescanner that is crashing

 

when you tested in a new env how did you do that

I created a VM and installed autoit and scite and your codescanner files and had the same issue

Also are you on windows ver 2004 ?

Edited by HighlanderSword
Link to comment
Share on other sites

Okay, edit your MCFinclude.au3 _dummycalls() func thus:

Func _dummyCalls()
; prevents MCF:_CreateSingleBuild() from removing the defs as redundant
; this UDF will be fixed-key encrypted

    _MCFCC_Init($CCkeytype,False,True)
    _MCFCC("")
    _MCFCNG("init")

 

Link to comment
Share on other sites

Despite claims to the contrary, Ward's AES machine code does not work on x64; it crashes the system (as you noticed). CodeScanner includes the  MCF library, and the latter includes MCFinclude.au3. MCFinclude initialises both encryption libraries, but if you're running AutoIt in x64, then CodeScanner attempts to run AES's faulty x64 initialisation. So I'm going to patch AES some more so this can no longer happen. Many thanks for alerting me to this issue;:) it will be fixed in the next bundle release.

Link to comment
Share on other sites

Thanks for getting it to work, couple other thing you might want to be aware of

  • #include <D:\Test_includes\__ArrayDisplay.au3> , when code is like that codescanner cant find the include file, changing it to #include "D:\Test_includes\__ArrayDisplay.au3" resolved the issue
  • Once Code scanner is done and treeview is displayed double clicking the mouse on a section does not bring up the screen , have to hit the enter key , so for example double click on settings and nothing happens

 

Link to comment
Share on other sites

Thanks, but your first point is actually an AutoIt feature (and the same convention holds in many other programming languages); it's got nothing to do with CodeScanner. #Includes in angled brackets are expected to be stored in AutoIt's default #includes location; and full path references need to be in quotes. Regarding issue 2, I would consider this trivial; learn to live with it.;)

EDIT: and of course on x64 you'll have to select Bcrypt encryption only in CodeCrypter (under Tab encryption)

Edited by RTFC
Link to comment
Share on other sites

  • 2 years later...

Hi rtfc
I'm trying the "codecanner" SW to analyze the list of this small script written just to do some basic test:

Global $Temp = _GetTemp()

If $Temp >= 15 Then
    ConsoleWrite("It's Hot" & @CRLF)
Else
    ConsoleWrite("It's Cold" & @CRLF)
EndIf

Global $ii
While $ii < 10
    For $i = 1 To 10
        ConsoleWrite('.')
    Next
    $ii += 1
WEnd

Func _GetTemp()
    Local $iTemp
    $iTemp = Random(0, 30, 1)
    Return $iTemp
EndFunc   ;==>_GetTemp


I can see that in the output file called "References.txt" each line of the source is described in detail.
But in that script the references to the various "loops" do not have the reference of the two mutual line numbers relating to the mutual "Loop Start" & "Loop End". While that information is contained in the GUI TreeView in the "Results by Subject -> General -> Loops" branch. Are this information present in any other outgoing file? or can they be generated with some run parameters?
In addition, I do not find the references to the lines of the list relating to the conditionally run statements "If Then Else EndIf". Can these also be found in some files or generated with some run parameters?
Thank You in advance.

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Hi Gianni:) Good questions.

The loop-related data is stored in "loops.txt," which is written out to the CS datadump directory only if internal global parameter $fulldump is true and metacode file writing is off (as it's not necessary for MCF processing). By default in GUI and cmdline mode, this boolean is false. You can either run CodeScanner in cmdline mode with explicit parameter /f (or -f) set, or change the call to "_WriteCSDataDump(True)" in Func _AnalyseCode() to always force full output. (NB this will result in an additional query at runtime whether you wish to inspect these files with explorer when written; just press cancel).

All conditional statements are called "phrases" in this environment. You can find them in file MCF0_phrased.txt after you run CodeCrypter to produce an encrypted version of your script. For that to work (and for Codecrypter to work on your code at all) you need to add #include "MCFinclude.au3" prior to your code, and (re)run CodeSCanner with writeMCF enabled.

In MCF0_phrased, look for "If {phrase", "While {phrase" and/or "Until {phrase"; each line has file and line number references suffices in curly brackets appended.

I never intended CodeScanner to produce separate listings of all conditionals (branching points), but the MCF library is able to produce these (see func _PhraseMCF in MCF.au3). You could hook into the MCF library directly with your code, without jumping through CodeCrypter's hoops (in which case, please consult the MetaCode tutorial pdf here).

Any more issues, don't hesitate to ask.

Link to comment
Share on other sites

Hi @RTFC, Thank you for your answer,

I was able to generate the loops.txt file, but not the MCF0_phrased.txt file
Could you please detail the steps required to generate the MCF0_phrased.txt file as well?

  • I added #include "MCFinclude.au3" at the beginning of my Simplest.au3 target file
  • I checked that the WriteMetaCode=True entry is present in the CodeScanner.ini file
  • I forced the True parameter in the _WriteCSDataDump(True) function present in the _AnalyseCode() portion of the CodeScanner.au3 listing
  • so running CodeScanner.au3, this also generated the loops.txt file

Running codecrypter.au3 later I get this alert:

"CodeScanner output file not found:
\....\Simplest.au3.CS_DATA\AU3operators.txt
Are you sure you ran CodeScanner with setting "WriteMetaCode=True",
on target file \....\simplest.au3 before? CodeCrypter requires this function."

the process proceeds anyway, but at the end I can't find the MCF0_phrased.txt file

Where am I doing wrong?
Thanks again for any help

Edited by Gianni

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

You're not going wrong, I was.:baby: CodeScanner was the second AutoIt script I ever wrote, and the first one I ever released (I wrote it to trace/resolve a deeply-nested callstack bug in my first script I just couldn't seem to fix manually; that now seems like a lifetime ago). It's almost a decade old and filled with patches of patches of rookie design mistakes (such as separate, parallel explicit lists of files to process for different cases, which then diverged, which causes "AU3operators.txt" to be written out for MCF processing, but not when writing a full dump). I never noticed this before, so thank you for spotting this. I should really spend some time to overhaul that whole data dump disaster and make it streamlined and consistent for a change. In the meantime, a quick patch would be in CodeScanner's function _WriteCSDataDump, immediately under label "; dump 1-D arrays" to just duplicate line:

"_FileWriteFromArray1D($CS_dumppath & "AU3Functions.txt",$AU3Functions,1)"

and edit it to write out the operators too:

_FileWriteFromArray1D($CS_dumppath & "AU3operators.txt",$AU3operators,1)

Since it always exists, there's no need to check for existence and optionally add an empty dummy file afterwards (immediately below that section).

 

Hint: Instead of using CodeCrypter (which is just a front-end for the MCF library), I would suggest you engage with the latter directly (as intimated earlier), like so:

#include "MCF.au3"

Global $path="<your CS_DATA dump path, including trailing backslash \>"

If _ReadCSDataDump($path)=False Then Exit(-11)

If Not FileExists($path & "MCF0.au3") Then
    If _CreateSingleBuild($path,True)=False Then Exit(-12)
EndIf

If _PhraseMCF($path)=False Then Exit(-13)
ConsoleWrite("Done." & @CRLF)

Easier, no?

Edited by RTFC
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...