ADC Home > Reference Library > Technical Notes > Legacy Documents > Carbon >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Resource Manager Tips

CONTENTS

This note discusses some problems with the Resource Manager and how to work around them.

[Jun 01 1986]






OpenResFile Bug

This section of the note formerly described a bug in OpenResFile on 64K ROM machines. Information specific to 64K ROM machines has been deleted from Macintosh Technical Notes for reasons of clarity.

Back to top

GetMenu and ResErrProc

If your application makes use of ResErrProc (a pointer to a procedure stored in low-memory global $AF2) to detect resource errors, you will get unexpected calls to your ResErrProc procedure when calling GetMenu on 128K ROMs. The Menu Manager call GetMenu makes a call to GetResInfo, requesting resource information about MDEF 0. Unfortunately, ROMMapInsert is set to FALSE, so this call fails, setting ResErr to -192 (resNotFound). This in turn will cause a call to your ResErrProc, procedure even though the GetMenu call has worked correctly. This is only a problem if you are using ResErrProc.

The workaround is to:

  1. save the address of your ResErrProc procedure
  2. clear ResErrProc
  3. do a GetResource call on the MENU resource you want to get
  4. check to see if you get a nil handle back, if you do, you can handle the error in whatever way is appropriate for your application
  5. call GetMenu, and
  6. when you are done calling GetMenu, restore ResErrProc

SetResAttrs on read-only resource maps

SetResAttrs does not return an error if you are setting the resource attributes of a resource in a resource file that has a read-only resource map. The workaround is to check to see if the map is read-only and proceed from there:

    CONST
        MapROBit = 8; {Toolbox bit ordering for bit 7 of low-order byte}

    BEGIN
        ...
        attrs:= GetResFileAttrs(refNum);

Back to top

References

The Resource Manager

The Memory Manager

The Menu Manager

M.OV.GestaltSysenvirons

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (40K).

Download



Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.