WorkstationInfo100.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. namespace SMBLibrary.Services
  12. {
  13. /// <summary>
  14. /// [MS-WKST] WKSTA_INFO_100
  15. /// </summary>
  16. public class WorkstationInfo100 : WorkstationInfoLevel
  17. {
  18. public uint PlatformID;
  19. public NDRUnicodeString ComputerName;
  20. public NDRUnicodeString LanGroup;
  21. public uint VerMajor;
  22. public uint VerMinor;
  23. public WorkstationInfo100()
  24. {
  25. ComputerName = new NDRUnicodeString();
  26. LanGroup = new NDRUnicodeString();
  27. }
  28. public WorkstationInfo100(NDRParser parser)
  29. {
  30. Read(parser);
  31. }
  32. public override void Read(NDRParser parser)
  33. {
  34. // If an array, structure, or union embeds a pointer, the representation of the referent of the
  35. // pointer is deferred to a position in the octet stream that follows the representation of the
  36. // embedding construction
  37. parser.BeginStructure();
  38. PlatformID = parser.ReadUInt32();
  39. parser.ReadEmbeddedStructureFullPointer(ref ComputerName);
  40. parser.ReadEmbeddedStructureFullPointer(ref LanGroup);
  41. VerMajor = parser.ReadUInt32();
  42. VerMinor = parser.ReadUInt32();
  43. parser.EndStructure();
  44. }
  45. public override void Write(NDRWriter writer)
  46. {
  47. writer.BeginStructure();
  48. writer.WriteUInt32(PlatformID);
  49. writer.WriteEmbeddedStructureFullPointer(ComputerName);
  50. writer.WriteEmbeddedStructureFullPointer(LanGroup);
  51. writer.WriteUInt32(VerMajor);
  52. writer.WriteUInt32(VerMinor);
  53. writer.EndStructure();
  54. }
  55. public override uint Level
  56. {
  57. get
  58. {
  59. return 100;
  60. }
  61. }
  62. }
  63. }