I am trying to convert a integer to an address of a function pointer.
I want to encrypt the pointer and then do some validation, afterwards i
will decrpyt the pointer back to an address. Can this be done. Below
is some of my code.
typedef void (*funcptr)(void);
void tryme(void){};
void main()
{
char *buffer = new char[30];
// save address of tryme fuction into a string
itoa ( (unsigned int)(&tryme),buffer,16);
Encrypt(buffer);
//some code here
// retreive address tryme function
decryptbuffer = Decrypt(buffer);
unsigned int x = (unsigned int)atoi(decryptbuffer );
funcptr restoreFuncPtr = (funcptr)x; // convert int to funcptr
address
}
}