OT - file permission checks on Windows

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Tue Mar 5 08:27:55 EST 2002


Skip Montanaro <skip at pobox.com> wrote:

>Given this simple file access permission code:

I would be mildly suprised to see code like that outside a unix
kernel, and the equivalent for NT's more sophisticated security model
would be very much longer.

>how would I do this under Windows?

The usual way in Windows is the same as the usual way on Unix: try to
open the file, and see if works or if you get an error code meaning
"permission denied".

If you want to check accessibility for another user then the
equivalent of setuid are ImpersonateLoggedOnUsed and RevertToSelf


Toby Dickenson
tdickenson at geminidataloggers.com



More information about the Python-list mailing list