Leaked source code of windows server 2003

71 lines
1.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation
  4. //
  5. // SYNOPSIS
  6. //
  7. // Declares the class TimeOfDay and functions for manipulating hour maps.
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef TIMEOFDAY_H
  11. #define TIMEOFDAY_H
  12. #pragma once
  13. #include "Condition.h"
  14. #include "textmap.h"
  15. // Returns true if the hour indicated by 'now' is set in the hour map.
  16. bool IsHourSet(
  17. const SYSTEMTIME& now,
  18. const BYTE* hourMap
  19. ) throw ();
  20. // Computes the number of seconds from 'now' until the first unset hour. If
  21. // 'currentHourOnly' is true, it only checks the current hour block. Otherwise,
  22. // it checks the entire map.
  23. DWORD ComputeTimeout(
  24. const SYSTEMTIME& now,
  25. const BYTE* hourMap
  26. ) throw ();
  27. // Imposes a Time of Day contraint for network policies.
  28. class ATL_NO_VTABLE TimeOfDay
  29. : public Condition,
  30. public CComCoClass<TimeOfDay, &__uuidof(TimeOfDay)>
  31. {
  32. public:
  33. IAS_DECLARE_REGISTRY(TimeOfDay, 1, IAS_REGISTRY_AUTO, NetworkPolicy)
  34. TimeOfDay() throw ();
  35. // Use compiler-generated version.
  36. // ~TimeOfDay() throw ();
  37. // ICondition
  38. STDMETHOD(IsTrue)(
  39. IRequest* pRequest,
  40. VARIANT_BOOL* pVal
  41. );
  42. // IConditionText
  43. STDMETHOD(put_ConditionText)(BSTR newVal);
  44. private:
  45. // Hour map being enforced.
  46. BYTE hourMap[IAS_HOUR_MAP_LENGTH];
  47. // Not implemented.
  48. TimeOfDay(const TimeOfDay&);
  49. TimeOfDay& operator=(const TimeOfDay&);
  50. };
  51. inline TimeOfDay::TimeOfDay() throw ()
  52. {
  53. memset(hourMap, 0, sizeof(hourMap));
  54. }
  55. #endif // TIMEOFDAY_H