Skip to content

Instantly share code, notes, and snippets.

@littledivy
Last active April 6, 2025 12:03
Show Gist options
  • Save littledivy/505e3354047abafb4dbbb54169390056 to your computer and use it in GitHub Desktop.
Save littledivy/505e3354047abafb4dbbb54169390056 to your computer and use it in GitHub Desktop.
libsui PE resource table layout

Icons in PE are very sensitive to resource table ordering. Here's what works:

image

We can't use editpe's builtin set_icon because it lays out Icon and Icon Group together before/after the RCData. Instead, we need a custom implementation that places RCData between the icon entries. This means we defer Icon Group to always happen during PortableExecutable::build.

After the fix:

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