Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Agree about the delay - ain't got any time to do this stuff, too much going on at work and private right now.. I've got something working. will post at lunchtime (1,5h away)
ok, lunchtime and 2:nd post since my previous post seems to have failed Notice : I'm not really happy with this - but cannot give it more time nor fix it better... added: just noticed that my comments wasn't in this .. you'll have to live with it a few hours (removed those tags after my first post...) ADDED AGAIN ... Well, after peeking at the other codes, I finally got to the point of REALLY knowing what was to be done... buggr. well, I'll be happy if I recive a 'f' for this
Code:
;enjoy my totally wrong code: If NOT @LOGONMODE Break On EndIf
Dim $SO
$SO = SetOption("Explicit","On") $SO = SetOption("NoVarsInStrings","On") $SO = SetOption("NoMacrosInStrings","On") ; dim $counter,$key,$val dim $wr,$add,$wri dim $split[],$c,$x dim $sp[],$spl,$ ;define values $counter=0 $key='HKEY_CURRENT_USER\Software\Golfing' $val='Round02' $add='28,00,00,00,ff,ff,ff,ff,02,00,00,00,03,00,00,00,3c,00,00,00,50,\ 00,00,00,fe,ff,ff,ff,b2,03,00,00,02,05,00,00,02,04,00,00' $wri='28000000ffffffff02000000030000003c00000050000000feffffffb20300000205000002040000'
$wr=readvalue($key,$val) $split=split($add,',')
for each $c in $split select case $counter = 2 $c = 'bc' Redim preserve $sp[$counter] $sp[$counter]=$c case 1 if instr($c,'\') $x=substr($c, len($c) - 1, 3) $=trim($x) Redim preserve $sp[$counter] $sp[$counter]=$x else Redim preserve $sp[$counter] $sp[$counter]=$c endif endselect $counter=$counter+1 next
ReDim $counter $counter=0
for $counter = 0 to ubound($sp) $spl = $spl + $sp[$counter] next
/* $wr ' Read value from reg' ? $wri ' should be equal to line above' ? $spl ' this is what we wanna write' ? */ if $wr = $spl 'entry already altered' ? exit @error else $wr=writevalue($key,$val,$spl,'reg_binary') if @error 'error: ' + @ERROR @SERROR + ' ' ? else 'altered key' ? endif endif
If you haven't noticed yet - this doesn't do what it was meant to do ... and since this is the second time I cannot use my webbrowser and screwed up a third post / alterning of this post... gah, this is what I'll post and deliver, since this post I have peeked at others codes, and therefore I disqalify both my spelling and paricipation in this 'round'... well, rewrote it quickly - or, did my 'own' version of the 'real' thing... this is more or less fresh from the drawingboard - not something I would put in production... Code:
If NOT @LOGONMODE Break On EndIf
Dim $SO Dim $wro[],$apa,$count,$counter,$wr,$wri,$key,$val,$to,$o,$ $SO = SetOption("Explicit","On") $SO = SetOption("NoVarsInStrings","On") $SO = SetOption("NoMacrosInStrings","On") $key='HKEY_CURRENT_USER\Software\Golfing' $val='Round02' $count=0 $counter=0
$wri=readvalue($key,$val)
for $count=0 to 80 step 2 $o=right(ltrim(substr($wri, 1, $count)),2) if $count=6 $o='bc' endif Redim preserve $wro[$counter] $wro[$counter]=$o $counter=$counter+1 next Redim $counter $counter=0
for $counter = 0 to ubound($wro) $to= $to + $wro[$counter] next
Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
This is what I finally came up with - no real errorchecking tho =/ And man, I've used things I've never touched before.. and the redim preserve, that took like ages to acctually figure out how to do it.
Code:
If NOT @LOGONMODE
Break On
EndIf
Dim $SO
$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
;
dim $counter,$key,$val
dim $wr,$add,$wri
dim $split[],$c,$x
dim $sp[],$spl,$
;define values
$counter=0
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
$add='28,00,00,00,ff,ff,ff,ff,02,00,00,00,03,00,00,00,3c,00,00,00,50,\'+ '00,00,00,fe,ff,ff,ff,b2,03,00,00,02,05,00,00,02,04,00,00'
$wri='28000000ffffffff02000000030000003c00000050000000feffffffb203'+
'00000205000002040000'
$wr=readvalue($key,$val)
$split=split($add,',')
for each $c in $split
select
case $counter = 2 $c = 'bc' Redim preserve $sp[$counter] $sp[$counter]=$c
case 1 if instr($c,'\') $x=substr($c, len($c) - 1, 3)
$=trim($x) Redim preserve $sp[$counter]
$sp[$counter]=$x else Redim preserve $sp[$counter] $sp[$counter]=$c endif
endselect
$counter=$counter+1
next
ReDim $counter
$counter=0
for $counter = 0 to ubound($sp)
$spl = $spl + $sp[$counter]
next
/*
$wr ' Read value from reg' ?
$wri ' should be equal to line above' ?
$spl ' this is what we wanna write' ?
*/
if $wr = $spl 'entry already altered' ? exit @error
else
$wr=writevalue($key,$val,$spl,'reg_binary')
if @error 'error: ' + @ERROR @SERROR + ' ' ?
else
'altered key' ? endif endif
I just noticed that my fifth edit of this post has gone a-wall, and my final part that acctually did what it more or less was supposed to is gone.. Provided below:
Code:
If NOT @LOGONMODE
Break On
EndIf
Dim $SO
Dim $wro[],$apa,$count,$counter,$wr,$wri,$key,$val,$to,$o,$
$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
$count=0
$counter=0
$wri=readvalue($key,$val)
for $count=0 to 80 step 2
$o=right(ltrim(substr($wri, 1, $count)),2)
if $count=6 $o='bc' endif
ReDim preserve $wro[$counter] $wro[$counter]=$o
$counter=$counter+1
next
ReDim $counter
$counter=0
for $counter = 0 to ubound($wro)
$to= $to + $wro[$counter]
next
;$to ?
;$wri ?
if $to = $wri 'entry already altered' ? exit @error
else
$wr=writevalue($key,$val,$to,'reg_binary')
if @error 'error: ' + @ERROR @SERROR + ' ' ?
else
'altered key' ? endif endif
This still lacks errorchecking - and uses the wrong key-structure.., but should be the code-snippet that you could comment. Interesting that you didn't notice that it didn't do the job correctly
Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Thanks for the input Doc, sorry for the long lines, but my postings were screwed up all the time, and all my alterings is totally gone.. just edited it again and if you just changed so I can alter I hope you can verify my second snippet.
_________________________
as long as it works - why fix it? If it doesn't work - kix-it!
Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I do have a question, but I will rewrite my second submission / perhaps my first as well edited more in the lines of the rules and the way it should be written. Note, this is only for my own, I need to get a grip on handeling this more correct as you might have noticed. Will also try to participate in lesson #3 and hopefully submit something this weekend.