Soumettre la recherche
Mettre en ligne
110824 knoss-windows系统机制浅析
•
2 j'aime
•
924 vues
Zoom Quiet
Suivre
金山卫士开源计划 {v11.08.8.0}开源卫士社区 http://code.ijinshan.com/
Lire moins
Lire la suite
Technologie
Signaler
Partager
Signaler
Partager
1 sur 28
Télécharger maintenant
Télécharger pour lire hors ligne
Recommandé
Android 源码分析 -- (一) Android启动过程
Android 源码分析 -- (一) Android启动过程
manateew
[嵌入式系統] MCS-51 實驗 - 使用 IAR (1)
[嵌入式系統] MCS-51 實驗 - 使用 IAR (1)
Simen Li
古斯塔斯集团的Qmail邮件系统
古斯塔斯集团的Qmail邮件系统
gavin shaw
Linux Binary Exploitation - Stack buffer overflow
Linux Binary Exploitation - Stack buffer overflow
Angel Boy
Talking about exploit writing
Talking about exploit writing
sbha0909
Monitor is all for ops
Monitor is all for ops
琛琳 饶
Java Web 程式之效能技巧與安全防護
Java Web 程式之效能技巧與安全防護
Justin Lin
Java Crash分析(2012-05-10)
Java Crash分析(2012-05-10)
Kris Mok
Recommandé
Android 源码分析 -- (一) Android启动过程
Android 源码分析 -- (一) Android启动过程
manateew
[嵌入式系統] MCS-51 實驗 - 使用 IAR (1)
[嵌入式系統] MCS-51 實驗 - 使用 IAR (1)
Simen Li
古斯塔斯集团的Qmail邮件系统
古斯塔斯集团的Qmail邮件系统
gavin shaw
Linux Binary Exploitation - Stack buffer overflow
Linux Binary Exploitation - Stack buffer overflow
Angel Boy
Talking about exploit writing
Talking about exploit writing
sbha0909
Monitor is all for ops
Monitor is all for ops
琛琳 饶
Java Web 程式之效能技巧與安全防護
Java Web 程式之效能技巧與安全防護
Justin Lin
Java Crash分析(2012-05-10)
Java Crash分析(2012-05-10)
Kris Mok
110823 kn-cachemana-wengjun
110823 kn-cachemana-wengjun
Zoom Quiet
Permutation Oriented Programming: (Re)searching for alternatives!
Permutation Oriented Programming: (Re)searching for alternatives!
Nelson Brito
Intro to unit.
Intro to unit.
garylintern
Cost of-opportunity
Cost of-opportunity
patrickbryant02
Ac&m jul11 stat_eng
Ac&m jul11 stat_eng
Procontent.Ru Magazine
Sect 2 KPI's
Sect 2 KPI's
Lars Moller
Intro Psat 20102011
Intro Psat 20102011
IS Manila
Investigate the role of social network marketing
Investigate the role of social network marketing
Carman Ho
Why social media matters - September 2011
Why social media matters - September 2011
Redd Marketing
Permutation Oriented Programming
Permutation Oriented Programming
Nelson Brito
Sect 3, Performance diagnostics
Sect 3, Performance diagnostics
Lars Moller
How to prepare_for_campus_placements_
How to prepare_for_campus_placements_
iTestiWin.com
Making Decisions... Parents' Advice
Making Decisions... Parents' Advice
International School Manila Elementary
Social Media Marketing & The Fallacy of Going Viral
Social Media Marketing & The Fallacy of Going Viral
LiBeck Integrated Marketing .
Content is not_flat
Content is not_flat
Cory-Ann Joseph
Marketing finance interface
Marketing finance interface
Ashwin Malshe
SVN to GitHUb
SVN to GitHUb
Jean-Laurent de Morlhon
基于Innodb开发的最佳实践
基于Innodb开发的最佳实践
wubx
Binary exploitation - AIS3
Binary exploitation - AIS3
Angel Boy
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
YingSiang Geng
COSCUP 2014 : open source compiler 戰國時代的軍備競賽
COSCUP 2014 : open source compiler 戰國時代的軍備競賽
Kito Cheng
Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)
frogd
Contenu connexe
En vedette
110823 kn-cachemana-wengjun
110823 kn-cachemana-wengjun
Zoom Quiet
Permutation Oriented Programming: (Re)searching for alternatives!
Permutation Oriented Programming: (Re)searching for alternatives!
Nelson Brito
Intro to unit.
Intro to unit.
garylintern
Cost of-opportunity
Cost of-opportunity
patrickbryant02
Ac&m jul11 stat_eng
Ac&m jul11 stat_eng
Procontent.Ru Magazine
Sect 2 KPI's
Sect 2 KPI's
Lars Moller
Intro Psat 20102011
Intro Psat 20102011
IS Manila
Investigate the role of social network marketing
Investigate the role of social network marketing
Carman Ho
Why social media matters - September 2011
Why social media matters - September 2011
Redd Marketing
Permutation Oriented Programming
Permutation Oriented Programming
Nelson Brito
Sect 3, Performance diagnostics
Sect 3, Performance diagnostics
Lars Moller
How to prepare_for_campus_placements_
How to prepare_for_campus_placements_
iTestiWin.com
Making Decisions... Parents' Advice
Making Decisions... Parents' Advice
International School Manila Elementary
Social Media Marketing & The Fallacy of Going Viral
Social Media Marketing & The Fallacy of Going Viral
LiBeck Integrated Marketing .
Content is not_flat
Content is not_flat
Cory-Ann Joseph
Marketing finance interface
Marketing finance interface
Ashwin Malshe
SVN to GitHUb
SVN to GitHUb
Jean-Laurent de Morlhon
En vedette
(17)
110823 kn-cachemana-wengjun
110823 kn-cachemana-wengjun
Permutation Oriented Programming: (Re)searching for alternatives!
Permutation Oriented Programming: (Re)searching for alternatives!
Intro to unit.
Intro to unit.
Cost of-opportunity
Cost of-opportunity
Ac&m jul11 stat_eng
Ac&m jul11 stat_eng
Sect 2 KPI's
Sect 2 KPI's
Intro Psat 20102011
Intro Psat 20102011
Investigate the role of social network marketing
Investigate the role of social network marketing
Why social media matters - September 2011
Why social media matters - September 2011
Permutation Oriented Programming
Permutation Oriented Programming
Sect 3, Performance diagnostics
Sect 3, Performance diagnostics
How to prepare_for_campus_placements_
How to prepare_for_campus_placements_
Making Decisions... Parents' Advice
Making Decisions... Parents' Advice
Social Media Marketing & The Fallacy of Going Viral
Social Media Marketing & The Fallacy of Going Viral
Content is not_flat
Content is not_flat
Marketing finance interface
Marketing finance interface
SVN to GitHUb
SVN to GitHUb
Similaire à 110824 knoss-windows系统机制浅析
基于Innodb开发的最佳实践
基于Innodb开发的最佳实践
wubx
Binary exploitation - AIS3
Binary exploitation - AIS3
Angel Boy
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
YingSiang Geng
COSCUP 2014 : open source compiler 戰國時代的軍備競賽
COSCUP 2014 : open source compiler 戰國時代的軍備競賽
Kito Cheng
Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)
frogd
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
Angel Boy
Avm2虚拟机浅析与as3性能优化(陈士凯)
Avm2虚拟机浅析与as3性能优化(陈士凯)
FLASH开发者交流会
[Flash开发者交流][2010.05.30]avm2虚拟机浅析与as3性能优化(陈士凯)
[Flash开发者交流][2010.05.30]avm2虚拟机浅析与as3性能优化(陈士凯)
Shanda innovation institute
Sigreturn Oriented Programming
Sigreturn Oriented Programming
Angel Boy
Win dbg入门
Win dbg入门
晓锋 陈
Windbg入门
Windbg入门
晓锋 陈
Rootkit 101
Rootkit 101
WEI CHIEH CHAO
Avm2虚拟机浅析与as3性能优化
Avm2虚拟机浅析与as3性能优化
Harvey Zhang
Arduino 底層原始碼解析心得
Arduino 底層原始碼解析心得
roboard
快快樂樂SIMD
快快樂樂SIMD
Wei-Ta Wang
Elastic stack day-2
Elastic stack day-2
YI-CHING WU
揭秘家用路由器Ch10 sharing
揭秘家用路由器Ch10 sharing
Yi-Jun Zheng
Python 于 webgame 的应用
Python 于 webgame 的应用
勇浩 赖
藍色小鋪, 數字管時鐘, 作品進化分享 (by 黃偉峻)
藍色小鋪, 數字管時鐘, 作品進化分享 (by 黃偉峻)
GoGoPrivateRyan
2011 06-12-lamp-mysql-顾春江
2011 06-12-lamp-mysql-顾春江
thinkinlamp
Similaire à 110824 knoss-windows系统机制浅析
(20)
基于Innodb开发的最佳实践
基于Innodb开发的最佳实践
Binary exploitation - AIS3
Binary exploitation - AIS3
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
COSCUP 2014 : open source compiler 戰國時代的軍備競賽
COSCUP 2014 : open source compiler 戰國時代的軍備競賽
Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
Avm2虚拟机浅析与as3性能优化(陈士凯)
Avm2虚拟机浅析与as3性能优化(陈士凯)
[Flash开发者交流][2010.05.30]avm2虚拟机浅析与as3性能优化(陈士凯)
[Flash开发者交流][2010.05.30]avm2虚拟机浅析与as3性能优化(陈士凯)
Sigreturn Oriented Programming
Sigreturn Oriented Programming
Win dbg入门
Win dbg入门
Windbg入门
Windbg入门
Rootkit 101
Rootkit 101
Avm2虚拟机浅析与as3性能优化
Avm2虚拟机浅析与as3性能优化
Arduino 底層原始碼解析心得
Arduino 底層原始碼解析心得
快快樂樂SIMD
快快樂樂SIMD
Elastic stack day-2
Elastic stack day-2
揭秘家用路由器Ch10 sharing
揭秘家用路由器Ch10 sharing
Python 于 webgame 的应用
Python 于 webgame 的应用
藍色小鋪, 數字管時鐘, 作品進化分享 (by 黃偉峻)
藍色小鋪, 數字管時鐘, 作品進化分享 (by 黃偉峻)
2011 06-12-lamp-mysql-顾春江
2011 06-12-lamp-mysql-顾春江
Plus de Zoom Quiet
42qu thrift1
42qu thrift1
Zoom Quiet
产品信息收集系统Infoc的演变
产品信息收集系统Infoc的演变
Zoom Quiet
Go courseday3
Go courseday3
Zoom Quiet
Go courseday2
Go courseday2
Zoom Quiet
Go courseday1
Go courseday1
Zoom Quiet
01s0401 go,互联网时代的c语言 许式伟
01s0401 go,互联网时代的c语言 许式伟
Zoom Quiet
Zoz pwned-by-the-owner-表惹程序猿
Zoz pwned-by-the-owner-表惹程序猿
Zoom Quiet
金山云查询系统改进之路1
金山云查询系统改进之路1
Zoom Quiet
Zh120226techparty zd-story
Zh120226techparty zd-story
Zoom Quiet
Zh120226techparty velocity2011-review
Zh120226techparty velocity2011-review
Zoom Quiet
Zh120226techparty jeff kit-ios-toolbox
Zh120226techparty jeff kit-ios-toolbox
Zoom Quiet
Velocity2011分享
Velocity2011分享
Zoom Quiet
陈正 Introduction to-sae_python
陈正 Introduction to-sae_python
Zoom Quiet
111218 zhtechparty-panda讲稿
111218 zhtechparty-panda讲稿
Zoom Quiet
111218 zhtechparty-移动互联网产品需求分析
111218 zhtechparty-移动互联网产品需求分析
Zoom Quiet
111218 zhtechparty-zd-浅谈symbian开发
111218 zhtechparty-zd-浅谈symbian开发
Zoom Quiet
ImpoImport this, that, and the other thing: custom importersrt not for_y
ImpoImport this, that, and the other thing: custom importersrt not for_y
Zoom Quiet
Import this, that, and the other thing: custom importers
Import this, that, and the other thing: custom importers
Zoom Quiet
金山卫士界面框架
金山卫士界面框架
Zoom Quiet
111030 gztechparty-小路-云时代的mysql
111030 gztechparty-小路-云时代的mysql
Zoom Quiet
Plus de Zoom Quiet
(20)
42qu thrift1
42qu thrift1
产品信息收集系统Infoc的演变
产品信息收集系统Infoc的演变
Go courseday3
Go courseday3
Go courseday2
Go courseday2
Go courseday1
Go courseday1
01s0401 go,互联网时代的c语言 许式伟
01s0401 go,互联网时代的c语言 许式伟
Zoz pwned-by-the-owner-表惹程序猿
Zoz pwned-by-the-owner-表惹程序猿
金山云查询系统改进之路1
金山云查询系统改进之路1
Zh120226techparty zd-story
Zh120226techparty zd-story
Zh120226techparty velocity2011-review
Zh120226techparty velocity2011-review
Zh120226techparty jeff kit-ios-toolbox
Zh120226techparty jeff kit-ios-toolbox
Velocity2011分享
Velocity2011分享
陈正 Introduction to-sae_python
陈正 Introduction to-sae_python
111218 zhtechparty-panda讲稿
111218 zhtechparty-panda讲稿
111218 zhtechparty-移动互联网产品需求分析
111218 zhtechparty-移动互联网产品需求分析
111218 zhtechparty-zd-浅谈symbian开发
111218 zhtechparty-zd-浅谈symbian开发
ImpoImport this, that, and the other thing: custom importersrt not for_y
ImpoImport this, that, and the other thing: custom importersrt not for_y
Import this, that, and the other thing: custom importers
Import this, that, and the other thing: custom importers
金山卫士界面框架
金山卫士界面框架
111030 gztechparty-小路-云时代的mysql
111030 gztechparty-小路-云时代的mysql
110824 knoss-windows系统机制浅析
1.
Windows 系统机制浅析
2011-8-24 祁伟
2.
•
Windows Components • 中断与异常 • KiFastCallEntry vs KiIntSystemCall • IRQ vs IRQL • FastMutex,Event 同步对象 • Lookaside 内存管理 • 对象管理器
3.
Windows 2000
4.
Windows Driver Kit
5.
深入解析 Windows 操作系统
. 第 5 版
6.
系统调用例子: •
NtUserFindWindowEx: • mov eax, 118Ch • mov edx, 7FFE0300h • call dword ptr [edx] • retn 14h • NtCreateProcess: • mov eax, 4Fh • mov edx, 7FFE0300h • call dword ptr [edx] • retn 20h • KiIntSystemCall • lea edx, [esp+arg_4] • int 2Eh • retn • KiFastSystemCall: • mov edx, esp • sysenter • retn
7.
中断 • 中断:指当出现需要时, CPU
暂时停止当 前程序的执行转而执行处理新情况的程序 和执行过程。即在程序运行过程中,系统 出现了一个必须由 CPU 立即处理的情况, 此时, CPU 暂时中止程序的执行转而处理 这个新的情况的过程就叫做中断。
8.
异常 • 异常:程序在运行过程中发生
由于硬件设备问 题、软件设计 错误等导致的程序异常事件 。 • 通过 try…catch 语句进行捕获 异常。 • 相关函数: SetUnhandledExceptionFilter • 异常处理结构在:线程控制块 (TEB)0 Byte 偏移处指针标识 ,即 FS : [0] 处地址。
9.
中断异常管理结构 •
kd> dt _ktrap_frame • ntdll!_KTRAP_FRAME • ................. • +0x018 Dr0 : Uint4B • +0x01c Dr1 : Uint4B • +0x020 Dr2 : Uint4B • +0x024 Dr3 : Uint4B • +0x028 Dr6 : Uint4B • +0x02c Dr7 : Uint4B • +0x030 SegGs : Uint4B • +0x034 SegEs : Uint4B • +0x038 SegDs : Uint4B • +0x03c Edx : Uint4B • +0x040 Ecx : Uint4B • +0x044 Eax : Uint4B • ...................... • typedef struct _CONTEXT { • 。。。。。。。 • ULONG Edi; • ULONG Esi; • ULONG Ebx; • ULONG Edx; • ULONG Ecx; • ULONG Eax; • ULONG Ebp; • ULONG Eip; • ULONG SegCs; • ULONG EFlags; • ULONG Esp; • ULONG SegSs; • 。。。。 • } CONTEXT; •
10.
异常 • l
0 号异常为除法运算出错,特别是除数为 0 。 • l 3 号异常用于通过自陷指令“ INT 3” 实现的程 序断点。 • l 6 号异常为遇到非法指令。 • l 9 号异常为浮点指令异常。 • l 13 号异常为总保护 (General Protection) ,例 如企图在用户空间执行特权指令等等。 • l 14 号异常为存储页面异常。 • l 16 号异常为浮点运算异常。
11.
中断异常分发函数 •中断分发函数: KiDispatchInterrupt •异常分发函数: KiDispatchException
12.
中断 •
kd> !idt • Dumping IDT: • 37: 806ee728 hal!PicSpuriousService37 • 3d: 806efb70 hal!HalpApcInterrupt • 41: 806ef9cc hal!HalpDispatchInterrupt • 50: 806ee800 hal!HalpApicRebootService • 62: 81b5a71c atapi!IdePortInterrupt (KINTERRUPT 81b5a6e0)->IDE 接口中断程序(支持该接口的硬盘或者光驱设备) • 63: 81965044 NDIS!ndisMIsr (KINTERRUPT 81965008)---> 网络 NDIS 中断程序 • 73: 8192a044 portcls!CKsShellRequestor::`vector deleting destructor'+0x26 (KINTERRUPT 8192a008) • USBPORT!USBPORT_InterruptService (KINTERRUPT 81945008) • 82: 81b5750c atapi!IdePortInterrupt (KINTERRUPT 81b574d0)->IDE 接口中断程序 • 83: 81b54ccc SCSIPORT!ScsiPortInterrupt (KINTERRUPT 81b54c90)->SCSI 接口中断程序 • 93: 81926044 i8042prt!I8042KeyboardInterruptService (KINTERRUPT 81926008)-> 键盘中断程序 • a3: 8192c044 i8042prt!I8042MouseInterruptService (KINTERRUPT 8192c008)--> 鼠标中断程序 • b1: 81bd95c4 ACPI!ACPIInterruptServiceRoutine (KINTERRUPT 81bd9588) • b2: 8194c044 serial!SerialCIsrSw (KINTERRUPT 8194c008)--> 串口中断程序 • c1: 806ee984 hal!HalpBroadcastCallService • d1: 806edd34 hal!HalpClockInterrupt---> 时钟中断 • e1: 806eef0c hal!HalpIpiHandler • e3: 806eec70 hal!HalpLocalApicErrorService • fd: 806ef464 hal!HalpProfileInterrupt • fe: 806ef604 hal!HalpPerfInterrupt
13.
KINTERRUPT 完整结构 •
nt!_KINTERRUPT • +0x000 Type : Int2B • +0x002 Size : Int2B • +0x004 InterruptListEntry : _LIST_ENTRY • +0x00c ServiceRoutine : Ptr32 unsigned char • +0x010 ServiceContext : Ptr32 Void • +0x014 SpinLock : Uint4B • +0x018 TickCount : Uint4B • +0x01c ActualLock : Ptr32 Uint4B • +0x020 DispatchAddress : Ptr32 void • +0x024 Vector : Uint4B • +0x028 Irql : UChar • +0x029 SynchronizeIrql : UChar • +0x02a FloatingSave : UChar • +0x02b Connected : UChar • +0x02c Number : Char • +0x02d ShareVector : UChar • +0x030 Mode : _KINTERRUPT_MODE • +0x034 ServiceCount : Uint4B • +0x038 DispatchCount : Uint4B • +0x03c DispatchCode : [106] Uint4B
14.
中断相关函数 • IoConnectInterrupt • IoDisconnectInterrupt •
KeInitializeInterrupt • KiInterruptTemplateObject
15.
IRQ • IRQ 英文全称
Interrupt Request ,中文翻译为中 断请求线。计算机中有许多设备(例如声卡、硬 盘等)他们都能在没有 CPU 介入的情况下完成一 定的工作。但是这些设备还是需要定期中断 CPU ,让 CPU 为其做一些特定的工作。如果这 些设备要中断 CPU 的运行,就必需在中断请求线 上把 CPU 中断的信号发给 CPU 。所以每个设备 只能使用自己独立的中断请求线。一般来说在 80286 以上计算机中,共有 16 个中断请求线与各 种需要用中断的不同外设相连接,(每个中断线 有一个标号也就是中断号)。
16.
IRQL • IRQL
是 Interrupt Request Level ,中断请求级 别。一个由 windows 虚拟出来的概念,划分在 windows 下中断的优先级,这里中断包括了硬中 断和软中断,硬中断是由硬件产生,而软中断则 是完全虚拟出来的。 处理器在一个 IRQL 上 执行线程代码。 IRQL 是帮助决定线程如何被中 断的。在同一处理器上,线程只能被更高级别 IRQL 的线程能中断。每个处理器都有自己的中 断 IRQL 。
17.
IRQL ( Interrupt
Request Level ) • #define PASSIVE_LEVEL 0 // Passive release level • #define LOW_LEVEL 0 // Lowest interrupt level • #define APC_LEVEL 1 // APC interrupt level • #define DISPATCH_LEVEL 2 // Dispatcher level • #define CMC_LEVEL 3 // Correctable machine check level • #define DEVICE_LEVEL_BASE 4 // 4 - 11 - Device IRQLs • #define PC_LEVEL 12 // Performance Counter IRQL • #define IPI_LEVEL 14 // IPI IRQL • #define CLOCK_LEVEL 13 // Clock Timer IRQL • #define POWER_LEVEL 15 // Power failure level • #define PROFILE_LEVEL 15 // Profiling level • #define HIGH_LEVEL 15 // Highest interrupt level • 注记:高 IRQL 级别函数调用低 IRQL 级别函数,会触发 IRQL_NOT_LESS_OR_EQUAL 蓝屏错误码。
18.
操作 IRQL 函数 •
KeGetCurrentIrql • KeRaiseIrql : the caller specifies NewIrql >= CurrentIrql • KeLowerIrql : it specifies NewIrql <= CurrentIrql
19.
函数调用相关的 IRQL 例子: •
PsCreateSystemThread IRQL = PASSIVE_LEVEL. • PsGetCurrentProcessId running at any IRQL. • KeAcquireSpinLock IRQL <= DISPATCH_LEVEL
20.
KiFastCallEntry •
.text:00413C8A ; ULONG_PTR __stdcall KiLoadFastSyscallMachineSpecificRegisters(ULONG_PTR) • .text:00413C8A _KiLoadFastSyscallMachineSpecificRegisters@4 proc near • .text:00413C8A ; CODE XREF: KiConfigureDynamicProcessor()+61p • .text:00413C8A ; DATA XREF: KiRestoreFastSyscallReturnState()+43o • .text:00413C8A cmp _KiFastSystemCallIsIA32, 0 • .text:00413C91 push esi • .text:00413C92 jz short loc_413CCC • .text:00413C94 mov esi, large fs:20h • .text:00413C9B push 0 • .text:00413C9D push 8 • .text:00413C9F push 174h • .text:00413CA4 call _WRMSR@12 ; WRMSR(x,x,x) • .text:00413CA9 push 0 • .text:00413CAB push offset _KiFastCallEntry • .text:00413CB0 push 176h • .text:00413CB5 call _WRMSR@12 ; WRMSR(x,x,x) • .text:00413CBA push 0 • .text:00413CBC push dword ptr [esi+1908h] • .text:00413CC2 push 175h • .text:00413CC7 call _WRMSR@12 ; WRMSR(x,x,x) • .text:00413CCC • .text:00413CCC loc_413CCC: ; CODE XREF: KiLoadFastSyscallMachineSpecificRegisters(x)+8j • .text:00413CCC pop esi • .text:00413CCD retn 4
21.
FastMutex 互斥同步对象 •
ExInitializeFastMutex • ExAcquireFastMutex • ExReleaseFastMutex • 内核管理结构是: nt!_FAST_MUTEX • 注记 :IRQL <= APC_LEVEL • Ring3 层的方法 : • InitializeCriticalSection • EnterCriticalSection • LeaveCriticalSection
22.
Event 同步对象 •
KeInitializeEvent • KeSetEvent • KeReadStateEvent • KeClearEvent • 内核管理结构是 nt!_KEVENT 。 • Ring3 层的方法 : • CreateEvent • OpenEvent • SetEvent
23.
Lookaside 固定大小内存管理 •
ExInitializePagedLookasideList • ExAllocateFromPagedLookasideList • ExFreeToPagedLookasideList • 注记: IRQL <= APC_LEVEL 。 • ExInitializeNPagedLookasideList • ExAllocateFromNPagedLookasideList • ExFreeToNPagedLookasideList • 注记: IRQL <= DISPATCH_LEVEL 。
24.
Lookaside 管理结构: •
ntdll!_GENERAL_LOOKASIDE • +0x000 ListHead : _SLIST_HEADER • +0x008 Depth : Uint2B • +0x00a MaximumDepth : Uint2B • +0x00c TotalAllocates : Uint4B • +0x010 AllocateMisses : Uint4B • +0x010 AllocateHits : Uint4B • +0x014 TotalFrees : Uint4B • +0x018 FreeMisses : Uint4B • +0x018 FreeHits : Uint4B • +0x01c Type : _POOL_TYPE • +0x020 Tag : Uint4B • +0x024 Size : Uint4B • +0x028 Allocate : Ptr32 void* • +0x02c Free : Ptr32 void • +0x030 ListEntry : _LIST_ENTRY • +0x038 LastTotalAllocates : Uint4B • +0x03c LastAllocateMisses : Uint4B • +0x03c LastAllocateHits : Uint4B • +0x040 Future : [2] Uint4B
25.
对象管理器
26.
对象定义浅说 •
Directory---->nt!_OBJECT_DIRECTORY • SymbolicLink --->nt!_OBJECT_SYMBOLIC_LINK • Event--->nt!_KEVENT • Mutant--->nt!_KMUTANT • Semaphore-->nt!_KSEMAPHORE • Timer-->nt!_KTIMER • Adapter-->_ADAPTER_OBJECT • Device ---->nt!_DEVICE_OBJECT • Driver----->nt!_DRIVER_OBJECT • Key--->nt!_CM_KEY_BODY • Port--->_LPCP_PORT_OBJECT • Section--->nt!_SECTION_OBJECT • Process-->nt!_EPROCESS • Thread--->nt!_ETHREAD • Token--->nt!_TOKEN
27.
对象管理器 API •
NTSYSAPI NTSTATUS NTAPI • NtCreateDirectoryObject( • OUT PHANDLE DirectoryHandle, • IN ACCESS_MASK DesiredAccess, • IN POBJECT_ATTRIBUTES ObjectAttributes • ); • • NTSYSAPI NTSTATUS NTAPI • NtOpenDirectoryObject( • OUT PHANDLE DirectoryHandle, • IN ACCESS_MASK DesiredAccess, • IN POBJECT_ATTRIBUTES ObjectAttributes • ); • NTSYSAPI NTSTATUS NTAPI • NtCreateSymbolicLinkObject( • OUT PHANDLE ObjectHandle, • IN ACCESS_MASK DesiredAccess, • IN POBJECT_ATTRIBUTES ObjectAttributes, • IN PUNICODE_STRING SubstituteString • ); • • NTSYSAPI NTSTATUS NTAPI • NtOpenSymbolicLinkObject( • OUT PHANDLE ObjectHandle, • IN ACCESS_MASK DesiredAccess, • IN POBJECT_ATTRIBUTES ObjectAttributes • ); • • typedef struct _OBJECT_NAME_INFORMATION { • UNICODE_STRING Name; • } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; • • NTSYSAPI NTSTATUS NTAPI • NtQuerySymbolicLinkObject( • IN HANDLE ObjectHandle, • OUT POBJECT_NAME_INFORMATION SubstituteString, • OUT PULONG SubstituteStringLength // 字节 • ); • •
28.
• 完
Télécharger maintenant