AceHeader.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using Utilities;
  10. namespace SMBLibrary
  11. {
  12. /// <summary>
  13. /// [MS-DTYP] ACE_HEADER
  14. /// </summary>
  15. public class AceHeader
  16. {
  17. public const int Length = 4;
  18. public AceType AceType;
  19. public AceFlags AceFlags;
  20. public ushort AceSize;
  21. public AceHeader()
  22. {
  23. }
  24. public AceHeader(byte[] buffer, int offset)
  25. {
  26. AceType = (AceType)ByteReader.ReadByte(buffer, offset + 0);
  27. AceFlags = (AceFlags)ByteReader.ReadByte(buffer, offset + 1);
  28. AceSize = LittleEndianConverter.ToUInt16(buffer, offset + 2);
  29. }
  30. public void WriteBytes(byte[] buffer, ref int offset)
  31. {
  32. ByteWriter.WriteByte(buffer, ref offset, (byte)AceType);
  33. ByteWriter.WriteByte(buffer, ref offset, (byte)AceFlags);
  34. LittleEndianWriter.WriteUInt16(buffer, ref offset, AceSize);
  35. }
  36. }
  37. }