extern "C"
typedef
NTSYSCALLAPI NTSTATUS NTAPI Nt_GetContextThread ( __in HANDLE ThreadHandle,
__inout PCONTEXT ThreadContext
) ;
Nt_GetContextThread* _NtGetContextThread;
PEPROCESS eprocess_NtGetContextThread;
ANSI_STRING Ansi_NtGetContextThread;
ANSI_STRING Ansi_NtGetContextThread1;
int in_res=0;
#pragma PAGEDCODE
extern "C"
NTSTATUS __stdcall MySSDT_NtGetContextThread ( __in HANDLE ThreadHandle,
__inout PCONTEXT ThreadContext
)
{
eprocess_NtGetContextThread=IoGetCurrentProcess();
RtlInitAnsiString(&Ansi_NtGetContextThread,(PCSZ)((ULONG)eprocess_NtGetContextThread+0x174));
RtlInitAnsiString(&Ansi_NtGetContextThread1,_Game_data);
int in_res=((NTSTATUS(NTAPI*)(HANDLE,PCONTEXT))_NtGetContextThread)(ThreadHandle,ThreadContext);
if(RtlCompareString(&Ansi_NtGetContextThread,&Ansi_NtGetContextThread1,TRUE)==0)
{
ThreadContext->Dr0=ThreadContext->Dr1=ThreadContext->Dr2=ThreadContext->Dr3=ThreadContext->Dr6=ThreadContext->Dr7=0;
}
return in_res;
}
#pragma INITCODE
VOID SSDT_NtGetConetxtThread()
{
ULONG* u_NtGetContextThread;
u_NtGetContextThread=Getsset_this(in_NtGetContextThread);
addrssdt_NtGetContextThread=Getssdt_addr(in_NtGetContextThread);
KdPrint(("当前NtGetContextThread的地址为:%x\n",addrssdt_NtGetContextThread));
_NtGetContextThread=(Nt_GetContextThread*)addrssdt_NtGetContextThread;
PAGED_Open();
*u_NtGetContextThread=(ULONG)MySSDT_NtGetContextThread;
PAGED_Exit();
}
#pragma PAGEDCODE
VOID UnHook_NtGetContextThread()
{
ULONG u_NtGetContextThread;
u_NtGetContextThread=(ULONG)KeServiceDescriptorTable->ServiceTableBase+in_NtGetContextThread*4;
PAGED_Open();
*((ULONG*)u_NtGetContextThread)=addrssdt_NtGetContextThread;
PAGED_Exit();
}
//------------------------------------------------------------------------------------------
jmp_code jmp_NtSetInformationThread;
pjmp_code pjmp_NtSetInformationThread;
#pragma INITCODE
VOID inline_NtSetInformationThread()
{
addr_NtSetInformationThread_inline=Getssdt_addr(in_NtSetInformationThread);
jmp_NtSetInformationThread_inline=addr_NtSetInformationThread_inline+5;
ULONG u_long;
__asm
{
push eax
mov eax,inlineMy_NtSetInformationThread
mov u_long,eax
pop eax
}
pjmp_NtSetInformationThread=(pjmp_code)addr_NtSetInformationThread_inline;
jmp_NtSetInformationThread.E9=pjmp_NtSetInformationThread->E9;
jmp_NtSetInformationThread.Fun_addr=pjmp_NtSetInformationThread->Fun_addr;
PAGED_Open();
pjmp_NtSetInformationThread->E9=0xE9;
pjmp_NtSetInformationThread->Fun_addr=(ULONG)(u_long-addr_NtSetInformationThread_inline-5);
PAGED_Exit();
}
ULONG u_esp;
#pragma PAGEDCODE
VOID __declspec(naked) inlineMy_NtSetInformationThread()
{
__asm
{
mov u_esp,esp
pushad
pushfd
mov eax,u_esp
mov eax,[eax+8]
cmp eax,0x11
jnz __break;
popfd
popad
xor eax,eax
ret
__break:
popfd
popad
push 0D0h
jmp jmp_NtSetInformationThread_inline
}
}
#pragma PAGEDCODE
VOID inlineUn_NtSetInformationThread()
{
PAGED_Open();
pjmp_NtSetInformationThread->E9=jmp_NtSetInformationThread.E9;
pjmp_NtSetInformationThread->Fun_addr=jmp_NtSetInformationThread.Fun_addr;
PAGED_Exit();
}
//--------------------------------------------------------------
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课