Trans2FindNext2.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 Trans2FindNext2 : SmbComTransaction
  21. {
  22. private int _sid;
  23. private int _informationLevel;
  24. private int _resumeKey;
  25. private int _flags;
  26. private string _filename;
  27. internal Trans2FindNext2(int sid, int resumeKey, string filename)
  28. {
  29. this._sid = sid;
  30. this._resumeKey = resumeKey;
  31. this._filename = filename;
  32. Command = SmbComTransaction2;
  33. SubCommand = Trans2FindNext2;
  34. _informationLevel = Smb.Trans2FindFirst2.SmbFileBothDirectoryInfo;
  35. _flags = unchecked(0x00);
  36. MaxParameterCount = 8;
  37. MaxDataCount = Smb.Trans2FindFirst2.ListSize;
  38. MaxSetupCount = 0;
  39. }
  40. internal override void Reset(int resumeKey, string lastName)
  41. {
  42. base.Reset();
  43. this._resumeKey = resumeKey;
  44. _filename = lastName;
  45. Flags2 = 0;
  46. }
  47. internal override int WriteSetupWireFormat(byte[] dst, int dstIndex)
  48. {
  49. dst[dstIndex++] = SubCommand;
  50. dst[dstIndex++] = unchecked(unchecked(0x00));
  51. return 2;
  52. }
  53. internal override int WriteParametersWireFormat(byte[] dst, int dstIndex)
  54. {
  55. int start = dstIndex;
  56. WriteInt2(_sid, dst, dstIndex);
  57. dstIndex += 2;
  58. WriteInt2(Smb.Trans2FindFirst2.ListCount, dst, dstIndex);
  59. dstIndex += 2;
  60. WriteInt2(_informationLevel, dst, dstIndex);
  61. dstIndex += 2;
  62. WriteInt4(_resumeKey, dst, dstIndex);
  63. dstIndex += 4;
  64. WriteInt2(_flags, dst, dstIndex);
  65. dstIndex += 2;
  66. dstIndex += WriteString(_filename, dst, dstIndex);
  67. return dstIndex - start;
  68. }
  69. internal override int WriteDataWireFormat(byte[] dst, int dstIndex)
  70. {
  71. return 0;
  72. }
  73. internal override int ReadSetupWireFormat(byte[] buffer, int bufferIndex, int len
  74. )
  75. {
  76. return 0;
  77. }
  78. internal override int ReadParametersWireFormat(byte[] buffer, int bufferIndex, int
  79. len)
  80. {
  81. return 0;
  82. }
  83. internal override int ReadDataWireFormat(byte[] buffer, int bufferIndex, int len)
  84. {
  85. return 0;
  86. }
  87. public override string ToString()
  88. {
  89. return "Trans2FindNext2[" + base.ToString() + ",sid=" + _sid + ",searchCount="
  90. + Smb.Trans2FindFirst2.ListSize + ",informationLevel=0x" + Hexdump.ToHexString(_informationLevel
  91. , 3) + ",resumeKey=0x" + Hexdump.ToHexString(_resumeKey, 4) + ",flags=0x" + Hexdump
  92. .ToHexString(_flags, 2) + ",filename=" + _filename + "]";
  93. }
  94. }
  95. }