Registry

 

Registry.SetValue("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR", "Start", 4);

 

The class Registry has a static method SetValue to which we pass the key, sub key and value. This class is present in the below name space

 

using Microsoft.Win32;

 

C program

 

HKEY key;int i = 4;

RegOpenKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\USBSTOR",&key);

RegSetValueExA(key,"Start",0,REG_DWORD,&i,4);