首页
社区
课程
招聘
[求助]delphi版的FindShadowTable的更正
发表于: 2008-11-26 11:25 4233

[求助]delphi版的FindShadowTable的更正

2008-11-26 11:25
4233
function IsShadowTable(cs1:ULONG):boolean;
var
I:integer;
lppp:ULONG;
begin
lppp:= ULONG(GetImportFunAddr(@KeServiceDescriptorTable));
result:=True;
for I:=0 To 15 do
begin
  if byte(pointer(cs1+I)^)<>byte(pointer(lppp+I)^) then
  begin
  Result:=false;
  break;
  end;
end;
end;

function FindShadowTable2:Pointer;
var
cPtr, pOpcode:ULONG;
cPtr2, pOpcode2:ULONG;
I:ULONG;
begin
  Result:=nil;
  cPtr:=ULONG(GetImportFunAddr(@KeAddSystemServiceTable));
  cPtr2:=ULONG(GetImportFunAddr(@KeServiceDescriptorTable));
  I:=cPtr;
  While (I<(cPtr+$1000)) Do
  begin
    if MmIsAddressValid(Pointer(I)) then
    begin
      if IsShadowTable(I) then
      begin
       Result:=Pointer(I);
       DbgPrint('%08x',Result);
      end;
    end;
    I:=I+1;
  end;
end;

首先申明 该写法是错误的 但是我不知道错在哪里 请熟悉delphi的大哥 更正

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 193
活跃值: (26)
能力值: ( LV9,RANK:210 )
在线值:
发帖
回帖
粉丝
2
自己解决了
function FindShadowTable2:Pointer;
var
cPtr, pOpcode:ULONG;
cPtr2, pOpcode2:ULONG;
I:ULONG;
begin
  Result:=nil;
  cPtr:=ULONG(GetImportFunAddr(@KeAddSystemServiceTable));
  DbgPrint('cPtr %08x',cPtr);
  cPtr2:=ULONG(GetImportFunAddr(@KeServiceDescriptorTable));
  DbgPrint('cPtr2 %08x',cPtr2);
  I:=cPtr;
  While (I<(cPtr+$1000)) Do
  begin
    if MmIsAddressValid(Pointer(I)) then
    begin
      if word(pointer(I)^)=$888d then
      begin
       Result:=PPointer(I+2)^;
       DbgPrint('good %08x',Result);
       break
      end;
    end;
    I:=I+1;
  end;
end;

XP版可以直接硬编码
function FindShadowTable:Pointer;
var
lpKeServiceDescriptorTable:ULONG;
begin
lpKeServiceDescriptorTable := ULONG(GetImportFunAddr(@KeServiceDescriptorTable));
Result:=Pointer(lpKeServiceDescriptorTable-$40);
end;
2008-11-26 12:13
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
菜鸟一个,看不懂这个是干什么用的
2008-11-27 09:21
0
游客
登录 | 注册 方可回帖
返回