Go 1.2 binding compatibility

This commit is contained in:
Ryan Hileman 2015-10-25 04:32:56 -07:00
parent 9cd7e2fbf6
commit 715d5c3557

View file

@ -19,43 +19,43 @@ type HookData struct {
type Hook uint64 type Hook uint64
//export hookCode //export hookCode
func hookCode(handle *C.uc_engine, addr uint64, size uint32, user unsafe.Pointer) { func hookCode(handle unsafe.Pointer, addr uint64, size uint32, user unsafe.Pointer) {
hook := (*HookData)(user) hook := (*HookData)(user)
hook.Callback.(func(Unicorn, uint64, uint32))(hook.Uc, uint64(addr), uint32(size)) hook.Callback.(func(Unicorn, uint64, uint32))(hook.Uc, uint64(addr), uint32(size))
} }
//export hookMemInvalid //export hookMemInvalid
func hookMemInvalid(handle *C.uc_engine, typ C.uc_mem_type, addr uint64, size int, value int64, user unsafe.Pointer) bool { func hookMemInvalid(handle unsafe.Pointer, typ C.uc_mem_type, addr uint64, size int, value int64, user unsafe.Pointer) bool {
hook := (*HookData)(user) hook := (*HookData)(user)
return hook.Callback.(func(Unicorn, int, uint64, int, int64) bool)(hook.Uc, int(typ), addr, size, value) return hook.Callback.(func(Unicorn, int, uint64, int, int64) bool)(hook.Uc, int(typ), addr, size, value)
} }
//export hookMemAccess //export hookMemAccess
func hookMemAccess(handle *C.uc_engine, typ C.uc_mem_type, addr uint64, size int, value int64, user unsafe.Pointer) { func hookMemAccess(handle unsafe.Pointer, typ C.uc_mem_type, addr uint64, size int, value int64, user unsafe.Pointer) {
hook := (*HookData)(user) hook := (*HookData)(user)
hook.Callback.(func(Unicorn, int, uint64, int, int64))(hook.Uc, int(typ), addr, size, value) hook.Callback.(func(Unicorn, int, uint64, int, int64))(hook.Uc, int(typ), addr, size, value)
} }
//export hookInterrupt //export hookInterrupt
func hookInterrupt(handle *C.uc_engine, intno uint32, user unsafe.Pointer) { func hookInterrupt(handle unsafe.Pointer, intno uint32, user unsafe.Pointer) {
hook := (*HookData)(user) hook := (*HookData)(user)
hook.Callback.(func(Unicorn, uint32))(hook.Uc, intno) hook.Callback.(func(Unicorn, uint32))(hook.Uc, intno)
} }
//export hookX86In //export hookX86In
func hookX86In(handle *C.uc_engine, port, size uint32, user unsafe.Pointer) uint32 { func hookX86In(handle unsafe.Pointer, port, size uint32, user unsafe.Pointer) uint32 {
hook := (*HookData)(user) hook := (*HookData)(user)
return hook.Callback.(func(Unicorn, uint32, uint32) uint32)(hook.Uc, port, size) return hook.Callback.(func(Unicorn, uint32, uint32) uint32)(hook.Uc, port, size)
} }
//export hookX86Out //export hookX86Out
func hookX86Out(handle *C.uc_engine, port, size, value uint32, user unsafe.Pointer) { func hookX86Out(handle unsafe.Pointer, port, size, value uint32, user unsafe.Pointer) {
hook := (*HookData)(user) hook := (*HookData)(user)
hook.Callback.(func(Unicorn, uint32, uint32, uint32))(hook.Uc, port, size, value) hook.Callback.(func(Unicorn, uint32, uint32, uint32))(hook.Uc, port, size, value)
} }
//export hookX86Syscall //export hookX86Syscall
func hookX86Syscall(handle *C.uc_engine, user unsafe.Pointer) { func hookX86Syscall(handle unsafe.Pointer, user unsafe.Pointer) {
hook := (*HookData)(user) hook := (*HookData)(user)
hook.Callback.(func(Unicorn))(hook.Uc) hook.Callback.(func(Unicorn))(hook.Uc)
} }