1

I'm trying to save the Hive Registry File called HKLM\SOFTWARE from a C# application.

When I run the the following command (from CMD) REG SAVE HKLM\SOFTWARE C:\TEST it give me a file with a size of about 90MB.

So, I expected that by running this command through the Process and ProcessStartInfo class in a C# Console Application, it would give me the same result. NO. It produces a file of about 8MB, obviously with less data!

Here is the C# code:

ProcessStartInfo start = new ProcessStartInfo("REG", "SAVE HKLM\SOFTWARE C:\TEST")
{
    UseShellExecute = false,
    RedirectStandardOutput = false,
    RedirectStandardError = false,
    CreateNoWindow = true,
};

Process.Start(start).WaitForExit();

Why it gives me a smaller file? How can I solve this?

Thanks in advance!

Liuk
  • 111
  • 7
  • Are you just saving the 64-bit registry hive? – Ron Beyer Apr 25 '18 at 15:01
  • Maybe you're running one command from a 32-bit process and the other from a 64-bit process? [They use different registry hives](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724072(v=vs.85).aspx). – Rufus L Apr 25 '18 at 15:13
  • Type `reg save /?` to get command help. You'll discover the /reg:32 and /reg:64 options. – Hans Passant Apr 25 '18 at 15:16

0 Answers0