using Microsoft.Win32.SafeHandles; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication7 { class Program { private static readonly IntPtr HKEY_LOCAL_MACHINE = new IntPtr(-2147483646); [DllImport("advapi32")] public static extern int RegRenameKey(SafeRegistryHandle hKey, [MarshalAs(UnmanagedType.LPWStr)] string oldname, [MarshalAs(UnmanagedType.LPWStr)] string newname); static void Main(string[] args) { SafeRegistryHandle hKey = null; hKey = new SafeRegistryHandle(HKEY_LOCAL_MACHINE,true); RegRenameKey(hKey, "SOFTWARE\\Company", "SOFTWARE\\Compa"); Console.ReadLine(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)