static
CFPropertyListRef (*orig_MGCopyAnswer_internal)(CFStringRef prop, uint32_t* outTypeCode);
CFPropertyListRef new_MGCopyAnswer_internal(CFStringRef prop, uint32_t* outTypeCode) {
return
orig_MGCopyAnswer_internal(prop, outTypeCode);
}
extern
"C"
MGCopyAnswer(CFStringRef prop);
static
CFPropertyListRef (*orig_MGCopyAnswer)(CFStringRef prop);
CFPropertyListRef new_MGCopyAnswer(CFStringRef prop) {
return
orig_MGCopyAnswer(prop);
}
%ctor {
uint8_t MGCopyAnswer_arm64_impl[8] = {0x01, 0x00, 0x80, 0xd2, 0x01, 0x00, 0x00, 0x14};
const
uint8_t* MGCopyAnswer_ptr = (
const
uint8_t*) MGCopyAnswer;
if
(
memcmp
(MGCopyAnswer_ptr, MGCopyAnswer_arm64_impl, 8) == 0) {
MSHookFunction(MGCopyAnswer_ptr + 8, (
void
*)new_MGCopyAnswer_internal, (
void
**)&orig_MGCopyAnswer_internal);
}
else
{
MSHookFunction(MGCopyAnswer_ptr, (
void
*)new_MGCopyAnswer, (
void
**)&orig_MGCopyAnswer);
}
}