MCPcopy Create free account
hub / github.com/qilingframework/qiling / __invoke_callback

Method __invoke_callback

qiling/os/windows/fiber.py:76–98  ·  view source on GitHub ↗
(self, fiber: Fiber)

Source from the content-addressed store, hash-verified

74
75 # TODO: this one is unused for now; see above
76 def __invoke_callback(self, fiber: Fiber):
77 assert fiber.cb is not None
78
79 # we are in an api hook. extract the return address of the free
80 # api to know where the callback should be returning to
81 retaddr = self.ql.stack_read(0)
82
83 # one PVOID arg, set to fiber data
84 args = ((PVOID, fiber.data),)
85
86 # set up call frame for callback
87 fcall = self.ql.os.fcall_select(CDECL)
88 fcall.call_native(fiber.cb, args, retaddr)
89
90 # callback has to be invoked before returning from the free api
91 self.ql.emu_start(fiber.cb, retaddr)
92
93 # unwind call frame
94 fcall.cc.unwind(len(args))
95
96 # ms64 cc needs also to unwind the reserved shadow slots on the stack
97 if self.ql.arch.type == QL_ARCH.X8664:
98 self.ql.arch.regs.arch_sp += (4 * self.ql.arch.pointersize)
99
100 def set(self, idx: int, data: int) -> bool:
101 if idx not in self.fibers:

Callers

nothing calls this directly

Calls 4

call_nativeMethod · 0.80
stack_readMethod · 0.45
emu_startMethod · 0.45
unwindMethod · 0.45

Tested by

no test coverage detected