Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!draken!tut!santra!kampi.hut.fi!jmunkki From: jmunkki@kampi.hut.fi (Juri Munkki) Newsgroups: comp.sys.mac.programmer Subject: Re: Locking the "chooser" user name? Message-ID: <22959@santra.UUCP> Date: 19 Jun 89 10:09:28 GMT References: <1889@dogie.macc.wisc.edu> <22951@santra.UUCP> <7697@hoptoad.uucp> Sender: news@santra.UUCP Reply-To: jmunkki@kampi.hut.fi.hut.fi (Juri Munkki) Organization: Helsinki University of Technology, Finland Lines: 78 In <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. In article <7697@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >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 This is because the current handle in RAM is changed. This means that anyone who really wants to change the username can change it. I think this is a good feature, but someone might disagree. >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.) ResEdit is a very strange program. I think the strange behavior was caused by ResEdit. The old version is the disk version (in the system file) and the new version is the RAM version. >It would appear that when the Chooser attempts to modify the 'STR ' >resource, it receives an error. IM-I doesn't say if this should create an error. In fact, there is no error for this situation. I took a look at the chooser code and it doesn't check for any errors. It probably should, because the system file might be locked in some other ways too. It just calls HNoPurge, ChangedResource, WriteResource and HPurge. >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. AddResource is never called when writing the resource. I think it is called when chooser is opening. The first time you open the chooser when the STR does not exist, it takes a lot longer than normally. >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. The answer is -- you didn't bother to check it well enough yourself! I knew there would be a copy in RAM and the good thing is that the user thinks the name is changed when it's not actually written to disk. This is what would happen if the same thing was done with an INIT and I seem to remember that the original poster wanted an INIT. The choosername will revert to the original the next time the Mac is restarted. >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 do not get multiple resources. I'm running chooser 3.3.1. >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. I was sure that it would work and I read my Inside Macintosh before posting... _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ | Juri Munkki jmunkki@hut.fi jmunkki@fingate.bitnet I Want Ne | | Helsinki University of Technology Computing Centre My Own XT | ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^