Hi all,
I'm trying to obtain the user id (not hot sync name) from the system
resouce database directly. I've found no information/documentation from
Palm on how to do this, I've been using the code from Bradly J. Barton
(at the bottom) as my guide.
However codewarrior 6 seems to barf when I try to use this, or a
modified version, and since I can't find any docs on accessing the
system resource database direclty, I've been unable to trouble shoot it
very well.. [:(] Does anyone have a snippet of code that can grab the
userid, or know
where there's more information on accessing the system resource database?
Or is there an API call that can be used to get the user ID, in case the
resouce DB structure gets changed later?
Thank you!
Ty
#include "DLServer.h"
void GetPUN(char* nameP, UInt16 size, char* defaultName)
{
DmOpenRef dbP;
DlkUserInfoPtr infoP;
Int32 len;
Handle resH;
MemSet(nameP, size, 0);
dbP = DmOpenDatabaseByTypeCreator(
sysFileTPreferences, // 'pref'
sysFileCSystem, // 'psys'
dmModeReadOnly);
if (dbP) {
resH = DmGet1Resource(
sysResTSysPref, // resource type 'psys'
sysResIDDlkUserInfo); // resource id 4
if (resH) {
infoP = MemHandleLock(resH);
len = infoP->header.userNameLen;
if (len) {
if (len >= size)
len = size - 1;
MemMove(nameP, infoP->nameAndLog, len);
}
MemHandleUnlock(resH);
}
DmCloseDatabase(dbP);
}
if (!StrLen(nameP))
StrCopy(nameP, defaultName);
} // end GetPUN
code from
http://groups.yahoo.com/group/palm-dev-forum/message/50680
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/