| 94 | self.entry.enabled = True |
| 95 | |
| 96 | def hook_callback(self, *args): |
| 97 | adapted_args = [] |
| 98 | for value, type in zip(args, self.original_types[1:]): |
| 99 | if type == ctypes.c_wchar_p: |
| 100 | adapted_args.append(ctypes.c_wchar_p(value)) |
| 101 | elif type == ctypes.c_char_p: |
| 102 | adapted_args.append(ctypes.c_char_p((value))) |
| 103 | else: |
| 104 | adapted_args.append(value) |
| 105 | |
| 106 | def real_function(*args): |
| 107 | if args == (): |
| 108 | args = adapted_args |
| 109 | return self.realfunction(*args) |
| 110 | return self.callback(*adapted_args, real_function=real_function) |
| 111 | |
| 112 | ## New simple hook API based on winproxy |
| 113 | def setup_hook(target, hook, dll_to_hook): |