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 theRecoverHandlefunction 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
TheRecoverHandlefunction returns a handle to the relocatable block pointed to byp. Ifpdoesn't point to a valid block, the results ofRecoverHandleare undefined.SPECIAL CONSIDERATIONS
Even thoughRecoverHandledoes not move or purge memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit forRecoverHandleare
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,
RecoverHandledoes not return a
result code in register D0; the previous contents of D0 are preserved unchanged.
The result code is, however, returned byMemError.The
RecoverHandlefunction looks only in the current heap zone for the relocatable block pointed to by the parameterp. If you want to use theRecoverHandlefunction 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 wordSYSas the second argument to the routine macro, as follows:
_RecoverHandle ,SYSRESULT CODES
noErr 0 No error memBCErr -115 Block check failed