• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Delphi修改窗口类名(HookAPI)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
program Project1;

uses
  Forms,
  Windows,
  Messages,
  SysUtils,
  Variants,
  Classes,
  Graphics,
  Controls,
  Dialogs,
  Unit1 in 'Unit1.pas' {Form1};

function GetClassInfoA1(x: Integer;y:Integer;j:Integer): Integer; stdcall; external 'user32.dll' name 'GetClassInfoA'; function RtlMoveMemory1(x: Integer;y:Pointer;j:Integer): Integer; stdcall; external 'kernel32.dll' name 'RtlMoveMemory'; var j_apidizhi,j_old:Pointer; jmt: array[1..8] of Byte; ent: array[1..8] of Byte; j_ls:LongWord; {$R *.res} function MyGetClassInfoA(hWnd:Integer;lpText: Integer;uType:Integer): Integer; stdcall; var myclassname:array[0..254] of char; jack:Integer; begin CopyMemory(j_apidizhi, @ent, 8); CopyMemory(@myclassname,Pointer(lptext),6); if myclassname='TForm1' then begin myclassname:='hgorj3'; RtlMoveMemory1(lpText,@myclassname,6); end; jack:=GetClassInfoA1(hWnd,lpText,uType); asm pushad mov eax,j_apidizhi mov byte [eax],$B8 add eax,1 mov ebx,j_ls mov [eax],ebx add eax,4 mov byte [eax],$FF add eax,1 mov byte [eax],$E0 popad end; Result:=jack; end; begin j_apidizhi:=GetProcAddress(GetModuleHandle('user32.dll'),'GetClassInfoA'); VirtualProtect(j_apidizhi,8,64,j_old); CopyMemory(@ent, j_apidizhi, 8); //保存原指令 j_ls:=LongWord(@MyGetClassInfoA); //jmt[1]:=$e9; //jmt[2]= //Pinteger(@jmt[2])^:=MyGetClassInfoA; //CopyMemory(@jmt[2], @MyGetClassInfoA, 4); asm pushad mov eax,j_apidizhi mov byte [eax],$B8 add eax,1 mov ebx,j_ls mov [eax],ebx add eax,4 mov byte [eax],$FF add eax,1 mov byte [eax],$E0 popad end; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end.

关于D的指针和内存操作还不熟练 特别是D好象没有字节集操作的概念  象易的到字节集 写到内存 指针到字节集这三个函数没有 操作不便 以待更加深入学习

关于apihook 最简单的mov eax,子程序 / jmp eax 方式 也暂时没有考虑多线程的问题


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi窗体函数GetWindow发布时间:2022-07-18
下一篇:
Delphi公用函数单元发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap