NTTransactQuerySecurityDescriptorRequest.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 Utilities;
  11. namespace SMBLibrary.SMB1
  12. {
  13. /// <summary>
  14. /// NT_TRANSACT_QUERY_SECURITY_DESC Request
  15. /// </summary>
  16. public class NTTransactQuerySecurityDescriptorRequest :NTTransactSubcommand
  17. {
  18. public const int ParametersLength = 8;
  19. // Parameters:
  20. public ushort FID;
  21. public ushort Reserved;
  22. public SecurityInfoFields SecurityInfoFields;
  23. public NTTransactQuerySecurityDescriptorRequest()
  24. {
  25. }
  26. public NTTransactQuerySecurityDescriptorRequest(byte[] parameters)
  27. {
  28. FID = LittleEndianConverter.ToUInt16(parameters, 0);
  29. Reserved = LittleEndianConverter.ToUInt16(parameters, 2);
  30. SecurityInfoFields = (SecurityInfoFields)LittleEndianConverter.ToUInt32(parameters, 4);
  31. }
  32. public override byte[] GetParameters(bool isUnicode)
  33. {
  34. byte[] parameters = new byte[ParametersLength];
  35. LittleEndianWriter.WriteUInt16(parameters, 0, FID);
  36. LittleEndianWriter.WriteUInt16(parameters, 2, Reserved);
  37. LittleEndianWriter.WriteUInt32(parameters, 4, (uint)SecurityInfoFields);
  38. return parameters;
  39. }
  40. public override NTTransactSubcommandName SubcommandName
  41. {
  42. get
  43. {
  44. return NTTransactSubcommandName.NT_TRANSACT_QUERY_SECURITY_DESC;
  45. }
  46. }
  47. }
  48. }