Skip to content

ikuncs2/ffi_hook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ffi hook

这是一个借助cffi实现的inline hook库。这是一个简单的例子

local ffi = require 'ffi'
local ffi_hook = require 'ffi_hook'

ffi_hook.set_ffi(ffi)

ffi.cdef [[
    int __stdcall MessageBoxA(int hWnd, const char* lpText, const char* lpCaption, unsigned int uType);
]]

local hookMessageBoxA 
hookMessageBoxA = ffi_hook.inline(ffi.C.MessageBoxA, function(hwnd, text, title, type)
    return hookMessageBoxA(hwnd, 'Hello ' .. ffi.string(text), ffi.string(title), type)
end)
ffi.C.MessageBoxA(0, 'Test', 'Title', 0)
hookMessageBoxA:remove()
ffi.C.MessageBoxA(0, 'Test', 'Title', 0)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.9%
  • CMake 8.1%