写一段汇编,在这个汇编里生成一个函数指针表,然后在C语言里使用这个表:
.686P
.MODEL FLAT,c
public _SysguardDispatch
.CODE
_SysguardDispatch:
hook macro syscall:REQ
LOCAL lbl;;
.CODE
lbl:
mov eax , syscall
jmp DWORD PTR _SysguardDispatch
;;函数指针表
.DATA
dd lbl
endm
num = 0
WHILE num LE 10
hook(num)
num = num + 1
ENDM
END
问题是如何导出这个函数指针表呢?
------解决方案--------------------
; 也许可以这样吧
.686P
.MODEL FLAT,c
option casemap:none
public _SysguardDispatch
.data
arPtrs label dword
forc i, 0123456789
dd lbl&i
endm
.CODE
forc x, 0123456789
lbl&x:
mov eax, x
jmp dword ptr _SysguardDispatch
endm
_SysguardDispatch:
; your dispatch code here
END