コード例 #1
0
        private void LoadImports()
        {
            importDataDir = header.OptionalHeader.DataDirectories[(int)DataDirectoryName.Import];

            if (importDataDir.TargetOffset.FileOffset != 0)
            {
                offsetConverter = new OffsetConverter(importDataDir.Section);
                image.SetOffset(importDataDir.TargetOffset.FileOffset);

                LibraryReference libraryRef = null;

                while (true)
                {
                    libraryRef = ReadLibraryImport();

                    if (libraryRef == null)
                    {
                        break;
                    }
                    else
                    {
                        foreach (ImportMethod method in libraryRef.ImportMethods)
                        {
                            method.ParentLibrary = libraryRef;
                        }
                        imports.Add(libraryRef);
                    }
                }
            }
        }
コード例 #2
0
ファイル: LoaderWin32.cs プロジェクト: Rex-Hays/GNIDA2
 public static LibraryReference1 L2L(LibraryReference lf)
 {
     LibraryReference1 tmp = new LibraryReference1(lf.LibraryName);
     tmp.ImportMethods = new ImportMethods1[lf.ImportMethods.Count()];
     for (int i = 0; i < lf.ImportMethods.Count(); i++)
     {
         tmp.ImportMethods[i] =
             new ImportMethods1(lf.ImportMethods[i].RVA, lf.ImportMethods[i].Ordinal, lf.ImportMethods[i].Name);
     }
     return tmp;
 }
コード例 #3
0
        private LibraryReference ReadLibraryImport()
        {
            uint importDirOffset = (uint)image.Position;
            var  rawImportDir    = image.ReadStructure <Structures.IMAGE_IMPORT_DESCRIPTOR>();

            if (ASMGlobals.IsEmptyStructure(rawImportDir))
            {
                return(null);
            }

            string libName = ReadLibraryName(rawImportDir);

            ImportMethod[] methods = ReadImportMethods(rawImportDir);

            LibraryReference libReference = new LibraryReference(image, importDirOffset, rawImportDir, libName, methods);

            // advance to next datadir.
            image.SetOffset(importDirOffset + sizeof(Structures.IMAGE_IMPORT_DESCRIPTOR));

            return(libReference);
        }
コード例 #4
0
        private LibraryReference ReadLibraryImport()
        {
            uint importDirOffset = (uint)image.Position;
            var rawImportDir = image.ReadStructure<Structures.IMAGE_IMPORT_DESCRIPTOR>();

            if (ASMGlobals.IsEmptyStructure(rawImportDir))
                return null;

            string libName = ReadLibraryName(rawImportDir);
            ImportMethod[] methods = ReadImportMethods(rawImportDir);

            LibraryReference libReference = new LibraryReference(image, importDirOffset, rawImportDir, libName, methods);

            // advance to next datadir.
            image.SetOffset(importDirOffset + sizeof(Structures.IMAGE_IMPORT_DESCRIPTOR));

            return libReference;
        }