views:

360

answers:

0

Hi,

I need to update the registry, specifically the Outlook 2003 Master category list to the following key. "Software\Microsoft\Office\11.0\Outlook\Categories"

It is stored as a Reg_binary value and it involves Unicode conversion. I was able to read it successfully but I am unsure how I can write it back. The code I used to read it is here:

Dim bytevalue As Object = Nothing bytevalue = key.GetValue("MasterList") key.Close()

Dim ascii As System.Text.Encoding = System.Text.Encoding.ASCII Dim unicode As System.Text.Encoding = System.Text.Encoding.Unicode

' Convert the string into a byte Dim unicodebytes As Byte() = CType(bytevalue, Byte())

' Perform the conversion from one encoding to another Dim asciibytes As Byte() = System.Text.Encoding.Convert(unicode, ascii, unicodebytes)

' Convert the new byte[] in a char[] and then into a string Dim asciiChars As Char() = New Char(ascii.GetCharCount(asciibytes, 0, asciibytes.Length) - 1) {}

ascii.GetChars(asciibytes, 0, asciibytes.Length, asciiChars, 0) sData = New String(asciiChars)

I need to append a value to the sData variable and re-write it back to this key but I am unsure how I can convert it and write it.

Any ideas?

Kevin