#39735 - 2003-05-02 12:56 AM
Re: SReg Problem (Array Out of Bounds)
|
R. Baker
Fresh Scripter
Registered: 2003-01-23
Posts: 7
|
Script attached as requested. Also tried 2nd mod and still produces the same error.
;Function Sreg() ; ;Author Lonkero ; ;Version 1.0 (15.01.2002 [GMT+2 04:45]) ; ;Action Searches specified string from value and/or valuename in specified ; subkey-tree in registry and returns all occurances in array. ; ;Syntax Sreg(Subkey, String, Integer) ; ;Parameters ; ; Subkey ; Defines from wherein registry to search for. ; Registry pointing rules apply. ; Supports remoteregistry scan. ; ; String ; tells the string to search for. ; ; Integer ; 0 for Valuename ; 1 for Value ; 2 for Both ; ;Remarks ; Nice, pure KiXsolution for regfinds! ; Waiting for multidimensional array support. Until that output not so nice. ; Full search on root keys can take up really much time. ; Test run on just HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft against "id" gave results: ; runtime: 35secons (previous builds approx. 5minutes!) ; found: 1587 matches ; memreserved: after return 112kB, at most 5888kB (previous release 28800kB!) ; ; So for your best, use as lowlevel subkeys as possible. ; Parsed the code to be shorter and lost lots of unneeded lines, but also got it ; really hard to follow the code. Kind of encrypted it ; ; ;Returns ; one dimensional array containing values where string occured. ; array format is SUBKEY,VALUENAME ; ; On error ; nonexistent subkey-input 1010,ERROR_BADKEY ; zero length string-input 24,ERROR_BAD_LENGTH ; Integer input not 0, 1 nor 2 50,ERROR_NOT_SUPPORTED ; ;Dependencies ; none ; ;Example break on ;$index=Sreg("HKEY_LOCAL_MACHINE\Software\Microsoft","id",2) ; as per original and works ;$index=Sreg("HKEY_LOCAL_MACHINE","74be21dbfdbd3d11ebae000acc725290",2) ;works ;$index=Sreg("HKEY_LOCAL_MACHINE","virusprotect6",2) ; doesn't work $index=Sreg("HKEY_LOCAL_MACHINE","virusprotect",2) ; produces result but doesn't find virusprotect6
if @error "error occured: @serror" ? else for each $value in $index ? $value next endif exit 0 ; ;Source Function Sreg($_Subkey, $_String, $_Integer) if not keyexist("$_Subkey") exit 1010 endif if not len($_String) exit 24 endif if $_Integer<0 or $_Integer>2 exit 50 endif $_I="" $_Chr=chr(29) $=execute('sk("$_Subkey","$_String",$_Integer)') $_C=0 $_Is ="" for each $_F in split($_I,$_Chr) if len($_F) $_C=$_C+1 endif next $_C=$_C-1 $=execute('global $$_IA[$_C]') $_C=0 for each $_F in split($_I,$_Chr) if len($_F) $=execute('$$_IA[$_C]="$_F"') $_C=$_C+1 endif next $Sreg=$_IA $_I="" $_IA="" EndFunction Function sk($_key, $_St, $_In) $_vC=0 $_Vn=enumvalue($_key,$_vC) while len($_Vn) if $_In=0 if instr($_Vn,$_St) $_I=$_I+$_key+",$_Vn"+$_Chr endif else if instr(readvalue($_key,$_Vn),$_St) $_I=$_I+$_key+",$_Vn"+$_Chr else if $_In=2 and instr($_Vn,$_St) $_I=$_I+$_key+",$_Vn"+$_Chr endif endif endif $_vC=$_vC+1 $_Vn=enumvalue($_key,$_vC) loop $_C=0 $_ID="" $_Un=enumkey($_key,$_C) while len($_Un) $_ID=$_ID+"$_key\$_Un," $_C=$_C+1 $_Un=enumkey($_key,$_C) loop for each $_uk in split($_ID,",") if len($_uk) $=execute('sk("$_uk","$_St",$_In)') endif next EndFunction
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|