WOW, Makslane... you have just automated the registration process at Handango and PocketGear!! Thank you so much!!
The code was initially created for Palm users, so they were the ones who came up with that obnoxious RegCode hexadecimal string separated by colons and ended with a hex checksum. Handango and PocketGear no longer use that, so I took what common sense I had and hacked the code as necessary:
Increased the stack max size to 100 from 30, to accomodate longer names
#define STACK_MAX_SIZE 100
Increased the PUN string to 100 characters (never should get that long, but there's no limit on Handango on PocketGear, so 100 should be fair):
static char PUN[100];
And just pulled the Registration name (first-100 characters):
char *GetUnlockKey(char *rpn, char *reg_code)
{
char i;
static char keyString[6];
rpn_error[0] = 0;
strcpy(RPNString, rpn);
strncpy(PUN, reg_code,100); This line modified.
/* Parse input and compute Unlock key */
ParseRPNString();
// ComputePUNFromRegCode(RegCode); This line removed/remarked out.
unlockKey = ComputeUnlockKey(PUN/*, stackOperators*/);
/* Return Results */
FormatKey(unlockKey, keyString);
if(rpn_error[0]) return "";
return keyString;
}
Now, all one has to do is:
- Code: Select all
actualcode = strcpy(text, GetUnlockKey("i 0 == 111 * key + c 2 * +","Will P");
if (actualcode == codeenteredbyuser) registered=1;
AWESOME!