[jcifs] Calling length on open file chokes

Rob Wygand rob at filefish.com
Fri Dec 14 11:54:14 EST 2001

I sort of agree with you. It is correct that if I wanted to do something 
invasive to the file, that I should get that exception... but smbclient 
and even Windows Network Neighborhood allow me to get the length of the 

Also, isDirectory() and isFile() both return false... I assume this is 


Allen, Michael B (RSCH) wrote:

> Mmm. I thought this would go away with the shareAccess change in SmbComNTCreateAndX. Unfourtunately this particular file is opened by the Win32 Kernel which I guess uses a very restrictive
> ShareAccess. The SMB_COM_QUERY_INFORMATION command is correctly getting the "File is being accessed by another process". smbclient uses the Trans2FindFirst2/Next2 commands. I'll see if there's a way
> to handle this a little more elegantly but I don't think so. Technically the "file is being accessed by another processes" business is correct; you shouldn't be querying that file. This is another yet
> another reason to implement listFiles().
> Mike
>>-----Original Message-----
>>From:	Rob Wygand [SMTP:rob at filefish.com]
>>Sent:	Thursday, December 13, 2001 6:35 PM
>>To:	jcifs at samba.org
>>Subject:	[jcifs] Calling length on open file chokes
>>Another little oddity, and this was also in 0.5.
>>If I can length() is a file that is open by another process, I get an 
>>exception (the file is in use by another process). I see this all the 
>>time when 'browsing' pagefile.sys. It should be possible to read the 
>>attrs of a file, even if another process has a write lock on it, no?
>>I tested this with smbclient, and that returns the right file length...

More information about the jcifs mailing list