This article describes the method of C# operating the windows registry. Share it for your reference. The details are as follows:
This code demonstrates how to read and write to a registry
Read the registry:
private string GetRegistShellData(string RegistName) { try { string registData, SubregistData; RegistryKey hkml = ; RegistryKey software = (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true); registData = (RegistName).ToString(); SubregistData = (0, 2); return SubregistData; } catch (Exception excp) { ("GetRegistShellData Error" + (), "mistake", , ); } return ""; }
Write to the registry:
private void RenameRegistData() { try { string registData1; RegistryKey hkml = ; RegistryKey software2 = (@"SOFTWARE\"+ Shadowin + @"\SysToolSign", true); registData1 = ("Sign").ToString(); ("Sign", "1"); registData1 = ("Sign").ToString(); } catch (Exception excp) { ("RenameRegistData Error" + (), "mistake", , ); } return ; }
I hope this article will be helpful to everyone's C# programming.