コード例 #1
0
            public ResourceDirectory(PEStream.ResourceSection resourceSection, FileStream file, long rootResourceAddress, long resourceAddress, long addressDelta, bool partialConstruct)
            {
                this._imageResourceDirectory = (PEStream.IMAGE_RESOURCE_DIRECTORY)PEStream.PEComponent.ReadData(file, resourceAddress, this._imageResourceDirectory.GetType());
                base._address = resourceAddress;
                base._size    = base.CalculateSize(this._imageResourceDirectory);
                base._data    = this._imageResourceDirectory;
                long address = base._address + base._size;
                int  num2    = 0;

                for (num2 = 0; num2 < this._imageResourceDirectory.NumberOfIdEntries; num2++)
                {
                    PEStream.ResourceDirectoryEntry entry = new PEStream.ResourceDirectoryEntry(file, address);
                    this._resourceDirectoryEntries.Add(entry);
                    address += entry.Size;
                }
                for (num2 = 0; num2 < this._imageResourceDirectory.NumberOfNamedEntries; num2++)
                {
                    PEStream.ResourceDirectoryEntry entry2 = new PEStream.ResourceDirectoryEntry(file, address);
                    this._resourceDirectoryEntries.Add(entry2);
                    address += entry2.Size;
                }
                foreach (PEStream.ResourceDirectoryEntry entry3 in this._resourceDirectoryEntries)
                {
                    bool   flag = false;
                    object key  = null;
                    if (entry3.NameIsString)
                    {
                        key = resourceSection.CreateResourceDirectoryString(file, rootResourceAddress + entry3.NameOffset).NameString;
                    }
                    else
                    {
                        key = entry3.Id;
                        if ((rootResourceAddress == resourceAddress) && (entry3.Id == 0x18))
                        {
                            flag = true;
                        }
                    }
                    entry3.Key = key;
                    object obj3 = null;
                    if (entry3.IsDirectory)
                    {
                        if (!partialConstruct || (partialConstruct && flag))
                        {
                            obj3 = new PEStream.ResourceDirectory(resourceSection, file, rootResourceAddress, rootResourceAddress + entry3.OffsetToData, addressDelta, false);
                        }
                    }
                    else
                    {
                        obj3 = new PEStream.ResourceData(file, rootResourceAddress, rootResourceAddress + entry3.OffsetToData, addressDelta);
                    }
                    if (obj3 != null)
                    {
                        this._resourceDirectoryItems.Add(key, obj3);
                    }
                }
            }
コード例 #2
0
 public ResourceDirectory(PEStream.ResourceSection resourceSection, FileStream file, long rootResourceAddress, long resourceAddress, long addressDelta, bool partialConstruct)
 {
     this._imageResourceDirectory = (PEStream.IMAGE_RESOURCE_DIRECTORY) PEStream.PEComponent.ReadData(file, resourceAddress, this._imageResourceDirectory.GetType());
     base._address = resourceAddress;
     base._size = base.CalculateSize(this._imageResourceDirectory);
     base._data = this._imageResourceDirectory;
     long address = base._address + base._size;
     int num2 = 0;
     for (num2 = 0; num2 < this._imageResourceDirectory.NumberOfIdEntries; num2++)
     {
         PEStream.ResourceDirectoryEntry entry = new PEStream.ResourceDirectoryEntry(file, address);
         this._resourceDirectoryEntries.Add(entry);
         address += entry.Size;
     }
     for (num2 = 0; num2 < this._imageResourceDirectory.NumberOfNamedEntries; num2++)
     {
         PEStream.ResourceDirectoryEntry entry2 = new PEStream.ResourceDirectoryEntry(file, address);
         this._resourceDirectoryEntries.Add(entry2);
         address += entry2.Size;
     }
     foreach (PEStream.ResourceDirectoryEntry entry3 in this._resourceDirectoryEntries)
     {
         bool flag = false;
         object key = null;
         if (entry3.NameIsString)
         {
             key = resourceSection.CreateResourceDirectoryString(file, rootResourceAddress + entry3.NameOffset).NameString;
         }
         else
         {
             key = entry3.Id;
             if ((rootResourceAddress == resourceAddress) && (entry3.Id == 0x18))
             {
                 flag = true;
             }
         }
         entry3.Key = key;
         object obj3 = null;
         if (entry3.IsDirectory)
         {
             if (!partialConstruct || (partialConstruct && flag))
             {
                 obj3 = new PEStream.ResourceDirectory(resourceSection, file, rootResourceAddress, rootResourceAddress + entry3.OffsetToData, addressDelta, false);
             }
         }
         else
         {
             obj3 = new PEStream.ResourceData(file, rootResourceAddress, rootResourceAddress + entry3.OffsetToData, addressDelta);
         }
         if (obj3 != null)
         {
             this._resourceDirectoryItems.Add(key, obj3);
         }
     }
 }