0
votes

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);
1
Please post your code, example input, and expected output.S.S. Anne
@JL2210 edited, just add client code from where I'm tried to access projected fsJ. Doe
Can you give the path to the file and ensure that you have read/write permissions to it?S.S. Anne
maybe not having full permission is the reason why it fails to get a GENERIC_ALL accessJ. Doe

1 Answers

1
votes

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.