public PEWindow(string path)
        {
            InitializeComponent();
            this.AddEscapeToClose();
            this.SetTopMost();

            _path = path;

            this.Text = "PE File - " + path;
            Program.PEWindows.Add(Id, this);

            this.InitializeLists();

            try
            {
                _mappedImage = new MappedImage(path);
                this.Read();
            }
            catch (Exception ex)
            {
                PhUtils.ShowException("Unable to load the specified file", ex);

                this.Close();
            }
        }
Beispiel #2
0
        internal ImageImportDll(MappedImage mappedImage, ImageImportDescriptor* descriptor)
        {
            _mappedImage = mappedImage;
            _descriptor = descriptor;

            if (_descriptor->OriginalFirstThunk != 0)
                _lookupTable = _mappedImage.RvaToVa(_descriptor->OriginalFirstThunk);
            else
                _lookupTable = _mappedImage.RvaToVa(_descriptor->FirstThunk);

            if (_lookupTable != null)
            {
                int i = 0;

                if (_mappedImage.Magic == Win32.Pe32Magic)
                {
                    while (((int*)_lookupTable)[i] != 0)
                        i++;
                }
                else if (_mappedImage.Magic == Win32.Pe32PlusMagic)
                {
                    while (((long*)_lookupTable)[i] != 0)
                        i++;
                }

                _count = i;
            }
        }
Beispiel #3
0
        internal ImageExports(MappedImage mappedImage)
        {
            _mappedImage = mappedImage;
            _dataDirectory = mappedImage.GetDataEntry(ImageDataEntry.Export);
            _exportDirectory = mappedImage.GetExportDirectory();

            if (_exportDirectory != null)
            {
                _addressTable = (int*)mappedImage.RvaToVa(_exportDirectory->AddressOfFunctions);
                _namePointerTable = (int*)mappedImage.RvaToVa(_exportDirectory->AddressOfNames);
                _ordinalTable = (short*)mappedImage.RvaToVa(_exportDirectory->AddressOfNameOrdinals);
            }
        }
        internal ImageExports(MappedImage mappedImage)
        {
            _mappedImage     = mappedImage;
            _dataDirectory   = mappedImage.GetDataEntry(ImageDataEntry.Export);
            _exportDirectory = mappedImage.GetExportDirectory();

            if (_exportDirectory != null)
            {
                _addressTable     = (int *)mappedImage.RvaToVa(_exportDirectory->AddressOfFunctions);
                _namePointerTable = (int *)mappedImage.RvaToVa(_exportDirectory->AddressOfNames);
                _ordinalTable     = (short *)mappedImage.RvaToVa(_exportDirectory->AddressOfNameOrdinals);
            }
        }
        internal ImageImports(MappedImage mappedImage)
        {
            _mappedImage = mappedImage;
            _descriptorTable = mappedImage.GetImportDirectory();

            // Do a quick scan.
            if (_descriptorTable != null)
            {
                int i = 0;

                while (_descriptorTable[i].OriginalFirstThunk != 0 || _descriptorTable[i].FirstThunk != 0)
                    i++;

                _count = i;
                _dlls = new ImageImportDll[i];
            }
        }
Beispiel #6
0
        internal ImageImports(MappedImage mappedImage)
        {
            _mappedImage     = mappedImage;
            _descriptorTable = mappedImage.GetImportDirectory();

            // Do a quick scan.
            if (_descriptorTable != null)
            {
                int i = 0;

                while (_descriptorTable[i].OriginalFirstThunk != 0 || _descriptorTable[i].FirstThunk != 0)
                {
                    i++;
                }

                _count = i;
                _dlls  = new ImageImportDll[i];
            }
        }
Beispiel #7
0
        internal ImageImportDll(MappedImage mappedImage, ImageImportDescriptor *descriptor)
        {
            _mappedImage = mappedImage;
            _descriptor  = descriptor;

            if (_descriptor->OriginalFirstThunk != 0)
            {
                _lookupTable = _mappedImage.RvaToVa(_descriptor->OriginalFirstThunk);
            }
            else
            {
                _lookupTable = _mappedImage.RvaToVa(_descriptor->FirstThunk);
            }

            // Do a quick scan.
            if (_lookupTable != null)
            {
                int i = 0;

                if (_mappedImage.Magic == Win32.Pe32Magic)
                {
                    while (((int *)_lookupTable)[i] != 0)
                    {
                        i++;
                    }
                }
                else if (_mappedImage.Magic == Win32.Pe32PlusMagic)
                {
                    while (((long *)_lookupTable)[i] != 0)
                    {
                        i++;
                    }
                }

                _count = i;
            }
        }