Trans2QueryPathInformation.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 Trans2QueryPathInformation : SmbComTransaction
  21. {
  22. private int _informationLevel;
  23. internal Trans2QueryPathInformation(string filename, int informationLevel)
  24. {
  25. Path = filename;
  26. this._informationLevel = informationLevel;
  27. Command = SmbComTransaction2;
  28. SubCommand = Trans2QueryPathInformation;
  29. TotalDataCount = 0;
  30. MaxParameterCount = 2;
  31. MaxDataCount = 40;
  32. MaxSetupCount = unchecked(unchecked(0x00));
  33. }
  34. internal override int WriteSetupWireFormat(byte[] dst, int dstIndex)
  35. {
  36. dst[dstIndex++] = SubCommand;
  37. dst[dstIndex++] = unchecked(unchecked(0x00));
  38. return 2;
  39. }
  40. internal override int WriteParametersWireFormat(byte[] dst, int dstIndex)
  41. {
  42. int start = dstIndex;
  43. WriteInt2(_informationLevel, dst, dstIndex);
  44. dstIndex += 2;
  45. dst[dstIndex++] = unchecked(unchecked(0x00));
  46. dst[dstIndex++] = unchecked(unchecked(0x00));
  47. dst[dstIndex++] = unchecked(unchecked(0x00));
  48. dst[dstIndex++] = unchecked(unchecked(0x00));
  49. dstIndex += WriteString(Path, dst, dstIndex);
  50. return dstIndex - start;
  51. }
  52. internal override int WriteDataWireFormat(byte[] dst, int dstIndex)
  53. {
  54. return 0;
  55. }
  56. internal override int ReadSetupWireFormat(byte[] buffer, int bufferIndex, int len)
  57. {
  58. return 0;
  59. }
  60. internal override int ReadParametersWireFormat(byte[] buffer,
  61. int bufferIndex,
  62. int len)
  63. {
  64. return 0;
  65. }
  66. internal override int ReadDataWireFormat(byte[] buffer,
  67. int bufferIndex,
  68. int len)
  69. {
  70. return 0;
  71. }
  72. public override string ToString()
  73. {
  74. return "Trans2QueryPathInformation["
  75. + base.ToString()
  76. + ",informationLevel=0x" + Hexdump.ToHexString(_informationLevel, 3)
  77. + ",filename=" + Path + "]";
  78. }
  79. }
  80. }