Request for review: 7190897 (fs) Files.isWritable method returns false when the path is writable (win). - ver. 1

Alexey Utkin alexey.utkin at oracle.com
Mon Mar 4 09:31:36 UTC 2013


Alan,
Do you agree with
>     /**
>      * Check the access right against the securityInfo in the current 
> thread.
>      */
>     static boolean checkAccessMask(long securityInfo, int accessMask,
>         int genericRead, int genericWrite, int genericExecute, int 
> genericAll)
>         throws WindowsException
>     {
>         int privilegies = TOKEN_QUERY;
>         long hToken = OpenThreadToken(GetCurrentThread(), privilegies, 
> false);
>         if (hToken == 0L && processTokenWithDuplicateAccess != 0L)
>             hToken = DuplicateTokenEx(processTokenWithDuplicateAccess,
>                 privilegies);
>
>         boolean hasRight = false;
>         if (hToken != 0L) {
>             try {
>                 hasRight = AccessCheck(hToken, securityInfo, accessMask,
>                     genericRead, genericWrite, genericExecute, 
> genericAll);
>             } finally {
>                 CloseHandle(hToken);
>             }
>         }
>         return hasRight;
>     }
implementation approach?

Regards,
-uta

On 01.03.2013 19:02, Alan Bateman wrote:
> A minor point is that in checkAccessMask then you could call 
> OpenThreadToken before the try/finally. That way you wouldn't need to 
> check hToken. Otherwise I think this is good to go and it's nice to 
> finally fix this issue.
>
> -Alan




More information about the core-libs-dev mailing list