Control Panel Files
Volume Number: 3
Issue Number: 10
Column Tag: Macintosh II
CDEV Control Panel Files Revisited
By Steven C. Sheets, Contributing Editor, Apple Computer, Il.
ApplFont - Control Panel Files
This months article will discuss the most obvious, and perhaps important,
feature of the new System/Finder (not the bulging trash can or the spinning watch
hands), the expandable Control Panel.
The new Control Panel is no longer a fixed Desk Accessory with only a single
appearance/function. Similar to the Chooser, the new Control Panel now refers to
special files in the System Folder. Each of these special Control Panel Files or cdev
files appears as an Icon on the left side of the Control Panel. When one is selected, the
corresponding cdev file tells the Control Panel how to draw the right side of the Control
Panel. The cdev file also has code inside it that that tells the Control Panel what to do
when a User selects something on the left side of the Control Panel. Now the User can
pick and chose his cdev files, like he does his Desk Accessories, Fonts or FKEYs. Each
new cdev gives the User a new way to change and “Control” his Macintosh.
While Apple has released some cdev files (General, Keyboard, Mouse, Monitor,
Sound, Startup Device), a number of other ones have appeared. This article will
explain how to create such a cdev file.
The new Control Panel and cdev files are of special importance to Mac // users.
While the Chooser is the standard way to contact peripherals (like Printers or File
Servers), the Control Panel is the method used to control the internals of the Machine,
including expansion cards. A cdev can be created that will only function on a specific
machine (one that has Color Quickdraw) or even only one that has a particular
expansion card installed.
cdev File Format
A Control Panel File contains several set of resources. Each group is used for a
different purpose. A cdev files has no information in it’s data fork. Besides the
resources, a cdev file has the File Signature of ‘cdev’ and a specific File Creator
(matching the BNDL resource, see below). It’s bundle and init bits must be set.
The first resource that is checked when the Control Panel is open is the ‘mach’
resource of ID -4064. This resource tells the Control Panel if this cdev can be used on
this machine. The resource contains 2 word values, the SoftMask followed by the
Hardmask. The Softmask is compared to the global variable ROM85 to check for
software features, while the HardMask is compared to HwCgfFlg to determine the
Hardware features. The cdev will appear in the Control Panel if every bit that is 0 in
the Softmask is 0 in ROM85 and every bit that is 1 in the Hardmask is 1 in HwCgfFlg.
For example, the Softmask of $FFFF and Hardmaks of $0000 would go with a cdev that
would appear on any machine. Softmask of $3FFF and Hardmaks of $0000 would go
with a cdev that would appear on a Mac // only. Finally there is the special case of a
Softmask of $0000 and a Hardmaks of $FFFF. This is for a cdev that needs to check for
more information than is stored in ROM85 and HwCgfFlg. In that case, the Control
Panel calls the ‘cdev’ resource code to ask if the machine is correct (more about this
below). This case would be used for a cdev that needs to have a certain expansion card
be installed.
Fig. 1 Selecting our CDEV in the Control Panel
Second a cdev file must have its own icon. Not only will this Icon appear in the
Finder, the Icon appears on the left side of the Control Panel. The Icon must be stored
as a ICN# resource of ID number -4064. The associating resources BNDL and FREF
(ie. ones that make the Finder know ICN# -4064 is to be used) must be set correctly
and have the ID number -4064. The BNDL resource will have the File Creator that the
cdev file must have. Finally there must be a owner resource of the same matching type
as the File Creator (ID 0) in the file. Just remember that the ICN#, BNDL and FREF
must be ID -4064 (normally they can be anything).
Next the cdev file must contain information on how the right side of the Control
Panel will be displayed. When an Icon is pressed on the left side of the Control Panel,
the Control Panel check the matching cdev file. It is looking for a resource of type