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: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines / Managing Relocatable Blocks


RecoverHandle

The Memory Manager does not allow you to change relocatable blocks into nonrelocatable blocks, or vice-versa. However, if you no longer have access to a handle but still have access to its master pointer, you can use the RecoverHandle function to recreate a handle to the relocatable block referenced by the master pointer.

FUNCTION RecoverHandle (p: Ptr): Handle;
p
The master pointer to a relocatable block.
DESCRIPTION
The RecoverHandle function returns a handle to the relocatable block pointed to by p. If p doesn't point to a valid block, the results of RecoverHandle are undefined.

SPECIAL CONSIDERATIONS
Even though RecoverHandle does not move or purge memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for RecoverHandle are
Registers on entry
A0Master pointer
Registers on exit
A0Handle to master pointer's relocatable block
D0Unchanged

Unlike most other Memory Manager routines, RecoverHandle does not return a
result code in register D0; the previous contents of D0 are preserved unchanged.
The result code is, however, returned by MemError.

The RecoverHandle function looks only in the current heap zone for the relocatable block pointed to by the parameter p. If you want to use the RecoverHandle function to recover a handle for a relocatable block in the system heap, set bit 10 of the routine trap word. In most development systems, you can do this by supplying the word SYS as the second argument to the routine macro, as follows:

_RecoverHandle ,SYS
RESULT CODES
noErr0No error
memBCErr-115Block check failed

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996