AShare UserName
Volume Number: 7
Issue Number: 6
Column Tag: Programmer's Forum
AppleShare Username to Chooser Name INIT
By Mark Gavin, Darby, PA
Note: Source code files accompanying article are located on MacTech CD-ROM or
source code disks.
[ Mark Gavin is a consultant in the Philadelphia area who specializes in
Macintosh software development using MacApp, Object Pascal and 68000 Assembly. He
can be reached via AppleLink GAVIN.MARK. ]
INIT’s in General
It used to be that an INIT had to be loaded into the system file using ResEdit or
some other resource installer. Only 32 INIT’s were allowed in the system file and you
had to be aware of possible resource ID conflicts during the installation process. A
while back Apple enhanced the INIT system by placing INIT 31 within the system file.
The job of INIT 31 is to look in the system folder for any files of type ‘INIT’ who happen
to have one or more ‘INIT’ resources. The search is in alphabetical order by filename.
When INIT 31 locates an INIT resource it is called and executed as if it were a procedure
(Inside Macintosh Volume IV, pp. 255-257) . INIT 31 can also allocate memory in the
system heap for the INIT if you use the ‘sysz’ resource (Inside Macintosh Volume V, pg.
352). As is, INIT 31 gives you at least a 16K block within the system heap.
An INIT in it’s basic form is a stand alone code module which normally has no
access to global data or anything that uses A5 relative addressing like QuickDraw. This
minor inconvenience can be easily circumvented by creating your own A5 world. There
is a very good explanation, and examples, of setting up your own A5 world in Apple’s
Macintosh Technical Note #256, Stand-Alone Code, ad nauseam.
Network Administration and Responder
One of my clients has implemented a wide area EtherNet network which covers
15 sites with 76 zones and 56 networks throughout the United States. Network support
is via Timbuktu which uses the Chooser name to identify each Mac. They also use
Inter•Poll and NetMinder for network diagnostics. These, also, use the Chooser name,
broadcast by the Responder.
Responder is an INIT supplied by Apple on the Macintosh System software disks.
Its function is to register the Macintosh Chooser name on the AppleShare network. The
Responder and the other utilities described above, play an important role in network
administration by allowing us to easily locate an individual Macintosh and it’s owner on
the network. The Chooser name, however, can be easily modified or deleted by the user.
For example, the network administrator, located in Pennsylvania, would have trouble
determining who owns a Macintosh named ‘Wizard’ located in California or Connecticut.
In addition, there is no guarantee the Macintosh will have the same name tomorrow or
the next day.
Placing the AppleShare username into the Chooser name appears to be the most
straight forward solution to the problem of system identification and offers us several
advantages:
1. Avoid burdening the user with yet one more administrative task.
2. Automatic update of Chooser name with new user.
3. The Chooser name can not be permanently modified by the user.
The AShareNameINIT
The function of the AShareNameINIT is to extract the AppleShare username from
the ‘AppleShare Prep’ file and place the username in the Chooser. I have chosen not to
display an ICON at startup because this INIT is a network administration tool that
should not be disabled by the user. Therefore, the less obtrusive the better.
The AppleShare Prep File
Apple hasn’t released any information on the AppleShare Prep file, so this is
what I have figured out thus far.
The AppleShare Prep file is created by selecting the AppleShare device within
the Chooser. When the file is created it contains 4 bytes, all nil, within a single
resource ‘BMLS’ 2447. The AppleShare logon name is only placed into the BMLS
resource if the user chooses to have an AppleShare volume auto-logon at startup. As a
side note; If you elect to have AppleShare automatically logon to a server with your
name and password, the password is also placed in the AppleShare Prep file but it is not
encrypted in any way. By looking at the resource with ResEdit you can read any stored
password.
The AppleShare Prep file saves a username and server history when the server
name changes. There does not appear to be any way of deleting information that is no
longer being used by AppleShare. This history is stored in a linked list of entries. The
number of entries in the file is stored in the first word of the BMLS resource. The
second word of the resource contains the size of the block to follow. It is also used as an
offset to the next entry in the list. Logical block size within the resource is variable
according to how many server disks are mounted. The username is a 32 byte Pascal