Skip to content
/ PEFile Public

Yet another library for Windows Portable Executable (PE) files

License

Notifications You must be signed in to change notification settings

iseki0/PEFile

Repository files navigation

PEFile

GitHub Actions Workflow Status Maven Central Version License

Yet another library for Windows Portable Executable (PE) files

Features

Reading the following data from PE file:

  • COFF Header
  • Optional Header(both of standard & Windows-specific fields)
  • Section Lists
  • Import Table(DLL names and symbols)
  • Resource Tree

Requirements

  • Java 17 or later
    • For Java >= 22, we read the PE file by MMAP

Usage

Main.kt

fun main() {
  val notepad = Path.of(System.getenv("SystemRoot"), "System32", "notepad.exe")
  PEFile.open(notepad).use { peFile->
    // print COFF header
    println(peFile.coffHeader)

    // print import table
    for (entry in peFile.importTable) {
      println("DLL: ${entry.name}")
      for (symbol in entry.symbols()) {
        println("  $symbol")
      }
    }
    // print resource tree
    println("Resource Tree:")
    for (entry in ResourceWalker(peFile.resourceRoot!!)) {
      println("  ".repeat(entry.depth) + entry.node)
    }
  }
}

About

Yet another library for Windows Portable Executable (PE) files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published