Coder Social home page Coder Social logo

Comments (5)

Liryna avatar Liryna commented on August 26, 2024

@suy "FILE_FLAG_DELETE_ON_CLOSE in the dwFlagsAndAttributes parameter of CreateFile. Dokan doesn't support that out of the box, but there are easy to work around."
If I remember Dokan already give you the information during CreateFile.

if (options & FILE_DELETE_ON_CLOSE) {

This Windows 10 (= 8.1) sample give us a over view of the officiel behaviour for detecting the delete file operation.
https://github.com/Microsoft/Windows-driver-samples/tree/master/filesys/miniFilter/delete

It monitors IRP_MJ_CREATE requests for the FILE_DELETE_ON_CLOSE flag. Also, it detects IRP_MJ_SET_INFORMATION requests for setting FileDispositionInformation. The sample also illustrates how to handle racing deletes (in the form of multiple parallel IRP_MJ_SET_INFORMATION operations), and how to distinguish deletion of an entire file from deletion of just one stream of the file.

I also think that it is the application that should keep a information to handle automaticaly the delete on close.

Maybe we even should remove the flag during CloseFile for the < 8 Windows version to have a "standard" behaviour ?

from dokany.

suy avatar suy commented on August 26, 2024

Removing the DeleteOnClose flag would be a source and binary incompatible change with old applications. That's why I was thinking of using it instead (either setting it in the application or the library/driver). That might be able to "upgrade" old applications that weren't aware of the flag, although you probably will know better if this is safe.

If you think it's the application's duty to do so, I'll implement it in mine, and update the docs.

One question remains, though: how comes that Microsoft introduced this safely? Isn't it breaking all other file system drivers as well?

from dokany.

Liryna avatar Liryna commented on August 26, 2024

You are right. Remove the flag would break compatibility.

I have look how to add the flag during close event on Win > 8.
DeleteOnClose is set from the EventContext information:

DokanFileInfo->DeleteOnClose = 1;

The EvenContext come from DeviceIoControl (dokan driver).

status = DeviceIoControl(

I guess Windows break the compatibility :D or the officiel behaviour never was to check delete on close.

The EvenContext is a new instance for every IO call. Thats why it is impossible to store the DeleteOnClose inside.

We should find a way to store it in a clean way inside the DokanLoop

from dokany.

Liryna avatar Liryna commented on August 26, 2024

Added with 770d2a7 from BenjaminKim/dokanx#45

The logic is different and more simple 😄 and it work ! 👍

Thanks @marinkobabic

from dokany.

suy avatar suy commented on August 26, 2024

It took me some time to be able to test, but so far, yes, this seems to work. :-) Thank you!

I don't understand, though, what would change the other parts of the change that Marinko did. I see the DeleteFile operation being called before the cleanup anyway.

from dokany.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.