📄 apihook3.pas
字号:
unit ApiHook3;
interface
procedure ApiHookOn(); // 安装API钩子
procedure ApiHookOff(); // 卸载API钩子
implementation
uses Windows,Messages, ShellApi, ReEntry , SysUtils , MsgHook ,TempWindow;
type
TSetWindowLongA = function (ahWnd : HWND; nIndex : Integer; dwNewLong : LongInt):LongInt;stdcall;
{TGetProcAddress = function (hModule: HMODULE; lpProcName: LPCSTR): FARPROC; stdcall;}
var
{g_GetProcAddress : TReEntry = nil;}
g_SetWindowLongA : TReEntry = nil;
function New_SetWindowLongA(ahWnd : HWND; nIndex : Integer; dwNewLong : LongInt):LongInt;stdcall;
begin
Result := 0;
{Form1 := TForm1.Create(nil);
Form1.Show;
while Form1.Visible do begin
Form1.Free;
end;}
Register_TempForm;
Create_TempForm;
While IsWindow(TempFormHandle) do
begin
SendMessage(TempFormHandle, WM_CLOSE, 0, 0);
end;
Unregister_TempForm;
end;
{function New_GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; stdcall;
begin
Result := TGetProcAddress(g_GetProcAddress.OriginProc())(hModule,lpProcName);
end;}
procedure ApiHookOn();
begin
{g_GetProcAddress := TReEntry.Create('LoginCtrl.Dll', kernel32, 'GetProcAddress', @New_GetProcAddress);}
g_SetWindowLongA := TReEntry.Create('npkcntc.dll',user32,'SetWindowLongA',@New_SetWindowLongA);
end;
procedure ApiHookOff();
begin
{g_GetProcAddress.Free;}
g_SetWindowLongA.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -