ObjectIDBufferType1.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2014 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 System.Text;
  10. using Utilities;
  11. namespace SMBLibrary
  12. {
  13. /// <summary>
  14. /// [MS-FSCC] FILE_OBJECTID_BUFFER Type 1
  15. /// </summary>
  16. public class ObjectIDBufferType1
  17. {
  18. public const int Length = 64;
  19. public Guid ObjectId;
  20. public Guid BirthVolumeId;
  21. public Guid BirthObjectId;
  22. public Guid DomainId;
  23. public ObjectIDBufferType1()
  24. {
  25. }
  26. public ObjectIDBufferType1(byte[] buffer)
  27. {
  28. ObjectId = LittleEndianConverter.ToGuid(buffer, 0);
  29. BirthVolumeId = LittleEndianConverter.ToGuid(buffer, 16);
  30. BirthObjectId = LittleEndianConverter.ToGuid(buffer, 32);
  31. DomainId = LittleEndianConverter.ToGuid(buffer, 48);
  32. }
  33. public byte[] GetBytes()
  34. {
  35. byte[] buffer = new byte[Length];
  36. LittleEndianWriter.WriteGuidBytes(buffer, 0, ObjectId);
  37. LittleEndianWriter.WriteGuidBytes(buffer, 16, BirthVolumeId);
  38. LittleEndianWriter.WriteGuidBytes(buffer, 32, BirthObjectId);
  39. LittleEndianWriter.WriteGuidBytes(buffer, 48, DomainId);
  40. return buffer;
  41. }
  42. }
  43. }