ShareInfo1Entry.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. /// [MS-SRVS] SHARE_INFO_1
  16. /// </summary>
  17. public class ShareInfo1Entry : IShareInfoEntry
  18. {
  19. public NDRUnicodeString NetName;
  20. public ShareTypeExtended ShareType;
  21. public NDRUnicodeString Remark;
  22. public ShareInfo1Entry()
  23. {
  24. }
  25. public ShareInfo1Entry(string shareName, ShareTypeExtended shareType)
  26. {
  27. NetName = new NDRUnicodeString(shareName);
  28. ShareType = shareType;
  29. Remark = new NDRUnicodeString(String.Empty);
  30. }
  31. public ShareInfo1Entry(NDRParser parser)
  32. {
  33. Read(parser);
  34. }
  35. public void Read(NDRParser parser)
  36. {
  37. parser.BeginStructure();
  38. parser.ReadEmbeddedStructureFullPointer(ref NetName);
  39. ShareType = new ShareTypeExtended(parser);
  40. parser.ReadEmbeddedStructureFullPointer(ref Remark);
  41. parser.EndStructure();
  42. }
  43. public void Write(NDRWriter writer)
  44. {
  45. writer.BeginStructure();
  46. writer.WriteEmbeddedStructureFullPointer(NetName);
  47. ShareType.Write(writer);
  48. writer.WriteEmbeddedStructureFullPointer(Remark);
  49. writer.EndStructure();
  50. }
  51. public uint Level
  52. {
  53. get
  54. {
  55. return 1;
  56. }
  57. }
  58. }
  59. }