Int 2Ah - KiGetTickCount

Int 2Ah - KiGetTickCount
ReWolf^HTB
http://www.rewolf.prv.pl



Date: 16.III.2007


I. BACKGROUND

Everybody knows that GetTickCount is often used as anti-debug trick,
also everybody has patched that function. There is ring0 equivalent
called KiGetTickCount... but we can call it from user mode.


II. DESCRIPTION

KiGetTickCount is not exported by ntoskrnl.exe, it is part of
_BBT_Exclude_Trap_Code_Begin. However it is interrupt 2Ah handler, which
we can call from usermode.


    kd> !idt 2a
    Dumping IDT:
    2a:    804deb92 nt!KiGetTickCount


    nt!KiGetTickCount:
    804deb92  cmp    dword ptr [esp+4],1Bh
    804deb97  jne    nt!KiGetTickCount+0x19 (804debab)
    804deb99  mov    eax,dword ptr cs:[nt!KeTickCount (80551280)]
    804deb9f  mul    eax,dword ptr cs:[nt!ExpTickCountMultiplier (805617bc)]
    804deba6  shrd   eax,edx,18h
    804debaa  iretd

Body of KiGetTickCount is almost identical to GetTickCount. Now if you
want to measure code execution time use int 2Ah instead of GetTickCount.

Int 2Ah returns "the number of milliseconds that have elapsed since
the system was started" in eax register, it also modifies edx register.

tested on Windows XP Pro sp2


III. END

comments, suggestions, job opportunities: rewolf@poczta.onet.pl
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值