Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File is getting deleted even when create_file and delete_file returns STATUS_ACCESS_DENIED #14

Open
ajaykumargdr opened this issue Oct 25, 2024 · 1 comment

Comments

@ajaykumargdr
Copy link

Environment

  • Windows version: Windows 11 Pro (23H2)
  • Processor architecture: x86
  • Dokany version: 2.2.0.1000

Description

We are trying to restrict deletion of file in some predefined cases. We tried returning STATUSS_ACCESS_DENIED from delete_file if the predefined condition are met. But later we got to know that delete_file is not getting called all the time when a file is getting deleted. So we also tried returning STATUSS_ACCESS_DENIED in create_file if delete_on_close is to true and predefined conditions met, but this also not preventing the file from getting deleted.

We also went thought the Question about preventing dokan delete a file discussion. We tried this fix but it didn't work for us.

@ajaykumargdr ajaykumargdr changed the title File is getting deleted even when CreateFile and DeleteFile returns STATUS_ACCESS_DENIED File is getting deleted even when create_file and delete_file returns STATUS_ACCESS_DENIED Oct 25, 2024
@ajaykumargdr
Copy link
Author

Based on this suggestion we tried checking the desired_access and returning STATUS_ACCESS_DENIED if it contains DELETE from the create_file. However this approach is making dokan throwing a error error: process didn't exit successfully: 'target\release\webdrive-app.exe' (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION).

It seems like even after we return the Err(STATUS_ACCESS_DENIED) from the create_file it is somehow continuing the cycle and trying to access the context from other functions like get_file_information. We doubt that since the context is assigned at the end of create_file function, returning error before that causes this issue.

We tried commenting all other code where we use context and this time it didn't give any errors, but it also didn't showed any popup in the explorer such as access denied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant