SmbComNtTransactionResponse.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. namespace SharpCifs.Smb
  18. {
  19. internal abstract class SmbComNtTransactionResponse : SmbComTransactionResponse
  20. {
  21. internal override int ReadParameterWordsWireFormat(byte[] buffer, int bufferIndex)
  22. {
  23. int start = bufferIndex;
  24. buffer[bufferIndex++] = unchecked(unchecked(0x00));
  25. // Reserved
  26. buffer[bufferIndex++] = unchecked(unchecked(0x00));
  27. // Reserved
  28. buffer[bufferIndex++] = unchecked(unchecked(0x00));
  29. // Reserved
  30. TotalParameterCount = ReadInt4(buffer, bufferIndex);
  31. if (BufDataStart == 0)
  32. {
  33. BufDataStart = TotalParameterCount;
  34. }
  35. bufferIndex += 4;
  36. TotalDataCount = ReadInt4(buffer, bufferIndex);
  37. bufferIndex += 4;
  38. ParameterCount = ReadInt4(buffer, bufferIndex);
  39. bufferIndex += 4;
  40. ParameterOffset = ReadInt4(buffer, bufferIndex);
  41. bufferIndex += 4;
  42. ParameterDisplacement = ReadInt4(buffer, bufferIndex);
  43. bufferIndex += 4;
  44. DataCount = ReadInt4(buffer, bufferIndex);
  45. bufferIndex += 4;
  46. DataOffset = ReadInt4(buffer, bufferIndex);
  47. bufferIndex += 4;
  48. DataDisplacement = ReadInt4(buffer, bufferIndex);
  49. bufferIndex += 4;
  50. SetupCount = buffer[bufferIndex] & unchecked(0xFF);
  51. bufferIndex += 2;
  52. if (SetupCount != 0)
  53. {
  54. if (Log.Level >= 3)
  55. {
  56. Log.WriteLine("setupCount is not zero: " + SetupCount);
  57. }
  58. }
  59. return bufferIndex - start;
  60. }
  61. }
  62. }