ServerInfo101.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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] SERVER_INFO_101
  16. /// </summary>
  17. public class ServerInfo101 : ServerInfoLevel
  18. {
  19. public PlatformName PlatformID;
  20. public NDRUnicodeString ServerName;
  21. public uint VerMajor;
  22. public uint VerMinor;
  23. public ServerType Type;
  24. public NDRUnicodeString Comment;
  25. public ServerInfo101()
  26. {
  27. ServerName = new NDRUnicodeString();
  28. Comment = new NDRUnicodeString();
  29. }
  30. public ServerInfo101(NDRParser parser)
  31. {
  32. Read(parser);
  33. }
  34. public override void Read(NDRParser parser)
  35. {
  36. // If an array, structure, or union embeds a pointer, the representation of the referent of the
  37. // pointer is deferred to a position in the octet stream that follows the representation of the
  38. // embedding construction
  39. parser.BeginStructure();
  40. PlatformID = (PlatformName)parser.ReadUInt32();
  41. parser.ReadEmbeddedStructureFullPointer(ref ServerName);
  42. VerMajor = parser.ReadUInt32();
  43. VerMinor = parser.ReadUInt32();
  44. Type = (ServerType)parser.ReadUInt32();
  45. parser.ReadEmbeddedStructureFullPointer(ref Comment);
  46. parser.EndStructure();
  47. }
  48. public override void Write(NDRWriter writer)
  49. {
  50. writer.BeginStructure();
  51. writer.WriteUInt32((uint)PlatformID);
  52. writer.WriteEmbeddedStructureFullPointer(ServerName);
  53. writer.WriteUInt32(VerMajor);
  54. writer.WriteUInt32(VerMinor);
  55. writer.WriteUInt32((uint)Type);
  56. writer.WriteEmbeddedStructureFullPointer(Comment);
  57. writer.EndStructure();
  58. }
  59. /*
  60. public static ServerInfo101 ReadServerInfo101Pointer(NDRParser parser)
  61. {
  62. uint referentID = parser.ReadUInt32(); // ServerInfoLevel pointer
  63. ServerInfo101 info = new ServerInfo101(parser);
  64. parser.AddReferentInstance(referentID, info);
  65. return info;
  66. }*/
  67. public override uint Level
  68. {
  69. get
  70. {
  71. return 101;
  72. }
  73. }
  74. }
  75. }