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.

96 lines
3.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 1998.
  5. //
  6. // File: usnvol.hxx
  7. //
  8. // Contents: Usn volume info
  9. //
  10. // History: 07-May-97 SitaramR Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include "scaninfo.hxx"
  15. //+-------------------------------------------------------------------------
  16. //
  17. // Class: CUsnVolume
  18. //
  19. // Purpose: Usn volume info
  20. //
  21. // History: 07-May-97 SitaramR Created
  22. //
  23. //--------------------------------------------------------------------------
  24. class CUsnVolume : public CDoubleLink
  25. {
  26. public:
  27. CUsnVolume( WCHAR wcDriveLetter, VOLUMEID volumeId );
  28. ~CUsnVolume();
  29. HANDLE VolumeHandle() { return _hVolume; }
  30. WCHAR DriveLetter() { return _wcDriveLetter; }
  31. USN MaxUsnRead() { return _usnMaxRead; }
  32. ULONG PercentRead();
  33. void SetMaxUsnRead( USN usn ) { _usnMaxRead = usn; }
  34. ULONGLONG JournalId() { return _JournalID; }
  35. VOLUMEID VolumeId() { return _volumeId; }
  36. FILEID RootFileId() { return _fileIdRoot; }
  37. inline void SetFsctlPending();
  38. void ResetFsctlPending() { _fFsctlPending = FALSE; }
  39. BOOL FFsctlPending() { return _fFsctlPending; }
  40. LONGLONG const & PendingTime() { return _ftPending; }
  41. HANDLE GetFsctlEvent() { return _evtFsctl.GetHandle(); }
  42. void CancelFsctl();
  43. ULONG WaitFsctl( DWORD msec ) { return _evtFsctl.Wait( msec ); }
  44. IO_STATUS_BLOCK * IoStatusBlock() { return &_iosb; }
  45. CScanInfoList & GetUsnScopesList() { return _usnScopesList; }
  46. BOOL IsOnline() const { return _fOnline; }
  47. void MarkOffline() { _fOnline = FALSE; }
  48. void * GetBuffer() { return (void *) _readBuffer; }
  49. ULONG GetBufferSize() { return sizeof(_readBuffer); }
  50. private:
  51. ULONGLONG _JournalID; // USN Journal ID
  52. LONGLONG _ftPending; // Fsctl went pending at this time
  53. HANDLE _hVolume; // Volume handle for usn fsctls
  54. WCHAR _wcDriveLetter; // Drive letter for usn scopes
  55. USN _usnMaxRead; // Max usn read from usn journal
  56. VOLUMEID _volumeId; // VolumeId
  57. FILEID _fileIdRoot; // File id of root of volume
  58. BOOL _fFsctlPending; // Is there an async fsctl pending ?
  59. BOOL _fOnline; // Is the volume healthy?
  60. CEventSem _evtFsctl; // Event signalled by async fsctl
  61. IO_STATUS_BLOCK _iosb; // Status block for fsctl
  62. CScanInfoList _usnScopesList; // List of scopes to monitor
  63. ULONGLONG _readBuffer[2048]; // Output buffer for usn-read fsctl
  64. };
  65. typedef class TDoubleList<CUsnVolume> CUsnVolumeList;
  66. typedef class TFwdListIter<CUsnVolume, CUsnVolumeList> CUsnVolumeIter;
  67. inline void CUsnVolume::SetFsctlPending()
  68. {
  69. GetSystemTimeAsFileTime( (FILETIME *)&_ftPending );
  70. _fFsctlPending = TRUE;
  71. }