Important: The information in this document is obsolete and should not be used for new development.
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 theRecoverHandle
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
TheRecoverHandle
function returns a handle to the relocatable block pointed to byp
. Ifp
doesn't point to a valid block, the results ofRecoverHandle
are undefined.SPECIAL CONSIDERATIONS
Even thoughRecoverHandle
does not move or purge memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit forRecoverHandle
are
Registers on entry A0 Master pointer
Registers on exit A0 Handle to master pointer's relocatable block D0 Unchanged 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 byMemError
.The
RecoverHandle
function looks only in the current heap zone for the relocatable block pointed to by the parameterp
. If you want to use theRecoverHandle
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 wordSYS
as the second argument to the routine macro, as follows:
_RecoverHandle ,SYSRESULT CODES
noErr 0 No error memBCErr -115 Block check failed