zoukankan      html  css  js  c++  java
  • LauncherClass

    using System;
    using System.Reflection;
    using System.Runtime.Remoting;
    using System.Threading;
    using System.Security.Permissions;
    using System.Security.Policy;
    using System.Security.Principal;

    namespace PPLauncher
    {
        class LauncherClass
        {
            [STAThread]
            static void Main(string[] args)
            {
                try
                {
                    AppDomain newAD = AppDomain.CreateDomain("ApressDomain");
                    //  The principal will always be based on the Windows identity.
                    String[] adRole = {"BigBucksClub"};
                    IIdentity adRoleIdentity = new GenericIdentity(@"WEINSTEFANER\Administrator");
                    Console.WriteLine("Creating the AD role principal.");
                    IPrincipal adRolePrincipal = new GenericPrincipal(adRoleIdentity, adRole);
                    
                    newAD.SetThreadPrincipal(new WindowsPrincipal(WindowsIdentity.GetCurrent()));
                    //  Now restrict this change for all download callers.
                    SecurityPermission sp = new SecurityPermission(SecurityPermissionFlag.ControlPrincipal);
                    sp.Deny();
                    
                    int ret = newAD.ExecuteAssembly(@"D:\assembly\PPTester.exe");
                }
                catch(Exception ex)
                {
                    Console.WriteLine(
                        ex.ToString());
                }    
            }
        }
    }
  • 相关阅读:
    apache的httpclient进行http的交互处理
    Java 基础篇之反射
    死磕 java线程系列之创建线程的8种方式
    Spring Boot(三) 使用Lombok
    Spring Boot (七): Mybatis极简配置
    Spring Boot Thymeleaf 实现国际化
    微项目:一步一步带你使用SpringBoot入门(二)
    SSM框架手动实现分页逻辑(非PageHelper)
    Java 基础篇之集合
    一起来学Java注解(Annotation)
  • 原文地址:https://www.cnblogs.com/shihao/p/2511956.html
Copyright © 2011-2022 走看看