NetrServerGetInfoResponse.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. /// NetrServerGetInfo Response (opnum 21)
  16. /// </summary>
  17. public class NetrServerGetInfoResponse
  18. {
  19. public ServerInfo InfoStruct;
  20. public Win32Error Result;
  21. public NetrServerGetInfoResponse()
  22. {
  23. }
  24. public NetrServerGetInfoResponse(byte[] buffer)
  25. {
  26. NDRParser parser = new NDRParser(buffer);
  27. InfoStruct = new ServerInfo(parser);
  28. // 14.4 - If an operation returns a result, the representation of the result appears after all parameters in
  29. Result = (Win32Error)parser.ReadUInt32();
  30. }
  31. public byte[] GetBytes()
  32. {
  33. NDRWriter writer = new NDRWriter();
  34. writer.WriteStructure(InfoStruct);
  35. writer.WriteUInt32((uint)Result);
  36. return writer.GetBytes();
  37. }
  38. }
  39. }