Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!Apple.COM!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: Identifying real handles Message-ID: <8613@goofy.Apple.COM> Date: 7 Jun 90 21:46:25 GMT Sender: usenet@Apple.COM Organization: Future Stuff, Apple Computer, Inc. Lines: 25 References:<7426@ucdavis.ucdavis.edu> <18379@well.sf.ca.us> In article <18379@well.sf.ca.us> odawa@well.sf.ca.us (Michael Odawa) writes: > A different check (which I do in my version of ValidHandle) might be to > determine whether the tag byte on the block header (the first of the eight > bytes which preceed the address) contained 0x8x, as documented in IM II-24: Unfortunately, this isn't 32-bit clean. The block headers in the 32-bit Memory Manager seem to be 12 bytes long (instead of 8). (I say "seem to be" since I was poking around without documentation.) In addition to the other tests that were mentioned, you might try testing whether RecoverHandle(addresss^)=address. (This is part of MacApp's IsHandle check.) If you do this, you have to be careful because RecoverHandle only works if the current heap zone is the same as the handle's. You also have to check for an empty handle (one whose master pointer is NIL). Larry Rosenstein, Apple Computer, Inc. Object Specialist Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1