Ejemplo n.º 1
0
        public override Address GetAddress(ClrAppDomain appDomain)
        {
            if (_containingType == null)
                return 0;

            bool shared = _containingType.Shared;

            IDomainLocalModuleData data = null;
            if (shared)
            {
                Address id = _containingType.DesktopModule.ModuleId;
                data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id);
                if (!IsInitialized(data))
                    return 0;
            }
            else
            {
                Address modAddr = _containingType.GetModuleAddress(appDomain);
                if (modAddr != 0)
                    data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(modAddr);
            }

            if (data == null)
                return 0;

            Address addr;
            if (DesktopRuntimeBase.IsPrimitive(ElementType))
                addr = data.NonGCStaticDataStart + _field.Offset;
            else
                addr = data.GCStaticDataStart + _field.Offset;

            return addr;
        }
Ejemplo n.º 2
0
        internal override IDomainLocalModuleData GetDomainLocalModule(ulong appDomain, ulong module)
        {
            DacLibrary.DacDataTarget.SetNextCurrentThreadId(0x12345678);
            DacLibrary.DacDataTarget.SetNextTLSValue(appDomain);

            IDomainLocalModuleData result = Request <IDomainLocalModuleData, LegacyDomainLocalModuleData>(DacRequests.DOMAINLOCALMODULE_DATA_FROM_MODULE, module);

            DacLibrary.DacDataTarget.SetNextCurrentThreadId(null);
            DacLibrary.DacDataTarget.SetNextTLSValue(null);

            return(result);
        }
Ejemplo n.º 3
0
        private bool IsInitialized(IDomainLocalModuleData data)
        {
            if (data == null || _containingType == null)
                return false;

            byte flags = 0;
            ulong flagsAddr = data.ClassData + (_containingType.MetadataToken & ~0x02000000u) - 1;
            if (!_heap.DesktopRuntime.ReadByte(flagsAddr, out flags))
                return false;

            return (flags & 1) != 0;
        }
Ejemplo n.º 4
0
        public override bool IsInitialized(ClrAppDomain appDomain)
        {
            if (_containingType == null)
                return false;

            if (!_containingType.Shared)
                return true;

            Address id = _containingType.DesktopModule.ModuleId;
            IDomainLocalModuleData data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id);
            if (data == null)
                return false;

            return IsInitialized(data);
        }
Ejemplo n.º 5
0
        public override ulong GetAddress(ClrAppDomain appDomain)
        {
            if (_containingType == null)
            {
                return(0);
            }

            bool shared = _containingType.Shared;

            IDomainLocalModuleData data = null;

            if (shared)
            {
                ulong id = _containingType.DesktopModule.ModuleId;
                data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id);
                if (!IsInitialized(data))
                {
                    return(0);
                }
            }
            else
            {
                ulong modAddr = _containingType.GetModuleAddress(appDomain);
                if (modAddr != 0)
                {
                    data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(modAddr);
                }
            }

            if (data == null)
            {
                return(0);
            }

            ulong addr;

            if (DesktopRuntimeBase.IsPrimitive(ElementType))
            {
                addr = data.NonGCStaticDataStart + _field.Offset;
            }
            else
            {
                addr = data.GCStaticDataStart + _field.Offset;
            }

            return(addr);
        }
Ejemplo n.º 6
0
        private bool IsInitialized(IDomainLocalModuleData data)
        {
            if (data == null || m_containingType == null)
            {
                return(false);
            }

            byte  flags     = 0;
            ulong flagsAddr = data.ClassData + (m_containingType.MetadataToken & ~0x02000000u) - 1;

            if (!m_heap.m_runtime.ReadByte(flagsAddr, out flags))
            {
                return(false);
            }

            return((flags & 1) != 0);
        }
Ejemplo n.º 7
0
        public override bool IsInitialized(ClrAppDomain appDomain)
        {
            if (_containingType == null)
            {
                return(false);
            }

            if (!_containingType.Shared)
            {
                return(true);
            }

            ulong id = _containingType.DesktopModule.ModuleId;
            IDomainLocalModuleData data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id);

            if (data == null)
            {
                return(false);
            }

            return(IsInitialized(data));
        }
Ejemplo n.º 8
0
        public override bool IsInitialized(ClrAppDomain appDomain)
        {
            if (m_containingType == null)
            {
                return(false);
            }

            if (!m_containingType.Shared)
            {
                return(true);
            }

            Address id = m_containingType.m_module.ModuleId;
            IDomainLocalModuleData data = m_containingType.m_heap.m_runtime.GetDomainLocalModule(appDomain.Address, id);

            if (data == null)
            {
                return(false);
            }

            return(IsInitialized(data));
        }
Ejemplo n.º 9
0
        private bool IsInitialized(IDomainLocalModuleData data)
        {
            if (data == null || _containingType == null)
                return false;

            byte flags = 0;
            ulong flagsAddr = data.ClassData + (_containingType.MetadataToken & ~0x02000000u) - 1;
            if (!_heap.DesktopRuntime.ReadByte(flagsAddr, out flags))
                return false;

            return (flags & 1) != 0;
        }