forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


BenchMark Program

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects
View previous topic :: View next topic  
Author Message
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 80
Location: Hershey Pennsylvania U.S.A.

PostPosted: Tue Apr 06, 2004 1:39 am    Post subject: BenchMark Program Reply with quote

If you're like me you get tired of cleaning "spyware" off your kids computer (or your own). I wanted a quick and easy way to determine is something I don't want has been installed on my PC.
This program takes a snapshot of your computer (.exe, .dll, .ocx) files.
You can run it again at any time and see if anything new has crept onto your computer.
It was hastily thrown together and isn't very polished but it works. I know there are commercial products that do similar things but I wanted something simple and free.
Check it out and feel free to modify and improve it!
.........David
Code:

Title File Benchmark
  DIALOG CREATE,File Benchmark,-1,0,640,480
  DIALOG ADD,LIST,LIST1,48,8,624,408
  DIALOG ADD,STATUS,STATUS
  DIALOG ADD,BUTTON,BUTTON1,16,40,72,24,BenchMark
  DIALOG ADD,BUTTON,BUTTON2,16,164,104,24,Accept These Files
  DIALOG ADD,BUTTON,BUTTON3,16,528,64,24,EXIT
  DIALOG ADD,BUTTON,BUTTON4,16,364,104,24,Compare Registry
  DIALOG SHOW
  DIALOG HIDE,BUTTON2
  %P = @PATH(%0)
Rem Create List files to be used later
  LIST CREATE, 1, SORTED
  LIST CREATE, 2, SORTED
  LIST CREATE, 3, SORTED
  LIST CREATE, 4, SORTED
  LIST CREATE, 5, SORTED
  LIST CREATE, 6, SORTED
  LIST CREATE, 7, SORTED

  Rem check to see if a BenchMark file exists
  IF @FILE(%Pbenchmark.txt)
  goto Compare
  end
LIST LOADTEXT,LIST1
"Please click the BenchMark Button
"to establish a starting point.
"Any .exe or .dll files added to your
"computer will be displayed next time
"this program is run.
goto evloop
:Benchmark
LIST CLEAR,LIST1
 IF @FILE(%Pbenchmark.txt)
  IF @NOT(@ASK(Benchmark file already exists @CR()Overwrite it with a new one?))
  goto evloop
  end
 end
  Rem Looks like we need to benchmark for first time. Better warn the user!
DIALOG SET,STATUS,Please Wait! Creating Benchmark File.
Rem Define the lowest level directory from which to start
%%root = "C:"
Rem List 1 contains the Folders/subfolders
LIST FILELIST, 1, %%root, *DHSR
Rem Now lets run through all the folders and find the files
%%count = 0
REPEAT
  LIST FILELIST, 2, @item(1, %%count)\*.EXE
  LIST FILELIST, 2, @item(1, %%count)\*.DLL
  LIST FILELIST, 2, @item(1, %%count)\*.OCX
  %%count = @succ(%%count)
UNTIL @equal(%%count, @count(1))@greater(%%count, @count(1))
Rem Add any files that may have been stuck in the root
 LIST FILELIST,2, %%root\*.EXE
 LIST FILELIST,2, %%root\*.DLL
 LIST FILELIST,2, %%root\*.OCX

Rem Now lets take a look at the registry and see what runs at startup
DIALOG SET,STATUS,Please Wait! Checking Registry
  LIST REGVALS, 4,HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run
%%count = 0
REPEAT
  LIST FILELIST, 6,@REGREAD(HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,@item(4, %%count)) 
   %%count = @succ(%%count) 
UNTIL @equal(%%count, @count(4))@greater(%%count, @count(4))
  LIST REGVALS, 5,HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Run
%%count = 0
REPEAT
  LIST FILELIST, 6,@REGREAD(HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,@item(5, %%count)) 
   %%count = @succ(%%count) 
UNTIL @equal(%%count, @count(5))@greater(%%count, @count(5))

LIST SAVEFILE,2,%Pbenchmark.txt
LIST SAVEFILE,6,%Pbenchmarkreg.txt
Rem Clear the status bar
DIALOG SET,STATUS
INFO Your File System has been BenchMarked for future use

:Evloop
  wait event
  goto @event()
:BUTTON1BUTTON
   goto benchmark
:BUTTON2BUTTON
Rem Make sure the benchmark file exists
   IF @NOT(@FILE(%Pbenchmark.txt))
      INFO You must Benchmark your System before selecting this option!
      goto evloop
   END
Rem If there's no difference then there's nothing to do
   IF @EQUAL(@COUNT(LIST1),0)
      INFO There are no files to add!
      goto evloop
   END
Rem Make sure it's what they really want to do
   IF @NOT(@ASK(Are you sure you want to add these files to your existing BenchMark?))
   goto evloop
   end
Rem Save the current list overwriting the previous one
   LIST SAVEFILE,2,%Pbenchmark.txt
  LIST CLEAR,LIST1
  INFO BenchMark File updated
  goto evloop
:BUTTON3BUTTON
goto close
:BUTTON4BUTTON
Rem Check for differences in the Registry startup settings
IF @NOT(@FILE(%Pbenchmark.txt))
      INFO You must Benchmark your System before selecting this option!
      goto evloop
END
Rem The Save current files button is not relevant for registry differences
DIALOG HIDE,BUTTON2
  LIST CLEAR,LIST1
Rem Get the registry settings we saved during benchmarking
  LIST LOADFILE, 7,%Pbenchmarkreg.txt
  LIST CLEAR,4
  LIST CLEAR,5
  LIST CLEAR,6
Rem Go get the current registry settings
  LIST REGVALS, 4,HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run
%%count = 0
REPEAT
  LIST FILELIST, 6,@REGREAD(HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,@item(4, %%count)) 
   %%count = @succ(%%count) 
UNTIL @equal(%%count, @count(4))@greater(%%count, @count(4))
  LIST REGVALS, 5,HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Run
%%count = 0
REPEAT
  LIST FILELIST, 6,@REGREAD(HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,@item(5, %%count)) 
   %%count = @succ(%%count) 
UNTIL @equal(%%count, @count(5))@greater(%%count, @count(5))
Rem Now lets compare the saved file with current settings
%%count = 0
 REPEAT
 IF @NOT(@MATCH(7,@item(6, %%count))) 
LIST ADD,LIST1,@item(6, %%count)
 END
 %%count = @succ(%%count)
 UNTIL @equal(%%count, @count(6))@greater(%%count, @count(6))
Rem If there's nothing in the list there were no changes
IF @equal(@count(LIST1),0)
INFO There have been no changes since Last Benchmark
END
goto evloop
Rem Jump here to compare current files with BenchMark
:Compare
  Rem We need to get the current file list, Better warn the user!
DIALOG SET,STATUS,Please Wait! Getting Current File List
Rem Define the lowest level directory from which to start
%%root = "C:"
Rem List 1 contains the Folders/subfolders
LIST FILELIST, 1, %%root, *DHSR
Rem Now lets run through all the folders and find the files
%%count = 0
REPEAT
 
  LIST FILELIST, 2, @item(1, %%count)\*.EXE
  LIST FILELIST, 2, @item(1, %%count)\*.DLL
  LIST FILELIST, 2, @item(1, %%count)\*.OCX
  %%count = @succ(%%count)
UNTIL @equal(%%count, @count(1))@greater(%%count, @count(1))

Rem Add any files that may have been stuck in the root
LIST FILELIST,2, %%root\*.EXE
LIST FILELIST,2, %%root\*.DLL
LIST FILELIST,2, %%root\*.OCX

Rem Inform the user what's happening
DIALOG SET,STATUS,Comparing current files with Benchmark

 LIST LOADFILE, 3,%Pbenchmark.txt 
%%count = 0
 REPEAT
 IF @NOT(@MATCH(3,@item(2, %%count))) 
LIST ADD,LIST1,@item(2, %%count)
 END
 %%count = @succ(%%count)
 UNTIL @equal(%%count, @count(2))@greater(%%count, @count(2))
DIALOG SET,STATUS
IF @equal(@count(LIST1),0)
INFO There have been no changes since Last Benchmark
goto evloop
END
DIALOG SHOW,BUTTON2
goto evloop
:Close

  exit
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Apr 06, 2004 6:56 pm    Post subject: Reply with quote

Interesting idea Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Apr 07, 2004 12:35 am    Post subject: Reply with quote

hi david,

great idea Smile

your program works for what o/s as i run into an error on 98se?...i suspect it is because of the registry keys you are calling (HLM, HCU,...)

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Apr 07, 2004 7:55 am    Post subject: Reply with quote

I don't think any of the registry keys are unique to an OS, but I can see where an error would occur if one of the LIST REGVALS produced no items, as the script doesn't check if the list count is > 0 before iterating through it.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Wed Apr 07, 2004 8:31 am    Post subject: Reply with quote

Sounds cool David! I'll check it out as soon as I have a little bit of spare time Smile

Regards,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 80
Location: Hershey Pennsylvania U.S.A.

PostPosted: Wed Apr 07, 2004 9:51 am    Post subject: Reply with quote

jules wrote:
I don't think any of the registry keys are unique to an OS, but I can see where an error would occur if one of the LIST REGVALS produced no items, as the script doesn't check if the list count is > 0 before iterating through it.

Ahh yes! Good observation. I've used this primarily on 98SE machines but added the registry stuff as an afterthought. I did that on XP Pro and posted it without going back and running it on 98 Embarassed . As you observed, it should work unless one of the lists comes up empty. When I get a moment I'll do some more thorough testing on 98 and eliminate that possibility.
Thanks for the Great Feedback!
..........David
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2141
Location: A House

PostPosted: Wed Apr 07, 2004 4:43 pm    Post subject: Reply with quote

Last month I started on a suite of apps that deal with the startup locations.
Here's the reg locations I check:

HCU,Software\Microsoft\Windows\CurrentVersion\Run
HCU,Software\Microsoft\Windows\CurrentVersion\RunOnce
HLM,Software\Microsoft\Windows\CurrentVersion\Run
HLM,Software\Microsoft\Windows\CurrentVersion\RunOnce
HLM,Software\Microsoft\Windows\CurrentVersion\RunServices
HLM,Software\Microsoft\Windows\CurrentVersion\RunServicesOnce

Don't forget to check those "RunOnce" locations, as they are a favorite of
many apps that have ill intent. Just because it says run once doesn't
mean that the apps won't keep placing their own entry in those locations.
In fact, that's what they do, they get ran, place their own entry back in
the RunOnce location, that way, they'll keep getting ran everytime
windows is started.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Apr 07, 2004 4:46 pm    Post subject: Reply with quote

There are a obviously a lot of great minds on this forum, all thinking alike... Wink
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 80
Location: Hershey Pennsylvania U.S.A.

PostPosted: Fri Apr 16, 2004 1:19 pm    Post subject: Major Re-Write Reply with quote

Based on some of the feedback from you folks and some of my own inspiration I decided to make some significant improvements.
1. Doesn't error out on empty reg keys.
2. Gives user flexibility to select file types and saves in INI file.
3. Eliminates status bar and uses main window for messages. When I tested this on "normal" users they ALL ignored the status bar messages.
Still not very "polished" but hopefuly it will generate some more constructive comments or ideas for enhancements.
.......David
Code:

Title File Benchmark
OPTION SCALE,96
  DIALOG CREATE,File Benchmark,-1,0,640,480
  DIALOG ADD,LIST,LIST1,48,8,624,408
  DIALOG ADD,BUTTON,BenchMark,16,40,72,24,BenchMark
  DIALOG ADD,BUTTON,Accept,16,134,104,24,Accept These Files
  DIALOG ADD,BUTTON,Exit,16,548,64,24,EXIT
  DIALOG ADD,BUTTON,CompareReg,16,254,104,24,Compare Registry
  DIALOG ADD,BUTTON,Configure,16,414,104,24,Configure
  DIALOG HIDE,Accept
  %P = @PATH(%0)
  rem Create List files to be used later
  LIST CREATE, 1, SORTED
  LIST CREATE, 2, SORTED
  LIST CREATE, 3, SORTED
  LIST CREATE, 4, SORTED
  LIST CREATE, 5, SORTED
  LIST CREATE, 6, SORTED
  LIST CREATE, 7, SORTED
  rem check to see if configuration file exists
  IF @NOT(@FILE(%Pbenchmark.ini))
     goto ConfigureBUTTON
  END
  DIALOG SHOW
  rem lets get the users current settings
GOSUB ReadINI
 
  rem check to see if a BenchMark file exists
  IF @FILE(%Pbenchmark.txt)
    goto Compare
  end
rem since there's no benchmark file prompt the user to create one
  LIST LOADTEXT,LIST1
"
"
"Please click the BenchMark Button
"to establish a starting point.
"Any new files of the selected types
"will be displayed next time
"this program is run.
  goto evloop
:Benchmark
rem lets ask the user to confirm that they really want to do this
  LIST CLEAR,LIST1
  IF @FILE(%Pbenchmark.txt)
    IF @NOT(@ASK(Benchmark file already exists @CR()Overwrite it with a new one?))
      goto evloop
    end
  end
 rem we jump here and re-benchmark without asking user permission
 rem if the configuration was changed
:ReBench
rem read ini settings again in case of change
GOSUB ReadINI
rem make sure main dialog is showing in case we've jumped here from
rem configuration routine
DIALOG SHOW
  LIST CLEAR,LIST1
  rem This could take a while. Better warn the user!
  LIST LOADTEXT,LIST1
"
"
"Please Wait! Creating Benchmark File.
"
"This may take a couple of Minutes if you
"Have a Large Hard Drive with many files
GOSUB GetFiles
  rem Now lets take a look at the registry and see what runs at startup
  LIST LOADTEXT,LIST1
"
"
"Please Wait! Checking Registry
GOSUB GetReg
  LIST SAVEFILE,2,%Pbenchmark.txt
  LIST SAVEFILE,6,%Pbenchmarkreg.txt
  LIST CLEAR, LIST1
  INFO Your File System has been BenchMarked for future use

:Evloop
  wait event
  goto @event()
:BenchMarkBUTTON
  goto benchmark
:AcceptBUTTON
  rem Make sure it's what they really want to do
  IF @NOT(@ASK(Are you sure you want to add these files to your existing BenchMark?))
    goto evloop
  end
  rem Save the current list overwriting the previous one
  LIST SAVEFILE,2,%Pbenchmark.txt
  LIST CLEAR,LIST1
  INFO BenchMark File updated
    DIALOG HIDE,Accept
  goto evloop
:ExitBUTTON
  goto close
:CompareRegBUTTON
  rem Check for differences in the Registry startup settings
  IF @NOT(@FILE(%Pbenchmark.txt))
    INFO You must Benchmark your System before selecting this option!
    goto evloop
  END
  rem The Save current files button is not relevant for registry differences
  DIALOG HIDE,Accept
  LIST CLEAR,LIST1
  rem Get the registry settings we saved during benchmarking
  LIST LOADFILE, 7,%Pbenchmarkreg.txt
  LIST CLEAR,4
  LIST CLEAR,5
  LIST CLEAR,6
  rem Go get the current registry settings
GOSUB GetReg
rem Now lets compare the saved file with current settings
  %%count = 0
  REPEAT
    IF @NOT(@MATCH(7,@item(6, %%count)))
      LIST ADD,LIST1,@item(6, %%count)
    END
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(6))@greater(%%count, @count(6))
  rem If there's nothing in the list there were no changes
  IF @equal(@count(LIST1),0)
    INFO There have been no changes since Last Benchmark
  END
  goto evloop
  rem Jump here to compare current files with BenchMark
:Compare
  rem We need to get the current file list, Better warn the user!
   LIST LOADTEXT,LIST1
"
"
"Please Wait! Getting Current File List
GOSUB GetFiles
  rem Inform the user what's happening
  LIST LOADTEXT,LIST1
"
"
"Comparing current files with Benchmark
Wait 1

  LIST LOADFILE, 3,%Pbenchmark.txt
  %%count = 0
  %%LENGTH = 0
 LIST CLEAR,LIST1
  REPEAT
    IF @NOT(@MATCH(3,@item(2, %%count)))
      LIST ADD,LIST1,@item(2, %%count)
      %%LEN = @LEN(@item(2, %%count))
  Rem determine length of longest item in LIST1
          IF @GREATER(%%LEN,%%LENGTH)
             %%LENGTH = %%LEN
          END
    END
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(2))@greater(%%count, @count(2))
  IF @equal(@count(LIST1),0)
    INFO There have been no changes since Last Benchmark
    goto evloop
  END
  Rem Use API to show Horizontal Scroll Bar in LIST1
  Rem Note:This is my first attempt to dynamically size a scroll bar depending
  Rem on the length of the longest line to be displayed. I've not yet
  Rem figured out how to get the length of a line in "pixels" so assume a
  Rem maximum character width of 9 in case the user has Xtra large fonts.
 %A = @sendmsg(@winexists(~LIST1),$0194,@PROD(%%LENGTH,9),0)

  DIALOG SHOW,Accept
  goto evloop
 
:ConfigureBUTTON
rem hide the main dialog and open configuration window
DIALOG HIDE
Title Configure
  DIALOG CREATE,Configure,-1,0,419,377,nosys
  DIALOG ADD,CHECK,CheckEXE,40,10,60,20,EXE
  DIALOG ADD,CHECK,DLL,60,10,60,20,DLL
  DIALOG ADD,CHECK,OCX,80,10,60,20,OCX
  DIALOG ADD,CHECK,VBS,100,10,60,20,VBS
  DIALOG ADD,CHECK,SCR,120,10,60,20,SCR
  DIALOG ADD,CHECK,BAT,140,10,60,20,BAT
  DIALOG ADD,CHECK,COM,160,10,60,20,COM
  DIALOG ADD,TEXT,TEXT10,10,30,,,Select File types to be included in Benchmark
  DIALOG ADD,TEXT,TEXT11,200,30,,,Select registry keys to be included in Benchmark
  DIALOG ADD,CHECK,HCURun,230,10,370,20,HCU\Software\Microsoft\Windows\CurrentVersion\Run
  DIALOG ADD,CHECK,HCURunOnce,250,10,370,20,HCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
  DIALOG ADD,CHECK,HLMRun,270,10,370,20,HLM\Software\Microsoft\Windows\CurrentVersion\Run
  DIALOG ADD,CHECK,HLMRunOnce,290,10,370,20,HLM\Software\Microsoft\Windows\CurrentVersion\RunOnce
  DIALOG ADD,BUTTON,Return,80,150,190,40,Return to Benchmark Program
  DIALOG SHOW
  rem if there's already an ini file get the users current settings
  rem and set the check boxes accordingly
   IF @FILE(%Pbenchmark.ini)
       INIFILE OPEN,%Pbenchmark.ini
         DIALOG SET,CheckEXE,@INIREAD(Files,exe)
         DIALOG SET,DLL,@INIREAD(Files,dll)
         DIALOG SET,OCX,@INIREAD(Files,ocx)
         DIALOG SET,VBS,@INIREAD(Files,vbs)
         DIALOG SET,SCR,@INIREAD(Files,scr)
         DIALOG SET,BAT,@INIREAD(Files,bat)
         DIALOG SET,COM,@INIREAD(Files,com)
         DIALOG SET,HCURun,@INIREAD(Registry,HCURun)
         DIALOG SET,HCURunOnce,@INIREAD(Registry,HCURunOnce)
         DIALOG SET,HLMRun,@INIREAD(Registry,HLMRun)
         DIALOG SET,HLMRunOnce,@INIREAD(Registry,HLMRunOnce)
   END
goto evloop

:ReturnBUTTON
rem here we modify the ini file with changes or create new file if
rem first time run
INIFILE OPEN,%Pbenchmark.ini
INIFILE WRITE,Files,exe,@dlgtext(CheckEXE)
INIFILE WRITE,Files,dll,@dlgtext(DLL)
INIFILE WRITE,Files,ocx,@dlgtext(OCX)
INIFILE WRITE,Files,vbs,@dlgtext(VBS)
INIFILE WRITE,Files,scr,@dlgtext(SCR)
INIFILE WRITE,Files,bat,@dlgtext(BAT)
INIFILE WRITE,Files,com,@dlgtext(COM)
INIFILE WRITE,Registry,HCURun,@dlgtext(HCURun)
INIFILE WRITE,Registry,HCURunOnce,@dlgtext(HCURunOnce)
INIFILE WRITE,Registry,HLMRun,@dlgtext(HLMRun)
INIFILE WRITE,Registry,HLMRunOnce,@dlgtext(HLMRunOnce)
DIALOG CLOSE
 
  rem Lets check if any changes were made that would require
  rem updating the benchmark
 
  IF @UNEQUAL(%%EXE,@INIREAD(Files,exe))
     goto rebench
  end
  IF @UNEQUAL(%%DLL,@INIREAD(Files,dll))
     goto rebench
  end
  IF @UNEQUAL(%%OCX,@INIREAD(Files,ocx))
     goto rebench
  end
  IF @UNEQUAL(%%VBS,@INIREAD(Files,vbs))
     goto rebench
  end
  IF @UNEQUAL(%%SCR,@INIREAD(Files,scr))
     goto rebench
  end
  IF @UNEQUAL(%%BAT,@INIREAD(Files,bat))
     goto rebench
  end
  IF @UNEQUAL(%%COM,@INIREAD(Files,com))
     goto rebench
  end
  IF @UNEQUAL(%%HCURun,@INIREAD(Registry,HCURun))
     goto rebench
  end
  IF @UNEQUAL(%%HCURunOnce,@INIREAD(Registry,HCURunOnce))
     goto rebench
  end
  IF @UNEQUAL(%%HLMRun,@INIREAD(Registry,HLMRun))
     goto rebench
  end
  IF @UNEQUAL(%%HLMRunOnce,@INIREAD(Registry,HLMRunOnce))
     goto rebench
  end
rem User hasn't changed anything - show main dialog and wait for user input
DIALOG SHOW
goto evloop

:Close
  exit
REM SUBROUTINE SECTION
:ReadINI
  INIFILE OPEN,%Pbenchmark.ini
  %%EXE = @INIREAD(Files,exe)
  %%DLL = @INIREAD(Files,dll)
  %%OCX = @INIREAD(Files,ocx)
  %%VBS = @INIREAD(Files,vbs)
  %%SCR = @INIREAD(Files,scr)
  %%BAT = @INIREAD(Files,bat)
  %%COM = @INIREAD(Files,com)
  %%HCURun = @INIREAD(Registry,HCURun)
  %%HCURunOnce = @INIREAD(Registry,HCURunOnce)
  %%HLMRun = @INIREAD(Registry,HLMRun)
  %%HLMRunOnce = @INIREAD(Registry,HLMRunOnce)
exit

:GetFiles
  rem Define the lowest level directory from which to start
  %%root = "C:"
  rem List 1 contains the Folders/subfolders
  LIST FILELIST, 1, %%root, *DHSR
  rem Now lets run through all the folders and find the files
  %%count = 0
  REPEAT
    IF %%EXE
    LIST FILELIST, 2, @item(1, %%count)\*.EXE
    end
    IF %%DLL
    LIST FILELIST, 2, @item(1, %%count)\*.DLL
    end
    IF %%OCX
    LIST FILELIST, 2, @item(1, %%count)\*.OCX
    end
    IF %%VBS
    LIST FILELIST, 2, @item(1, %%count)\*.VBS
    end
    IF %%SCR
    LIST FILELIST, 2, @item(1, %%count)\*.SCR
    end
    IF %%BAT
    LIST FILELIST, 2, @item(1, %%count)\*.BAT
    end
    IF %%COM
    LIST FILELIST, 2, @item(1, %%count)\*.COM
    end
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(1))@greater(%%count, @count(1))
  rem Add any files that may have been stuck in the root
    IF %%EXE
    LIST FILELIST, 2, @item(1, %%root)\*.EXE
    end
    IF %%DLL
    LIST FILELIST, 2, @item(1, %%root)\*.DLL
    end
    IF %%OCX
    LIST FILELIST, 2, @item(1, %%root)\*.OCX
    end
    IF %%VBS
    LIST FILELIST, 2, @item(1, %%root)\*.VBS
    end
    IF %%SCR
    LIST FILELIST, 2, @item(1, %%root)\*.SCR
    end
    IF %%BAT
    LIST FILELIST, 2, @item(1, %%root)\*.BAT
    end
    IF %%COM
    LIST FILELIST, 2, @item(1, %%root)\*.COM
    end
exit
:GetReg
rem get selected registry values
IF %%HCURun
  LIST REGVALS, 4,HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Run
rem check to make sure we're not trying to process an empty list
  IF @UNEQUAL(@count(4),0)
  %%count = 0
  REPEAT
    LIST FILELIST, 6,@REGREAD(HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,@item(4, %%count))
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(4))@greater(%%count, @count(4))
  END
  LIST CLEAR, 4
end
IF %%HCURunOnce
  LIST REGVALS, 4,HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
  IF @UNEQUAL(@count(4),0)
  %%count = 0
  REPEAT
    LIST FILELIST, 6,@REGREAD(HCU,SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce,@item(4, %%count))
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(4))@greater(%%count, @count(4))
  END
  LIST CLEAR, 4
end
IF %%HLMRun
  LIST REGVALS, 4,HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run
  IF @UNEQUAL(@count(4),0)
  %%count = 0
  REPEAT
    LIST FILELIST, 6,@REGREAD(HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Run,@item(4, %%count))
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(4))@greater(%%count, @count(4))
  END
  LIST CLEAR, 4
end
IF %%HLMRunOnce
  LIST REGVALS, 4,HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
  IF @UNEQUAL(@count(4),0)
  %%count = 0
  REPEAT
    LIST FILELIST, 6,@REGREAD(HLM,SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce,@item(4, %%count))
    %%count = @succ(%%count)
  UNTIL @equal(%%count, @count(4))@greater(%%count, @count(4))
  END
  LIST CLEAR, 4
end
exit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group