apihooks code