Page 1 of 1 1
Topic Options
#39728 - 2003-05-01 12:58 AM SReg Problem (Array Out of Bounds)
R. Baker Offline
Fresh Scripter

Registered: 2003-01-23
Posts: 7
Hello all!

I've used kix for a few scripts, but I'm stuck on an issue. I'm writing (or trying to write) a script to manually uninstall NAV Corp Edition on 95 clients, as there are several client that won't uninstall by conventional means. Symantec has a doco which explains what needs to be done. One of the steps is to search for and delete all instances of 74BE21DBFDBD3D11EBAE000ACC725290 & VirusProtect6.

I've figured out that I need to use SReg to search for particular subkeys. I was able to use SReg to find all instances of 74BE21DBFDBD3D11EBAE000ACC725290 (although I can't use "0" for the integer parameter, but that's another story) However, when I try to search for VirusProtect6, I get and "Array out of bounds" error msg. I gather the problem is with the "6" or its interpation of, but how do I get around it? The expression I've tried is $index=Sreg("HKEY_LOCAL_MACHINE","virusprotect6",2)

Any help greatly appreciated.

Regards,

R. Baker [Mad]

Top
#39729 - 2003-04-30 01:02 PM Re: SReg Problem (Array Out of Bounds)
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
R.

Welcome to the board !

Questions :

-> What version of KiX are you using ?
-> Is sReg() one of the udf's posted here ? {Yes, it is ... should've known better}

[ 30. April 2003, 13:04: Message edited by: Jochen ]
_________________________



Top
#39730 - 2003-04-30 01:06 PM Re: SReg Problem (Array Out of Bounds)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sreg: http://www.gwspikval.com/jooel/UDF/udf/000133.htm

kix at least 4.00

if I remember correctly, build 45 (some 4.00 rc) works with that code.

my quess is that it's not that number related...

go figure.
you could at least try to change:
	$=execute('$$_IA[$_C]="$_F"')

to:
	$=execute('$$_IA[$_C]=""+$_F')


but, the Sreg has no pre-defined array sizes so it feels pretty weird...

[ 30. April 2003, 13:10: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#39731 - 2003-05-01 12:06 AM Re: SReg Problem (Array Out of Bounds)
R. Baker Offline
Fresh Scripter

Registered: 2003-01-23
Posts: 7
Using v 4.20. I tried replacing the string as suggested. I still get the same error "Array reference out of bounds". With this mod, the other reg key search fails as well with an "unknown command [74BE21DBFDBD3D11EBAE000ACC725290]! with 74BE21DBFDBD3D11EBAE000AC highlighted.

The reason why I suspected the problem is with the number is that if I search for virusprotect I get a result. Problem is it finds HKEY_LOCAL_MACHINE\Software\Microsoft\Office\8.0\New User Settings\PowerPoint\Options,MacroVirusProtection and not HKEY_LOCAL_MACHINE\Software\Intel\LanDesk\VirusProtect6!

Why? (and why me??!)

RB

Top
#39732 - 2003-05-01 03:16 PM Re: SReg Problem (Array Out of Bounds)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please post your script. Also, did you make any modifications to SREG()?
_________________________
There are two types of vessels, submarines and targets.

Top
#39733 - 2003-05-01 05:15 PM Re: SReg Problem (Array Out of Bounds)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
RB, asking you to re-mod the same line to:
$=execute('$$_IA[$_C]=""+$$_F')

missed one $-sign [Wink]
_________________________
!

download KiXnet

Top
#39734 - 2003-05-01 10:23 PM Re: SReg Problem (Array Out of Bounds)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
also, there is the logical upper bound for array size in kixtart (dunno why)

it is 2,147,483,647 which is pretty much the same as integer value.
as said, this is weird. why to code array size limitation just to get limitation?
_________________________
!

download KiXnet

Top
#39735 - 2003-05-02 12:56 AM Re: SReg Problem (Array Out of Bounds)
R. Baker Offline
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 [Smile]
;
;
;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
#39736 - 2003-05-02 06:14 AM Re: SReg Problem (Array Out of Bounds)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hey baker, could you try with the new searcreg() that eric yesterday posted.

I don't have right now the time to check out all the possible problems sreg() might have but if the searcreg() works for you, I really even don't need to [Wink]
_________________________
!

download KiXnet

Top
#39737 - 2003-05-04 02:46 AM Re: SReg Problem (Array Out of Bounds)
R. Baker Offline
Fresh Scripter

Registered: 2003-01-23
Posts: 7
I had a quick look at that new funcion before I left work on Friday. Looks like it's going to work. Thanks for your help.

R. Baker

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.102 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org