First, my environment:

Kix: 4.61
O/S: Windows 7 Enterprise, 32-bit

While working on a mainteance script, I stumbled upon a weird issue that really has me head-scratching. I am having some weird (read: different) results with the READVALUE function, where I get one value if I direct output to a log file and a different value if I output to the screen.

 Code:
   ; ===== Open the log file =====
   $log = split (@scriptname,".")
   $logfile = @scriptdir + "\" + $log[0] + ".log"
   $x = redirectoutput ($logfile,1)
   " ========== @scriptname =========="?
   
   ; ===== Read value from registry =====
   $regkey = "hkcu\software\microsoft\windows\currentversion\internet settings\connections"
   $regentry = "defaultconnectionsettings"
   $regdata = readvalue ($regkey,$regentry)
   $regdata ?
   
   ; ===== The bitter end =====
   " ========== @scriptname =========="?
   $x = redirectoutput ("")
   
   exit 0


If I open the log file (in the same folder as my .kix script), I see a value of ...

4600000022010000090000000e00000032382e38362e36332e33323a3830070000002a2e6c6
f63616c000000000500000000000000a0b9e676a198cb010000000000000000000000000200
000002000000ac10011f0000000000000000000000000000000000000000000000001700000
0000000000000000000000000000000000000000100000000000000001c0000000000000000
000000000000000000000000000000000000000000000017000000000000000000000000000
0000000ffffac10011f00000000000000001700000000000000000000000000000000000000
00000001000000000000000099000099302f0000e0614200d8e741000000000004000000000
00000010000000300000000000000000000000c8d4200feffffff0c00000002000000010042
000000000080000000000000000000000000000000000000000000000000000000

This value is correct and matches the value I see when viewing the registry in Regedit.

Now, if I use the same code and get rid of the log file, the output goes to the screen.


 Code:
   ; ===== Read value from registry =====
   $regkey = "hkcu\software\microsoft\windows\currentversion\internet settings\connections"
   $regentry = "defaultconnectionsettings"
   $regdata = readvalue ($regkey,$regentry)
   $regdata ?
   
   sleep 20 ; so I have time to copy the text from the window ...
   
   exit 0



Instead of the value I saw before, I get ... 0000000000800000000000000000000000000000000000000000000000000000004200feffffff0c00000002000000010042 instead.

I can duplicate the issue on XP Pro and Windows 7 Enterprise, 64-bit.

Kixtart 4.53, 4.60, 4.61 BETA and 4.61 all yield the same result.

Any ideas?


Edited by Glenn Barnas (2010-12-10 10:07 PM)
Edit Reason: broke long line