in reply to How to test if a file is readable on Win64?
Hi , I have some ideas :)
Unfortunately this doesn't work on Windows resulting in my script crashing due to Permission Denied trying to read a protected file.
Try Win32API::File , for example
sub is_readable { use Win32API::File (); my $oldMode = Win32API::File::SetErrorMode(2); my $readable = -r $_[0]; Win32API::File::SetErrorMode( $oldMode ); return $readable; }
Also try cacls.exe for changing permissions ...
Also, I remember hearing about starting win32 programs with "dropped privileges" (psexec.exe -d -l ) ... so the program doesn't use all the permissions you have ... :)
Thats my ideas
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to test if a file is readable on Win64?
by rhardy (Acolyte) on Mar 10, 2014 at 01:16 UTC | |
by Anonymous Monk on Mar 10, 2014 at 01:53 UTC |