能力值:
( LV9,RANK:610 )
|
-
-
2 楼
先看到很多函数原型都不对
|
能力值:
( LV5,RANK:60 )
|
-
-
3 楼
改完也得蓝
|
能力值:
( LV5,RANK:70 )
|
-
-
4 楼
哪儿不对,就说出来吧,反正我们都是在学习…
|
能力值:
( LV12,RANK:1010 )
|
-
-
5 楼
哪里都不对,
|
能力值:
( LV3,RANK:20 )
|
-
-
6 楼
哈哈真牛比~~
把NtOpenProcess的原型声明对吧
你要HOOK的代理函数也需要和原函数原型一样
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
可以参考下
堕落天才
的
代码
#include<ntddk.h>
typedef struct _SERVICE_DESCRIPTOR_TABLE
{
PVOID ServiceTableBase;
PULONG ServiceCounterTableBase;
ULONG NumberOfService;
ULONG ParamTableBase;
}SERVICE_DESCRIPTOR_TABLE,*PSERVICE_DESCRIPTOR_TABLE; //由于KeServiceDescriptorTable只有一项,这里就简单点了
extern PSERVICE_DESCRIPTOR_TABLE KeServiceDescriptorTable;//KeServiceDescriptorTable为导出函数
/////////////////////////////////////
VOID Hook();
VOID Unhook();
VOID OnUnload(IN PDRIVER_OBJECT DriverObject);
//////////////////////////////////////
ULONG JmpAddress;//跳转到NtOpenProcess里的地址
ULONG OldServiceAddress;//原来NtOpenProcess的服务地址
//////////////////////////////////////
__declspec(naked) NTSTATUS __stdcall MyNtOpenProcess(PHANDLE ProcessHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PCLIENT_ID ClientId)
{
DbgPrint("NtOpenProcess() called");
__asm{
push 0C4h
push 804eb560h //共十个字节
jmp [JmpAddress]
}
}
///////////////////////////////////////////////////
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath)
{
DriverObject->DriverUnload = OnUnload;
DbgPrint("Unhooker load");
Hook();
return STATUS_SUCCESS;
}
/////////////////////////////////////////////////////
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
DbgPrint("Unhooker unload!");
Unhook();
}
/////////////////////////////////////////////////////
VOID Hook()
{
ULONG Address;
Address = (ULONG)KeServiceDescriptorTable->ServiceTableBase + 0x7A * 4;//0x7A为NtOpenProcess服务ID
DbgPrint("Address:0x%08X",Address);
OldServiceAddress = *(ULONG*)Address;//保存原来NtOpenProcess的地址
DbgPrint("OldServiceAddress:0x%08X",OldServiceAddress);
DbgPrint("MyNtOpenProcess:0x%08X",MyNtOpenProcess);
JmpAddress = (ULONG)NtOpenProcess + 10; //跳转到NtOpenProcess函数头+10的地方,这样在其前面写的JMP都失效了
DbgPrint("JmpAddress:0x%08X",JmpAddress);
__asm{//去掉内存保护
cli
mov eax,cr0
and eax,not 10000h
mov cr0,eax
}
*((ULONG*)Address) = (ULONG)MyNtOpenProcess;//HOOK SSDT
__asm{//恢复内存保护
mov eax,cr0
or eax,10000h
mov cr0,eax
sti
}
}
//////////////////////////////////////////////////////
VOID Unhook()
{
ULONG Address;
Address = (ULONG)KeServiceDescriptorTable->ServiceTableBase + 0x7A * 4;//查找SSDT
__asm{
cli
mov eax,cr0
and eax,not 10000h
mov cr0,eax
}
*((ULONG*)Address) = (ULONG)OldServiceAddress;//还原SSDT
__asm{
mov eax,cr0
or eax,10000h
mov cr0,eax
sti
}
DbgPrint("Unhook");
}
|
能力值:
( LV3,RANK:30 )
|
-
-
8 楼
楼主ring3 inline hook 估计都没玩熟。。。
代理函数那边,参数有很多都不对!
|
能力值:
( LV5,RANK:70 )
|
-
-
9 楼
还是不行
提示:error LNK2001: unresolved external symbol "struct _SERVICE_DESCRIPTOR_TABLE * KeServiceDescriptorTable" (?KeServiceDescriptorTable@@3PAU_SERVICE_DESCRIPTOR_TABLE@@A)
|
能力值:
( LV2,RANK:10 )
|
-
-
10 楼
是我给你那代码?
DDK 2000 完全可以编译
|
能力值:
( LV6,RANK:90 )
|
-
-
11 楼
编译环境不对
|
能力值:
( LV2,RANK:10 )
|
-
-
12 楼
牛瓣......
|
能力值:
( LV6,RANK:90 )
|
-
-
13 楼
把cpp改C编译就会成功,堕落天使是用C写的,非cpp
|
|
|