2012-12-02 111 views
0

在我的应用程序开始时,我将注册表的shell值更改为自定义shell并杀死explorer.exe(它在应用程序之外完成),我想允许后门返回到原始的外壳,并带回explorer.exe。这个过程对我来说可以正常工作,但是当我运行我的代码来更改注册表值时,没有发生任何异常,但值不会改变,当我检查注册表时, 这是我的代码(在另一个问题上看到它) :更改Shell注册表

 RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true); 
     regKey.SetValue("Shell", "explorer.exe", RegistryValueKind.String); 
     regKey.Close(); 

请帮

回答

4

在代码中,你实际上是在设置的

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell 

价值,因为某些注册表项被重定向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(); 
+0

工作,感谢:

试试这个 – meirrav