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

Open read-only file with FILE_FLAG_DELETE_ON_CLOSE flag #16

Closed
denisovpi opened this issue Dec 21, 2024 · 0 comments · Fixed by #17
Closed

Open read-only file with FILE_FLAG_DELETE_ON_CLOSE flag #16

denisovpi opened this issue Dec 21, 2024 · 0 comments · Fixed by #17

Comments

@denisovpi
Copy link
Contributor

denisovpi commented Dec 21, 2024

Test
There are two lines of command for winfstest

expect("CreateFile %s GENERIC_WRITE 0 0 CREATE_ALWAYS FILE_ATTRIBUTE_READONLY 0" % name, 0)
expect("CreateFile %s GENERIC_WRITE 0 0 OPEN_EXISTING FILE_FLAG_DELETE_ON_CLOSE 0" % name, "ERROR_ACCESS_DENIED")

Environment 1:

  1. Installed Dokany v2.2.0.1000
  2. Run - .\memfs.exe /d /l M:
  3. Run test

Log:

###Create file handle = 0x0000023729EAA7A0, eventID = 0005, event Info = 0x0000023729E61D30
Dokan Information: DokanEndDispatchCreate() status = 0, file handle = 0x0000023729EAA7A0, eventID = 0005, result = 0x2
Dokan Information: SendAndPullEventInformation() with NTSTATUS 0x0, context 0x29eaa7a0, and result object 0x0000023729F1B790 with size 48
...
###Cleanup file handle = 0x0000023729EAA7A0, eventID = 0005, event Info = 0x0000023729E61D30
Dokan Information: SendAndPullEventInformation() with NTSTATUS 0x0, context 0x29eaa7a0, and result object 0x0000023729F1B790 with size 48
###Close file handle = 0x0000023729EAA7A0, eventID = 0005, event Info = 0x0000023729E61D30
###Create file handle = 0x0000023729EAA7A0, eventID = 0006, event Info = 0x0000023729E61D30
Dokan Information: DokanEndDispatchCreate() status = c0000121, file handle = 0x0000000000000000, eventID = -001, result = 0x5
Dokan Information: SendAndPullEventInformation() with NTSTATUS 0xc0000121, context 0x0, and result object 0x0000023729F1B790 with size 48

Tests passed correctly. The result is expected:
Dokan Information: DokanEndDispatchCreate() status = c0000121, file handle = 0x0000000000000000, eventID = -001, result = 0x5

Environment 2:

  1. Clone the current repository from the master branch. Dokany version is 2.2.0.1000.
  2. Build and run the 'memfs' example
  3. Run test

Log:

###Create file handle = 0x000002450658DB00, eventID = 0005, event Info = 0x00000245064E9900
Dokan Information: DokanEndDispatchCreate() status = 0, file handle = 0x000002450658DB00, eventID = 0005, result = 0x2
Dokan Information: SendAndPullEventInformation() with NTSTATUS 0x0, context 0x658db00, and result object 0x0000024508141FF0 with size 48
...
###Cleanup file handle = 0x000002450658DB00, eventID = 0005, event Info = 0x00000245064E9900
Dokan Information: SendAndPullEventInformation() with NTSTATUS 0x0, context 0x658db00, and result object 0x0000024508141FF0 with size 48
###Close file handle = 0x000002450658DB00, eventID = 0005, event Info = 0x00000245064E9900
###Create file handle = 0x000002450658DB00, eventID = 0006, event Info = 0x00000245064E9900
Delete failed, ask parent folder if we have the right
Parent give us the right to delete
Dokan Information: DokanEndDispatchCreate() status = 0, file handle = 0x000002450658DB00, eventID = 0006, result = 0x1
Dokan Information: SendAndPullEventInformation() with NTSTATUS 0x0, context 0x658db00, and result object 0x0000024508141FF0 with size 48
< crash >

The program crashes after this operation:
Dokan Information: DokanEndDispatchCreate() status = 0, file handle = 0x000002450658DB00, eventID = 0006, result = 0x1

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

Successfully merging a pull request may close this issue.

1 participant