Hello guys, I have a code where I get the registry subKey and I have assigned the value to a variable named subKey (this value came from wmic process and the final data came without {}) but I need to add {} and the beginning and end of this value in order to get the information that I need. The problem is that when I print the value to validate that I have gotten the right information, the debug shows me that the variable is null. I think the issue is the concatenation. Please, follow the code here below:
the right line should be something like that RegistryKey key2 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C3BCB0F2-5303-489D-AFAB-218B416D000D}"); please, follow the information from the debug attached here. in the debug3 you will see that the variable key is null
any idea, please?
regards,
Jose
keyValue:
SystemInfo systemInfo = new SystemInfo();
wmic Wmic = new wmic();
Wmic.IdentifyingNumber = GetSipeliaInfo("output4");
//I have to us eregex because I need to remove those characters
// (\r\r\n\r\r\n) from "C3BCB0F2-5303-489D-AFAB-218B416D000D \r\r\n\r\r\n"
string input = Regex.Replace(Wmic.IdentifyingNumber, @"\s+", "");
Console.WriteLine(input);
string subKey = input;
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" + "\\{" + subKey + "\\}");
Console.WriteLine(key);
the right line should be something like that RegistryKey key2 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C3BCB0F2-5303-489D-AFAB-218B416D000D}"); please, follow the information from the debug attached here. in the debug3 you will see that the variable key is null
any idea, please?
regards,
Jose