Firstly, there is no problem executing the code on Win7/Win8 etc. The problem exists solely on Windows XP. The code is in a button, and basically runs taskmgr.exe as another users credentials (a local admin credentials, this is a Kiosk PC which loads a C# application which can be logged into and then load cmd.exe/taskmgr.exe as a local admin unaffected by the GPOs linked to the Kiosk user).
However, on XP, I get the error when clicking the button: Stub received bad data.
Code:
private void btnTaskMgr_Click(object sender, EventArgs e)
{
string password = "myPassword";
SecureString secureString = new SecureString();
foreach (char chr in password) secureString.AppendChar(chr);
ProcessStartInfo processAdmin;
processAdmin = new ProcessStartInfo();
processAdmin.UseShellExecute = false;
processAdmin.Password = secureString;
processAdmin.UserName = "admin";
processAdmin.FileName = "taskmgr.exe";
processAdmin.WorkingDirectory = "C:\\Windows\\System32";
Process.Start(processAdmin);
}
FileName = "taskmgr.exe"
sufficient? The documentation forCreateProcess
says oflpApplicationName
In the case of a partial name, the function uses the current drive and current directory to complete the specification. The function will not use the search path. I don't have any information that says whetherFileName
is mapped tolpApplicationName
orlpCommandLine
.