SmbComOpenAndXResponse.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 class SmbComOpenAndXResponse : AndXServerMessageBlock
  20. {
  21. internal int Fid;
  22. internal int FileAttributes;
  23. internal int DataSize;
  24. internal int GrantedAccess;
  25. internal int FileType;
  26. internal int DeviceState;
  27. internal int Action;
  28. internal int ServerFid;
  29. internal long LastWriteTime;
  30. internal override int WriteParameterWordsWireFormat(byte[] dst, int dstIndex)
  31. {
  32. return 0;
  33. }
  34. internal override int WriteBytesWireFormat(byte[] dst, int dstIndex)
  35. {
  36. return 0;
  37. }
  38. internal override int ReadParameterWordsWireFormat(byte[] buffer, int bufferIndex
  39. )
  40. {
  41. int start = bufferIndex;
  42. Fid = ReadInt2(buffer, bufferIndex);
  43. bufferIndex += 2;
  44. FileAttributes = ReadInt2(buffer, bufferIndex);
  45. bufferIndex += 2;
  46. LastWriteTime = ReadUTime(buffer, bufferIndex);
  47. bufferIndex += 4;
  48. DataSize = ReadInt4(buffer, bufferIndex);
  49. bufferIndex += 4;
  50. GrantedAccess = ReadInt2(buffer, bufferIndex);
  51. bufferIndex += 2;
  52. FileType = ReadInt2(buffer, bufferIndex);
  53. bufferIndex += 2;
  54. DeviceState = ReadInt2(buffer, bufferIndex);
  55. bufferIndex += 2;
  56. Action = ReadInt2(buffer, bufferIndex);
  57. bufferIndex += 2;
  58. ServerFid = ReadInt4(buffer, bufferIndex);
  59. bufferIndex += 6;
  60. return bufferIndex - start;
  61. }
  62. internal override int ReadBytesWireFormat(byte[] buffer, int bufferIndex)
  63. {
  64. return 0;
  65. }
  66. public override string ToString()
  67. {
  68. return "SmbComOpenAndXResponse[" + base.ToString() + ",fid=" + Fid + ",fileAttributes="
  69. + FileAttributes + ",lastWriteTime=" + LastWriteTime + ",dataSize=" + DataSize
  70. + ",grantedAccess=" + GrantedAccess + ",fileType=" + FileType + ",deviceState="
  71. + DeviceState + ",action=" + Action + ",serverFid=" + ServerFid + "]";
  72. }
  73. }
  74. }