如何检查未出现在图像列表中但出现在 !DumpDomain 输出中的 .NET 程序集的版本?

How to check the version of a .NET assembly which does not appear in the image list, but does appear in the !DumpDomain output?

鉴于:

0:000> lmm *day*
start             end                 module name
0:000> .shell -i- -ci "!DumpDomain" findstr /i "day"
Assembly:           0000005fa3efdbe0 [C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\mobilewebservice0f679a1c08b4\assembly\dl3cd4f8481b1ad_ccc8d101\Dayforce.Common.dll]
00007ff7b82c8ff8            C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\mobilewebservice0f679a1c08b4\assembly\dl3cd4f8481b1ad_ccc8d101\Dayforce.Common.dll
...

(挺多的)

重点是 !DumpDomain 识别 Dayforce.Common.dll 程序集的存在,但 lm 不识别。

我依赖lmvm获取程序集的版本。但是这里我很疑惑:

  1. 首先,为什么 lm 没有看到加载的程序集?
  2. 这种情况下如何获取程序集的版本?

请注意,检查托管堆栈可确认程序集已加载,只是图像列表中缺少它们。

TLDR:.imgscan /l 扫描 MZ header 并加载模块信息。然后再试一次lm


在我的应用程序中,我可以看到 none 个程序集由 lm 列出。这似乎是一种默认行为,因为我对我的应用程序中的那些程序集没有做任何特别的事情。试图找到一个特定的失败:

0:009> .symfix d:\debug\symbols
0:009> .reload
Reloading current modules
......................................
0:009> lm m Test*
start    end        module name

然而,做一个!DumpDomain它被列出:

0:009> !DumpDomain
[...]
Assembly:           00737f20 [C:\Program Files (x86)\...\TestAdore.dll]
ClassLoader:        0071dd98
SecurityDescriptor: 00729ba8
  Module Name
00377440    C:\Program Files (x86)\...\TestAdore.dll

使用.imgscan /l我能够找到DLL的MZheader并加载模块信息:

0:009> .imgscan /l
[...]
MZ at 003a0000, prot 00000002, type 01000000 - size e000
  Name: TestAdore.dll
  Loaded TestAdore.dll module

之后,模块出现在lm列表中:

0:009> lm m Test*
start    end        module name
003a0000 003ae000   TestAdore   (deferred) 

并且可以查询版本信息

0:009> lm vm TestAdore
start    end        module name
003a0000 003ae000   TestAdore   (deferred)             
    Image path: TestAdore.dll
    Image name: TestAdore.dll
    Has CLR image header, track-debug-data flag not set
    Timestamp:        Sun Jul 26 23:13:53 2015 (55B54D91)
    File version:     1.0.0.0
[...]