Skip to content

actboy168/ffi_hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ffi hook

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

local ffi = require 'ffi'
local hk = require 'hook'

hk.initialize(ffi.new)

function ffi.hook(target, detour)
    return hk.install(target, detour)
end

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

local hookMessageBoxA 
hookMessageBoxA = ffi.hook(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