Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

byte array from registry is not converted properly by readbyts function

$
0
0

Hi

i need to convert c++ code that reads registry to c#; however while the c++ returns expected values the c# returns mostly "" or cryptic values;

in the debugger when i check the  byte array returned by c# i can see the ascii characters : 62,85, etc but the readbyte seems not able to convert these into string / int

my code is shown below 

 string g_provSvrKey = "Software\\Telegroup\\ProvSvr";


             


             RegistryKey rem = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "10.100.51.70");


             RegistryKey rkeyProvSrvr = rem.OpenSubKey(g_provSvrKey);

             string[] sub, ssub;
             char[] ch = null;
             String[] ValueNames = rkeyProvSrvr.GetValueNames();
            
             
             TSetupData stup = new TSetupData();
             BinaryReader rd;
             foreach (string name in ValueNames)
             {
                 if (name==g_regValueNames[0])//  .Contains(g_regValueNames[0]))
                 {
                    byte[]
                        setupAr= (byte[])rkeyProvSrvr.GetValue(name.ToUpper());
                    rd = new BinaryReader(new MemoryStream(setupAr, false));
                     stup.idbDataSource = rd.ReadString();
                     stup.idbLoginTimeout = rd.ReadInt16();
                     stup.idbUserName = rd.ReadString();                     
                     stup.idbUserPwd = rd.ReadString();
                    // byte[] stp=(byte[])stup.
                 }
             }// sub;


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>