int 2e
在 windows xp 之前的系统中使用 windows xp 快速系统调用是从用户模式转换到内核模式的首选方法
快速系统调用指针嵌入在共享用户数据部分
0:003> dt ntdll!_KUSER_SHARED_DATA @@masm(SharedUserData) SystemCall
+0x300 SystemCall : 0x76dd70f0
0:003> uf 0x76dd70f0
ntdll!KiFastSystemCall:
76dd70f0 8bd4 mov edx,esp
76dd70f2 0f34 sysenter
76dd70f4 c3 ret
如果您使用的是用户模式调试器,则无法看到 Nt/Zw 函数的内部结构
ntdll 只携带转换到内核模式的存根
你需要一个内核调试连接或者你必须依赖ntos的静态分析.....(kr/mp).exe(内核执行代码)
或者您可以使用来自 sysinternals 的 livekd 进行本地调试
NtCreatePort
调用nt!AlpcpCreateConnectionPort
内部调用NtCreateObject
,初始化端口属性将
对象插入到 HANDLE 表中并返回
控制流程的小概述如下(win 7 32位)
kd> uf /c nt!NtCreatePort
nt!NtCreatePort (8303f8a6)
nt!NtCreatePort+0x22 (8303f8c8):
call to nt!AlpcpCreateConnectionPort (8304d35c)
nt!NtCreatePort+0x52 (8303f8f8):
call to nt!KiCheckForKernelApcDelivery (82e74b24)
kd> uf /c nt!AlpcpCreateConnectionPort
nt!AlpcpCreateConnectionPort (8304d35c)
nt!AlpcpCreateConnectionPort+0x7 (8304d363):
call to nt!_SEH_prolog4 (82ecc240)
nt!AlpcpCreateConnectionPort+0xb3 (8304d40f):
call to nt!ObCreateObject (83072413)
nt!AlpcpCreateConnectionPort+0xc5 (8304d421):
call to nt!memset (82e864c0)
nt!AlpcpCreateConnectionPort+0xf4 (8304d450):
call to nt!AlpcpInitializePort (830b76c5)
nt!AlpcpCreateConnectionPort+0x101 (8304d45d):
call to nt!ObfDereferenceObject (82ec5163)
nt!AlpcpCreateConnectionPort+0x120 (8304d47c):
call to nt!AlpcpValidateAndSetPortAttributes (830b75a5)
nt!AlpcpCreateConnectionPort+0x140 (8304d49c):
call to nt!AlpcpSetOwnerProcessPort (830b77dc)
nt!AlpcpCreateConnectionPort+0x14d (8304d4a9):
call to nt!AlpcpAllocateBlob (830b7526)
nt!AlpcpCreateConnectionPort+0x181 (8304d4dd):
call to nt!AlpcInitializeHandleTable (830b7898)
nt!AlpcpCreateConnectionPort+0x198 (8304d4f4):
call to nt!ObInsertObjectEx (83071380)
nt!AlpcpCreateConnectionPort+0x1d5 (8304d531):
call to nt!_SEH_epilog4 (82ecc285)
kd>