c# Run ein console program in ein winforms program as admin.

  • Deutsch
    Hallo,


    Ich habe eine Konsole-Anwendung, die sendkeywait verwendet, um in eFlyff Chat, indem sie Argumente mit ihr Typ.
    Wie: FlyffCommandApi.exe "chat", "FLYFF" "Quget" "Hallo" "3" "Eine riesige Liste"
    Er wird sagen: Hallo zusammen 3 mal ingame :) Es funktioniert.
    Aber wenn ich es Rinne laufen meine WinForms-Anwendung soll ich einen unbekannten invissable Fehler. Erst wenn Gameguard läuft. Zu umgehen, dass Sie als Administrator werden rannte müssen. Aber meine Konsole-Anwendung scheint nicht das zu tun: (Ich habe bereits das Manifest Dinge right.This ist das, was ich habe.


    Ich weiß, es wurde getestet alles :/
    Es funktioniert auf Notizbuch harten ohne gg Lauf.

    PHP
    public void CommandApiInit()        {            procInfo.CreateNoWindow = true;            procInfo.UseShellExecute = true;            procInfo.RedirectStandardOutput = false;            procInfo.FileName = @"FlyffCommandApi.exe";//exe";            procInfo.Verb = "runas";           // procInfo.WorkingDirectory = Environment.CurrentDirectory;            commandApiProg.StartInfo = procInfo;        }
            public void startApi(string args)        {            procInfo.Arguments = args;            procInfo.Verb = "runas";            commandApiProg.StartInfo = procInfo;            try            {                commandApiProg.StartInfo.Verb = "runas";                commandApiProg.Start();                commandApiProg.WaitForExit();            }            catch (Exception ex)            {                MessageBox.Show(ex.Message.ToString());            }        }


    English
    Hi,

    I made a console application which uses sendkeywait to typ in eFlyff chat by getting arguments with it.
    Like : FlyffCommandApi.exe "chat" "FLYFF" "Quget" "Hi there" "3" "A huge list"
    It will say Hi there 3 times ingame :) It works.
    But when I want to run it trough my winforms application I get a unkown invissable error. It is only when Gameguard is running. Too bypass that It need to be ran as admin. But my console application doesn't seem to do that :( I already did the manifest things right.This is what I have.

    I know it was testing everything :/
    It works on notepad tough without gg running.

    PHP
    public void CommandApiInit()        {            procInfo.CreateNoWindow = true;            procInfo.UseShellExecute = true;            procInfo.RedirectStandardOutput = false;            procInfo.FileName = @"FlyffCommandApi.exe";//exe";            procInfo.Verb = "runas";           // procInfo.WorkingDirectory = Environment.CurrentDirectory;            commandApiProg.StartInfo = procInfo;        }
            public void startApi(string args)        {            procInfo.Arguments = args;            procInfo.Verb = "runas";            commandApiProg.StartInfo = procInfo;            try            {                commandApiProg.StartInfo.Verb = "runas";                commandApiProg.Start();                commandApiProg.WaitForExit();            }            catch (Exception ex)            {                MessageBox.Show(ex.Message.ToString());            }        }


    ps
    The english section won't work -.-"

  • Well, it should work with a manifest File ( resquestAdministrator ) but u can try to use the Process.StartInfo and use the Shell like:

    ProcessStartInfo.UseShellExecute = true
    ProcessStartInfo.Verb = "runas"

    The runas Verb should start the Process with Administrator rights.
    ( May u have to disable UAC )

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!