mnkonar@gorby.SRC.Honeywell.COM (Murat N. Konar) (03/06/89)
What is the cleanest, most Apple-Approved(TM) way of causing a resource file to remain open after the INIT that opened it is done running? I know that the System closes the INIT file after the INIT is through (this makes sense of course) but I would expect to be able to open another resource file from the INIT and have it remain open for my INIT installed patch. SuitcaseII seems to be able to do this (it even rearranges the search order so that its resource files come AFTER the System file. Neat trick.). When I try it, the files don't stay open. ______________________________________________________________________ Have a day. :^| Murat N. Konar Honeywell Systems & Research Center, Camden, MN mnkonar@SRC.honeywell.com (internet) {umn-cs,ems,bthpyd}!srcsip!mnkonar (UUCP)
tim@hoptoad.uucp (Tim Maroney) (03/06/89)
In article <18170@srcsip.UUCP> mnkonar@srcsip.UUCP (Murat N. Konar) writes: >What is the cleanest, most Apple-Approved(TM) way of causing >a resource file to remain open after the INIT that opened it >is done running? I know that the System closes the INIT file >after the INIT is through (this makes sense of course) but I >would expect to be able to open another resource file from >the INIT and have it remain open for my INIT installed patch. There is no clean way to do it. All resource files except the System are closed on the Launch of the Finder, and on every subsequent ExitToShell or "exec"-type Launch. (Things are a little more complicated under MultiFinder since every application has its own open resource file list; but all those resource files are closed when the application dies via ExitToShell or Launch.) However, there is an unclean dirty nasty messy way to it. You can make a copy of the resource map handle in memory, put a new file decriptor in it, and link it into and out of the resource search path yourself as needed. This requires using the "next resource map" field documented in Inside Mac volume 1 page 129; to iterate down the list of resource map handles, you start at the low-memory global TopMapHndl. Once again, this is messy and not guaranteed to work on future Mac operating system releases. >SuitcaseII seems to be able to do this (it even rearranges >the search order so that its resource files come AFTER the >System file. Neat trick.). When I try it, the files don't >stay open. Interesting. I don't use Suitcase but I would guess that it moves its resource map copies to come after SysMapHndl. This would keep them open all the time if the routine RsrcZoneInit stops at SysMapHndl when closing all open resource files instead of looking for a null next map handle, and it would allow searches if the various resource access routines don't stop past SysMapHndl but instead look for a null next map handle. This would seem like a lot to hope for from Apple software; they could do it any way they wanted, after all; but I understand Suitcase does so much resource manager patching that it may be a non-issue. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "Now hear a plain fact: Swedenborg has not written one new truth: Now hear another: he has written all the old falshoods. And now hear the reason. He conversed with Angels who are all religious, & conversed not with Devils who all hate religion..." - Blake, "The Marriage of Heaven and Hell"