Exemplo n.º 1
0
        private void UpdateNetDirectory(EmitContext context)
        {
            var assembly = NetDirectory.Assembly;

            NetDirectory.MetadataDirectory.VirtualAddress = (uint)assembly.FileOffsetToRva(MetadataDirectory.StartOffset);
            NetDirectory.MetadataDirectory.Size           = MetadataDirectory.GetPhysicalLength();

            if (NetDirectory.ResourcesManifest != null)
            {
                NetDirectory.ResourcesDirectory.VirtualAddress = (uint)assembly.FileOffsetToRva(NetDirectory.ResourcesManifest.StartOffset);
                NetDirectory.ResourcesDirectory.Size           = NetDirectory.ResourcesManifest.GetPhysicalLength();
            }

            if (NetDirectory.StrongNameData != null)
            {
                NetDirectory.StrongNameSignatureDirectory.VirtualAddress =
                    (uint)assembly.FileOffsetToRva(NetDirectory.StrongNameData.StartOffset);
                NetDirectory.StrongNameSignatureDirectory.Size = NetDirectory.StrongNameData.GetPhysicalLength();
            }

            if (VTableFixups != null)
            {
                NetDirectory.VTableFixupsDirectory.VirtualAddress =
                    (uint)assembly.FileOffsetToRva(VTableFixups.Directory.StartOffset);
                NetDirectory.VTableFixupsDirectory.Size = VTableFixups.Directory.GetPhysicalLength();
            }
        }
Exemplo n.º 2
0
        public override uint GetPhysicalLength()
        {
            var dirLength = MetadataDirectory.GetPhysicalLength();

            return(1 * sizeof(uint) +
                   2 * sizeof(ushort) +
                   1 * dirLength +
                   2 * sizeof(uint) +
                   6 * dirLength);
        }