Giter VIP home page Giter VIP logo

Comments (11)

Liryna avatar Liryna commented on August 30, 2024

Hi @maurosampietro ,

it is right, the context should be the same between CreateFile and CloseFile.

You should also know that there could be different context for the same file. The system is offen going to call CreateFile a multiple time in the same moment. Therefore you will have one new context for each request.
Ex:

#1 CreateFile \test.txt
#2 CreateFile \test.txt
#1 Write 
#2 Lock
#1 CloseFile
#2 CloseFile

from dokan-dotnet.

maurosampietro avatar maurosampietro commented on August 30, 2024

I create a new WriteStream every time CreateFile w/ FileMode.CreateNew is called. How do you usually manage this situation to avoid 'file already in use' exceptions?

(I never get Lock function called but it may not be a problem now)

from dokan-dotnet.

Liryna avatar Liryna commented on August 30, 2024

You have to handle sharing mode with https://msdn.microsoft.com/fr-fr/library/system.io.fileshare%28v=vs.110%29.aspx at open.

from dokan-dotnet.

maurosampietro avatar maurosampietro commented on August 30, 2024

So i'm already doing the right way :) thank you!

from dokan-dotnet.

maurosampietro avatar maurosampietro commented on August 30, 2024

I'm sorry to bore you but i have a few other question in order to complete my file system...

Suppose i want to copy a file i have on my desktop called 'file.dat' to my volume. The final destination path is '\subdir1\subdir2'. I open explorer browse to this destination folder and paste my file.dat.

In debug i see CreateFile is called w/ FIleMode.CreateNew parameter but the path is missing the actual name of the file: i receive ''\subdir1\subdir2' but i expected '\subdir1\subdir2\file.dat' in order to properly create the file. The operation fails telling me there's not enough space. What's happening here?

If i copy from code the same file in my unit test, i correctly receive '\subdir1\subdir2\file.dat' and I am able to create the file.

from dokan-dotnet.

Liryna avatar Liryna commented on August 30, 2024

At first the device open the folder ''\subdir1\subdir2' to be sure that it exist and only after it is going to call you with '\subdir1\subdir2\file.dat'.

Do you check if the request is made for a directory ?
https://github.com/dokan-dev/dokan-dotnet/blob/master/sample/DokanNetMirror/Mirror.cs#L83
https://github.com/dokan-dev/dokan-dotnet/blob/master/sample/DokanNetMirror/Mirror.cs#L121

from dokan-dotnet.

maurosampietro avatar maurosampietro commented on August 30, 2024

I write on Console any request of create file. I don't seem to receive the proper '\subdir1\subdir2\file.dat' request. I check for directories.

from dokan-dotnet.

Liryna avatar Liryna commented on August 30, 2024

Humm so there should be something wrong in your implementation before this call.
It is pretty hard for me to give you advice at this point 😢

Did you start your project by editing the mirror ?

from dokan-dotnet.

maurosampietro avatar maurosampietro commented on August 30, 2024

You seem quite sure it's something related to my implementation so I'll will investigate some more. Back to you if this persists. thank you.

from dokan-dotnet.

marinkobabic avatar marinkobabic commented on August 30, 2024

@maurosampietro You can pass in a ConsoleLogger when doing the mount. So you don't need to log your self.

from dokan-dotnet.

Liryna avatar Liryna commented on August 30, 2024

@maurosampietro do you still have issues or I can close the ticket ?

from dokan-dotnet.

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.