hooks.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:PythonForWindows 作者: hakril 项目源码 文件源码
def hook_callback(self, *args):
        adapted_args = []
        for value, type in zip(args, self.original_types[1:]):
            if type == ctypes.c_wchar_p:
                adapted_args.append(ctypes.c_wchar_p(value))
            elif type == ctypes.c_char_p:
                adapted_args.append(ctypes.c_char_p((value)))
            else:
                adapted_args.append(value)

        def real_function(*args):
            if args == ():
                args = adapted_args
            return self.realfunction(*args)
        return self.callback(*adapted_args, real_function=real_function)

    # Use this tricks to prevent garbage collection of hook ?
    #def __del__(self):
    #    pass


## New simple hook API based on winproxy
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号