当前位置: 首页 > news >正文

smss源代码分析之smss!SmpLoadSubSystemsForMuSession函数分析加载csrss.exe

第一部分:

    Next = SmpSubSystemsToLoad.Flink;
    while ( Next != &SmpSubSystemsToLoad ) {
        p = CONTAINING_RECORD( Next,
                               SMP_REGISTRY_VALUE,
                               Entry
                             );
#if SMP_SHOW_REGISTRY_DATA
        DbgPrint( "SMSS: Loaded SubSystem( %wZ = %wZ )\n", &p->Name, &p->Value );
#endif
        if (!_wcsicmp( p->Name.Buffer, L"debug" )) {
            Status = SmpExecuteCommand( &p->Value, *pMuSessionId, pWindowsSubSysProcessId, SMP_SUBSYSTEM_FLAG | SMP_DEBUG_FLAG );
        }
        else {
            Status = SmpExecuteCommand( &p->Value, *pMuSessionId, pWindowsSubSysProcessId, SMP_SUBSYSTEM_FLAG );
        }


第二部分:
0: kd> dt _SMP_REGISTRY_VALUE 00163fd0
smss!_SMP_REGISTRY_VALUE
   +0x000 Entry            : _LIST_ENTRY [ 0x164168 - 0x4858f618 ]
   +0x008 Name             : _UNICODE_STRING "Debug"
   +0x010 Value            : _UNICODE_STRING ""
   +0x018 AnsiValue        : 0x00164018  ""


0: kd> x smss!SmpSubSystemsToLoad
4858f618          smss!SmpSubSystemsToLoad = struct _LIST_ENTRY [ 0x163fd0 - 0x164168 ]
0: kd> dx -r1 (*((smss!_LIST_ENTRY *)0x4858f618))
(*((smss!_LIST_ENTRY *)0x4858f618))                 [Type: _LIST_ENTRY]
    [+0x000] Flink            : 0x163fd0 [Type: _LIST_ENTRY *]
    [+0x004] Blink            : 0x164168 [Type: _LIST_ENTRY *]
0: kd> dx -r1 ((smss!_LIST_ENTRY *)0x163fd0)
((smss!_LIST_ENTRY *)0x163fd0)                 : 0x163fd0 [Type: _LIST_ENTRY *]
    [+0x000] Flink            : 0x164168 [Type: _LIST_ENTRY *]
    [+0x004] Blink            : 0x4858f618 [Type: _LIST_ENTRY *]

0: kd> dt _SMP_REGISTRY_VALUE 0x164168
smss!_SMP_REGISTRY_VALUE
   +0x000 Entry            : _LIST_ENTRY [ 0x4858f618 - 0x163fd0 ]
   +0x008 Name             : _UNICODE_STRING "Windows"
   +0x010 Value            : _UNICODE_STRING "C:\WINDOWS\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
   +0x018 AnsiValue        : 0x001641a0  "C:\WINDOWS\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"


0: kd> x smss!SmpSubSystemsToLoad
4858f618          smss!SmpSubSystemsToLoad = struct _LIST_ENTRY [ 0x163fd0 - 0x164168 ]

        if (!_wcsicmp( p->Name.Buffer, L"debug" )) {
            Status = SmpExecuteCommand( &p->Value, *pMuSessionId, pWindowsSubSysProcessId, SMP_SUBSYSTEM_FLAG | SMP_DEBUG_FLAG );
        }

第三部分:

0: kd> t
Breakpoint 3 hit
smss!SmpExecuteCommand:
001b:4858a860 55              push    ebp
0: kd> kc
 #
00 smss!SmpExecuteCommand
01 smss!SmpLoadSubSystemsForMuSession
02 smss!SmpLoadDataFromRegistry
03 smss!SmpInit
04 smss!main
05 smss!NtProcessStartup
0: kd> dv
            CommandLine = 0x00163fe0 ""
            MuSessionId = 0
pWindowsSubSysProcessId = 0x4858f614
                  Flags = 9
          ImageFileName = ""
       CurrentDirectory = 394 ''
              Arguments = 3266

    if (Flags & SMP_DEBUG_FLAG) {
        return( STATUS_SUCCESS );
    }

第四部分:


0: kd> t
Breakpoint 3 hit
smss!SmpExecuteCommand:
001b:4858a860 55              push    ebp
0: kd> kc
 #
00 smss!SmpExecuteCommand
01 smss!SmpLoadSubSystemsForMuSession
02 smss!SmpLoadDataFromRegistry
03 smss!SmpInit
04 smss!main
05 smss!NtProcessStartup
0: kd> dv
            CommandLine = 0x00164178 "C:\WINDOWS\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
            MuSessionId = 0
pWindowsSubSysProcessId = 0x4858f614
                  Flags = 8
          ImageFileName = ""
       CurrentDirectory = 394 ''
              Arguments = 3266

http://www.xdnf.cn/news/251749.html

相关文章:

  • 全感官交互革命:当 AI 大模型学会 “看、听、说、创”
  • 滑动窗口leetcode 209和76
  • rabbitMQ如何确保消息不会丢失
  • [学成在线]22-自动部署项目
  • 【Git】万字详解 Git 的原理与使用(上)
  • 精益数据分析(37/126):深度剖析SaaS模式下的参与度与流失率指标
  • STM32——GPIO
  • AI 生成内容的版权困境:法律、技术与伦理的三重挑战
  • patch命令在代码管理中的应用
  • C++负载均衡远程调用学习之UDP SERVER功能
  • react + antd 实现后台管理系统
  • TS 常用类型
  • C++-Lambda表达式
  • MySQL 窗口函数
  • 使用conda安装Python库包报错:module ‘libmambapy‘ has no attribute ‘QueryFormat‘
  • SpringBoot实现条件分页
  • ROPE(旋转位置编码)简述
  • 数据库性能杀手与调优实践
  • 第十六届蓝桥杯单片机组省赛(第一套)
  • 解决 3D Gaussian Splatting 中 SIBR 可视化组件报错 uv_mesh.vert 缺失问题【2025最新版!】
  • 基于深度学习的毒蘑菇检测
  • 大学生入学审核系统设计与实现【基于SpringBoot + Vue 前后端分离技术】
  • 精益数据分析(38/126):SaaS模式的流失率计算优化与定价策略案例
  • ubuntu22.04安装显卡驱动与cuda+cuDNN
  • IntelliJ IDEA 使用教程
  • Linux:信号(一)
  • 八闽十三张模块部署测试记录:源码结构拆解与本地运行验证(含常见问题与修复指南)
  • c/c++开发调试工具之gdb
  • 每天学一个 Linux 命令(34):wc
  • DeepSeek R1:强化学习范式的推理强化模型