<p><br>
On Jun 8, 2013 2:12 AM, "Somnath Kundu" <<a href="mailto:skundu07@gmail.com">skundu07@gmail.com</a>> wrote:<br>
><br>
> Thanks for your response.<br>
><br>
> This happened several weeks ago when I included source code of this library with my Android project and was stepping through it to understand what is happening in the library. Then it could not open files for reading, and after I made the above changes, it worked.<br>

><br>
> Today, after receiving your email, I again tested my project, which is now in working condition, with your "jcifs-1.3.17.jar", and to my surprise, it is working fine.<br>
><br>
> To find out why it was not working previously, I open the "SmbFile.java", and see there is a conditional block,<br>
><br>
> if( tree.session.transport.hasCapability( ServerMessageBlock.CAP_NT_SMBS )) {</p>
<p>Hi Somnath,</p>
<p>I would be shocked if you found a server that does not hasCapability CAP_NT_SMBS. Maybe an ancient version of Samba thats actually a honeypot.</p>
<p>Mike</p>
<p>> .....<br>
> SmbComNTCreateAndX request = new SmbComNTCreateAndX( unc, flags, access, shareAccess, attrs, options, null );<br>
> ......<br>
> } else {<br>
> .....<br>
> send( new SmbComOpenAndX( unc, access, flags, null ), response );<br>
> .....<br>
> }<br>
><br>
> I am yet to figure out what "hasCapability" method above is doing, but if the control goes through "SmbComOpenAndX", it does not add FILE_READ_DATA flag (where 'desiredAccess' is set to 'SHARING_DENY_NONE' only).<br>

><br>
> Is it possible that this was happening in my case earlier?<br>
><br>
> Best regards,<br>
> Somnath<br>
><br>
><br>
> On Fri, Jun 7, 2013 at 6:26 AM, Michael B Allen <<a href="mailto:ioplex@gmail.com">ioplex@gmail.com</a>> wrote:<br>
>><br>
>> On Thu, Jun 6, 2013 at 3:27 AM, Somnath Kundu <<a href="mailto:skundu07@gmail.com">skundu07@gmail.com</a>> wrote:<br>
>> > Hello,<br>
>> ><br>
>> > I was trying to use 'SmbRandomAccessFile' class with mode value "r" for<br>
>> > reading some file data, but it was not working. From the source code, it<br>
>> > appears that for mode value "r", the 'access' value remains set to '0', and<br>
>> > hence this problem. I had to modify the code as below to make it working.<br>
>><br>
>> Hi Somnath,<br>
>><br>
>> SmbComNTCreateAndX automatically adds FILE_READ_DATA.<br>
>><br>
>> Perhaps you should post precisely what actually happens and describe<br>
>> why you think it is in error.<br>
>><br>
>> ><br>
>> > BTW, what is the meaning of 'WRITE_OPTIONS' value as '0x0842' (as I do not<br>
>> > see any description in the code), and I see the default zero value is being<br>
>> > converted to '0x0040' later in the code?<br>
>><br>
>> Those are options specific to if the file is created. I don't recall<br>
>> what each bit actually means. I don't think they were documented when<br>
>> I wrote the code. They may be now.<br>
>><br>
>> Mike<br>
>><br>
>> --<br>
>> Michael B Allen<br>
>> Java Active Directory Integration<br>
>> <a href="http://www.ioplex.com/">http://www.ioplex.com/</a><br>
>><br>
</p>