I’m trying to hook the BTServer (MobileBluetooth.framework), with the help of this reversed engineered header:
https://code.google.com/p/iphone-bluetooth/source/browse/btGpsServer/MobileBluetooth.h?name=experimental
This is my target method:
int BTDeviceConnectServices(BTDEVICE device, int services);
And this is my code
int (*oldBTDeviceConnectServices)(BTDEVICE device, int services);
int newBTDeviceConnectServices(BTDEVICE device, int services){
printf("hooked!");
return oldBTDeviceConnectServices(device,services);
}
%ctor{
MSHookFunction(&BTDeviceConnectServices, &newBTDeviceConnectServices, &oldBTDeviceConnectServices);
}
.
But it couldn’t compile ;(
Making all for tweak Alerting... Linking tweak Alerting... Undefined symbols for architecture armv7: "_BTDeviceConnectServices", referenced from: _logosLocalCtor_8b131269() in Tweak.xm.8f96d575.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Have no idea on hooking C++ function, would be great if anyone could give some hints