Example #1
0
 internal ResourceDirectoryEntry[] ConstructChildEntries(int count)
 {
     ResourceDirectoryEntry[] entries = new ResourceDirectoryEntry[count];
     for (int i = 0; i < count; i++)
         entries[i] = ReadDirectoryEntry((uint)stream.Position);
     return entries;
 }
Example #2
0
        internal ResourceDirectoryEntry ReadDirectoryEntry(uint offset)
        {
            var    rawEntry   = ASMGlobals.ReadStructureFromReader <Structures.IMAGE_RESOURCE_DIRECTORY_ENTRY>(reader);
            string customName = string.Empty;
            ResourceDirectoryEntry resourceEntry = new ResourceDirectoryEntry(image, offset, rawEntry, customName);

            return(resourceEntry);
        }
Example #3
0
 internal ResourceDirectory(PeImage image, uint offset, ResourcesReader reader, ResourceDirectoryEntry parentEntry, Structures.IMAGE_RESOURCE_DIRECTORY rawDirectory)
 {
     this._image = image;
     this.ParentEntry = parentEntry;
     this._offset = offset;
     this._fileOffset = offset + image.ParentAssembly._ntHeader.OptionalHeader.DataDirectories[(int)DataDirectoryName.Resource].TargetOffset.FileOffset;
     this._rawDirectory = rawDirectory;
     this._reader = reader;
 }
Example #4
0
 internal ResourceDataEntry ReadDataEntry(uint offset, ResourceDirectoryEntry entry)
 {
     if (TrySetOffset(offset))
     {
         var rawDataEntry = ASMGlobals.ReadStructureFromReader <Structures.IMAGE_RESOURCE_DATA_ENTRY>(reader);
         return(new ResourceDataEntry(image, resourceDirectory.TargetOffset.FileOffset + offset, entry, rawDataEntry));
     }
     return(null);
 }
Example #5
0
 internal ResourceDirectoryEntry[] ConstructChildEntries(int count)
 {
     ResourceDirectoryEntry[] entries = new ResourceDirectoryEntry[count];
     for (int i = 0; i < count; i++)
     {
         entries[i] = ReadDirectoryEntry((uint)stream.Position);
     }
     return(entries);
 }
Example #6
0
 internal ResourceDataEntry ReadDataEntry(uint offset, ResourceDirectoryEntry entry)
 {
     if (TrySetOffset(offset))
     {
         var rawDataEntry = ASMGlobals.ReadStructureFromReader<Structures.IMAGE_RESOURCE_DATA_ENTRY>(reader);
         return new ResourceDataEntry(image, resourceDirectory.TargetOffset.FileOffset + offset, entry, rawDataEntry);
     }
     return null;
 }
Example #7
0
        internal ResourceDirectory ReadDirectory(uint offset, ResourceDirectoryEntry entry)
        {
            if (TrySetOffset(offset))
            {
                var rawDirectory = ASMGlobals.ReadStructureFromReader <Structures.IMAGE_RESOURCE_DIRECTORY>(reader);

                return(new ResourceDirectory(image, offset, this, entry, rawDirectory));
            }
            return(null);
        }
Example #8
0
        internal ResourceDataEntry(PeImage image, uint offset, ResourceDirectoryEntry parentEntry, Structures.IMAGE_RESOURCE_DATA_ENTRY rawDataEntry)
        {
            this._image = image;
            this._offset = offset;
            this.ParentEntry = parentEntry;
            this._rawDataEntry = rawDataEntry;

            Section resourceSection = Section.GetSectionByRva(image.ParentAssembly, image.ParentAssembly._ntHeader.OptionalHeader.DataDirectories[(int)DataDirectoryName.Resource].TargetOffset.Rva);
            _targetOffset = OffsetToData - resourceSection.RVA + resourceSection.RawOffset;
        }
Example #9
0
        internal ResourceDataEntry(PeImage image, uint offset, ResourceDirectoryEntry parentEntry, Structures.IMAGE_RESOURCE_DATA_ENTRY rawDataEntry)
        {
            this._image        = image;
            this._offset       = offset;
            this.ParentEntry   = parentEntry;
            this._rawDataEntry = rawDataEntry;

            Section resourceSection = Section.GetSectionByRva(image.ParentAssembly, image.ParentAssembly._ntHeader.OptionalHeader.DataDirectories[(int)DataDirectoryName.Resource].TargetOffset.Rva);

            _targetOffset = OffsetToData - resourceSection.RVA + resourceSection.RawOffset;
        }
Example #10
0
        internal void FillChildEntries(ref ResourceDirectoryEntry[] entries)
        {
            for (int i = 0; i < entries.Length; i++)
            {

                if (!entries[i].IsEntryToData)
                {
                    entries[i].Directory = ReadDirectory(entries[i].OffsetToData - 0x80000000, entries[i]);
                }
                else
                {
                    entries[i].DataEntry = ReadDataEntry(entries[i].OffsetToData, entries[i]);
                }
            }
        }
Example #11
0
        internal ResourceDirectoryEntry ReadDirectoryEntry(uint offset)
        {
            var rawEntry = ASMGlobals.ReadStructureFromReader<Structures.IMAGE_RESOURCE_DIRECTORY_ENTRY>(reader);
            string customName = string.Empty;
            ResourceDirectoryEntry resourceEntry = new ResourceDirectoryEntry(image, offset, rawEntry, customName);

            return resourceEntry;
        }
Example #12
0
        internal ResourceDirectory ReadDirectory(uint offset, ResourceDirectoryEntry entry)
        {
            if (TrySetOffset(offset))
            {
                var rawDirectory = ASMGlobals.ReadStructureFromReader<Structures.IMAGE_RESOURCE_DIRECTORY>(reader);

                return new ResourceDirectory(image, offset, this, entry, rawDirectory);
            }
            return null;
        }
Example #13
0
 internal ResourceDirectory(PeImage image, uint offset, ResourcesReader reader, ResourceDirectoryEntry parentEntry, Structures.IMAGE_RESOURCE_DIRECTORY rawDirectory)
 {
     this._image        = image;
     this.ParentEntry   = parentEntry;
     this._offset       = offset;
     this._fileOffset   = offset + image.ParentAssembly._ntHeader.OptionalHeader.DataDirectories[(int)DataDirectoryName.Resource].TargetOffset.FileOffset;
     this._rawDirectory = rawDirectory;
     this._reader       = reader;
 }