I have some issues with setting, removing and freeing AppInfoBlock, so
I thought maybe I could find some light here :) and figure out if my
understanding is flawed or...
Lets say I have initialized DmOpenRef to some database and I want to
set a new AppInfoBlock, here is what I am doing:
DmOpenDatabaseInfo - to get dbID and dbCardNum
DmDatabaseInfo - to get LocalID of the current AppInfoBlock
MemHandleNew - to get a memory location for new AppInfoBlock
MemHandleLock
MemMove - to get the wanted data in
MemHandleUnlock
MemHandleToLocalID - to get it int he format usable in the next call
DmSetDatabaseInfo - to attach the new AppInfoBlock to the DB
at this point I thought that the DB should have the new app info
blcok, and, I should free up the old info block that I had gotten
using the DmDatabaseInfo call... so here is what I thought of
doing....:
if
(
(NULL != appInfoIDP)
&&
(NULL != (*appInfoIDP))
)
{
MemLocalIDToPtr - get the pointer, wich hope we can get to the handle
MemPtrRecoverHandle - getting the handler so I can release it
MemHandleFree - here we go OS, the memory is back
}
now.. all of this would be dandy candy handy... but....
when I try accessing the newly set AppInfoBlock from another
application I get total garbage in it.... shrug....
I also sometimes manage to get into a situation where I cannot delete
that particular DB anymore, neither with PalmOS nor with RsrcEdit, and
I cannot back it up using the standard conduit (since it pulls the
AppInfoBlock - I think...)
This makes me to believe that whatever I am doing is not quite
right... however I am not getting any errors when executing what I
am... shrug (except the memory freeing snuff...)
any comments about my thought coding ways would be highly
appreciated...
:)
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/