I've create example application using Projected File System
I've implement all necessary functions and it works well when I open a file from projected FS with GENERIC_READ or GENERIC_WRITE access, but when I'm trying to use GENERIC_ALL I'm getting access denied error.
What is possible reason of getting access denied
error?
I'm getting the error when a file is already copied to projected filesystem.
CODE:
HANDLE fHandle = CreateFile(path_to_file_in_projected_fs, GENERIC_ALL, 0, 0, OPEN_EXISTING, 0, 0);
Expected result: valid file handle.
Actual result: invalid handle with access denied error (via GetLastError())
P.S. GENERIC_READ_WRITE_EXECUTE works fine
HANDLE fHandle = CreateFile(path_to_file_in_projected_fs, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
Is GENERIC_ALL equivalent to GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE?
GENERIC_ALL
means "every possible level of access" (for files, this has the name FILE_ALL_ACCESS
). It's not just GENERIC_EXECUTE
+ GENERIC_WRITE
+ GENERIC_READ
, GENERIC_ALL
contains things such as DELETE
, WRITE_DAC
(to change permissions) and WRITE_OWNER
(to change owner). You could check the File Security and Access Rights for the access of FILE_GENERIC_*
.
You can try to add permissions one by one from GENERIC_READ+WRITE+EXECUTE to see which permissions cause the issue. However, you should request only the level of access that actually need.