Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Resources


The Driver Resource

Listing 1-15 shows the Rez format of the 'DRVR' resource type.

Listing 1-15 'DRVR' resource format

type 'DRVR' {
   boolean = 0;
   boolean  dontNeedLock, needLock;       /* lock drvr in memory */
   boolean  dontNeedTime, needTime;       /* for periodic action */
   boolean  dontNeedGoodbye, needGoodbye; /* call before heap reinit */
   boolean  noStatusEnable, statusEnable; /* responds to Status */
   boolean  noCtlEnable, ctlEnable;       /* responds to Control */
   boolean  noWriteEnable, writeEnable;   /* responds to Write */
   boolean  noReadEnable, readEnable;     /* responds to Read */
   byte = 0;
   integer;                               /* driver delay */
   unsigned hex integer;                  /* DA event mask */
   integer;                               /* DA menu */
   unsigned hex integer;                  /* offset to Open */
   unsigned hex integer;                  /* offset to Prime */
   unsigned hex integer;                  /* offset to Control */
   unsigned hex integer;                  /* offset to Status */
   unsigned hex integer;                  /* offset to Close */
   pstring;                               /* driver name */
   hex string;                            /* driver code */
};
The driver resource begins with seven flags that specify certain characteristics of the driver.

You need to set the dNeedLock flag if your driver's code should be locked in memory.

You set the dNeedTime flag of the drvrFlags word if your device driver needs to perform some action periodically.

You need to set the dNeedGoodbye flag if you want your application to receive a goodbye control request before the heap is reinitialized.

The last four flags indicate which Device Manager requests the driver's routines can respond to.

The next element of the resource specifies the time between periodic tasks.

The next two elements provide an event mask and menu ID for desk accessories. The section "Writing a Desk Accessory" on page 1-49 describes these fields.

Offsets to the driver routines follow the desk accessory fields. See "Entering and Exiting From Driver Routines" on page 1-29 for more information about the routine offsets.

The next element of the driver resource is the driver name. You can use uppercase and lowercase letters when naming your driver, but the first character should be a period--.MyDriver, for example.

Your driver routines, which follow the driver name, must be aligned on a word boundary.

The section "Creating a Driver Resource" on page 1-24 discusses this structure in detail.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996