Skip to content

Commit

Permalink
fix dumping CLR modTableRows
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoubfaouzi committed Nov 26, 2024
1 parent 3d2334b commit 36f3e7d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,15 +854,17 @@ func parsePE(filename string, cfg config) {
switch table {
case peparser.Module:
fmt.Print("\n\t[Modules]\n\t---------\n")
modTableRow := modTable.Content.(peparser.ModuleTableRow)
modName := pe.GetStringFromData(modTableRow.Name, pe.CLR.MetadataStreams["#Strings"])
Mvid := pe.GetStringFromData(modTableRow.Mvid, pe.CLR.MetadataStreams["#GUID"])
MvidStr := hex.EncodeToString(Mvid)
fmt.Fprintf(w, "Generation:\t 0x%x\n", modTableRow.Generation)
fmt.Fprintf(w, "Name:\t 0x%x (%s)\n", modTableRow.Name, string(modName))
fmt.Fprintf(w, "Mvid:\t 0x%x (%s)\n", modTableRow.Mvid, MvidStr)
fmt.Fprintf(w, "EncID:\t 0x%x\n", modTableRow.EncID)
fmt.Fprintf(w, "EncBaseID:\t 0x%x\n", modTableRow.EncBaseID)
modTableRows := modTable.Content.([]peparser.ModuleTableRow)
for _, modTableRow := range modTableRows {
modName := pe.GetStringFromData(modTableRow.Name, pe.CLR.MetadataStreams["#Strings"])
Mvid := pe.GetStringFromData(modTableRow.Mvid, pe.CLR.MetadataStreams["#GUID"])
MvidStr := hex.EncodeToString(Mvid)
fmt.Fprintf(w, "Generation:\t 0x%x\n", modTableRow.Generation)
fmt.Fprintf(w, "Name:\t 0x%x (%s)\n", modTableRow.Name, string(modName))
fmt.Fprintf(w, "Mvid:\t 0x%x (%s)\n", modTableRow.Mvid, MvidStr)
fmt.Fprintf(w, "EncID:\t 0x%x\n", modTableRow.EncID)
fmt.Fprintf(w, "EncBaseID:\t 0x%x\n", modTableRow.EncBaseID)
}
w.Flush()

}
Expand Down

0 comments on commit 36f3e7d

Please sign in to comment.