Пример #1
0
        public ImageResourceDataEntry?FindVersionDataEntry(BinaryReader reader, ImageResourceDirectory root, UInt32 resourceOffset)
        {
            var rcDataDirectory = root.VersionDirectory;

            if (rcDataDirectory.HasValue)
            {
                uint rcDataOffset = resourceOffset + rcDataDirectory.Value.Offset;
                var  ird          = new ImageResourceDirectory(reader, rcDataOffset);

                foreach (var dd in ird.DirectoryEntries)
                {
                    if (1 == dd.IdOrName)
                    {
                        uint lcidOffset = resourceOffset + dd.Offset;
                        var  lciddd     = new ImageResourceDirectory(reader, lcidOffset);
                        if (lciddd.NumberOfIdEntries > 0)
                        {
                            var verOffset = resourceOffset + lciddd.DirectoryEntries[0].Offset;
                            return(new ImageResourceDataEntry(reader, verOffset));
                        }
                    }
                }
            }

            return(null);
        }
Пример #2
0
        public ImageResourceDataEntry?FindSealDataEntry(BinaryReader reader, ImageResourceDirectory root, UInt32 resourceOffset)
        {
            var rcDataDirectory = root.RCDATADirectory;

            if (rcDataDirectory.HasValue)
            {
                uint rcDataOffset = resourceOffset + rcDataDirectory.Value.Offset;
                var  ird          = new ImageResourceDirectory(reader, rcDataOffset);

                uint nameOffset = 0;

                foreach (var dd in ird.NamedDirectoryEntries)
                {
                    nameOffset = resourceOffset + dd.NameOffset;
                    var irds = new ImageResourceDirectoryString(reader, nameOffset);
                    if ("AESEAL" == irds.Name)
                    {
                        uint lcidOffset = resourceOffset + dd.Offset;
                        var  lciddd     = new ImageResourceDirectory(reader, lcidOffset);
                        if (lciddd.NumberOfIdEntries > 0)
                        {
                            var sealOffset = resourceOffset + lciddd.DirectoryEntries[0].Offset;
                            return(new ImageResourceDataEntry(reader, sealOffset));
                        }
                    }
                }
            }

            return(null);
        }