uwfmgr does not release registry

553 Views Asked by At

Greetings SO Community

I'm writing a c# program to manage the uwfmgr registry exclusions.

I execute the following command.

uwfmgr registry get-exclusions.

Afterwards, when I want to read the registry, I get an exception with the message:

No more data is available.

This problem persists until the next reboot.

I suspect, that uwfmgr does not release the registry key properly.

I've made a minimal example to demonstrate the error.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;

namespace WindowsFormsApplication2
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {
                Process proc = new Process();
                proc.StartInfo.CreateNoWindow = true;
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError = true;
                proc.StartInfo.FileName = "C:\\Windows\\Sysnative\\uwfmgr.exe";
                proc.StartInfo.Arguments = "registry get-exclusions";
                proc.Start();
                proc.WaitForExit();
                string output = proc.StandardOutput.ReadToEnd();

                string[] subkeys = Registry.LocalMachine.GetSubKeyNames();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
            }
        }
    }
}

Info:

  • CLR is ".Net Framework 4.5".
  • Target is "Any CPU".
  • The executing system is "Windows Embedded 8.1 Industry Pro".
  • The architecture is 64bit.

Now, is there any possible way to force uwfmgr to release the registry?

PS: This is my first post. I tried to post according to the rules, but if I forgot something, please kindly remind me. Thanks.

0

There are 0 best solutions below