lazarus 使用微软detour库 delphi
作者:互联网
导出函数供lazarus使用
function DetourAttach( ppPtr:DWORD;pDetour:DWORD):DWORD;stdcall; external 'mydetour' name 'DetourAttach'; function DetourTransactionBegin():DWORD;stdcall; external 'mydetour' name 'DetourTransactionBegin'; function DetourTransactionCommit():DWORD;stdcall; external 'mydetour' name 'DetourTransactionCommit'; function DetourUpdateThread(hd:HANDLE):DWORD;stdcall; external 'mydetour' name 'DetourUpdateThread'; function DetourDetach(ppPtr:DWORD;pDetour:DWORD):DWORD;stdcall; external 'mydetour' name 'DetourDetach';
function hook( ppPtr:DWORD;pDetour:DWORD):DWORD; begin DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); Result:=DetourAttach(ppPtr,pDetour); DetourTransactionCommit(); end; hook(DWORD(@@TrampolineMessageBox),DWORD(@InterceptMessageBox)); TrampolineMessageBox是函数指针,指向messagebox InterceptMessageBox是伪造函数 本人对delphi不熟,在dephi中 对函数指针 @@TrampolineMessageBox 意思是取函数指针地址 对函数指针来说,messagebox和@messagebox好像是一个意思
标签:function,mydetour,name,delphi,detour,lazarus,external,stdcall,DWORD 来源: https://www.cnblogs.com/fply/p/14334487.html