Page 1 of 1 1
Topic Options
#79091 - 2002-08-08 01:33 PM Bug in "WriteValue" v4.1
NameME Offline
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
#79092 - 2002-08-08 01:48 PM Re: Bug in "WriteValue" v4.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
christian,
which kix version you are using?
if you check our latest kixgolf tournament in forum scripts you can see that it works nicely.
we used mostly 4.10 when it was done, but obviously it was pretty well tested.
_________________________
!

download KiXnet

Top
#79093 - 2002-08-08 02:09 PM Re: Bug in "WriteValue" v4.1
NameME Offline
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
#79094 - 2002-08-08 02:15 PM Re: Bug in "WriteValue" v4.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I might check this later on...
if you check:
http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003633;p=1#000009

you will get your time fly while waiting [Big Grin]

be back...
_________________________
!

download KiXnet

Top
#79095 - 2002-08-08 02:17 PM Re: Bug in "WriteValue" v4.1
NameME Offline
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 Offline
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 Offline
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
#79098 - 2002-08-08 03:04 PM Re: Bug in "WriteValue" v4.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just started checking your code and it seems to be just a simple syntax error.
in your function change the line:
$n=WriteValue($sub,$name,$val,$dtype)

to:
$n=WriteValue($sub,$name,$value,$dtype)

[Razz]
_________________________
!

download KiXnet

Top
#79099 - 2002-08-08 03:08 PM Re: Bug in "WriteValue" v4.1
Bxn Offline
Getting the hang of it

Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
Wouldn't it be the reference to "$Value" and "$Val" in you Function which makes things wrong ?

"Function WRITEINREG($sub,$name,$value,$dtype)
...
$n=WriteValue($sub,$name,$val,$dtype)
..."

Top
#79100 - 2002-08-08 03:10 PM Re: Bug in "WriteValue" v4.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
bxn, good point. [Big Grin]
_________________________
!

download KiXnet

Top
#79101 - 2002-08-08 03:14 PM Re: Bug in "WriteValue" v4.1
Bxn Offline
Getting the hang of it

Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
Sorry, I didn' see your post [Wink]
I guess It took more than 4 mins for me to formulate my Answer ...
Will buy a speech to text device [Big Grin]

Top
#79102 - 2002-08-08 03:17 PM Re: Bug in "WriteValue" v4.1
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Maybe you need Mavis Beacon...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#79103 - 2002-08-08 03:24 PM Re: Bug in "WriteValue" v4.1
Bxn Offline
Getting the hang of it

Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
Could you please explain ? [Frown]

It doesn't look like these strange-to-newbies acronyms the veterans sometimes use ! [Wink]

Is it expensive and will I be compelled to brain and/or tongue surgery ? [Big Grin]

Top
#79104 - 2002-08-08 03:31 PM Re: Bug in "WriteValue" v4.1
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
With STFW, an explanation is not required. If you're still confused, goto www.google.com and type STFW.
After that, type Mavis Beacon.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#79105 - 2002-08-08 03:41 PM Re: Bug in "WriteValue" v4.1
Bxn Offline
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 [Roll Eyes] ... Is it a male or female name ?
[Big Grin]

Top
#79106 - 2002-08-08 03:57 PM Re: Bug in "WriteValue" v4.1
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
NameME: Are you out there?

The answer to your question in the beginning of this thread:

No, there's no bug in KiXtart but you did write your function wrong, you're paasing variable $value and then try to write value $val. See Lonkeros post who illustrates it.
_________________________
There are two types of vessels, submarines and targets.

Top
#79107 - 2002-08-08 04:02 PM Re: Bug in "WriteValue" v4.1
Bxn Offline
Getting the hang of it

Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
Sorry, For OffTopic Posts ...
Won't Do It Again ...

Top
#79108 - 2002-08-08 04:37 PM Re: Bug in "WriteValue" v4.1
NameME Offline
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
#79109 - 2002-08-08 05:02 PM Re: Bug in "WriteValue" v4.1
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
NameME:

If you are using KiXtart 4.10+ then I would HIGHLY recommend the following two lines in the beginning of your scripts:
code:
$rc=SETOPTION('Explicit','ON')
$rc=SETOPTION('NoVarsInStrings','ON')

They will force you to declare all variables (therefore detecting spelling errors) and properly enclose strings in quotes. This will eliminate a lot of debugging.
_________________________
There are two types of vessels, submarines and targets.

Top
#79110 - 2002-11-30 11:44 AM Re: Bug in "WriteValue" v4.1
MCA Offline
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)
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


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

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

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