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.

75 lines
1.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: RCSTRMHD.CXX
  7. //
  8. // Contents: Header information for the Recoverable Storage Object.
  9. //
  10. // Classes: CRcovStorageHdr
  11. //
  12. //
  13. // History: 07-Feb-1994 SrikantS Created
  14. //
  15. //----------------------------------------------------------------------------
  16. #include <pch.cxx>
  17. #pragma hdrstop
  18. #include <rcstrmhd.hxx>
  19. void CRcovStorageHdr::Init(ULONG ulVer)
  20. {
  21. Win4Assert( FIELD_OFFSET( CRcovStorageHdr, _version ) == 0 );
  22. _version = ulVer;
  23. _flags = 0;
  24. _iPrimary = idxOne;
  25. _opCurr = opNone;
  26. _sigHdr1 = SIGHDR1;
  27. _sigHdr2 = SIGHDR2;
  28. memset( &_ahdrStrm, 0, sizeof(_ahdrStrm) );
  29. memset( &_ahdrUser, 0, sizeof(_ahdrUser) );
  30. Win4Assert( IsValid(ulVer) );
  31. }
  32. //+---------------------------------------------------------------------------
  33. //
  34. // Function: IsValid
  35. //
  36. // Synopsis: Checks the validity of the header data.
  37. //
  38. // History: 12-12-94 srikants Created
  39. //
  40. // Notes:
  41. //
  42. //----------------------------------------------------------------------------
  43. BOOL CRcovStorageHdr::IsValid(ULONG ulExpectedVer) const
  44. {
  45. if ( ulExpectedVer != _version)
  46. {
  47. return FALSE;
  48. }
  49. if ((SIGHDR1 != _sigHdr1) || (SIGHDR2 != _sigHdr2))
  50. {
  51. return FALSE;
  52. }
  53. if ( _iPrimary != idxOne && _iPrimary != idxTwo )
  54. {
  55. return FALSE;
  56. }
  57. if ( _opCurr < opNone || _opCurr > opDirty )
  58. {
  59. return FALSE;
  60. }
  61. return TRUE;
  62. }