Hi..all.... i'm going to retrieve the palm serial number programmatically. i
found the code from the falch.net help file and it compiles smoothly.  But
when i run the program, it gives me the error: "The application just wrote
to memory location 0x00084A52, which is in the storage heap. In order to
protect the integrity of the user's data, such direct access is not allowed.
Instead, application should use special palm OS functions for this purpose"

The following code:

static void DrawSerialNumOrMessage(Int16 x, Int16 y, Char* noNumberMessage)
{
Char* bufP;
UInt16* bufLen;
Err retval;
Int16 count;
UInt8 checkSum;
Char checksumStr[2];


retval = SysGetROMToken (0, sysROMTokenSnum,(UInt8**) &bufP, bufLen);
if ((!retval) && (bufP) && ((UInt8) *bufP != 0xFF)) {
checkSum = 0;
for (count=0; count<*bufLen; count++)
{
checkSum += bufP[count];
checkSum = (checkSum<<1) | ((checkSum & 0x80) >> 7);
}
checkSum = ((checkSum>>4) & 0x0F) + (checkSum & 0x0F) + 2;

WinDrawChars(bufP, *bufLen, x, y);
x += FntCharsWidth(bufP, *bufLen);

// draw the dash and the checksum digit right after it
checksumStr[0] = '-';
checksumStr[1] =
((checkSum < 10) ? (checkSum +'0'):(checkSum -10 +'A'));
WinDrawChars (checksumStr, 2, x, y);
}
else // there's no serial number
// draw a status message if the caller provided one
if (noNumberMessage)
WinDrawChars(noNumberMessage, StrLen(noNumberMessage),x, y);
}



i called the program from the
static int StartApplication(void)
{

Int16 x =10, y = 50;
Char *Msg;

DrawSerialNumOrMessage(x, y, Msg);

}

can i do this by this way??? pls help me.
Thank you very very much




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to