Ejemplo n.º 1
0
            private void InitializeComInterfaces()
            {
                Guid     cid     = new Guid("9280188D-0E8E-4867-B30C-7FA83884E8DE");
                Guid     cid2    = new Guid("B79B0ACD-F5CD-409B-B5A5-A16244610B92");
                IRuntime runtime = (IRuntime)((IMeta)CLRCreateInstance(cid, typeof(IMeta).GUID)).GetRuntime(_RuntimeVersion, typeof(IRuntime).GUID);

                _StrongName = (IStrongName)runtime.GetInterface(cid2, typeof(IStrongName).GUID);
            }
Ejemplo n.º 2
0
    private bool CheckCore()
    {
        string Base    = RuntimeEnvironment.GetRuntimeDirectory();
        string Build   = RuntimeEnvironment.GetSystemVersion();
        bool   HostCLR = Int32.Parse(Build[1].ToString()) >= 4;

        if (HostCLR)
        {
            Guid CID_META_HOST   = new Guid("9280188D-0E8E-4867-B30C-7FA83884E8DE");
            Guid CID_STRONG_NAME = new Guid("B79B0ACD-F5CD-409B-B5A5-A16244610B92");

            IMeta    Meta    = (IMeta)CreateInstance(CID_META_HOST, typeof(IMeta).GUID);
            IRuntime Runtime = (IRuntime)Meta.GetRuntime(Build, typeof(IRuntime).GUID);
            SN = (IStrongName)Runtime.GetInterface(CID_STRONG_NAME, typeof(IStrongName).GUID);
        }

        string File1 = Path.ChangeExtension(Path.Combine(Base, "mscorlib"), "dll");
        string File2 = Path.ChangeExtension(Path.Combine(Base, "system"), "dll");

        byte[] Token = new byte[] {
            183,
            122,
            92,
            86,
            25,
            52,
            224,
            137
        };
        if (!IsTrusted(File1, Token, HostCLR))
        {
            return(false);
        }
        if (!IsTrusted(File2, Token, HostCLR))
        {
            return(false);
        }

        return(true);
    }