Ladies and Gentlemen:

I will very much appreciate help on this. Is the following known and/or
documented? Are there any fixes?

My guess is that this is also the reason why almost all keyboard drivers
either need to be manually activated after each reset or are managed by a
hack manager or are prone to crashes.

DESCRIPTION. Here is an example to show that using DmOpenDatabase() during
sysAppLaunchCmdSystemReset does NOT work. The following PilotMain() returns
errNone BUT all subsequent attempts to use the opened up database fail,
including attempts to close it. Both DmNextOpenDatabase() and
DmNextOpenResDatabase() fail to recognize the opened up database BUT it can't
be deleted since it is open.  I need a pageUp-reset to delete the database.

All the other commands [sysAppLaunchCmdSyncNotify, sysAppLaunchCmdNotify with
sysNotifySyncFinishEvent] work perfectly.

TESTED: OS 3.5, 4.0, 4.1 on POSE 3.4 and 3.5, OS 3.5 on TRGPro and OS 4.1 on
m515.

// I replaced TABS with SPACES since my e-mailer doesn't like TABS
// use your own myType and myCreator
UInt32 PilotMain (UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
#pragma unused (launchFlags)
 SysNotifyParamType * notifyParamP;
 SysAppLaunchCmdSystemResetType * systemResetP;
 LocalID dbID;
 UInt16 cardNo;
 DmSearchStateType searchState;

 switch (cmd)
  {
  case sysAppLaunchCmdSystemReset:
   if ((systemResetP = (SysAppLaunchCmdSystemResetType *) cmdPBP) == NULL)
    {return (sysErrParamErr);}
   if (systemResetP->hardReset == false)
     {
     if (
         (DmGetNextDatabaseByTypeCreator (true, &searchState, myType, myCreator, true, 
&cardNo, &dbID) == errNone)
      && (DmOpenDatabase (cardNo, dbID, (dmModeReadOnly | dmModeLeaveOpen)) != NULL)
      )
      {return (errNone);}
     }
   break;

  case sysAppLaunchCmdSyncNotify:
   if (
       (DmGetNextDatabaseByTypeCreator (true, &searchState, myType, myCreator, true, 
&cardNo, &dbID) == errNone)
    && (DmOpenDatabase (cardNo, dbID, (dmModeReadOnly | dmModeLeaveOpen)) != NULL)
    )
    {return (errNone);}
   break;

  case sysAppLaunchCmdNotify:
   if ((notifyParamP = (SysNotifyParamType *) cmdPBP) == NULL)
    {return (sysErrParamErr);}
   switch (notifyParamP->notifyType)
    {
    case sysNotifySyncFinishEvent:
     if (
         (DmGetNextDatabaseByTypeCreator (true, &searchState, myType, myCreator, true, 
&cardNo, &dbID) == errNone)
      && (DmOpenDatabase (cardNo, dbID, (dmModeReadOnly | dmModeLeaveOpen)) != NULL)
      )
      {return (errNone);}
     break;
    }
   // EOF switch (notifyParamP->notifyType)
   break;
  // EOF case sysAppLaunchCmdNotify:

  default:
   break;
  }
 // EOF switch (cmd)

 return (errNone);
}
// EOF UInt32 PilotMain (UInt16 cmd, Ptr cmdPBP, UInt16 launchFlags)


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

Reply via email to