Repository navigation
fix(nt): name modules after their image file, not the loader's alias - #35
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
BaseDllName)The loader entry can record a canonical or legacy
BaseDllNamethat differs from the loaded image file (FullDllName).module_info_from_recordusedBaseDllNameforModuleInfo::name, keepingFullDllNameonly in thepathfield that no output shows.Fix
Take the name from the last component of
FullDllNamewhen the loader recorded one, falling back toBaseDllNameand then the unknown marker — matching WinDbg'slm, which names modules after their image file. Extracted into a small helper with unit tests.The kernel entry is unchanged: it records
ntoskrnl.exein both fields (verified withdt nt!_KLDR_DATA_TABLE_ENTRY poi(nt!PsLoadedModuleList)); CDB'sntkrnlmp.exefor it comes from its symbol store, not from the dump.Verification
cdb -z <dump> -c "lmvn"exactly: 151/151, the only remaining difference being the kernel name above.derive_short_namealready maps all kernel variants tont, so symbol prefixes are unaffected.