Ejemplo n.º 1
0
        private void AppendSection(XmlDocumentWrapper xml, XmlNode main, ImportFunctionSection s)
        {
            if (main == null || s == null || s.Count <= 0)
            {
                return;
            }

            XmlNode imports = xml.CreateElement(NodeImports);

            if (imports == null)
            {
                return;
            }

            // serialize all the import sections:
            foreach (ImportFunctionModule desc in s.Modules)
            {
                XmlNode m = SerializeImportModule(xml, desc);

                if (m != null)
                {
                    imports.AppendChild(m);
                }
            }

            main.AppendChild(imports);
        }
Ejemplo n.º 2
0
        private static void DumpImportSection(BinaryFile file)
        {
            if (file == null)
            {
                return;
            }

            // get import section:
            ImportFunctionSection import = file[ImportFunctionSection.DefaultName] as ImportFunctionSection;

            if (import != null)
            {
                Trace.WriteLine("Imported functions:");
                foreach (ImportFunctionModule m in import.Modules)
                {
                    Trace.WriteLine(string.Format("Module: {0} ({1})", m.Name, m.BindDate));
                    foreach (ImportFunctionDescription f in m.Functions)
                    {
                        Trace.WriteLine(string.Format("  Function: {0} (@{1}, H{2}) at address: 0x{3:X8}", f.Name,
                                                      f.Ordinal, f.Hint, f.VirtualAddress));
                    }
                }
            }
        }