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.

150 lines
4.3 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1995, Microsoft Corporation
  4. //
  5. // File: recon.hxx
  6. //
  7. // Contents: Data structures for Volume Object Reconciliation, and some
  8. // inline functions useful for reconciliation
  9. //
  10. // Classes: None
  11. //
  12. // Functions: IsFTNewer -- FILETIME comparison functions
  13. // IsFTOlder --
  14. // IsFTSame --
  15. // IsFTSameOrNewer --
  16. // IsFTSameOrOlder --
  17. //
  18. // History: April 17, 1995 Milans created
  19. //
  20. //-----------------------------------------------------------------------------
  21. #ifndef _RECON_
  22. #define _RECON_
  23. typedef struct {
  24. LPWSTR wszPrefix;
  25. LPWSTR wszShortPath;
  26. GUID idVolume;
  27. DWORD dwState;
  28. DWORD dwType;
  29. LPWSTR wszComment;
  30. ULONG dwTimeout;
  31. FILETIME ftEntryPath;
  32. FILETIME ftState;
  33. FILETIME ftComment;
  34. } DFS_ID_PROPS, *PDFS_ID_PROPS;
  35. //+----------------------------------------------------------------------------
  36. //
  37. // Function: IsFTNewer
  38. //
  39. // Synopsis: Given two filetimes, this routine returns TRUE if the first
  40. // filetime is chronologically later than the second.
  41. //
  42. // Arguments: [ftFirst] -- The two filetimes
  43. // [ftSecond]
  44. //
  45. // Returns: TRUE if ftFirst is later in time than ftSecond
  46. //
  47. //-----------------------------------------------------------------------------
  48. BOOL inline IsFTNewer(
  49. const FILETIME ftFirst,
  50. const FILETIME ftSecond)
  51. {
  52. return( (BOOL) (CompareFileTime( &ftFirst, &ftSecond ) == +1L) );
  53. }
  54. //+----------------------------------------------------------------------------
  55. //
  56. // Function: IsFTSame
  57. //
  58. // Synopsis: Given two filetimes, this routine returns TRUE if the first
  59. // filetime is chronologically equal to the second.
  60. //
  61. // Arguments: [ftFirst] -- The two filetimes
  62. // [ftSecond]
  63. //
  64. // Returns: TRUE if ftFirst is equal in time than ftSecond
  65. //
  66. //-----------------------------------------------------------------------------
  67. BOOL inline IsFTSame(
  68. const FILETIME ftFirst,
  69. const FILETIME ftSecond)
  70. {
  71. return( (BOOL) (CompareFileTime( &ftFirst, &ftSecond ) == 0L) );
  72. }
  73. //+----------------------------------------------------------------------------
  74. //
  75. // Function: IsFTOlder
  76. //
  77. // Synopsis: Given two filetimes, this routine returns TRUE if the first
  78. // filetime chronologically predates the second.
  79. //
  80. // Arguments: [ftFirst] -- The two filetimes
  81. // [ftSecond]
  82. //
  83. // Returns: TRUE if ftFirst predates ftSecond in time
  84. //
  85. //-----------------------------------------------------------------------------
  86. BOOL inline IsFTOlder(
  87. const FILETIME ftFirst,
  88. const FILETIME ftSecond)
  89. {
  90. return( (BOOL) (CompareFileTime( &ftFirst, &ftSecond ) == -1L) );
  91. }
  92. //+----------------------------------------------------------------------------
  93. //
  94. // Function: IsFTSameOrNewer
  95. //
  96. // Synopsis: Given two filetimes, this routine returns TRUE if the first
  97. // filetime is chronologically equal to or later than the second.
  98. //
  99. // Arguments: [ftFirst] -- The two filetimes
  100. // [ftSecond]
  101. //
  102. // Returns: TRUE if ftFirst is equal or later in time than ftSecond
  103. //
  104. //-----------------------------------------------------------------------------
  105. BOOL inline IsFTSameOrNewer(
  106. const FILETIME ftFirst,
  107. const FILETIME ftSecond)
  108. {
  109. return( (BOOL) (CompareFileTime( &ftFirst, &ftSecond ) >= 0L) );
  110. }
  111. //+----------------------------------------------------------------------------
  112. //
  113. // Function: IsFTSameOrOlder
  114. //
  115. // Synopsis: Given two filetimes, this routine returns TRUE if the first
  116. // filetime is chronologically equal to or predates the second.
  117. //
  118. // Arguments: [ftFirst] -- The two filetimes
  119. // [ftSecond]
  120. //
  121. // Returns: TRUE if ftFirst is equal or predates in time ftSecond
  122. //
  123. //-----------------------------------------------------------------------------
  124. BOOL inline IsFTSameOrOlder(
  125. const FILETIME ftFirst,
  126. const FILETIME ftSecond)
  127. {
  128. return( (BOOL) (CompareFileTime( &ftFirst, &ftSecond ) <= 0L) );
  129. }
  130. #endif // _RECON_