Important: The information in this document is obsolete and should not be used for new development.
GetHandleSize
You can use theGetHandleSize
function to find out the logical size of the relocatable block corresponding to a handle.
FUNCTION GetHandleSize (h: Handle): Size;
h
- A handle to a relocatable block.
DESCRIPTION
TheGetHandleSize
function returns the logical size, in bytes, of the relocatable block whose handle ish
. In case of an error,GetHandleSize
returns 0.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit forGetHandleSize
are
Registers on entry A0 Handle to the relocatable block
Registers on exit D0 If >=0
, number of bytes in relocatable blockIf <0
, result codeThe trap dispatcher sets the condition codes before returning from a trap by testing the low-order word of register D0 with a
TST.W
instruction. Because the block size returned in D0 by_GetHandleSize
is a full 32-bit long word, the word-length test sets the condition codes incorrectly in this case. To branch on the contents of D0, use your ownTST.L
instruction on return from the trap to test the full 32 bits of the register.SPECIAL CONSIDERATIONS
You shouldn't callGetHandleSize
at interrupt time because the heap might be in an inconsistent state.RESULT CODES
noErr 0 No error nilHandleErr -109 NIL
master pointermemWZErr -111 Attempt to operate on a free block