예제 #1
0
        internal static void Patch(ModuleReader module, Dictionary <int, string> strings, ref string imageRuntimeVersion, ref byte[] blobHeap)
        {
            if (!module.CustomAttribute.Sorted)
            {
                // HasAllowMultipleAttribute requires this
                throw new NotImplementedException("CustomAttribute table must be sorted");
            }

            bool clr = imageRuntimeVersion.Contains(";");

            if (clr)
            {
                imageRuntimeVersion = imageRuntimeVersion.Substring(imageRuntimeVersion.IndexOf(';') + 1);
                if (imageRuntimeVersion.StartsWith("CLR", StringComparison.OrdinalIgnoreCase))
                {
                    imageRuntimeVersion = imageRuntimeVersion.Substring(3);
                }
                imageRuntimeVersion = imageRuntimeVersion.TrimStart(' ');
            }
            else
            {
                Assembly mscorlib = module.universe.Mscorlib;
                imageRuntimeVersion = mscorlib.__IsMissing ? "v4.0.30319" : mscorlib.ImageRuntimeVersion;
            }

            WindowsRuntimeProjection obj = new WindowsRuntimeProjection(module, strings);

            obj.PatchAssemblyRef(ref blobHeap);
            obj.PatchTypeRef();
            obj.PatchTypes(clr);
            obj.PatchMethodImpl();
            obj.PatchCustomAttribute(ref blobHeap);
        }
예제 #2
0
        internal MissingType(Module module, Type declaringType, string ns, string name)
        {
            this.module        = module;
            this.declaringType = declaringType;
            this.ns            = ns;
            this.name          = name;
            MarkEnumOrValueType(ns, name);

            // HACK we need to handle the Windows Runtime projected types that change from ValueType to Class or v.v.
            if (WindowsRuntimeProjection.IsProjectedValueType(ns, name, module))
            {
                typeFlags |= TypeFlags.ValueType;
            }
            else if (WindowsRuntimeProjection.IsProjectedReferenceType(ns, name, module))
            {
                typeFlags |= TypeFlags.NotValueType;
            }
        }
		internal static void Patch(ModuleReader module, Dictionary<int, string> strings, ref string imageRuntimeVersion, ref byte[] blobHeap)
		{
			if (!module.CustomAttribute.Sorted)
			{
				// HasAllowMultipleAttribute requires this
				throw new NotImplementedException("CustomAttribute table must be sorted");
			}

			bool clr = imageRuntimeVersion.Contains(";");
			if (clr)
			{
				imageRuntimeVersion = imageRuntimeVersion.Substring(imageRuntimeVersion.IndexOf(';') + 1);
				if (imageRuntimeVersion.StartsWith("CLR", StringComparison.OrdinalIgnoreCase))
				{
					imageRuntimeVersion = imageRuntimeVersion.Substring(3);
				}
				imageRuntimeVersion = imageRuntimeVersion.TrimStart(' ');
			}
			else
			{
				Assembly mscorlib = module.universe.Mscorlib;
				imageRuntimeVersion = mscorlib.__IsMissing ? "v4.0.30319" : mscorlib.ImageRuntimeVersion;
			}

			WindowsRuntimeProjection obj = new WindowsRuntimeProjection(module, strings);
			obj.PatchAssemblyRef(ref blobHeap);
			obj.PatchTypeRef();
			obj.PatchTypes(clr);
			obj.PatchMethodImpl();
			obj.PatchCustomAttribute(ref blobHeap);
		}