Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.5 KiB

  1. /*
  2. * REVISIONS:
  3. * pcy30Nov92: Added header
  4. * ane16Dec92: Moved some functions up from platform specific apps
  5. * pcy17Dec92: Added construction of theConfigManager to MainApp
  6. * ane11Jan93: Call Host::RegisterForEvents explicitly
  7. * ane18Jan93: Added data logger and updated Set function
  8. * ane21Jan93: Added error logger
  9. * pcy29Jan93: Generate a MONITORING_STARTED event in ServerApp::Start()
  10. * jod02Feb93: Moved MONITORING_STARTED to Os2ServerApp::Start()
  11. * ane02Feb93: Moved MONITORING_STARTED back to ServerApp::Start()
  12. * ane03Feb93: Changed order of construction and added some initialization
  13. * rct09Feb93: Split client and server app to thier own files
  14. * tje26Feb93: Added stdlib.h header for getenv() prototype
  15. * cad07Jun93: made bcfgmgr.h include only for windows
  16. * pcy09Sep93: Log file not found error to errlog if inifile isnt there
  17. * rct05Nov93: Added hook to allow 'passing' of directory to mainapp for NLMs
  18. * cad19Nov93: better ini file delim
  19. * mwh16Mar94: better path check for .ini file
  20. * ram21Mar94: Added some windows specific stuff and also modified ctor and
  21. * dtor.
  22. * mwh05May94: #include file madness , part 2
  23. * ajr22Jul94: Fixed crash if "configuration" file isn't found.
  24. * dml21Jun95: Modified for general utility to get default pwrchute
  25. * directory, req'd for Windows
  26. * ajr07Nov95: port for SINIX
  27. * pam02Apr96: When deleting theTimerManager, I check to see if
  28. * _theTimerManager exists as well *
  29. * inf01Mar97: Loaded all localisable strings from the resource file
  30. * inf28Apr97: Used FormatMessage() to display message about ini file missing.
  31. * ntf08May97: Changed mainapp.cxx to use NTConfigManager on Win95
  32. * inf10May97: Loaded resource file in MainApplication because it had to be
  33. * loaded before the ErrorLogger object was created
  34. * ntf03Oct97: Removed C_WIN95. NTConfigManager now used in both NT and 95.
  35. * cgm25Nov97: Removed the duplicate creation of theErrorLog
  36. * awm02Oct97: Moved setting _theConfigManager to NULL when the main ini
  37. * configuration manager is destroyed to the main application
  38. * from the object itself in order to support multiple
  39. * configuration managers operating at once.
  40. */
  41. #include "cdefine.h"
  42. #include "_defs.h"
  43. #include "mainapp.h"
  44. #include "errlogr.h"
  45. #include "timerman.h"
  46. #include "ntcfgmgr.h"
  47. /*
  48. C+
  49. Name :MainApplication
  50. Synop :
  51. Constructor. Can be called from any class dervived from
  52. MainApplication. Initializes a Dispatcher.
  53. Any object derived from this class should NEW the
  54. TimerManager object.
  55. */
  56. MainApplication::MainApplication() : theTimerManager((PTimerManager)NULL)
  57. {
  58. theConfigManager = new NTConfigManager();
  59. // need to do this here, after we check for the existance of pwrchute.ini and
  60. // the resource file, because the resource file is used when ErrorLogger
  61. // is created
  62. theErrorLog = new ErrorLogger(this);
  63. }
  64. /***************************************************************************
  65. ***************************************************************************/
  66. MainApplication::~MainApplication()
  67. {
  68. delete theConfigManager;
  69. _theConfigManager = (PConfigManager) NULL;
  70. delete theErrorLog;
  71. theErrorLog = NULL;
  72. if (theTimerManager && (_theTimerManager)) {
  73. delete theTimerManager;
  74. theTimerManager = NULL;
  75. }
  76. _theTimerManager = theTimerManager = (PTimerManager)NULL;
  77. }