Skip to content

Instantly share code, notes, and snippets.

View xrombar's full-sized avatar
👾
Vibing

bakki xrombar

👾
Vibing
View GitHub Profile
@namazso
namazso / SuperReturn.c
Last active July 31, 2025 15:11
SuperReturn
/// Return, but across multiple frames.
///
/// This function unwinds the given number of frames, then sets the return value provided, emulating as if this number
/// of functions returned, with the last one returning the value provided in RetVal. Can be used to hook a callee when
/// you don't have a convenient way to hook it directly and actually just want to stub it out with a return value.
///
/// @param FramesToSkip The number of frames to skip, starting from the current frame.
/// @param RetVal The value to return from the last frame.
/// @param Context Context to start from, in case you want to SuperReturn from somewhere deeper.
DECLSPEC_NOINLINE void SuperReturn(