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.

69 lines
2.1 KiB

  1. //--------------------------------------------------------------------------
  2. // TimeBomb.CPP
  3. //--------------------------------------------------------------------------
  4. //#include "time.h"
  5. #include "timebomb.h"
  6. #include "winbase.h"
  7. #include "IPServer.H"
  8. // prototypes
  9. BOOL After (SYSTEMTIME t1, SYSTEMTIME t2);
  10. // Change this to the desired expiration date
  11. // format {year, month, dayofweek, day, hour, minute, second, milliseconds}
  12. const SYSTEMTIME beta_death = {1998, 3, 0, 1, 0, 0, 0, 0}; // 1 Mar 1998
  13. //-------------------------------------------------------------------
  14. // CheckExpired - checks whether to the control has expired (beta)
  15. //-------------------------------------------------------------------
  16. BOOL CheckExpired (void)
  17. {
  18. #ifdef BETA_BOMB
  19. SYSTEMTIME now;
  20. GetSystemTime(&now);
  21. if (After (now, beta_death))
  22. { // alert user of expiration
  23. MessageBox(NULL, SZEXPIRED1, SZEXPIRED2,
  24. (MB_OK | MB_TASKMODAL));
  25. return FALSE;
  26. }
  27. #endif //BETA_BOMB
  28. return TRUE;
  29. }
  30. //-------------------------------------------------------------------
  31. // After - determines whether t1 is later than t2
  32. //-------------------------------------------------------------------
  33. BOOL After (SYSTEMTIME t1, SYSTEMTIME t2)
  34. {
  35. // compare Years
  36. if (t1.wYear > t2.wYear) return TRUE;
  37. if (t1.wYear < t2.wYear) return FALSE;
  38. // else Years are equal; compare Months
  39. if (t1.wMonth > t2.wMonth) return TRUE;
  40. if (t1.wMonth < t2.wMonth) return FALSE;
  41. // else Months are equal; compare Days
  42. if (t1.wDay > t2.wDay) return TRUE;
  43. if (t1.wDay < t2.wDay) return FALSE;
  44. // else Days are equal; compare Hours
  45. if (t1.wHour > t2.wHour) return TRUE;
  46. if (t1.wHour < t2.wHour) return FALSE;
  47. // else Hours are equal; compare Minutes
  48. if (t1.wMinute > t2.wMinute) return TRUE;
  49. if (t1.wMinute < t2.wMinute) return FALSE;
  50. // else Minutes are equal; compare Seconds
  51. if (t1.wSecond > t2.wSecond) return TRUE;
  52. if (t1.wSecond < t2.wSecond) return FALSE;
  53. // else Seconds are equal; compare Milliseconds
  54. if (t1.wMilliseconds > t2.wMilliseconds) return TRUE;
  55. // else Milliseconds are equal or less
  56. return FALSE;
  57. }