RFR: 7038105 - File.isHidden() should return true for pagefile.sys and hiberfil.sys

Alan Bateman Alan.Bateman at oracle.com
Tue May 14 11:21:48 UTC 2013


On 14/05/2013 02:59, Rob McKenna wrote:
> Hi folks,
>
> Looking for a review of this suggested fix from Fujitsu. 
> GetFileAttributesExW() returns ERROR_SHARING_VIOLATION for 
> pagefile.sys and hiberfi.sys so we're falling back to FindFirstFile 
> instead:
>
> http://cr.openjdk.java.net/~robm/7038105/webrev.01/
>
>     -Rob
Thanks for taking this one and removed the crud that is the harding of 
c:\pagefile.sys.

Using FindFirstFile when GetFileAttributesExW fails when 
ERROR_SHARING_VIOLATION is the right approach but it needs an additional 
check on the attributes to see if they contain a reparse point, 
otherwise you return the attributes of the reparse point rather than the 
final file (try it with a symbolic link and you'll see what I mean). 
When it contains a reparse point then you can use getFileInformation to 
attempt to open the file (with sharing) and obtain the attributes.

One other idea is to rename it to getFinalAttributes and move it up to 
near the top so that it's with the other support functions.

-Alan.




More information about the core-libs-dev mailing list