40楼#
发布于:2002-06-28 17:30
好cool的名词,解释一下,虚拟地址描述符?干什么的??? 大兄弟,我现在也在2000下呢 不用试了,只要id对,应该可以的 2000和XPint 2e功能一样,但id不一样 |
|
|
41楼#
发布于:2002-06-28 17:30
[quote]How can I get the details?? 就是那个int 2e用的表??? 大兄弟,int 2e太不通用,在2000和XP下不同 :mad: :mad: :mad: [/quote] 快被你气疯了,你至少试过把输出给我呀。 |
|
42楼#
发布于:2002-06-28 17:32
[quote][quote]How can I get the details?? 就是那个int 2e用的表??? 大兄弟,int 2e太不通用,在2000和XP下不同 :mad: :mad: :mad: [/quote] 快被你气疯了,你至少试过把输出给我呀。 [/quote] 现在帖子错开了,你看看我上面的帖子 如果非要试,那下周告诉你结果 切换一次OS好麻烦的 |
|
|
43楼#
发布于:2002-06-28 17:34
How can I get the details?? yes!!! |
|
|
44楼#
发布于:2002-06-28 17:39
[quote]好cool的名词,解释一下,虚拟地址描述符?干什么的??? 大兄弟,我现在也在2000下呢 不用试了,只要id对,应该可以的 2000和XPint 2e功能一样,但id不一样 [/quote] XP采用sysenter进入内核,内核中的Zw*不再采用int2e,而是直接call。这些是根据zdhe老兄copy的一点点XP内核汇编代码得知的,因为我没有XP的开发机才这么麻烦。他没copyInt2e的处理代码,所以我不知道XP是否有意与2000兼容而保留int2e,若不是的话int2e就彻底废了,这才是真正不能用的原因,不要再说ID了吧,我从copy别人的XP上的ntdll.dll可以得到所需。 你进XP试一下或CopyXP内核Int2e代码有这么麻烦么?算了吧。 |
|
45楼#
发布于:2002-06-28 17:44
[quote][quote]好cool的名词,解释一下,虚拟地址描述符?干什么的??? 大兄弟,我现在也在2000下呢 不用试了,只要id对,应该可以的 2000和XPint 2e功能一样,但id不一样 [/quote] XP采用sysenter进入内核,内核中的Zw*不再采用int2e,而是直接call。这些是根据zdhe老兄copy的一点点XP内核汇编代码得知的,因为我没有XP的开发机才这么麻烦。他没copyInt2e的处理代码,所以我不知道XP是否有意与2000兼容而保留int2e,若不是的话int2e就彻底废了,这才是真正不能用的原因,不要再说ID了吧,我从copy别人的XP上的ntdll.dll可以得到所需。 你进XP试一下或CopyXP内核Int2e代码有这么麻烦么?算了吧。 [/quote] 好啦,我自己看能不能找到。试了再告诉你。 不说这个了,呵呵 |
|
46楼#
发布于:2002-06-28 17:57
一急说话就有点冲,呵呵
其实你想得到ntoskrnl.exe得最简单办法就在于此了,2000上不用说了,我去试试XP |
|
47楼#
发布于:2002-06-29 16:37
it seems pjf still remember my question.
i found a well document just paste here. may it can help. \"Fast System Call\" implementation of NTCALL --------------------------------------------- Windows NT/x86 uses for system calls (= NTCALLs -> user-mode/kernel-mode -> Intel: ring-3/ring-0 transitions) interrupt 0x2e. Handler for Int 0x2e has name KiSystemService and is used for KM/KM transitions too. It is well documented, everyone knows (or can read/find) how this interface works, what happens inside. Windows 2000/x86 has in addition built-in support for transitions via \"Fast System Call\" instructions SYSENTER/SYSEXIT. Descriptions for those Pentium II+ instructions can be found in Intel Architecture Software Developer\'s Manual Volume 2: Instruction Set Reference, pages 721..727 (3-681..3-687). Handler for SYSENTER has name KiFastCallEntry and is located at ~ KiSystemService-0x100 in ntoskrnl.exe. ------------------------------------------------------------------------------ Let\'s admit KiFastCallEntry is invoked by ring-3 SYSENTER stub similar to INT2E stub (-> Int 0x2e is replaced with SYSENTER): FastCallRing3Stub: MOV EAX, NTCALLnumber LEA EDX, [ESP+4] ;pointer to parameters SYSENTER ;JMP FastCallEntry RET xxx Here is the prologue of KiFastCallEntry: MOV ESP, SS:[0xFFDFF040] MOV ESP, [ESP+4] ;this is ring-0 stack for FastCall PUSH 0x23 ;imitate ring-3_SS PUSH EDX ;ring-3_ESP + 4 (see LEA EDX, [ESP+4] above) SUB DWORD PTR [ESP], 4 ;ring-3_ESP + 4 - 4 (-> ring-3_ESP) PUSHFD OR DWORD PTR [ESP], 0x200 ;imitate ring-3_EFlags, IRQs enabled PUSH 0x1B ;imitate ring-3_CS PUSH ECX ;this should be ring-3_EIP ? ;..fill in KeTrapFrame ;..go to common NTCALL dispatch code Imitation is clear: common NTCALL dispatch code uses pointers to the stack as it would be set by Int 0x2e (from protected mode ring-3). ECX should contain ring-3_EIP. Then I suggest this form of FastCallRing3Stub: MOV EAX, NTCALLnumber LEA EDX, [ESP+4] LEA ECX, SYSEXIThere ;or shorter MOV ECX, OFFSET SYSEXIThere SYSENTER SYSEXIThere: RET xxx Here comes the epilogue (common for KiSystemService and KiFastCallEntry) as a part of KiServiceExit (similar code is used in KiSetLowWaitHighThread too): TEST KeFeatureBits, 0x1000 ;Does CPU support Fast System Call? JZ ReturnFromInterrupt ; no -> iret TEST DWORD PTR [ESP+4], 1 ;Invoked from ring-3? JZ ReturnFromInterrupt ; no -> iret TEST DWORD PTR [ESP+8], 0x20000 ;Invoked from V86? JNZ ReturnFromInterrupt ; yes -> iret POP EDX ;ring-3_EIP ADD ESP, 8 ;remove imitation (CS and EFlags) POP ECX ;ring-3_ESP STI SYSEXIT ReturnFromInterrupt: IRETD (There is also KiServiceExit2 which is KiServiceExit without SYSEXIT stuff) ------------------------------------------------------------------------------ So we\'ve seen SYSEXIT but where is SYSENTER? Logically, it should be inside user-mode components. Int 0x2e is extensively used inside ntdll.dll, user32.dll, gdi32.dll, imm32.dll, winsrv.dll. But they don\'t contain SYSENTER nowadays. So what are the perspectives? I think future service packs or the next NT versions will contain 2 types of user DLLs: 1st for poor CPUs (standard Int 0x2e), 2nd for Pentium II+ CPUs (SYSENTER). Or there will be only one type of user DLL with something like: MOV EAX, NTCALLnumber LEA EDX, [ESP+4] TEST CPUfeatures, SupportsFastCall JE DoInt2e LEA ECX, SYSENTERhere SYSENTER DoInt2e: INT 0x2e SYSENTERhere: RET xxx If ECX will be used as I suggest I would add to KiFastCallEntry for sure: ;... CMP ECX, MmUserProbeAddress JAE ThrowAccessViolation ;... What can cause difficulties is SYSENTER from V86 mode. ------------------------------------------------------------------------------ Hooking KiFastCall will not be as simple as hooking KiSystemService: kernel-mode tools will have to read/write to MSRs or will have to overwrite KiFastCallEntry\'s begin (with INT 3, JMP, ...). ------------------------------------------------------------------------------ EliCZ, Jan-25-2000 |
|
48楼#
发布于:2002-06-29 17:01
for pjf, this is xp output...
================ Sat Jun 29 17:31:13 2002 :u ntdll!zwopenprocess ntdll!NtOpenProcess 001B:77F7EB53 MOV EAX,0000007A 001B:77F7EB58 MOV EDX,7FFE0300 001B:77F7EB5D CALL EDX 001B:77F7EB5F RET 0010 001B:77F7EB62 NOP :u zwopenprocess ntoskrnl!ZwOpenProcess 0008:8050B7EE MOV EAX,0000007A 0008:8050B7F3 LEA EDX,[ESP+04] 0008:8050B7F7 PUSHFD 0008:8050B7F8 PUSH 08 0008:8050B7FA CALL 804D4DCD @@@@@, hoho.pjf, what i seen, int 2e entry is 804D4DCD 0008:8050B7FF RET 0010 :idt 2e Int Type Sel:Offset Attributes Symbol/Owner 002E IntG32 0008:804D4DCD DPL=3 P ntoskrnl!KeInitializeInterrupt+09B8 @@@@@, hoho.pjf, what i have seen!!! int 2e entry is 804D4DCD :u 7FFE0300 l 100 0008:7FFE0300 MOV EDX,ESP 0008:7FFE0302 SYSENTER 0008:7FFE0304 RET 0008:7FFE0305 PUSHFD 0008:7FFE0306 OR DWORD PTR [ESP],00000100 0008:7FFE030D POPFD 0008:7FFE030E RET 0008:7FFE030F MOV EDX,ESP 0008:7FFE0311 SYSCALL 0008:7FFE0313 RET 0008:7FFE0314 NOP 0008:7FFE0315 PUSHFD 0008:7FFE0316 OR DWORD PTR [ESP],00000100 0008:7FFE031D POPFD 0008:7FFE031E RET 0008:7FFE031F INC DWORD PTR [EAX] .... :g |
|
49楼#
发布于:2002-06-29 17:45
ZwQuerySystemInformation就可以得到系统模块的地址了
|
|
|
50楼#
发布于:2002-06-30 07:40
非常感谢zdhe兄 :D
以前由你copy的代码 PUSHFD PUSH 08 CALL 804D4DCD 猜测这段代码是模仿一个软自陷,却没证据说明模仿的是int2e,现在总算确认了。早应请你copy出IDT的2e项呀,白疑惑了好久。呵呵 上面第一篇的内容与原先猜测的大致相同,只是我认为安装系统时就可确认使用int或sysenter,因此不必像他猜的那样运行时确认,白费掉几条指令。其实我一直想知道的就是int2e的处理程序了,我怕XP上的实现就是返回一个“未实现”给我们,呵呵。第二贴让我乐了一阵,3x :) 对了,原先那问题搞定了吗?我一直奇怪你哪儿为何蓝屏。我试过ZwProtectVirtualMemory,返回是SUUCESS(0)。环境有什么不同吗? |
|
51楼#
发布于:2002-06-30 07:47
ZwQuerySystemInformation就可以得到系统模块的地址了 hehe,大家对NativeAPI应该很熟了吧。 你没看花猫贴的贴子,他是要自己定位内核函数,他的想法是先暴力搜索得到模块基址再从导出表搜函数地址(比如Zw*)。 |
|
52楼#
发布于:2002-06-30 08:04
花猫,至少有两种方法可以取代暴力搜索,等此站好了再聊聊。
|
|
53楼#
发布于:2002-07-01 09:44
花猫,至少有两种方法可以取代暴力搜索,等此站好了再聊聊。 大兄弟,int 2e真的不行 知道为什么我不研究PII甚至PIII的指令吗?我就是想写出的代码跨平台性好。 大兄弟,你地,明白? |
|
|
54楼#
发布于:2002-07-01 10:14
[quote]花猫,至少有两种方法可以取代暴力搜索,等此站好了再聊聊。 大兄弟,int 2e真的不行 知道为什么我不研究PII甚至PIII的指令吗?我就是想写出的代码跨平台性好。 大兄弟,你地,明白? [/quote] 急啥?我什么都还没说呢,呵呵 发给你了,收件箱。 |
|
55楼#
发布于:2002-07-01 10:21
贴一下吧
|
|
|
56楼#
发布于:2002-07-01 11:16
贴一下吧 发出去了,没存 也没几句话 |
|
上一页
下一页