If anybody who knows RegCode wants to help me out... please do...
Presently when I run my app the first time after it's installed onto my
physical Palm, it tells me it's registered. It's not until I go to the
launcher and start my app a second time does it tell me I have the
unregistered version.
Below is some code I pulled from the RegCode SDK. If there is no preferences
resource found, does that mean that "name" is just a null pointer that
causes regCode() to return garbage? Well, it looks like on my handheld the
first time I run my unregistered app, EvalKey likes what it sees in that
garbage because it returns registered == true.
I'm using the plain vanilla algorithm where you just sum the ascii values of
the PUN.
/***************************************************************************
**
* static Err AppStart(void)
* Reads preferences database for this app. Checks to see if the key stored
* there matches the RegCode, and sets global "registered" variable
accordingly.
****************************************************************************
*/
static Err AppStart(void)
{
Word prefsSize;
char name[dlkUserNameBufSize],*data;
// Read the saved preferences / saved-state information.
prefsSize = sizeof(PreferenceType);
if (PrefGetAppPreferences(appFileCreator, appPrefID, &prefs,
&prefsSize, true) != noPreferenceFound) {
DlkGetSyncInfo(NULL, NULL, NULL, name, NULL, NULL);
if(!name[0]) {
StrCopy(name, "Emulator");
}
data = regCode((unsigned char *)name, 1);
registered = EvalKey(prefs.key, data);
// Then I start doing some stuff...
.... open databases
.... go to startup form
}
return 0;
}