I have a legacy winForms program (runs on Windows 7 Embedded) that we are trying to make run on windows 10. We have a simple process where we start the command prompt process cmd.exe and do various tasks. One task is to interact with the write filter. WES7 uses ewfmgr and windows 10 uses uwfmgr commandline tools.
In order to interpret the result we read the output and make decisions based on the output.
The problem is on windows 10 the output is unreadable. This is only for
Sample simple code:
private Process statusProcess = new Process();
private List<string> cmdOutput = new List<string>();
ProcessStartInfo cmdStartInfo = new ProcessStartInfo();
cmdStartInfo.FileName = @"C:\Windows\System32\cmd.exe";
cmdStartInfo.WorkingDirectory = @"C:\Dev";
cmdStartInfo.CreateNoWindow = true;
cmdStartInfo.UseShellExecute = false;
//Add Admin account details
cmdStartInfo.Domain = "Bla";
cmdStartInfo.UserName = "Admin";
cmdStartInfo.Password = securePwd;
cmdStartInfo.RedirectStandardOutput = true;
cmdStartInfo.RedirectStandardError = true;
cmdStartInfo.RedirectStandardInput = true;
statusProcess.StartInfo = cmdStartInfo;
statusProcess.ErrorDataReceived += cmd_Error;
statusProcess.OutputDataReceived += cmd_DataReceived;
statusProcess.EnableRaisingEvents = true;
statusProcess.Start();
statusProcess.BeginOutputReadLine();
statusProcess.BeginErrorReadLine();
//cmd_DataReceived Simple just add data
private void cmd_DataReceived(object sender, DataReceivedEventArgs e)
{
cmdOutput.Add(e.Data);
}
Send commands using
statusProcess.StandardInput.WriteLine("dir");
If we run commands like dir we get perfect results.
if we run uwfmgr Get-Config
Although that command displays config, the set commands are not working so its not only an output issue or is it?
The error stream is empty and I presume the error stream works as I can get errors on other commands.
The code page is set to 437, and other commands work as expected, note the first line is correct and makes sense.
I have tried different approaches
I Wrote a powershell script and can call the script correctly, but I can't get past UAC (I think its UAC but I get access denied) in the error stream and also not sure how to get the output from powershell
Looked as using the powershell classes from System.Management.Automation, can get that working for W10 but introduces WES7 issues.
I'm curious as to why the output display like that?
I've just written this post and I'm wondering if security is not messing me around, I'mm gonna investigate that angle.
Thanks in advance if anyone was some pointers.