Jump to content

Startup Info Problem


Recommended Posts

This is my first script using AutoIt and I am trying to pull as much Startup data as I can. The problem I am having when I run the script below is that the first couple of entries for $StartData[$LoopNum][0] are empty but the later ones contain the data. I'm using version 3.1.1.55. Can someone take a look at this and help me figure out where I'm going wrong?

Script:

#include <Array.au3>

#cs

$StartData [x][0] = Name in Registry

$StartData [x][1] = Name in Registry Value

$StartData [x][2] = File Name

$StartData [x][3] = File Path without flags

$StartData [x][4] = File Version

$StartData [x][5] = Description <-- Figure This Out Later

$StartData [x][6] = Copyright <-- Figure This Out Later

$StartData [x][7] = Registry Path

#ce

$ProcessTotal = ProcessList()

$RunLoop = $ProcessTotal[0][0]

Dim $StartData[ ($ProcessTotal[0][0]) ][8]

Dim $Var, $RegVar[7]

$RegVar[0] = ""

$RegVar[1] = "HKLM\Software\Microsoft\Windows\CurrentVersion\Run"

$RegVar[2] = "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce"

$RegVar[3] = "HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices"

$RegVar[4] = "HKCU\Software\Microsoft\Windows\CurrentVersion\Run"

$RegVar[5] = "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce"

$LastLoop = 0

$PathLoop = 0

For $PathLoop = 1 To 5

$RegPath = $RegVar[$PathLoop]

$LoopNum = 0

Do

$LoopNum = $LoopNum + 1

$StartData[$LoopNum][0] = RegEnumVal($RegPath, $LoopNum)

If $StartData[$LoopNum][0] = "" Then

$LoopNum = $RunLoop

Else

$StartData[$LoopNum][1] = RegRead($RegPath, $StartData[$LoopNum][0])

$len = StringLen($StartData[$LoopNum][1])

$baby = ""

$BSTest = ""

$STest = ""

$RFTest = ""

For $BSTest = $len To 1 Step - 1

$yeah = StringMid($StartData[$LoopNum][1], $BSTest, 1)

If $BSTest = 1 Then $baby = $StartData[$LoopNum][1]

If $yeah = "\" Then

$baby = StringMid($StartData[$LoopNum][1], ($BSTest + 1))

$FirstBaby = StringMid($StartData[$LoopNum][1], 1, $BSTest)

$BSTest = 1

EndIf

Next

If StringRight($baby, 1) = '"' Then $baby = StringTrimRight($baby, 1)

For $STest = $len To 1 Step - 1

$yeah2 = StringMid($baby, $STest, 1)

If $STest = 1 Then $StartData[$LoopNum][2] = $baby

If $yeah2 = " " Then

$StartData[$LoopNum][2] = StringMid($baby, 1, ($STest - 1))

$STest = 1

EndIf

Next

If StringRight($StartData[$LoopNum][2], 1) = '"' Then $StartData[$LoopNum][2] = StringTrimRight($StartData[$LoopNum][2], 1)

$StartData[$LoopNum][3] = $FirstBaby & $StartData[$LoopNum][2]

If StringLeft($StartData[$LoopNum][3], 1) = '"' Then $StartData[$LoopNum][3] = StringTrimLeft($StartData[$LoopNum][3], 1)

$StartData[$LoopNum][4] = "FileVersion: " & FileGetVersion($StartData[$LoopNum][3])

$StartData[$LoopNum][5] = "Description: "

$StartData[$LoopNum][6] = "Copyright: "

$StartData[$LoopNum][7] = $RegPath

$LastLoop = $LastLoop +1

EndIf

Until $LoopNum = $RunLoop

Next

$PathLoop = 0

$LoopRun = 0

$Var = ""

For $LoopRun = 1 To ($LastLoop - 1)

; MsgBox(0, "Test", $Var)

$Var = $Var & $StartData[$LoopRun][0] & ", " & $StartData[$LoopRun][1] & ", " & $StartData[$LoopRun][2] & ", " & $StartData[$LoopRun][3] & @CRLF & $StartData[$LoopRun][4] & ", " & $StartData[$LoopRun][5] & ", " & $StartData[$LoopRun][6] & ", " & $StartData[$LoopRun][7] & @CRLF & @CRLF

Next

MsgBox(0, "Startup", $Var)

Not All Who Wander Are Lost
Link to comment
Share on other sites

Did a little test, only ran this against one reg section.

3 of the 4 were in the message box.

checked against the process' running and 3 of the 4 were there.

Is this what you expect?

Also when I ran the whole thing and then just the one section, whole, some were missing the name, one section all info was there for same keys.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

My goal for the script is to find all the data loading in the Run, RunOnce, etc. registry keys and load it into an array. Once I can accomplish this, I figured I would write in some functions to manipulate that data. I used the ProcessList() function to get a max limit for the array. When I run the script, it finds all 9 items I have in those keys, it's just those first few keys have the name missing, as you pointed out. Why it is working only a portion of the time is what confuses me. :)

With this being my first script, what I'm trying to figure out is why the name is missing and how to correct it. I've looked all through the help file and don't seem to be coming up with the solution.

Any assistance you can provide in accomplishing this with AutoIt would be greatly appreciated. :evil:

Not All Who Wander Are Lost
Link to comment
Share on other sites

err.. this is just my idea.. but

hijack this does an awsome job of this (if i recall it correctly)

and you can output it to a txt file and that txt file could be very very easily parsed...

but thats just what i would do, I am by farfoolish in many things tho

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