-
-
[求助][求助]最近inline hook的时候怎么偶然出现这样的问题,忘知道的告知下原因
-
-
[求助][求助]最近inline hook的时候怎么偶然出现这样的问题,忘知道的告知下原因
最近写几个hook的代码,可是总是偶然出现第一个字节该不了的情况,望知道的告知原因。上图:
函数代码如下:
BOOLEAN RestoreHook( PVOID pHookAddress, PVOID OriCodeBuffer, DWORD dwLen )
{
if( MmIsAddressValid( pHookAddress ) )
{
KSPIN_LOCK SpinLock;
KIRQL OldIrq;
PMDL MemoryDescriptorList;
DWORD dwIrql = 0;
MapVirtualAddress( pHookAddress, dwLen, &MemoryDescriptorList );
if( (DWORD)KeGetCurrentIrql() < 2 )
{
KeInitializeSpinLock( &SpinLock );
KeAcquireSpinLock( &SpinLock, &OldIrq );
dwIrql = 1;
}
WPOFF();
memcpy( pHookAddress, OriCodeBuffer, dwLen );
WPON();
if( dwIrql == 1 )
KeReleaseSpinLock( &SpinLock, OldIrq );
if( MmIsAddressValid(MemoryDescriptorList) )
UnMapVirtualAddress( MemoryDescriptorList );
return TRUE;
}
return FALSE;
}
刚刚还运行的好好的,现在又不行了,真见鬼了
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课