⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thunk.pas

📁 Delphi写的屏幕取词程序
💻 PAS
字号:
unit thunk;

interface

{function SetGDIHook: WORD;
function UnSetGDIHook:word;}
implementation

uses SysUtils, Windows;

{ Undocumented Kernel32 calls. }
{function LoadLibrary16(LibraryName: PChar): THandle; stdcall; external kernel32 index 35;
procedure FreeLibrary16(HInstance: THandle); stdcall; external kernel32 index 36;
function GetProcAddress16(Hinstance: THandle; ProcName: PChar): Pointer; stdcall; external kernel32 index 37;
procedure QT_Thunk; cdecl; external kernel32 name 'QT_Thunk';
var
  hInst16: THandle; {}
{  pFunc: Pointer; {函数指针}
{ QT_Thunk 需要堆栈}
{$StackFrames On}

{function SetGDIHook: WORD;
var
  ThunkTrash: array[0..$20] of Word;
begin
 ThunkTrash[0] := hInst16;
  hInst16 := LoadLibrary16('PROJECT1.DLL');
  if hInst16 < 32 then
    raise Exception.Create('不能载入Project1.DLL');
  pFunc := GetProcAddress16(hInst16, 'TextHookCreate');
  if pFunc = nil then
    raise Exception.Create('不能获取函数TextHookCreate的地址');
  asm
    mov edx, pFunc     { 载入16-bit过程指针 }
 {   call QT_Thunk     {调用替换程序 }
  {  mov Result, ax    { 保存结果}
{  end;
  FreeLibrary16(hInst16);
end;
function UnSetGDIHook: WORD;
var
  ThunkTrash: array[0..$20] of Word;
begin
  ThunkTrash[0] := hInst16;
  hInst16 := LoadLibrary16('PROJECT1.DLL');
  if hInst16 < 32 then
    raise Exception.Create('不能载入Project1.DLL');
  pFunc := GetProcAddress16(hInst16, 'TextHookFree');
  if pFunc = nil then
    raise Exception.Create('不能获取函数TextHookCreate的地址');
  asm
    mov edx, pFunc     { 载入16-bit过程指针 }
 {   call QT_Thunk     {调用替换程序 }
  {  mov Result, ax    { 保存结果}
{  end;
  FreeLibrary16(hInst16);
end;}

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -