Skip to content

fix(nt): name modules after their image file, not the loader's alias - #35

Merged
dmaivel merged 1 commit into
dmaivel:masterfrom
elmarco:module-name-from-image-file
Oct 21, 2026
Merged

dmaivel merged 1 commit into
dmaivel:masterfrom
elmarco:module-name-from-image-file

Conversation

@elmarco

@elmarco elmarco commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Problem

Diffing ntoseye's module list against WinDbg/CDB on the same dump showed modules as missing + extra that are really the same module under different names. On Windows Server 2022 (build 20348) kernel dumps, 4 of 151 modules were affected:

base address ntoseye (BaseDllName) CDB (image file)
fffff805`4d2a0000 kdcom.dll kd.dll
fffff805`4cf00000 mcupdate.dll mcupdate_GenuineIntel.dll
fffff805`57550000 dump_storport.sys dump_diskdump.sys
fffff805`4fc00000 ntoskrnl.exe ntkrnlmp.exe

The loader entry can record a canonical or legacy BaseDllName that differs from the loaded image file (FullDllName). module_info_from_record used BaseDllName for ModuleInfo::name, keeping FullDllName only in the path field that no output shows.

Fix

Take the name from the last component of FullDllName when the loader recorded one, falling back to BaseDllName and then the unknown marker — matching WinDbg's lm, which names modules after their image file. Extracted into a small helper with unit tests.

The kernel entry is unchanged: it records ntoskrnl.exe in both fields (verified with dt nt!_KLDR_DATA_TABLE_ENTRY poi(nt!PsLoadedModuleList)); CDB's ntkrnlmp.exe for it comes from its symbol store, not from the dump.

Verification

  • On a Server 2022 kernel dump, the module list now matches cdb -z <dump> -c "lmvn" exactly: 151/151, the only remaining difference being the kernel name above.
  • derive_short_name already maps all kernel variants to nt, so symbol prefixes are unaffected.
  • Full test suite passes (1242 tests), plus new unit tests for the name preference and fallbacks.

The loader entry's BaseDllName can record a canonical or legacy name
that differs from the loaded image file: on Windows Server 2022
(build 20348), kd.dll is recorded as kdcom.dll,
mcupdate_GenuineIntel.dll as mcupdate.dll, and dump_diskdump.sys as
dump_storport.sys. WinDbg's lm reports the image file (FullDllName's
last component), so module lists diffed against it showed each of
these as one missing and one extra module.

Take ModuleInfo::name from FullDllName's file name when the loader
recorded one, falling back to BaseDllName and then the unknown
marker. The kernel's own entry records ntoskrnl.exe in both fields
(WinDbg's ntkrnlmp.exe comes from its symbol store, not the dump),
so it is unchanged.
@dmaivel
dmaivel merged commit a70362a into dmaivel:master Oct 21, 2026
21 checks passed
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.

2 participants