Skip to content

Fix PDB enum storage size handling#32

Closed
SaveEditors wants to merge 1 commit intozeroKilo:masterfrom
SaveEditors:codex/enum-size-fix
Closed

Fix PDB enum storage size handling#32
SaveEditors wants to merge 1 commit intozeroKilo:masterfrom
SaveEditors:codex/enum-size-fix

Conversation

@SaveEditors
Copy link
Copy Markdown

Summary

  • stop creating every imported PDB enum as an 8-byte enum
  • derive enum storage size from the CodeView underlying type when it is a known primitive
  • fall back to the resolved Ghidra datatype length for non-primitive enum backing types, then preserve the old 8-byte behavior as a last resort

Why

Issue #31 points out that PDB enums are currently hardcoded to 8 bytes. The bug is in TPIStream.AddEnumType, which always does
ew EnumDataType(en.name, 8) even though LF_ENUM already carries the underlying type in �n.utype.

Validation

  • compiled the new CodeViewTypeInfo helper and ran a smoke test against representative 1/2/4/8-byte CodeView primitive types
  • compiled the patched TPIStream.java and helper directly against the local Ghidra 12.0.4 jars with javac

Closes #31.

@SaveEditors SaveEditors deleted the codex/enum-size-fix branch March 23, 2026 15:36
@zeroKilo
Copy link
Copy Markdown
Owner

thanks for the input! im not on my pc this week, but will try to merge this on the weekend, I have to make new releases anyway
greetz WV

@SaveEditors SaveEditors restored the codex/enum-size-fix branch March 25, 2026 06:47
@SaveEditors SaveEditors reopened this Mar 25, 2026
@SaveEditors
Copy link
Copy Markdown
Author

Closing this PR as I requested a newer one here: #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PDB] Enums are hardcoded to 8 bytes, instead of the size of the enum's type

2 participants