예제 #1
0
파일: Program.cs 프로젝트: uDEV2019/NSudo
        static void Main(string[] args)
        {
            NSudoInstance instance = new NSudoInstance();

            instance.WriteLog("M2.NSudo.Demo", "Start");

            try
            {
                instance.CreateProcess(
                    NSUDO_USER_MODE_TYPE.TRUSTED_INSTALLER,
                    NSUDO_PRIVILEGES_MODE_TYPE.ENABLE_ALL_PRIVILEGES,
                    NSUDO_MANDATORY_LABEL_TYPE.SYSTEM,
                    NSUDO_PROCESS_PRIORITY_CLASS_TYPE.NORMAL,
                    NSUDO_SHOW_WINDOW_MODE_TYPE.DEFAULT,
                    0,
                    true,
                    "cmd",
                    null);
            }
            catch (Exception ex)
            {
                Console.WriteLine(
                    "CreateProcess Failed, return {0}",
                    ex.HResult);
            }

            instance.WriteLog("M2.NSudo.Demo", "End");

            Console.WriteLine(instance.ReadLog());

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            NSudoInstance instance = new NSudoInstance();

            instance.CreateProcess(
                NSUDO_USER_MODE_TYPE.TRUSTED_INSTALLER,
                NSUDO_PRIVILEGES_MODE_TYPE.ENABLE_ALL_PRIVILEGES,
                NSUDO_MANDATORY_LABEL_TYPE.SYSTEM,
                NSUDO_PROCESS_PRIORITY_CLASS_TYPE.NORMAL,
                NSUDO_SHOW_WINDOW_MODE_TYPE.DEFAULT,
                0,
                true,
                "cmd",
                null);

            Console.ReadKey();
        }