Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: file info from rsrc handle? Message-ID: <6557@hoptoad.uucp> Date: 18 Feb 89 01:29:26 GMT References: <3687@ucdavis.ucdavis.edu> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 35 In article <3687@ucdavis.ucdavis.edu> lim@iris.ucdavis.edu (Lloyd Lim) writes: >I realize this a rather basic question, but I never ventured into this area >before. Please bear with me. Actually, I don't think it's so basic. This whole area of the OS is weird. >I need to get information about a file (using PBGetFInfo) given a handle to >a resource in that file. OK, so I do a HomeResFile which gives me the path >reference number, then a GetVRefNum which gives me the volume reference >number. > >Then I get stuck. PBGetFInfo likes file names or directory indexes. >I realize that with HFS I could do a PBGetFCBInfo to get the file name and >simply do a PBGetFInfo. However, I would also like this to work on 64K ROMS. These days, I would forget old ROMs. There are a miniscule fraction of the installed base; the Mac didn't start selling well until the Mac Plus. Still, if you do want to be compatible, you have the advantage that the old ROM OS is frozen, so you can get away with certain tricks that wouldn't be safe on today's systems. One such trick is looking directly in the FCB table. The file reference number is a byte offset into the table for the FCB you want. Add it to FCBSPtr (you may need to add another two bytes to bypass the length word, I'm not sure). Then you get the FCB structure documented in the old File Manager chapter, which contains the file number you need. And of course, you should *only* do this if you find that HFS is not installed (which isn't the same as checking for old ROMs; you can run the old RAM-based HFS on old ROM systems). Otherwise, use PBGetFCBInfo. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim These are not my opinions, those of my ex-employers, my old schools, my relatives, my friends, or really any rational person whatsoever.