> Not sure what the situation is that you want to know if it's protected, but
> you could try...

If you're writing a file manager for VFS, you need to know this if you want to 
copy a file from the card to RAM (if you want to be nice and tell the user 
things).  Deleting the file would be dangerous, just in case it works, and 
that's not what the user wanted to do ;)

If you're writing a backup program, I want to know if a file is protected to 
decide weather or not to back it up / restore it.  I would also like to be 
able to restore "open"/"protected" databases like "Net Prefs" and such, then 
reset when done...

The above are examples from when -I've- needed to know :P - but there are 
probably many other examples available if you hunt around.

> 1) On OS4 listen out for the sysNotifyDeleteProtectedEvent when you try to
> delete it.

This relates to another discussion (...Visual Basic...? ;) - I like to support 
devices as old as OS 3.0, as that was the first [Palm] device I ever had, and 
I seriousally doubt that there are many OS 1/2 devices still flying around.

> 2) Call DmDatabaseProtect(cardNo, dbID, false) and see if it returns
> errNone or dmErrDatabaseNotProtected. Obviously you may then have to
> protect it again...

Thanks!  As I'm writing a backup program, I'll need that line for my restore 
code.  Yay! ;)  Lurking here is paying off...  It'll hopefully pay off the 
bandwidth use :P

> 3) If you have the Palm OS source have a look at the function
> PrvDatabaseIsProtected() and see if you can use something similar to that -
> I'm not convinced you can as it uses system globals.

The Palm source code is always an entertaining read.  I especially like some 
of the comments from the developers (the values of the notifications are 
quite amusing).  I like how cheap (read: fast/simple/elegant) the SysRandom 
function is.

-- 
Matthew (Darkstorm) Bevan       [EMAIL PROTECTED]
Margin Software, NECTI.         http://www.marginsoftware.com
        Re-inventing the wheel, every time.

 - All the passions make us commit faults; love makes us commit the most
ridiculous ones.
                -- La Rochefoucauld


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

Reply via email to