WorkstationInfo100.cs 2.3 KB

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