mei*_*rav 1 c# windows registry windows-shell regedit
在我的应用程序开始时,我将注册表的 shell 值更改为自定义 shell 并杀死 explorer.exe(它在应用程序之外完成),我希望允许后门返回原始 shell 并带回资源管理器。可执行程序。恢复进程对我来说很好,但是当我运行我的代码来更改注册表值时,没有抛出异常,但是当我签入 regedit 时该值没有改变,这是我的代码(在另一个问题上看到它):
RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true);
regKey.SetValue("Shell", "explorer.exe", RegistryValueKind.String);
regKey.Close();
Run Code Online (Sandbox Code Playgroud)
请帮忙
在您的代码中,您实际上设置了
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
Run Code Online (Sandbox Code Playgroud)
由于某些注册表项被 WOW64 重定向,请查看MSDN以获取更多详细信息。
尝试这个:
RegistryKey localMachine = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey regKey = localMachine .OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true);
regKey.SetValue("Shell", "explorer.exe", RegistryValueKind.String);
regKey.Close();
Run Code Online (Sandbox Code Playgroud)