Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Locking the "chooser" user name? Message-ID: <7697@hoptoad.uucp> Date: 18 Jun 89 22:49:25 GMT References: <1889@dogie.macc.wisc.edu> <22951@santra.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 51 In article <22951@santra.UUCP> jmunkki@kampi.hut.fi.hut.fi (Juri Munkki) writes: >How about setting the protected bit (with ResEdit) after setting the names? >I don't know how the chooser would react to this, but it might work. I tried it and got confusing results. First, I was able to change the name even with the 'STR ' resource's protected bit set. However, it appears that if you then go in and open the resource with ResEdit again, it reverts to the previous name. Open it once and it shows the new name; close it and open it again, and it shows the old name. This is very strange behavior and I can only speculate on the reasons. (I don't feel like stepping through the DA in MacsBug to make sure, frankly.) It would appear that when the Chooser attempts to modify the 'STR ' resource, it receives an error. This is what would be expected since the protected bit is set. However, it interprets this error as meaning "resource not present" regardless of where the error happens or what is the actual error code. It then does an AddResource to create a new copy of the 'STR ' with the new name, assuming that it has not yet been set. The Resource Manager is not sensitive to this error and will let you create two resources with the same ID. I believe this is what happens. However, at some point ResEdit is detecting this error and deleting the later copy of the resource without telling you. This is why it pops up with the new value the first time, but reverts to the old value the second time. This would imply that the checking happens when you close the window associated with a resource. (Perhaps Jon Singer could give some information on this?) So the answer is -- this does not appear to be safe, as setting the protected bit can cause the Chooser to introduce an error into the resource file. Furthermore, it does not work even if you consider the error acceptable; since the Resource Manager will return the most recently added copy of a duplicate resource, the newer (changed) version of the name will persist. You can verify this for yourself. Set the protected bit and close the system file; bring up the Chooser and change the name; close the Chooser; bring up Chooser again and see that the name has in fact been changed; repeat the last two steps two or three times just to make sure; give up and fix the resource file. I don't mean to revert to cranky mode again, but this is the second suggestion in the last couple of days that has been put forward without spending a few minutes doing rudimentary testing with ResEdit. This kind of thing does not improve the network's signal to noise ratio. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934 "Please help support the moratorium on meaningless quotes in .signatures." -- Doug Asherman on rec.music.cd