NtTransQuerySecurityDesc.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // This code is derived from jcifs smb client library <jcifs at samba dot org>
  2. // Ported by J. Arturo <webmaster at komodosoft dot net>
  3. //
  4. // This library is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU Lesser General Public
  6. // License as published by the Free Software Foundation; either
  7. // version 2.1 of the License, or (at your option) any later version.
  8. //
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. // Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public
  15. // License along with this library; if not, write to the Free Software
  16. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. using SharpCifs.Util;
  18. namespace SharpCifs.Smb
  19. {
  20. internal class NtTransQuerySecurityDesc : SmbComNtTransaction
  21. {
  22. internal int Fid;
  23. internal int SecurityInformation;
  24. internal NtTransQuerySecurityDesc(int fid, int securityInformation)
  25. {
  26. this.Fid = fid;
  27. this.SecurityInformation = securityInformation;
  28. Command = SmbComNtTransact;
  29. Function = NtTransactQuerySecurityDesc;
  30. SetupCount = 0;
  31. TotalDataCount = 0;
  32. MaxParameterCount = 4;
  33. MaxDataCount = 32768;
  34. MaxSetupCount = unchecked(unchecked(0x00));
  35. }
  36. internal override int WriteSetupWireFormat(byte[] dst, int dstIndex)
  37. {
  38. return 0;
  39. }
  40. internal override int WriteParametersWireFormat(byte[] dst, int dstIndex)
  41. {
  42. int start = dstIndex;
  43. WriteInt2(Fid, dst, dstIndex);
  44. dstIndex += 2;
  45. dst[dstIndex++] = unchecked(unchecked(0x00));
  46. // Reserved
  47. dst[dstIndex++] = unchecked(unchecked(0x00));
  48. // Reserved
  49. WriteInt4(SecurityInformation, dst, dstIndex);
  50. dstIndex += 4;
  51. return dstIndex - start;
  52. }
  53. internal override int WriteDataWireFormat(byte[] dst, int dstIndex)
  54. {
  55. return 0;
  56. }
  57. internal override int ReadSetupWireFormat(byte[] buffer, int bufferIndex, int len
  58. )
  59. {
  60. return 0;
  61. }
  62. internal override int ReadParametersWireFormat(byte[] buffer, int bufferIndex, int
  63. len)
  64. {
  65. return 0;
  66. }
  67. internal override int ReadDataWireFormat(byte[] buffer, int bufferIndex, int len)
  68. {
  69. return 0;
  70. }
  71. public override string ToString()
  72. {
  73. return "NtTransQuerySecurityDesc[" + base.ToString() + ",fid=0x" + Hexdump
  74. .ToHexString(Fid, 4) + ",securityInformation=0x" + Hexdump.ToHexString(SecurityInformation
  75. , 8) + "]";
  76. }
  77. }
  78. }