[futurebasic] Re: [FB] Determine where App running from

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 1999 : Group Archive : Group : All Groups

From: "Michael Evans" <mikonic@...>
Date: Thu, 05 Aug 1999 10:39:39 -0400
> Thanks for the response Rick. Actually, what I'm trying to do is determine
whether
> my app is being run from a CD or from a copy somewhere else. I've come up with
a
> different strategy to identify this that has nothing to do with volRefNums. I
just
> try to write to the app's resource fork, if it lets me then the app is not on
the
> CD, but somewhere else. Not 100% perfect, but good enough for my purposes.
Someone
> "might" have locked the app on some other media too, but unlikely. Again,
> thanks for
> all of your marvelous insights.
>

You could adapt the following to check for hard(ware) locked and soft(ware)
locked volumes:

I believe this is from FBII handbook examples...?

'-----------------------------------------
'ShowLockedVolumes
'-----------------------------------------
CLEAR LOCAL
_hardLockFlag = &x0000000010000000
_softLockFlag = &x1000000000000000
DIM pBlock.128
DIM 63 volName$
DIM err
LOCAL FN ShowLockedVolumes
  pBlock.ioNamePtr& = @volName$                   'pointer to volume name
  DO
    INC WORD (@pBlock.ioVolIndex%)                'look for next mounted
volume
    err = FN HGETVINFO (@pBlock)                  'get original volume info
    LONG IF err = _noErr                          'no error?
      'show volume number and name
      PRINT "Volume:";pBlock.ioVolIndex%;" '";volName$"' ";
      PRINT STRING$(20-LEN(volName$),32);"  ";

      'test attributes for software lock and hardware lock
      IF (pBlock.ioVAtrb% AND _hardLockFlag) THEN PRINT "*hard locked* ";
      IF (pBlock.ioVAtrb% AND _softLockFlag) THEN PRINT "*soft locked*";
      PRINT

      'show educational info :)
      DEFSTR LONG
      PRINT "Soft Lock Flag: "; BIN$(_softLockFlag);    " = ";_softLockFlag
      PRINT "Hard Lock Flag: "; BIN$(_hardLockFlag);    " = ";_hardLockFlag
      PRINT "Vol Attributes: "; BIN$(pBlock.ioVAtrb%);  " =
";pBlock.ioVAtrb%
      PRINT
    END IF
  UNTIL err                                       'until no more volumes
END FN = err

Cheers,

----------------------------------------------------------
Michael Evans
Manager of Software Development * Photo Systems, Inc.
3301 Wood Valley Road, NW * Atlanta, GA, 30327-1515
Voice: (404) 846-9386
Fax: (404) 240-0878 * Cell: (404) 229-3930
E-mail: evans@... * michael_evans@...
----------------------------------------------------------