Re: How to determine if file handle has write access?

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 09/01/04


Date: Wed, 1 Sep 2004 15:51:02 -0700

ERROR_ACCESS_DENIED doesn't occur beause of device error.

Try to call DuplicateHandle with GENERIC_WRITE rights. If it fails, the
source handle doesn't have GENERIC_WRITE.

"Pieter" <msnews@insanegenius.com> wrote in message
news:uHSfN19jEHA.140@TK2MSFTNGP12.phx.gbl...
> How do I determine if a handle to a file has been opened with
> FILE_WRITE_DATA access?
>
> On NT I can call GetSecurityInfo(), but how do I do it on 9x?
>
> If I write to the file using WriteFile() and write 0 bytes, I get an
> access denied error, but how do I know the error is because of the way the
> file was opened, or an actual device error?
>
> Any ideas?
>
> Pieter
>



Relevant Pages