Exemplo n.º 1
0
        public TargetPE(string filePath)
        {
            FileInfo fi = new FileInfo(filePath);

            if (fi.Exists)
            {
                _data = GetFileBytes(fi.FullName);
                if (_data == null)
                {
                    throw new FileLoadException("The target file seem to be locked.");
                }

                PE = PortableExecutableImage.FromBytes(_data);
                if (PE != null && PE.Is32Bit)
                {
                    Calculator = PE.GetCalculator();

                    FilePath = fi.FullName;
                    FileInfo = fi;

                    BaseAddress        = (long)PE.NTHeaders.OptionalHeader.ImageBase;
                    MajorLinkerVersion = PE.NTHeaders.OptionalHeader.MajorLinkerVersion;

                    CryptoPatches = new CryptoPatchContainer();
                    ClientVersion = -1;

                    IsValid       = true;
                    CanUpdateKey2 = true;
                }
            }
        }