Reputation: 1543
I am having trouble reading this key from my managed bootstrapper (.NET 4.5.2), and my custom action (tried .NET 2.0 and 4.0).
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages
I tried running the bootstrapper and msi using cmd as Administrator. My test environment is Windows 7 64-bit. I am using Wix 3.11
I made a test command line app and it was able to access this key.
The testing code I used in the bootstrapper and custom action:
static RegistryKey GetHKLMKey(string registryPath) {
var hklm64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
var registryKey64 = hklm64.OpenSubKey(registryPath);
if ((registryKey64?.GetValueNames().Any()).GetValueOrDefault()) {
return registryKey64;
}
var hklm32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
return hklm32.OpenSubKey(registryPath);
}
}
...
var path = @"SOFTWARE";
foreach (var segment in @"Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages".Split('\\')) {
path += "\\"+segment;
var j = GetHKLMKey(path);
Log(path + ": " + j);
var k = Registry.LocalMachine.OpenSubKey(path);
Log(path + ": " + k);
if (k == null) return true;
}
test output
SOFTWARE\Microsoft: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft
SOFTWARE\Microsoft: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft
SOFTWARE\Microsoft\Windows: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
SOFTWARE\Microsoft\Windows: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
SOFTWARE\Microsoft\Windows\CurrentVersion: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
SOFTWARE\Microsoft\Windows\CurrentVersion: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing
SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing
SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages:
SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages:
Upvotes: 1
Views: 732
Reputation: 42126
Debugging Managed Code Custom Actions: Not quite clear what the problem is? The read does not work as a custom action? Try showing a message box from the custom action and then attach the debugger to the rundll32.exe
process running managed code. Then you can step through the code using Visual Studio in normal "debug fashion". Here is a nice video from Advanced Installer showing you how to do this: Debug C# Custom Actions.
Registry Read: Once you have debugability, it should be possible to work out what the cause is of whatever problem it is that you are seeing.
ignore exit code
"?Just some ideas off the top of my head. Please let us know what it was.
Upvotes: 2