This code works quite well...it's from the Dr. McCoy sample code.
Also, if you have Codewarrior, check out the project settings, 
PalmREZ PostLinker, and one of the checkboxes will also Copyprotect.
It's a feature of 3.0, but this code is for backwards compatibility
with older SDKs.
//* Rus Daniel Nesse 
>-----Original Message-----
>From: Sam Charette [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, May 16, 2000 5:52 AM
>To: Palm Developer Forum
>Subject: Re: Beam Protecting my App
>
>
>Here is some code found (I think) in the tutorial.  I haven't 
>tried it but if I'm not mistaken the version of the SDK I am 
>using is 3.0 (I'm new-ish, so I could be wrong ;).  It is
>likely what you are doing (and if so I don't know what the 
>problem is) but here it is anyways :)
>
>Sam
>
>/**************************************************************
>*********
> *
> * FUNCTION:  ProtectOurDatabase
> *
> * DESCRIPTION:  Sets the bit in the database header which tells the
> *               launcher that this app shouldn't be beamable.
> *
> *     Note that this function assumes we're the active UI app.
> *     (See note in the code for what to do if you're not.)
> *
> *     Once this routine has been run, the launcher will not
> *     allow this app to be beamed.  You can call this routine
> *     as many times as you want; calling it when the app is
> *     launched is convenient and won't slow down the rest of
> *     the OS by wasting time during the other launch codes.
> *
> *     Setting this bit at compile-time would be better, but
> *     none of the current tools allow this yet.  When they
> *     do, you can get rid of this routine.
> *
> 
>***************************************************************
>********/
>static void ProtectOurDatabase()
>{
>// temporary definition, in case old headers are being used
>#ifndef dmHdrAttrCopyPrevention
>#define dmHdrAttrCopyPrevention  0x0040
>#endif
>
> UInt cardNo;
> LocalID dbID;
> UInt attributes;
>
> // Find our database - only works if you're the running UI 
>application.
> // If you need to do this when you're not the running app, then call
> // DmFindDatabase() with your app's database name instead.
> SysCurAppDatabase(&cardNo, &dbID);
>
> if (dbID) {
>  // get the current attributes, turn on protection, and save them.
>  DmDatabaseInfo(cardNo, dbID, 0, &attributes, 0,0,0,0,0,0,0,0,0);
>  attributes = attributes | dmHdrAttrCopyPrevention;
>  DmSetDatabaseInfo(cardNo, dbID, 0, &attributes, 0,0,0,0,0,0,0,0,0);
> }
>}
>
>
>[EMAIL PROTECTED] wrote:
>
>> I'm trying to prevent my OS 3.3 application from being 
>beamed by a user. I've looked in the knowledge base / archives 
>and can't seem to find anything that helps me.
>>
>> I've also tried using setting the dmHdrAttrCopyPrevention 
>attribute for the resource but my compiler seems to have a 
>problem with it - I'm assuming it's a new feature in OS 3.5.
>>
>> Has anyone got some sample code to solve this?
>>
>> Any help would be gratefully appreciated.
>
>
>-- 
>For information on using the Palm Developer Forums, or to 
>unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
>

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

Reply via email to