ASD-LifeForce.exe

Disassemble this, find functions with resources

Dr.Binary
inspect_binary

PE32 Windows GUI app (2007, MSVC 7.10) — a game using OpenGL + Cg + FMOD + OpenCV, not stripped, not packed. Now let me enumerate the .rsrc section and then dump it with Ghidra.

run_sandbox

Small script bug — fixing and rerunning the resource walker:

run_sandbox

My field order was wrong (VirtualSize, VirtualAddress, SizeOfRawData, PointerToRawData). Correcting:

run_sandbox

Let me debug the resource directory parse step by step:

run_sandbox

Resource directory parses cleanly now: BITMAP, 5 ICONs, DIALOG #101, GROUP_ICON, and a custom type 240. Now the full walk — and in parallel I'll kick off the Ghidra dump (the long pole):

dump_data
run_sandbox

Ghidra dump complete. Now let me parse the dialog template + TYPE240, and start finding functions that use these resources:

run_sandbox

The dump has 1,534 functions. My dialog parser had a bad struct format again — let me write a clean script file this time, and grep the dump for resource-using functions in parallel:

write_file
run_sandbox

Two resource functions found immediately. Let me run the parser and dig further:

run_sandbox

Two things: my resource offsets were RVAs (OffsetToData is image-relative), and the dialog proc is LAB_00421620. Fixing both:

run_sandbox
run_sandbox

The dialog is a DIALOGEX (signature 01 00 FF FF) and TYPE240 #101 contains ASCII "1|2|3|4|5". Let me fix the parser for the EX format and read the resource-using functions found by grep:

write_file
run_sandbox

FUN_00427b90 is a classic NeHe-style OpenGL window setup using system icon/cursor (0x7f05/0x7f00), and FUN_00427f70 is the WinMain that shows dialog #101 with proc LAB_00421620. Let me parse the dialog and read the dialog-proc functions:

run_sandbox
run_sandbox

FUN_004215a0 is just a bit-blit helper — the real dialog proc at LAB_00421620 wasn't decompiled as a function. My parser also has a format typo (one I too many). Fixing both:

run_sandbox
run_sandbox
run_sandbox
run_sandbox

The dialog proc at 0x421620 is now clear from disassembly (Ghidra merged it into FUN_004215a0's range and never decompiled it). The dialog template parse has an offset quirk — let me hexdump the rest and hand-verify:

run_sandbox

Excellent — the hexdump now decodes cleanly with a custom-compiled DIALOGEX (NUL-terminated titles, 4-byte control IDs): "Run…", "Quit", "Music", "Windowed", "Force 16:9", "Resolution" groupbox + combobox, and an SS_BITMAP static whose title is ordinal 0x73 = BITMAP #115. Since FindResource is never imported, let me check whether code references the resource data directly by VA, and disassemble the WM_INITDIALOG half of the dialog proc:

run_sandbox
run_sandbox

The WM_INITDIALOG half is fully decoded: it fills combobox 1014 from the display-modes table (" %d x %d (4:3)", (16:9), (16:10) — table built by FUN_00424c20 via EnumDisplaySettingsA), and pre-checks Music/Force-16:9. Two last verifications — the raw bytes of the 0x147 message push and the proc's tail:

run_sandbox

The raw bytes confirm push 0x147 (CB_GETLBTEXT) in the Run path vs push 0x14E (CB_SETCURSEL) in the init path — an anomaly worth pinning down precisely. Since Ghidra never decompiled the dialog proc, let me disassemble it exactly with capstone (via angr's dependency) and settle the checkbox-ID mapping and stack balance:

run_sandbox

Capstone resolves it — I misread the colorized disassembly earlier. The calls are perfectly balanced: (1003), (1002), (1004) (dead — results discarded), then (1011)→Music flag, !(1012)→fullscreen, (1013)→Force-16:9, and SendDlgItemMessage(1014, CB_GETLBTEXT, 0, 0)'s return as the mode index. Last piece — the bitmap/icon dimensions:

run_sandbox

BITMAP #115 = 300×169px 24bpp (152,100+40 bytes — exact match, and a 16:9 logo). My icon RVAs had a typo — quick fix:

run_sandbox
run_sandbox

Analysis complete. Here's the full picture.

Binary

ASD-LifeForce.exe — PE32 x86 Windows GUI, MSVC 7.10 (2007), image base 0x400000, 1,534 functions recovered by Ghidra (ghidra_data/ASD-LifeForce.exe/). It's a homebrew OpenGL game ("LifeForce by ASD 2007") linking opengl32, cg/cgGL, fmod, and OpenCV 0.9.7. Not packed.

Resource inventory (.rsrc @ RVA 0x684000)

TypeIDContents
DIALOG101Startup settings dialog (554 B), title "-=== LifeForce by ASD - 2007 ===-", Arial 10pt, 10 controls
BITMAP115300×169px 24bpp logo (152,140 B) — shown by the dialog
GROUP_ICON114 → ICONs 1–516×16, 32×32, 48×48, 64×64, 128×128 (32/24bpp) — the app icon
Type 24010120-byte custom blob: f6 03 03 04 0a 00 00 00 "1|2|3|4|5"

Dialog #101 controls: id 1 "Run …" (def-push), id 2 "Quit", checkboxes 1011 "Music", 1012 "Windowed", 1013 "Force 16:9", "Resolution" groupbox + combobox 1014, two untitled frames, and an SS_BITMAP static whose title is ordinal 115 → BITMAP #115.

Functions that use resources

FUN_00427f70 @ 0x427f70 — WinMain-equivalent (called as WinMain from CRT startup 0x4908c6). DialogBoxParamA(hInst, MAKEINTRESOURCE(101), NULL, proc 0x421620, 0), then creates the game window " = LifeForce ASD 2007 = " and runs the message loop. Defaults 0x380×0x1f7 (896×503) if the dialog is skipped.

Dialog proc @ 0x421620 — spans 0x421620–0x4218f0 but Ghidra never decompiled it (it fell inside FUN_004215a0's range, which is an unrelated bit-blit helper); I recovered it from disassembly (rizin + capstone, byte-verified):

  • WM_INITDIALOG (0x421756): CheckRadioButton(hDlg,1002,1003,1003), CheckDlgButton(1011=Music, 1), CheckDlgButton(1013=Force16:9, 1); iterates the display-mode table at [0x4ba60c], classifies each mode as 4:3/16:9/16:10 by float compare, sprintf's " %d x %d (4:3)" / (16:9) / (16:10), and SendDlgItemMessageA(1014, CB_ADDSTRING(0x143), 0, str); preselects 1280×1024 else 1024×768 via CB_SETCURSEL(0x14E).
  • WM_COMMAND id 1 (Run) (0x421660): flags ← IsDlgButtonChecked: [0x4ba481]=1011 (Music), [0x4ba480]=**!**1012 (fullscreen = not Windowed), [0x4b4068]=1013 (Force 16:9); resolution ← mode table indexed by SendDlgItemMessageA(1014, 0x147, 0, 0)'s return; writes width/height into 0x4b8428/2c/14/18; EndDialog. With Force-16:9 set, height = width × 9/16 (fmul const, FUN_0048e54c centering).
  • WM_COMMAND id 2 (Quit): EndDialog + exit(0).

FUN_00427b90 @ 0x427b90 — CreateGLWindow (NeHe-style): RegisterClassA("OpenGL") with LoadIconA(NULL, 0x7f05=IDI_WINLOGO) and LoadCursorA(NULL, 0x7f00=IDC_ARROW) — system resources, not the exe's own icon; CreateWindowExA(WS_EX_CLIENTEDGE, "OpenGL", …), fullscreen via ChangeDisplaySettingsA, pixel-format/GL-context setup.

FUN_00424c20 @ 0x424c20 — feeds the dialog: EnumDisplaySettingsA loop building the mode table the combobox lists (dynamic, not .rsrc).

FUN_004220a0 @ 0x4220a0 — matched the grep but only updates the main window title (SetWindowTextA with X:/Y:/Z:/Time:/Fps:/Aux: OSD) — not a .rsrc consumer.

Observations

  • FindResource/LoadResource/LoadImage/LoadBitmap are never imported; the only code→resource link is via DialogBoxParamA(MAKEINTRESOURCE(101)) (which pulls in BITMAP 115 through the SS_BITMAP static). ICONs 1–5/GROUP_ICON 114 are never loaded in code — Explorer/taskbar only.
  • The Run path sends message 0x147 = CB_GETLBTEXT with wParam=0, lParam=NULL and uses the return as the mode-table index, while init uses CB_SETCURSEL (0x14E) for the analogous operation. This looks like a typo for CB_GETCURSEL (a homebrew bug — NULL text buffer / index=string-length), though I only verified this statically.
  • CheckRadioButton(1002,1003,1003) and IsDlgButtonChecked(1002/1003/1004) reference control IDs that don't exist in the template (their results are discarded) — stale IDs from an older dialog layout.
  • Type 240 #101 ("1|2|3|4|5", right after the dialog data) has no code reference; likely vestigial metadata from the custom resource compiler (the template is not standard rc.exe output: NUL-terminated titles, 4-byte control IDs).

Coverage: I read 0x427b90, 0x427f70, 0x4220a0, 0x4215a0 in full, fully disassembled the dialog proc 0x421620–0x4218f0, and grepped all 1,534 functions for resource-related imports — resource-relevant functions are exhaustively covered; the remaining ~1,500 functions (game/render logic) were not read.