[原创]白话windows之三 另辟新径看系统启动和用户登录过程 xp篇
经常看到有人写系统引导过程的,看的也是云里雾里的。看完之后还是不是很理解。如果能自己跟一遍是不是理解的更深刻呢?
说干就干,下面就是我用windbg跟踪的系统启动和用户登录过程。
由于我主要关注一下几点:
1. CPU 初始化
2. 驱动加载(BOOT、START、AUTO)
3. 系统线程创建
4. 各类进程创建顺序
个人认为以上几点基本上涵盖了系统启动和用户加载过程的简单脉络。当然,内核初始化很复杂,这里并没有关注各个组件的初始化循序等信息。
nt!RtlpBreakWithStatusInstruction:
8052c5dc cc int 3 [B][COLOR=Blue]//第一次被断下,现在是刚进入Nt模块。
[/COLOR][/B]
[COLOR="Red"]//此时NTLdr已经执行完成,现在是在Nt模块领空。[/COLOR]
[COLOR=Blue]//[B]看一下堆栈[/B]。 可以看出这是主Cpu初始化线程。[/COLOR]
kd> kv
ChildEBP RetAddr Args to Child
8055225c 80697f58 00000001 8055ce60 00000000 nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
805523e8 806a5204 00000000 80087000 8003fc00 nt!ExpInitializeExecutive+0x37e (FPO: [Non-Fpo])
8055243c 806a2ecc 8055d0c0 8055ce60 80552700 nt!KiInitializeKernel+0x568 (FPO: [Non-Fpo])
00000000 00000000 00000000 00000000 00000000 nt!KiSystemStartup+0x2c4
[COLOR=Blue]//[B]看一下进程列表[/B]。为空,现在还没有进程被创建[/COLOR]
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
NULL value in PsActiveProcess List
[COLOR=Blue]//[B]看一下内核模块列表[/B]。 可以看到nt、hal还有SERVICE_BOOT_START类型的驱动已经加载,不过还没初始化。[/COLOR]
kd> lm
start end module name
804d8000 806e5000 nt (pdb symbols) e:\symbols\ntkrpamp.pdb\7D6290E03E32455BB0E035E38816124F1\ntkrpamp.pdb
806e5000 80705d00 hal (deferred)
ba5ac000 ba5c5b80 Mup (deferred)
ba5c6000 ba5f2980 NDIS (deferred)
ba5f3000 ba67f600 Ntfs (deferred)
ba680000 ba696880 KSecDD (deferred)
ba697000 ba6a8e00 sr (deferred)
ba6a9000 ba6c8b00 fltMgr (deferred)
ba6c9000 ba6e0880 SCSIPORT (deferred)
ba6e1000 ba6f8900 atapi (deferred)
ba6f9000 ba71e100 dmio (deferred)
ba71f000 ba73d880 ftdisk (deferred)
ba73e000 ba74e280 pci (deferred)
ba74f000 ba77c500 ACPI (deferred)
ba77d000 ba7a7000 KDVM (deferred)
ba8a8000 ba8b0d80 isapnp (deferred)
ba8b8000 ba8c2580 MountMgr (deferred)
ba8c8000 ba8d3f80 VolSnap (deferred)
ba8d8000 ba8e0e00 disk (deferred)
ba8e8000 ba8f4180 CLASSPNP (deferred)
ba8f8000 ba902580 agp440 (deferred)
bab28000 bab2e180 PCIIDEX (deferred)
bab30000 bab34d00 PartMgr (deferred)
bacb8000 bacbb000 BOOTVID (deferred)
bacbc000 bacbe800 compbatt (deferred)
bacc0000 bacc3f00 BATTC (deferred)
bacc4000 bacc6c00 vmscsi (deferred)
bada8000 bada9100 WMILIB (deferred)
badaa000 badab580 intelide (deferred)
badac000 badad700 dmload (deferred)
[COLOR=Red][B]//*开始咱们的观测之旅,下打印日志断点*[/B][/COLOR]
[COLOR=Blue]//[B]非主CPU初始化函数断点[/B]。当非主CPU初始化时会打印一条日志[/COLOR]
kd> bp hal!HalStartNextProcessor ".printf \"*New CPU Idle Thread Start.\\n\"; gc;"
[COLOR=Blue]//[B]SERVICE_BOOT_START和内建驱动初始化函数断点[/B]。当该类型初始化时,会打印响应日志[/COLOR]
kd> bp nt!IopInitializeBuiltinDriver ".printf \"*InitBuiltinDriver: \\n\"; dt nt!_unicode_string poi(esp+4);gc;"
[COLOR=Blue]//[B]驱动加载断点[/B]。当非SERVICE_BOOT_START驱动加载时打印日志[/COLOR]
kd> bp nt!MmLoadSystemImage ".printf \"*LoadDriver: \\n\"; dt nt!_unicode_string poi(esp+4);gc;"
[COLOR=Blue]//[B]创建线程断点[/B]。 当创建的是内核线程的时候打印日志[/COLOR]
kd> bp nt!pspcreatethread "r $t0=poi(esp+0xA*4); .if(@$t0!=0){.printf \"*NewThread:\\n\";r $t1=poi(esp+0x4*4);.if(@$t1!=0){!headle esp+0x4*4 0;};r @$t1=poi(esp+0x5*4);.if(@$t1!=0){!process @$t1 0;};dds esp+0xA*4 l1;};gc;"
[COLOR=Blue]//[B]创建进程断点[/B]。 当进程创建成功后,打印进程信息还有父进程信息。805d1fb4是PspCreateProcess函数结尾处地址[/COLOR]
kd> bp 805d1fb4 "r $t0=@eax;r $t1=poi(ebp-0x1c);.printf \"*NewProcess:\\n\";dt nt!_EPROCESS UniqueProcessId ImageFileName @ecx;.if(@$t1!=0){.printf \"**Parent:\\n\";dt nt!_EPROCESS UniqueProcessId ImageFileName @$t1;}.else{.printf \"**No Parent! \\n\";};gc;"
[B][COLOR=Red]
//好了,断点设置完了,就让系统运行吧~[/COLOR][/B]
kd> g
[COLOR=Red][B]/*下面就是由断点产生的日志了*[/B][/COLOR]
[B][COLOR=Blue]//*进程创建日志[/COLOR][/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000004 Void
+0x174 ImageFileName : [16] "" [COLOR=Blue]//此处为system进程。为什么没有名字呢,是因为这个时候名字还没有被设置。Idle进程不是调用PspCreateProcess创建的,所以看不到它创建过程。[/COLOR]
**No Parent! [COLOR=Blue]//没有父进程[/COLOR]
[B][COLOR=Blue]//*新线程创建日志[/COLOR][/B]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 1.
Image: System [COLOR=Blue]//线程所属进程[/COLOR]
[B][COLOR=SeaGreen]//此处显示的是线程起始地址[/COLOR][/B]
805521a0 8069890c[COLOR=Red] nt!Phase1Initialization[/COLOR] [COLOR=Blue]//该线程就是TID=8线程,执行内核阶段1初始化。下面的工作都是由它来做的,直到内核初始化完成。最后退化为零页面线程。[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: <Data Not Accessible>
Image: System
baccf7b0 804efdf4 [COLOR=Red]nt!InbvRotateGuiBootDisplay[/COLOR] [COLOR=Blue]//可能跟显示器有关的线程[/COLOR]
[COLOR=Red]
*New CPU Idle Thread Start.[/COLOR][COLOR=Blue] //我系统有两个CPU,这是初始化第二个CPU[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
baccf79c 8053967e [COLOR=Red]nt!ExpWorkerThread[/COLOR] [COLOR=Blue]//工作线程[/COLOR]
[B]//... 由于[/B][B][COLOR=Blue]创建的工作线程[/COLOR]太多,这里忽略(我的机器创建了12个)[/B]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
baccf7cc 80614f74 nt![COLOR=Red]ExpWorkerThreadBalanceManager [/COLOR][COLOR=Blue]//工作线程管理器线程[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
baccf708 8050d022 nt![COLOR=Red]MiDereferenceSegmentThread [/COLOR][COLOR=Blue]//Dereference Segment Thread[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
baccf79c 8064f1bc nt![COLOR=Red]MiModifiedPageWriter[/COLOR][COLOR=Blue][COLOR=Red] [/COLOR]//修改页面写出器线程[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
baccf79c 80540ed6 nt![COLOR=Red]KeBalanceSetManager [/COLOR][COLOR=Blue]//平衡集管理器线程[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
baccf79c 805411ca nt![COLOR=Red]KeSwapProcessOrStack [/COLOR][COLOR=Blue]//进程/栈交换器线程[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 2.
Image: System
bad23d50 8050f4a4 nt![COLOR=Red]MiMappedPageWriter [/COLOR][COLOR=Blue]//映射页面写出线程[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 9.
Image: System
baccf7d0 804eee2a nt![COLOR=Red]FsRtlWorkerThread [/COLOR][COLOR=Blue]//与文件系统相关的线程池线程[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 9.
Image: System
baccf7d0 804eee2a nt![COLOR=Red]FsRtlWorkerThread [/COLOR][COLOR=Blue]//与文件系统相关的线程池线程[/COLOR]
[B][COLOR=Red]//* SERVICE_BOOT_START和内建驱动初始化*[/COLOR][/B]
*InitBuiltinDriver:
"\FileSystem\RAW"
+0x000 Length : 0x1e
+0x002 MaximumLength : 0x20
+0x004 Buffer : 0x8069dd38 [COLOR=Red]"\FileSystem\RAW"[/COLOR] [COLOR=Blue]//该驱动是内建驱动[/COLOR]
*InitBuiltinDriver:
"\Driver\ACPI"
+0x000 Length : 0x18
+0x002 MaximumLength : 0x18
+0x004 Buffer : 0x89a4c148 [COLOR=Red]"\Driver\ACPI" [/COLOR][COLOR=Blue]//SERVICE_BOOT_START驱动[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 35.
Image: System
baccf584 ba75fb10 ACPI!ACPIWorker
*InitBuiltinDriver:
"\Driver\PCI"
+0x000 Length : 0x16
+0x002 MaximumLength : 0x16
+0x004 Buffer : 0x898c3308 [COLOR=Red] "\Driver\PCI" [/COLOR][COLOR=Blue]//SERVICE_BOOT_START驱动[/COLOR]
[B]//... 所有的[/B][B][COLOR=Blue]SERVICE_BOOT_START[COLOR=Black]类型驱动都会在此时初始化,有些驱动在初始化时还会伴随线程的创建[/COLOR][/COLOR][COLOR=Black],这里不一一显示[/COLOR][/B]
[B][COLOR=Red]//*SERVICE_SYSTEM_START类型的驱动加载并初始化*[/COLOR][/B]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\i8042prt.sys"
+0x000 Length : 0x52
+0x002 MaximumLength : 0x54
+0x004 Buffer : 0xe1544ca0 [COLOR=Red]"\SystemRoot\system32\DRIVERS\i8042prt.sys"[/COLOR] [COLOR=Blue]//SERVICE_SYSTEM_START驱动[/COLOR]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\kbdclass.sys"
+0x000 Length : 0x52
+0x002 MaximumLength : 0x54
+0x004 Buffer : 0xe1544ca0 [COLOR=Red]"\SystemRoot\system32\DRIVERS\kbdclass.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\vmmouse.sys"
+0x000 Length : 0x50
+0x002 MaximumLength : 0x52
+0x004 Buffer : 0xe1544ca0 [COLOR=Red]"\SystemRoot\system32\DRIVERS\vmmouse.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\mouclass.sys"
+0x000 Length : 0x52
+0x002 MaximumLength : 0x54
+0x004 Buffer : 0xe1544ca0 [COLOR=Red] "\SystemRoot\system32\DRIVERS\mouclass.sys"[/COLOR]
[B]//... 所有的[/B][B][COLOR=Blue]SERVICE_SYSTEM_START[COLOR=Black]类型驱动都会在此时加载并初始化,有些驱动在初始化时还会伴随线程的创建[/COLOR][/COLOR][COLOR=Black],这里不一一显示[/COLOR][/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000310 Void
+0x174 ImageFileName : [16] [COLOR=Red]"smss.exe"[/COLOR] [COLOR=Blue]//登录管理器进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000004 Void
+0x174 ImageFileName : [16] [B]"System"[/B][COLOR=Blue] //smss.exe由system创建[/COLOR]
[B][COLOR=Red][SIZE=5]//*此时,内核部分已经初始化完成,下面进入创建第一个会话创建过程*[/SIZE]
[/COLOR][/B][COLOR=Red][COLOR=Black]*NewProcess:
+0x084 UniqueProcessId : 0x00000330 Void
+0x174 ImageFileName : [16] [COLOR=Red]"autochk.exe[/COLOR][COLOR=Blue][COLOR=Red]"[/COLOR] //磁盘检查进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000310 Void
+0x174 ImageFileName : [16] [B]"smss.exe"[/B]
[COLOR=Blue]//磁盘检查进程会加载驱动[/COLOR]
*LoadDriver:
"\SystemRoot\System32\Drivers\Cdfs.SYS"
+0x000 Length : 0x4a
+0x002 MaximumLength : 0x4c
+0x004 Buffer : 0xe15a0980 [COLOR=Red]"\SystemRoot\System32\Drivers\Cdfs.SYS"[/COLOR]
*LoadDriver:
"\SystemRoot\System32\Drivers\diskdump.sys"
+0x000 Length : 0x52
+0x002 MaximumLength : 0x54
+0x004 Buffer : 0x805790ea [COLOR=Red] "\SystemRoot\System32\Drivers\diskdump.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\System32\Drivers\vmscsi.sys"
+0x000 Length : 0x4e
+0x002 MaximumLength : 0x50
+0x004 Buffer : 0xe1695000 [COLOR=Red]"\SystemRoot\System32\Drivers\vmscsi.sys"[/COLOR]
[B][COLOR=Blue]//*加载并初始化注册表*[/COLOR][/B]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 56.
Image: System
ba26fb64 80627dc4 nt![COLOR=Red]CmpLoadHiveThread[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 56.
Image: System
ba26fb64 80627dc4 nt![COLOR=Red]CmpLoadHiveThread[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 56.
Image: System
ba26fb64 80627dc4 nt![COLOR=Red]CmpLoadHiveThread[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 56.
Image: System
ba26fb64 80627dc4 nt![COLOR=Red]CmpLoadHiveThread[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 56.
Image: System
ba26fb64 80627dc4 nt![COLOR=Red]CmpLoadHiveThread[/COLOR]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 56.
Image: System
ba26fb64 80627dc4 nt![COLOR=Red]CmpLoadHiveThread[/COLOR]
[/COLOR][/COLOR]
[COLOR=Red][COLOR=Black][COLOR=Red][COLOR=Black][B][COLOR=Blue]//*加载win32子系统*
[/COLOR][/B][/COLOR][/COLOR]*LoadDriver:
"\SystemRoot\System32\win32k.sys"
+0x000 Length : 0x3e
+0x002 MaximumLength : 0x3e
+0x004 Buffer : 0xe15c68b0 [COLOR=Red]"\SystemRoot\System32\win32k.sys"[/COLOR] [COLOR=Blue]//win32子系统内核模块[/COLOR]
*LoadDriver:
"\SystemRoot\System32\Dxapi.sys"
+0x000 Length : 0x3c
+0x002 MaximumLength : 0x3e
+0x004 Buffer : 0x8947f1a8 [COLOR=Red]"\SystemRoot\System32\Dxapi.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\System32\drivers\Dxapi.sys"
+0x000 Length : 0x4c
+0x002 MaximumLength : 0x4e
+0x004 Buffer : 0x8984a538 [COLOR=Red]"\SystemRoot\System32\drivers\Dxapi.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\System32\watchdog.sys"
+0x000 Length : 0x42
+0x002 MaximumLength : 0x44
+0x004 Buffer : 0x89457bf0 [COLOR=Red]"\SystemRoot\System32\watchdog.sys"[/COLOR]
*NewProcess:
+0x084 UniqueProcessId : 0x00000350 Void
+0x174 ImageFileName : [16] [COLOR=Red]"csrss.exe"[/COLOR] [COLOR=Blue]//win32子系统进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000310 Void
+0x174 ImageFileName : [16] [B] "smss.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x0000036c Void
+0x174 ImageFileName : [16] [COLOR=Red]"winlogon.exe"[/COLOR] [COLOR=Blue]//winlogon.exe进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000310 Void
+0x174 ImageFileName : [16] [B] "smss.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000398 Void
+0x174 ImageFileName : [16] [COLOR=Red]"services.exe"[/COLOR] [COLOR=Blue]//服务管理器进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000036c Void
+0x174 ImageFileName : [16] [B] "winlogon.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x000003a4 Void
+0x174 ImageFileName : [16] [COLOR=Red]"lsass.exe"[/COLOR] [COLOR=Blue]//本地权威子系统进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000036c Void
+0x174 ImageFileName : [16] [B]"winlogon.exe"[/B]
[B][COLOR=Blue]//*[/COLOR][/B][/COLOR][/COLOR][COLOR=Red][COLOR=Black][B][COLOR=Blue][COLOR=Red][COLOR=Black][COLOR=Blue]服务管理器进程[/COLOR][/COLOR][/COLOR]启动服务和加载SERVICE_AUTO_START驱动*
[/COLOR][/B][COLOR=Blue][COLOR=Black]*NewProcess:
+0x084 UniqueProcessId : 0x00000444 Void
+0x174 ImageFileName : [16] [COLOR=Red]"vmacthlp.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000398 Void
+0x174 ImageFileName : [16] [B]"services.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000460 Void
+0x174 ImageFileName : [16] [COLOR=Red]"svchost.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000398 Void
+0x174 ImageFileName : [16] [B]"services.exe"[/B]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\ndisuio.sys"
+0x000 Length : 0x50
+0x002 MaximumLength : 0x52
+0x004 Buffer : 0xe164db70 [COLOR=Red]"\SystemRoot\system32\DRIVERS\ndisuio.sys"[/COLOR]
*NewThread:
No export headle found
bad4bd78 ba5ccb85 NDIS!ndisWorkerThread
*NewProcess:
+0x084 UniqueProcessId : 0x00000548 Void
+0x174 ImageFileName : [16] "svchost.exe"
**Parent:
+0x084 UniqueProcessId : 0x00000398 Void
+0x174 ImageFileName : [16] [B]"services.exe"[/B]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\rdbss.sys"
+0x000 Length : 0x4c
+0x002 MaximumLength : 0x4e
+0x004 Buffer : 0xe18c5130 [COLOR=Red]"\SystemRoot\system32\DRIVERS\rdbss.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\mrxsmb.sys"
+0x000 Length : 0x4e
+0x002 MaximumLength : 0x50
+0x004 Buffer : 0xe18c5130 [COLOR=Red]"\SystemRoot\system32\DRIVERS\mrxsmb.sys"[/COLOR]
*LoadDriver:
"\SystemRoot\system32\DRIVERS\mrxdav.sys"
+0x000 Length : 0x4e
+0x002 MaximumLength : 0x50
+0x004 Buffer : 0xe1e5d260 [COLOR=Red]"\SystemRoot\system32\DRIVERS\mrxdav.sys"[/COLOR]
[/COLOR][/COLOR][/COLOR][/COLOR]
[B]//... 所有的[COLOR=Blue]服务[/COLOR]和[/B][B][COLOR=Blue]SERVICE_AUTO_START[COLOR=Black]类型驱动都会在此时加载并初始化,有些驱动在初始化时还会伴随线程的创建[/COLOR][/COLOR][COLOR=Black],这里不一一显示
[/COLOR][/B][COLOR=Black]
*NewProcess:
+0x084 UniqueProcessId : 0x00000498 Void
+0x174 ImageFileName : [16] [COLOR=Blue] [COLOR=Red]"logonui.exe"[/COLOR] //[B]欢迎界面[/B]进程,此时选择账号并输入密码登陆系统[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000036c Void
+0x174 ImageFileName : [16] [B]"winlogon.exe"[/B][/COLOR][B][COLOR=Black]
[/COLOR][/B]
[COLOR=Red][COLOR=Black][COLOR=Red][COLOR=Black][B][COLOR=Blue][SIZE=5]//*此时进入到了欢迎界面,等待选择用户登录*[/SIZE]
[/COLOR][/B][/COLOR][/COLOR][/COLOR][/COLOR]
[COLOR=Red][COLOR=Black][COLOR=Red][COLOR=Black][B][COLOR=Blue][COLOR=Red][B]//*选择了一个用户,输入正确的密码,并验证通过后*[/B][/COLOR]
[/COLOR][/B][COLOR=Blue][COLOR=Black]*NewProcess:
+0x084 UniqueProcessId : 0x00000608 Void
+0x174 ImageFileName : [16] [COLOR=Red]"userinit.exe"[/COLOR][COLOR=Blue] //用户初始化进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000036c Void
+0x174 ImageFileName : [16] [B]"winlogon.exe"[/B]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 378.
Image: System
bad13700 b11d7df6 aec!AecPrivateWorkerThread
[COLOR=Blue]//下面这几个驱动好像跟声音有关[/COLOR]
*LoadDriver:
"\SystemRoot\system32\drivers\swmidi.sys"
+0x000 Length : 0x4e
+0x002 MaximumLength : 0x50
+0x004 Buffer : 0xe2218a10 "\SystemRoot\system32\drivers\swmidi.sys"
*LoadDriver:
"\SystemRoot\system32\drivers\DMusic.sys"
+0x000 Length : 0x4e
+0x002 MaximumLength : 0x50
+0x004 Buffer : 0xe19d3cc0 "\SystemRoot\system32\drivers\DMusic.sys"
*LoadDriver:
"\SystemRoot\system32\drivers\kmixer.sys"
+0x000 Length : 0x4e
+0x002 MaximumLength : 0x50
+0x004 Buffer : 0xe19d3cc0 "\SystemRoot\system32\drivers\kmixer.sys"
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 378.
Image: System
bad138ac b11931f0 kmixer!MxPrivateWorkerThread
*NewProcess:
+0x084 UniqueProcessId : 0x0000045c Void
+0x174 ImageFileName : [16] [COLOR=Blue] [COLOR=Red]"explorer.exe"[/COLOR] //shell进程[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000608 Void
+0x174 ImageFileName : [16] [B]"userinit.exe"[/B]
[COLOR=Blue][B]//自动运行的程序开始创建[/B][/COLOR]
*NewProcess:
+0x084 UniqueProcessId : 0x0000012c Void
+0x174 ImageFileName : [16] [COLOR=Red]"ie4uinit.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000045c Void
+0x174 ImageFileName : [16] [B]"explorer.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x0000018c Void
+0x174 ImageFileName : [16] "rundll32.exe"
**Parent:
+0x084 UniqueProcessId : 0x0000012c Void
+0x174 ImageFileName : [16] "ie4uinit.exe"
*NewProcess:
+0x084 UniqueProcessId : 0x000001b0 Void
+0x174 ImageFileName : [16] "shmgrate.exe"
**Parent:
+0x084 UniqueProcessId : 0x0000012c Void
+0x174 ImageFileName : [16] "ie4uinit.exe"
*NewProcess:
+0x084 UniqueProcessId : 0x000001b8 Void
+0x174 ImageFileName : [16] [COLOR=Red] "regsvr32.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000045c Void
+0x174 ImageFileName : [16] [B]"explorer.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x000007ec Void
+0x174 ImageFileName : [16] [COLOR=Red]"TSVNCache.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000045c Void
+0x174 ImageFileName : [16] [B]"explorer.exe"
//....
[/B][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR]
[COLOR=Red][COLOR=Black][COLOR=Red][COLOR=Black][COLOR=Blue][COLOR=Black][B][SIZE=5][COLOR=Red][B]//*至此,系统开机启动到第一个用户登录过程完成![/B]*<img src="upload/attach/202608/83_8P2DF2C8DF83433.jpeg">
//*下面看一下第二个用户登录过程*
[SIZE=3][COLOR=Blue]//*点击开始菜单的“注销”,这个时候切换到winlogon桌面
//选择"切换用户",Winlogin会创建logonui.exe进入欢迎界面
[/COLOR][/SIZE][/COLOR][/SIZE][/B][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR]*NewProcess:
+0x084 UniqueProcessId : 0x00000568 Void
+0x174 ImageFileName : [16] [COLOR=Red]"logonui.exe"[/COLOR] [COLOR=Blue]//[B]欢迎界面[/B][/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x0000036c Void
+0x174 ImageFileName : [16] [B] "winlogon.exe"[/B]
[COLOR=Blue]
[B]//输入选择账号正确的密码之后[/B][/COLOR]
watchdog!WdUpdateRecoveryState: Recovery enabled.
*LoadDriver:
"\SystemRoot\System32\win32k.sys"
+0x000 Length : 0x3e
+0x002 MaximumLength : 0x3e
+0x004 Buffer : 0xe202b350 [COLOR=Red]"\SystemRoot\System32\win32k.sys"[/COLOR][COLOR=Blue] //加载win32子系统模块,由smss.exe加载[/COLOR]
*NewProcess:
+0x084 UniqueProcessId : 0x0000012c Void
+0x174 ImageFileName : [16] [COLOR=Red]"csrss.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000310 Void
+0x174 ImageFileName : [16] [B]"smss.exe"[/B]
*LoadDriver:
"\SystemRoot\System32\drivers\dxg.sys"
+0x000 Length : 0x48
+0x002 MaximumLength : 0x4a
+0x004 Buffer : 0xe23abc90 "\SystemRoot\System32\drivers\dxg.sys"
*NewProcess:
+0x084 UniqueProcessId : 0x00000214 Void
+0x174 ImageFileName : [16] [COLOR=Red] "winlogon.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000310 Void
+0x174 ImageFileName : [16] [B]"smss.exe"[/B]
*LoadDriver:
"\SystemRoot\System32\TSDDD.dll"
+0x000 Length : 0x3c
+0x002 MaximumLength : 0x3e
+0x004 Buffer : 0xe1def598 "\SystemRoot\System32\TSDDD.dll"
*LoadDriver:
"\SystemRoot\System32\TSDDD.dll"
+0x000 Length : 0x3c
+0x002 MaximumLength : 0x3e
+0x004 Buffer : 0xe1def598 "\SystemRoot\System32\TSDDD.dll"
*LoadDriver:
"\SystemRoot\System32\vmx_fb.dll"
+0x000 Length : 0x3e
+0x002 MaximumLength : 0x40
+0x004 Buffer : 0xe2247e18 "\SystemRoot\System32\vmx_fb.dll"
*LoadDriver:
"\SystemRoot\System32\vga.dll"
+0x000 Length : 0x38
+0x002 MaximumLength : 0x3a
+0x004 Buffer : 0xe2247e18 "\SystemRoot\System32\vga.dll"
*LoadDriver:
"\SystemRoot\System32\vmx_fb.dll"
+0x000 Length : 0x3e
+0x002 MaximumLength : 0x40
+0x004 Buffer : 0xe2247e18 "\SystemRoot\System32\vmx_fb.dll"
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 385.
Image: System
b160c26c b11931f0 kmixer!MxPrivateWorkerThread
*NewProcess:
+0x084 UniqueProcessId : 0x0000053c Void
+0x174 ImageFileName : [16] [COLOR=Red]"logonui.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000214 Void
+0x174 ImageFileName : [16] [B] "winlogon.exe"[/B]
*NewThread:
PROCESS 89a1c830 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 09f20020 ObjectTable: e1002e40 HandleCount: 390.
Image: System
b16d226c b11931f0 kmixer!MxPrivateWorkerThread
*NewProcess:
+0x084 UniqueProcessId : 0x000006b4 Void
+0x174 ImageFileName : [16] [COLOR=Red] "userinit.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000214 Void
+0x174 ImageFileName : [16] [B] "winlogon.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x000002e0 Void
+0x174 ImageFileName : [16] [COLOR=Red] "wscntfy.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000214 Void
+0x174 ImageFileName : [16] [B] "winlogon.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000518 Void
+0x174 ImageFileName : [16] [COLOR=Red]"explorer.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x000006b4 Void
+0x174 ImageFileName : [16] [B]"userinit.exe"[/B]
[COLOR=Blue]//创建属于该用户的开机启动进程[/COLOR]
*NewProcess:
+0x084 UniqueProcessId : 0x00000834 Void
+0x174 ImageFileName : [16] [COLOR=Red]"TSVNCache.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000518 Void
+0x174 ImageFileName : [16] [B]"explorer.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000854 Void
+0x174 ImageFileName : [16] [COLOR=Red]"verclsid.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000518 Void
+0x174 ImageFileName : [16] [B]"explorer.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x00000860 Void
+0x174 ImageFileName : [16] [COLOR=Red]"verclsid.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000518 Void
+0x174 ImageFileName : [16] [B]"explorer.exe"[/B]
*NewProcess:
+0x084 UniqueProcessId : 0x0000087c Void
+0x174 ImageFileName : [16] [COLOR=Red]"imjpmig.exe"[/COLOR]
**Parent:
+0x084 UniqueProcessId : 0x00000518 Void
+0x174 ImageFileName : [16] [B] "explorer.exe"[/B]
[B]
//...[/B]
[COLOR=Red][COLOR=Black][COLOR=Red][COLOR=Black][COLOR=Blue][COLOR=Black][B][SIZE=5][COLOR=Red][B]//*至此,第二个用户登录过程完成![/B]*<img src="upload/attach/202608/83_XF7KMRKRBYGZ8QJ.jpeg">[/COLOR][/SIZE][/B][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR]
测试环境为XP SP3,由于系统中安装的软件不尽相同,以上结果可能部分与你的不一致。总结一下:
1. 在NT获取控制权时,BOOT类型的驱动已经被加载到内存中(由ntldr加载),但是并没有初始化
2. BOOT类型驱动初始化和SYSTEM类型驱动加载,是由IoInitSystem中完成的。此时已经到了内核初始化后期,不过这部分是内核初始化时最耗时间的。
3. 服务和AUTO驱动在用户登录之前启动和加载。
4. 每个会话对应一个win32子系统。关于会话与win32子系统之间的关系,请参见:白话windows之 会话、工作站、桌面、窗口之间的关系
5. 关键进程创建顺序和父子关系如下:
-Idle
-system
--smss.exe
---autochk.exe
---win32k.sys
---csrss.exe
---winLogin.exe
----services.exe
----lsass.exe
----logonui.exe
----userinit.exe
-----explorer.exe
非第一次用户登录时:
--smss.exe
---win32k.sys
---csrss.exe
---winlogin.exe
----logonui.exe
----userinit.exe
-----explorer.exe
欢迎各位拍砖~
