NetrShareEnumRequest.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 SMBLibrary.RPC;
  11. using Utilities;
  12. namespace SMBLibrary.Services
  13. {
  14. /// <summary>
  15. /// NetrShareEnum Request (opnum 15)
  16. /// </summary>
  17. public class NetrShareEnumRequest
  18. {
  19. public string ServerName;
  20. public ShareEnum InfoStruct;
  21. public uint PreferedMaximumLength; // Preferred maximum length, in bytes, of the returned data
  22. public uint ResumeHandle;
  23. public NetrShareEnumRequest()
  24. {
  25. }
  26. public NetrShareEnumRequest(byte[] buffer)
  27. {
  28. NDRParser parser = new NDRParser(buffer);
  29. ServerName = parser.ReadTopLevelUnicodeStringPointer();
  30. InfoStruct = new ShareEnum(parser);
  31. PreferedMaximumLength = parser.ReadUInt32();
  32. ResumeHandle = parser.ReadUInt32();
  33. }
  34. public byte[] GetBytes()
  35. {
  36. NDRWriter writer = new NDRWriter();
  37. writer.WriteTopLevelUnicodeStringPointer(ServerName);
  38. writer.WriteStructure(InfoStruct);
  39. writer.WriteUInt32(PreferedMaximumLength);
  40. writer.WriteUInt32(ResumeHandle);
  41. return writer.GetBytes();
  42. }
  43. }
  44. }