Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site wang.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!wanginst!wang!ephraim From: ephraim@wang.UUCP (pri=8 Ephraim Vishniac x76659 ms1459) Newsgroups: net.micro.mac Subject: Re: INIT Resources Message-ID: <796@wang.UUCP> Date: Wed, 16-Apr-86 08:32:06 EST Article-I.D.: wang.796 Posted: Wed Apr 16 08:32:06 1986 Date-Received: Fri, 18-Apr-86 20:52:11 EST References: <8604110030.AA22220@kim.berkeley.edu> Organization: Wang Labs, Lowell MA Lines: 31 Gordon Hamachi asks: > Can someone explain INIT resources, or say where they are documented? I > have not been able to find out anything from Inside Macintosh, except that > there is a resource type "INIT". So, how come people are posting INIT > resource installers? How do they find out how to write them? I found out how to write them by calling Stew Rubinstein at Harvard. He told me that my INITs should start with a BRAnch to the real code, and that _SizeRsrc was often used to cut back the resource size after the one-time-only code in them had run. INITs are loaded, locked, and invoked with a JSR from the system code. For reasons I can't imagine, the system patches two NOPs (4E714E71) over the start of your INIT after it returns. INITs are useful for doing anything you want done at system startup, after PTCH installation. The INIT number determines the order in which the INITs are executed. Detaching or releasing an INIT is a bit tricky. I got information on how to do this from Evan Solley of Infosphere, who evidently disassembled the system code that invokes INITs. I don't have the details handy, but the general idea involves knowing that the system leaves a handle to your INIT in D7 (?), and faking it out when you release your INIT and invalidate the handle. Apple is now providing an INIT (#31) which invokes INITs from other files so that they don't have to live in the system file. See the December supplement for details. Ephraim Vishniac decvax!wanginst!wang!ephraim