in article 20094@palm-dev-forum, Eric at [EMAIL PROTECTED] wrote on 7/8/00 3:50
AM:

> is it possible to take a checksum of parts or even whole of the
> code? if possible, I can prevent my code get corrupt.

Without getting into a discussion of the merits or otherwise of doing so,
here's the code:

   UInt16 ComputeChecksum (UInt16 seed)
   {
      MemHandle        hRes;
      MemPtr           pRes;
      UInt16           size, checksum;
    
      hRes = DmGetResource ('code', 1);
    
      size = MemHandleSize (hRes);
        
      pRes = MemHandleLock (hRes);
    
      checksum = Crc16CalcBlock (pRes, size, seed);
    
      MemHandleUnlock (hRes);
    
      DmReleaseResource (hRes);
    
      return checksum;
   }

Stephen Best
Bitware Australia


-- 
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