vagner,
вот в формочке почему то не работает. =(((((((((((
(на шаге
p.Start();
пишет неверный дескриптор.
подскажите в чём может быть дело?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace win_session_dropper
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
drop("", "");
}
private void drop(string serverIP, string sessionNum)
{
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.CreateNoWindow = true;
p.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(866);
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UserName = @"Administrator";
System.Security.SecureString UserPass = new System.Security.SecureString();
string PassString = @"xxxxxxxx";
SetPass(UserPass, PassString);
p.StartInfo.Password = UserPass;
p.StartInfo.FileName = @"C:\Windows\system32\tsdiscon.exe";
p.StartInfo.Arguments = @"1 /server:10.99.2.235 -v";
p.Start();
}
public static void SetPass(System.Security.SecureString UserPass, string PassString)
{
while (PassString.Length > 0)
{
char s = Convert.ToChar(PassString.Substring(0, 1));
UserPass.AppendChar(s);
PassString = PassString.Substring(1, (PassString.Length - 1));
}
}
}
}
хотя в ConsoleApplication все арботает