Leaked source code of windows server 2003
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.

68 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998.
  5. //
  6. // File: VolInfo.cxx
  7. //
  8. // Contents: Grab bag for volume-wide information
  9. //
  10. // History: 28-Jul-98 KyleP Pulled from cicat.hxx
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include "volinfo.hxx"
  16. //+---------------------------------------------------------------------------
  17. //
  18. // Member: CVolumeInfo::Set, public
  19. //
  20. // Synopsis: Associate a volume with the CVolumeInfo
  21. //
  22. // Arguments: [wc] -- Drive letter of volume
  23. // [CreationTime] -- Creation time of volume
  24. // [SerialNumber] -- Volume serial number
  25. // [fUsnVolume] -- TRUE if volume supports USNs
  26. // [JournalId] -- USN Journal ID (if appropriate)
  27. //
  28. // History: 28-Jul-1998 KyleP Pulled from cicat.hxx
  29. //
  30. //----------------------------------------------------------------------------
  31. void CVolumeInfo::Set( WCHAR wc,
  32. ULONGLONG const & CreationTime,
  33. ULONG SerialNumber,
  34. BOOL fUsnVolume,
  35. ULONGLONG const & JournalId )
  36. {
  37. _wch = wc;
  38. _fUsnVolume = fUsnVolume;
  39. _JournalId = JournalId;
  40. _CreationTime = CreationTime;
  41. _SerialNumber = SerialNumber;
  42. WCHAR awcTmp[10];
  43. wcscpy( awcTmp, L"\\\\.\\k:" );
  44. awcTmp[ 4 ] = wc;
  45. HANDLE h = CreateFile( awcTmp,
  46. FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
  47. FILE_SHARE_READ | FILE_SHARE_WRITE,
  48. 0,
  49. OPEN_EXISTING,
  50. 0, 0 );
  51. if ( INVALID_HANDLE_VALUE == h )
  52. {
  53. ciDebugOut(( DEB_WARN, "Error %u opening %wc:\n", GetLastError(), wc ));
  54. _JournalId = 0;
  55. _CreationTime = 0;
  56. _SerialNumber = 0;
  57. }
  58. _xVolume.Set( h );
  59. }