0

I tried it as follows:

  System.Diagnostics.ProcessStartInfo process = new System.Diagnostics.ProcessStartInfo {
    Arguments        = "",
    FileName         = "regedit.exe",
    UseShellExecute  = true,
    Verb             = "runas",
    WorkingDirectory = Environment.CurrentDirectory
  };
  try {
    System.Diagnostics.Process.Start(process);
  } catch {
    // error handling
  }

The C# app I am running the code from is elevated and opens Regedit but neither does it prompt for UAC nor is HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node visible. That key is only visible when I open regedit manually.

What am I doing wrong?

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
tar
  • 156
  • 2
  • 13
  • https://superuser.com/questions/115854/open-registry-directly-to-a-given-key – Jeremy Lakeman Jan 24 '22 at 04:32
  • My issue is not to open the registry at a certain path, but to open the registry explorer where the mentioned path is existing. – tar Jan 24 '22 at 12:14

1 Answers1

0

The issue is resolved.

As in my app the platform was set to "Any CPU" it run as 32 bit process and therefore the call of regedit.exe also only shows the 32 bit registry entries. By changing my app platform explicitely to "x64" the 64 bit registry opens and the special 32 bit path (HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node) within the 64 bit registry is existing and showing up as expected.

I was confused as within a 32 bit app you are able to access the 64 bit registry programmatically when using RegistryView.Registry64. More on that here. But unfortunately, you are not able to open the 64 bit registry explorer by a 32 bit application.

tar
  • 156
  • 2
  • 13