#79091 - 2002-08-08 01:33 PM
Bug in "WriteValue" v4.1
|
NameME
Fresh Scripter
Registered: 2002-08-04
Posts: 17
|
I've found a curious bug in the "writevalue" function, If I try this:
$sub="HKEY_CURRENT_USER\Software\Microsoft\Internet Connection Wizard" $name="Completed" $value="01000000" $dtype="REG_BINARY"
WriteValue($sub,$name,$val,$dtype)
Everything works as normal, but if I try this:
Function WRITEINREG($sub,$name,$value,$dtype) Dim $n $n=WriteValue($sub,$name,$val,$dtype) EndFunction
$sub="HKEY_CURRENT_USER\Software\Microsoft\Internet Connection Wizard" $name="Completed" $value="01000000" $dtype="REG_BINARY"
WRITEINREG($sub,$name,$value,$dtype)
the data is not properly written to the registry as you can see if check the registry before and after.
NOTE: I've posted this as an example to make the function fail, I'm trying to do something different, but I need to pass the parameters through a Function and then write to the registry.
_________________________
Regards
|
|
Top
|
|
|
|
#79093 - 2002-08-08 02:09 PM
Re: Bug in "WriteValue" v4.1
|
NameME
Fresh Scripter
Registered: 2002-08-04
Posts: 17
|
I'm using 4.10 I tried this problem on 4.11 and it is happening too.
Notice that the problem is not passing the values as vars to the "writevalue" is passing them first to a function and inside that function to the "writevalue"
_________________________
Regards
|
|
Top
|
|
|
|
#79095 - 2002-08-08 02:17 PM
Re: Bug in "WriteValue" v4.1
|
NameME
Fresh Scripter
Registered: 2002-08-04
Posts: 17
|
Oops! I just found that the situation is worst than I expected, the problem is not passing the parameters to a function, the problem is using variables at all with the "writevalue" while inside a user defined function.
Can someone have a look at this, I'm starting to get crazy!
_________________________
Regards
|
|
Top
|
|
|
|
#79096 - 2002-08-08 02:20 PM
Re: Bug in "WriteValue" v4.1
|
NameME
Fresh Scripter
Registered: 2002-08-04
Posts: 17
|
Lonkero have you actualy tried the code I've post???
I can sure you that it is not working on my setup, every time I use vars and "writevalue" inside a function and try to write a binary value I get a (Zero-length binary value) instead of "010000".
_________________________
Regards
|
|
Top
|
|
|
|
#79097 - 2002-08-08 02:48 PM
Re: Bug in "WriteValue" v4.1
|
NameME
Fresh Scripter
Registered: 2002-08-04
Posts: 17
|
I don't understand...
There's any kind of bug anywere, your function works flawlesly and the simple one I've post at the beggining of the topic does not...
If it is not a bug... what I'm doing wrong????
_________________________
Regards
|
|
Top
|
|
|
|
#79101 - 2002-08-08 03:14 PM
Re: Bug in "WriteValue" v4.1
|
Bxn
Getting the hang of it
Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
|
Sorry, I didn' see your post I guess It took more than 4 mins for me to formulate my Answer ... Will buy a speech to text device
|
|
Top
|
|
|
|
#79103 - 2002-08-08 03:24 PM
Re: Bug in "WriteValue" v4.1
|
Bxn
Getting the hang of it
Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
|
Could you please explain ?
It doesn't look like these strange-to-newbies acronyms the veterans sometimes use !
Is it expensive and will I be compelled to brain and/or tongue surgery ?
|
|
Top
|
|
|
|
#79105 - 2002-08-08 03:41 PM
Re: Bug in "WriteValue" v4.1
|
Bxn
Getting the hang of it
Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
|
So, I thought STFW meant Search The Fuckin' Web, but the first answer from Google is :
Schweizerische Technische Fachschule Winterthur
I again realize FKHR (Full Knowledge is Hard to Reach) isn't it ?
For the second search, I now know Mavis Beacon should be a good teacher, but haven't got a picture ... Is it a male or female name ?
|
|
Top
|
|
|
|
#79108 - 2002-08-08 04:37 PM
Re: Bug in "WriteValue" v4.1
|
NameME
Fresh Scripter
Registered: 2002-08-04
Posts: 17
|
Yes it's true!! Thanks all!!
It was a stupid mistake, this and the fact that I was using this wrongly typed var across 5 diferent places in my script were driving me crazy.
Thanks guys and sorry for this stupid issue!
_________________________
Regards
|
|
Top
|
|
|
|
#79110 - 2002-11-30 11:44 AM
Re: Bug in "WriteValue" v4.1
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear NameME,
Another possibility is it use our tool kixref, which you can find on our site. The last part shows the defined variables and also the amount of references. In your situation: $val only reference once.
code:
Kixref test-script.kix 1 1 Function WRITEINREG($sub,$name,$value,$dtype) 2 Dim $n 3 $n=WriteValue($sub,$name,$val,$dtype) 4 1 EndFunction 5 6 $sub="HKEY_CURRENT_USER\Software\Microsoft\Internet Connection Wizard" 7 $name="Completed" 8 $value="01000000" 9 $dtype="REG_BINARY" 10 11 WRITEINREG($sub,$name,$value,$dtype) . Kixref test-script.kix . DIM c 2 $dtype v 1 3 9 11 ENDFUNCTION c 4 FUNCTION c 1 $n v 2 3 $name v 1 3 7 11 $sub v 1 3 6 11 $val v 3 $value v 1 8 11 writeinreg ??? 11 writeinreg udf 1 WRITEVALUE f 3 . Kixref test-script.kix . Summary - kixtart 4.10/3.07e
boldsymbols 0 commands 3 functions 1 labels 0 macros 0 variables 6
env 0 udf 1 ? 1
gosub 0 goto 0
12
. Block Structure . do:until [0:0] for|each:in|to:step|next [0|0:0|0:0|0] function:endfunction [1:1] if:else:endif [0:0:0] select:case:endselect [0:0:0] while:loop [0:0] . 1 blocks . Kixref test-script.kix . dim 1 c $dtype 4 v endfunction 1 c function 1 c $n 2 v $name 4 v $sub 4 v $val 1 v $value 3 v writeinreg 1 ??? writeinreg 1 udf writevalue 1 f
greetings.
btw: we will extend the option "/warnings". it will show also variables referencing only once.
(TO_DO)
|
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|