0

我正在尝试调试转储,我的 USER 模式 STOPPED_PENDING 服务,只是检查服务停止事件“MySvcStopEvent”是否设置,我得到事件句柄,试图转储句柄详细信息,

0:002> !handle  0x00000000`00000164 f
Handle 0000000000000164
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   3
  PointerCount  785993
  Name          \BaseNamedObjects\MySvcStopEvent
  Object specific information

无法弄清楚是否设置了事件?

4

1 回答 1

1

注释对象特定信息仅在转储中存在时才会显示,
您可能必须使用适当的选项创建转储,以确保您查找的信息包含在转储中

这是 Handle Type EVENT 的实时目标显示

0:000> !handle 0 f EVENT
Handle 4
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  32769
  Name          <none>
  Object Specific Information
    Event Type Manual Reset
    Event is Waiting
Handle c
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65537
  Name          <none>
  Object Specific Information
    Event Type Auto Reset
    Event is Waiting
Handle 3c
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65535
  Name          <none>
  Object Specific Information
    Event Type Auto Reset
    Event is Set
Handle 40
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65536
  Name          <none>
  Object Specific Information
    Event Type Auto Reset
    Event is Set
4 handles of type Event

您可以使用 windbg 包中提供的 dumpchk 工具来检查转储它解析 _MINIDUMP_HEADER 并发出输入 dmp 文件的统计信息,其中 Number OfStreams 或 _MINIDUMP_HEADER 标志指示转储文件中存在的数据量

下面的四个转储文件是使用 .dump,.dump /f , .dump /h , .dump/ma 在随机进程上使用 windbg 创建的,并且相关信号被 grepped 和张贴

F:\>f:\git\usr\bin\ls.exe -lag *.dmp
-rw-r--r-- 1 197121 7979145 Sep 20 13:09 bar.dmp
-rw-r--r-- 1 197121 7989384 Sep 20 13:10 blah.dmp
-rw-r--r-- 1 197121    9180 Sep 20 13:09 foo.dmp
-rw-r--r-- 1 197121   11198 Sep 20 13:10 hand.dmp

F:\>f:\git\usr\bin\ls.exe -lag *.txt
-rw-r--r-- 1 197121  8612 Sep 20 13:12 bar.txt
-rw-r--r-- 1 197121 22447 Sep 20 13:12 blah.txt
-rw-r--r-- 1 197121 13912 Sep 20 13:11 foo.txt
-rw-r--r-- 1 197121 15458 Sep 20 13:12 hand.txt

F:\>f:\git\usr\bin\grep.exe -ir "Loading.*Dump.*File" -A 1 *.txt
bar.txt:Loading Dump File [F:\bar.dmp]
bar.txt-User Dump File: Only application data is available
--
blah.txt:Loading Dump File [F:\blah.dmp]
blah.txt-User Mini Dump File with Full Memory: Only application data is available
--
foo.txt:Loading Dump File [F:\foo.dmp]
foo.txt-User Mini Dump File: Only registers, stack and portions of memory are available
--
hand.txt:Loading Dump File [F:\hand.dmp]
hand.txt-User Mini Dump File: Only registers, stack and portions of memory are available

F:\>f:\git\usr\bin\grep.exe -ir "Number.*of.*Streams" -A 1 *.txt
blah.txt:NumberOfStreams 17
blah.txt-Flags           641826
--
foo.txt:NumberOfStreams 13
foo.txt-Flags           40000
--
hand.txt:NumberOfStreams 15
hand.txt-Flags           40004

关于最后的评论

我根据文档中的这句话给出了答案,当我需要它时它对我有用几次,但答案没有得到操作员的验证,并被评论为多余。

备注部分中文档的引用

However, you cannot use this extension on user-mode dump files, unless you specifically created them with handle information. (You can create such dump files by using the .dump /mh (Create Dump File) command.)


好奇心总是害死猫 编辑

在使用 64 位调试器的 win10 64 位机器上使用 sysinternals procdump 创建了 3 个转储

将它们全部加载到windbg中以查找句柄类型事件
,它们都具有句柄数据,并且都具有特定于对象的信息。
所以显然这是一个抛硬币问题,或者可能是一个 64 位 32 位奇怪的极端案例问题,也许
无法得出赞成或反对的确凿证据

f:\src\wait>f:\sysint\procdump.exe -mm wait.exe waitmm.dmp
f:\src\wait>f:\sysint\procdump.exe -ma wait.exe waitma.dmp
f:\src\wait>f:\sysint\procdump.exe -mc ffffffff wait.exe waitmc.dmp


f:\src\wait>f:\git\usr\bin\ls -lag *.dmp
-rw-r--r-- 1 197121 7003583 Sep 23 17:47 waitma.dmp
-rw-r--r-- 1 197121  124387 Sep 23 17:47 waitmc.dmp
-rw-r--r-- 1 197121  124369 Sep 23 17:47 waitmm.dmp


f:\src\wait>cdb -c "!handle 0 f Event;q" -z waitmc.dmp

Microsoft (R) Windows Debugger Version 10.0.17763.132 AMD64

0:000> cdb: Reading initial command '!handle 0 f Event;q'
Handle 0000000000000004
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65537
  Name          <none>
  Object specific information
    Event Type Manual Reset
    Event is Set
Handle 0000000000000008
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65538
  Name          <none>
  Object specific information
    Event Type Auto Reset
    Event is Waiting

4 handles of type Event
quit:

f:\src\wait>cdb -c "!handle 0 f Event;q" -z waitma.dmp


0:000> cdb: Reading initial command '!handle 0 f Event;q'
Handle 0000000000000004
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65537
  Name          <none>
  Object specific information
    Event Type Manual Reset
    Event is Set
Handle 0000000000000008
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65538
  Name          <none>
  Object specific information
    Event Type Auto Reset
    Event is Waiting

4 handles of type Event
quit:


f:\src\wait>cdb -c "!handle 0 f Event;q" -z waitmm.dmp


0:000> cdb: Reading initial command '!handle 0 f Event;q'
Handle 0000000000000004
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65537
  Name          <none>
  Object specific information
    Event Type Manual Reset
    Event is Set
Handle 0000000000000008
  Type          Event
  Attributes    0
  GrantedAccess 0x1f0003:
         Delete,ReadControl,WriteDac,WriteOwner,Synch
         QueryState,ModifyState
  HandleCount   2
  PointerCount  65538
  Name          <none>
  Object specific information
    Event Type Auto Reset
    Event is Waiting

4 handles of type Event
quit:
于 2019-09-20T04:52:24.710 回答