[comp.sys.mac.programmer] When is the boot process over?

time@ice.com (02/19/91)

In article <2799@krafla.rhi.hi.is>, ebth@rhi.hi.is (Eggert Bjarni Thorlacius) writes:
> I am writing an INIT that is supposed to be active only during the startup
> process.  Is there any trap(toolbox preferably) that is called for the first
> time *soon* after startup?  I have tried InitWindows, InitMenus etc. but a
> lot of INITs call these, so they won't do.  I also patched InsertMenu but,
> for some wierd reason, that didn't work on a MacIIfx (read: probably only works
> on a Plus).

In the SCSI disk drivers I have written, I use a "dNeedTime" flag
in the driver. The first "accRun" control call to the driver does
not happen until just after the Finder launch. If you do not have
a driver for this, you might try patching PBMount, which should
happen just as Finder boots.

tim.

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |  Voice            FAX
Whitmore Lake MI. 48189   |  (313) 449 8288   (313) 449 9208

ebth@rhi.hi.is (Eggert Bjarni Thorlacius) (02/19/91)

Hello everybody.

I am writing an INIT that is supposed to be active only during the startup
process.  Is there any trap(toolbox preferably) that is called for the first
time *soon* after startup?  I have tried InitWindows, InitMenus etc. but a
lot of INITs call these, so they won't do.  I also patched InsertMenu but,
for some wierd reason, that didn't work on a MacIIfx (read: probably only works
on a Plus).

Also, does anyone have a good method to head-patch from Pascal?  Is it just

procedure TheOriginalTrap(parameters:BlahBlahBlah;
			originalAdrr:LongInt)
inline
	POP A0
	UNLK (A6)
	JMP A0;
(and if so, how do you say that in hex?), or is there something more to it?

Thanks in advance
Eggert Thorlacius
Unversity of Iceland.

Disclaimer of the week: All opinions marked with a (*) are mine.  The others
are somebody elses'.

mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) (02/20/91)

In article <2799@krafla.rhi.hi.is>, ebth@rhi.hi.is (Eggert Bjarni Thorlacius) writes:
>Hello everybody.
>
>I am writing an INIT that is supposed to be active only during the startup
>process.  Is there any trap(toolbox preferably) that is called for the first
>time *soon* after startup?  I have tried InitWindows, InitMenus etc. but a
>lot of INITs call these, so they won't do.  I also patched InsertMenu but,
>for some wierd reason, that didn't work on a MacIIfx (read: probably only works
>on a Plus).

Maybe a patch to _Launch would work ?

Matthias

-- 
Matthias Neeracher                                   mneerach@iiic.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_

Greg@AppleLink.Apple.Com (Greg Marriott) (02/20/91)

In article <1CE00001.y856or@tbomb.ice.com>,... writes:
> In article <2799@krafla.rhi.hi.is>, ebth@rhi.hi.is (Eggert Bjarni Thorlacius) writes:
> > I am writing an INIT that is supposed to be active only during the startup
> > process.  Is there any trap(toolbox preferably) that is called for the first
> > time *soon* after startup?  
> 
> In the SCSI disk drivers I have written, I use a "dNeedTime" flag
> in the driver. The first "accRun" control call to the driver does
> not happen until just after the Finder launch. If you do not have
> a driver for this, you might try patching PBMount, which should
> happen just as Finder boots.

An even better way is to patch _Launch.

BTW, I just thought I'd mention that you can't just "unpatch" your patches by
setting the trap address back to what it was before you patched it.  Any
other INITs that patch the same traps you do would be "cut off".  Either set
a flag in your patches that will make them short-circuit after boot time, or
make a little "jump table" that points to your patches when they're active
and then points to the old trap address when they're not.

Greg Marriott
Blue Meanie
Apple Computer, Inc.