Source code of Windows XP (NT5)
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.

112 lines
3.0 KiB

  1. #ifndef __WATCHDOG_H
  2. #define __WATCHDOG_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: watchdog.h
  5. Description: The CWatchDog class is the main control object for the
  6. disk quota watchdog applet. A client merely creates a CWatchDog
  7. and tells it to "Run()".
  8. CWatchDog
  9. To run, the object does the following:
  10. 1. Enumerates all local and connected volumes on the machine.
  11. 2. For any volumes that support quotas, quota statistics are
  12. gathered for both the volume and the local user on the volume.
  13. Statistics are maintained in a list of CStatistics objects; one
  14. object for each volume/user pair.
  15. 3. Once all information has been gathered, a list of action objects
  16. (CActionEmail, CActionPopup) are created. System policy and
  17. previous notification history are considered when creating action
  18. objects.
  19. 4. When all action objects are created, they are performed.
  20. Revision History:
  21. Date Description Programmer
  22. -------- --------------------------------------------------- ----------
  23. 07/01/97 Initial creation. BrianAu
  24. */
  25. ///////////////////////////////////////////////////////////////////////////////
  26. #ifndef _WINDOWS_
  27. # include <windows.h>
  28. #endif
  29. #ifndef _SHLOBJ_H_
  30. # include <shlobj.h>
  31. #endif
  32. #ifndef __MAPISEND_H
  33. # include "mapisend.h"
  34. #endif
  35. #ifndef __STATS_H
  36. # include "stats.h"
  37. #endif
  38. #ifndef __POLICY_H
  39. # include "policy.h"
  40. #endif
  41. #ifndef __HISTORY_H
  42. # include "history.h"
  43. #endif
  44. #ifndef __ACTION_H
  45. # include "action.h"
  46. #endif
  47. //
  48. // This guy controls the whole thing.
  49. // Just create a CWatchDog object and call Run().
  50. // That's all there is to it.
  51. //
  52. class CWatchDog
  53. {
  54. public:
  55. CWatchDog(HANDLE htokenUser);
  56. ~CWatchDog(VOID);
  57. HRESULT Run(VOID);
  58. private:
  59. HANDLE m_htokenUser; // User account token.
  60. CPolicy m_policy; // Controls what actions occur.
  61. CHistory m_history; // Controls notification frequency.
  62. CStatisticsList m_statsList; // User & Volume quota info.
  63. CArray<CAction *> m_actionList; // List of actions to perform.
  64. CMapiSession m_mapiSession; // MAPI session object for sending email
  65. HRESULT GatherQuotaStatistics(IShellFolder *psfDrives);
  66. HRESULT BuildActionList(VOID);
  67. HRESULT BuildPopupDialogActions(VOID);
  68. HRESULT BuildEmailActions(VOID);
  69. HRESULT DoActions(VOID);
  70. VOID ClearActionList(VOID);
  71. LPBYTE GetUserSid(HANDLE htokenUser);
  72. BOOL ShouldReportTheseStats(const CStatistics& stats);
  73. BOOL ShouldSendEmail(VOID);
  74. BOOL ShouldPopupDialog(VOID);
  75. BOOL ShouldDoAnyNotifications(VOID);
  76. //
  77. // Prevent copy.
  78. //
  79. CWatchDog(const CWatchDog& rhs);
  80. CWatchDog& operator = (const CWatchDog& rhs);
  81. };
  82. #endif // __WATCHDOG_H