home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 20046 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.1 KB  |  51 lines

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