The code snippet below is almost text book. It works fine on Pre OS 5
versions of
PalmOS, returning the 12 character Device ROM ID.
Without adding the null terminator (line 16), the returned string has a
stange character
at the end of it - so that's why it's there.
However, running it on both the Release and Debug Palm OS Simulator
(utilizing PACE),
I get the string "SERIALNUMBER" returned, but when I exit the app, the
simulator freezes.
It requires a soft reset.
Removing the line which adds the null terminator (line 16), re-introduces
the stange charcater
at the end of the returned string, but on exiting the app, all is fine.
Can anyone shed some light on this please?
Steve
1 Char*
2 GetSysRomID()
3 {
4 Char* buffer = NULL;
5 Char* retStr = NULL;
6 UInt16 length = 0;
7 Err error = errNone;
8
9 error = SysGetROMToken(0,sysROMTokenSnum,(UInt8**)&buffer,&length);
10
11 if((!error) && (buffer) && ((UInt8)*buffer != 0xFF))
12 {
13 retStr = new Char[length];
14 CHECK_NEW_PTR(retStr); // macro to check retStr
15 StrNCopy(retStr,buffer,length);
16 retStr[length] = '\0';
17 }
18 return retStr;
19 }
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
- Re: Accessing the Device Rom ID on Palm Simulator OS 5 p... Stephen Gilfillan
