Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: What is OpenRFPerm doing?!? Keywords: resource corrupt OpenRFPerm Message-ID: <7087@hoptoad.uucp> Date: 25 Apr 89 18:39:28 GMT References: <1146@uvm-gen.UUCP> <7017@hoptoad.uucp> <1152@uvm-gen.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 46 In article <1152@uvm-gen.UUCP> chaffee@uvm-gen.UUCP (Alex D. Chaffee) writes: >Tim, your intuition seems to be correct. Although I haven't _quite_ >finished debugging the whole program, it is obvious that the problem lies >with certain, apparently corrupt, resource files. Well, it's not certain yet (see below). >(For those of you who've just joined us: When I opened the resource fork of > a file with OpenRFPerm directly following an SFGetFile, my resource map > got trashed, as evidenced by Alerts appearing off-screen and so forth.) > >I now have two questions: > >1) ResEdit opens these files (there are two) fine, and the FKEYs within > them work fine when installed into the system. What can be special > about them? I don't know how much special checking ResEdit does. (Jon?) If I wonder about the correctness of a file, I go into MPW and run the RezDet tool on it. This picks up and reports on a wide variety of resource file problems. ResEdit bypasses the Resource Manager and handles the resource file format directly, so it is possible that there could be an error that wouldn't make ResEdit choke but would make the RM freak out. I have to say it seems a bit unlikely. >2) How can I programmatically detect and/or correct this user-nasty > situation? Or any similar situation where the Resource Manager gets > confused... Is there an error-reporting function or global? I seem > to remember catching the end of a related thread on the net a week or > two ago. In practice, I don't think any developers actually check their resource files except for the few that bypass the resource manager completely. Remember, though, the real problem is that if you let users open any resource files that aren't owned by you, you can't guarantee that its resources won't conflict with yours, and you shouldn't keep it in the resource search path except during the rare times when you're extracting information from it and changing information in it. I still tend to suspect that you may have some such conflict situation here. Could you describe in a bit more detail why you are opening the resource files? -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "The above opinions and suggestions have absolutely nothing to do with the little, fat man putting crisp, $100 bills in my pocket." -- Alan Vymetalik