All pastes #709008 Raw Edit

Miscellany

public text v1 · immutable
#709008 ·published 2007-09-24 08:21 UTC
rendered paste body
/* External */
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>

static void * (*CTCallDialWithIDOrig)(void *p, int contact_id,
				      unsigned char contact_type, void * x1, void * x2) = NULL;

void * CTCallDialWithID(void *p, int contact_id,
			unsigned char contact_type, void * x1, void * x2)
{
  void * status = 0;

  /* Get the original symbol, you need to link this against CoreTelephony for it to work */
  if (CTCallDialWithIDOrig == NULL)
    CTCallDialWithIDOrig = dlsym(RTLD_NEXT, "CTCallDialWithID");

  /*
    Go FUNKY here !
   */

  /* Call original symbol*/
  status = CTCallDialWithIDOrig(p, contact_id, contact_type, x1, x2);
  return status;
}