home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!elroy.jpl.nasa.gov!ucla-cs!kona.cs.ucla.edu!tj
- From: tj@kona.cs.ucla.edu (Tom Johnson)
- Subject: Re: Detecting reboot or startup
- Message-ID: <1992Dec18.181253.9369@cs.ucla.edu>
- Sender: usenet@cs.ucla.edu (Mr Usenet)
- Nntp-Posting-Host: kona.cs.ucla.edu
- Organization: UCLA, Computer Science Department
- References: <cmcclary-151292113831@mcclary-mac.ucs.indiana.edu> <1992Dec16.132825.13170@kth.se> <1992Dec17.181910.12542@lloyd.Camex.COM>
- Date: Fri, 18 Dec 92 18:12:53 GMT
- Lines: 38
-
- cmcclary@ucs.indiana.edu (Charles McClary) asked:
- >>
- >>>What is the best/preferred method for an application to detect if the
- >>>system has been rebooted or restarted since it (the application) last ran.
-
- And d88-jwa@dront.nada.kth.se (Jon Wtte) answered:
- >>
- >>Install a gestalt selector with your own signature as selector code.
- >>
-
- In considering old systems that don't have Gestalt, kent@lloyd.Camex.COM
- (Kent Borg) suggested:
- >
- >Put a little something else in the System heap, note its location in a
- >file, and check whether it is still there when you next launch.
- >(Rather than using a file to record the address you might walk the
- >heap to find it. I doubt Apple will change the heap structure in
- >*old* systems.)
- >
- >Off the top of my head, I can't remember how an app can allocate a
- >handle in the System heap and also prevent Multifinder from cleaning
- >up and deleting it for you when you exit, but loading a resource into
- >the System heap and then detaching it should work. Shouldn't it?
- >
-
- This reminded me of how I used to handle communication between a cdev and
- an INIT before Gestalt was available. I simply installed a small driver
- and used it to pass variables back and forth.
-
- For this purpose (detecting whether the machine has been rebooted, the
- driver wouldn't really have to do anything - it could be a very simple
- shell. As with Jon's Gestalt method, you would simply check for an error
- - in this case one returned by OpenDriver().
-
- Tom
- --
- Tom Johnson "They say Confucious does his crossword with a pen."
- tj@cs.ucla.edu -Tori Amos
-