[comp.sys.mac] Protecting Chooser name

viraf@gwusun.gwu.edu (Viraf Bankwalla) (06/19/89)

Hi,

  Several people have been asking on how to prevent the chooser name from
being changed.  I too needed such a patch, and found it on 
	Comp.sys.mac.programmer 
a few months ago.

 I have tried the patch, and it works.  For those who want it, it follows
below.

						    viraf bankwalla
						    viraf@gwusun.gwu.edu
						    uunet!gwusun!viraf


	    ----------------------------------------------

Some had ask how to prevent users from changing the name in the Chooser.  I,
too, have a use for this is a Macintosh cluster, where the Chooser name is
used to record statistics on who is using the facility.  The users have
boot floppies and will mount AppleShare servers for most applications.  We
will probably use something like TrafficWatch from Farallon Computing to
monitor users on the network.  To requires that the Chooser name remain
constant.

I've figured out a way to do this.  The Chooser name is stored in at 'STR '
(trailing space required) resource in the System file, id = -16096.  AppleShare
and RegisterName (also from Farallon) both look for this string id.  What I did
was to modify Chooser so it allows changing to a different 'STR ' resource,
leaving the right intact.  To do this:

1) Run Font/DA Mover to transfer the Chooser from the System file to a suitcase
file.

2) Run Resedit, and open the suitcase file.  See what id the 'DRVR' resource
has (call this number N).  Now calculate:

	I = 32 * N - 16382

(This is the resource id of resource #2, owned by 'DRVR' N).

3) Open the System file and copy 'STR ' resource id = -16096 to the suitcase
file.

4) Change the resource id of this copied resource to I.  Save and exit Resedit.

5) Run Fedit or similar file editor.  Open the suitcase resource fork.

6) Search for all occurrences of hex string 'C120' and change it to the hex
equivalent of value I, calculated in 2) above.  There are 2 occurrences, fairly
close together, in the same block.  Save and exit.

7) Now use Font/DA Mover to delete the original Chooser in the System file and
copy in the modified version.

Now changes to the Chooser name (via Chooser itself) don't change what
AppleShare uses as the default login name, nor the name used by RegisterName.
Changing the name now requires Resedit, which is beyond the casual user.

Note that since Chooser may have different id numbers in different System
files, you may need to use different values for I.  Also, a modified Chooser
from one System may have a conflicting id for a different System, and
Font/DA Mover will modify the id number and all resources owned by it.  Then
running Chooser will fail, since it has a hard coded resource number.

Have fun and don't tell Apple I did this :-)

Edward Moy
Workstation Software Support Group
University of California
Berkeley, CA  94720

edmoy@violet.Berkeley.EDU
ucbvax!violet!edmoy