Dokan.NET 0.2.0 released
July 1st, 2008 in .NET
Dokan.NET 0.2.0 is now released
Sorry for frequent updates. As you know, Dokan.NET is a library which enables to make a Windows file system easily.
Changes from 0.1.9
- Fixed ProcessId while CreateFile, Open/CreateDirectory functions
Awesome!!! Thank you Hiroki!
Hi Hiroki,
I’m having another little issue. The following only happens, if I don’t set DokanOptions.ThreadCount = 1 (so an arbitrary number of threads). If set to 1, everything’s fine.
At the root of my filesystem I have around 90 directories, each of which contains files. Bizarrely, the following is only valid for some of these directories (it seems that it affects those with only 1-2 files in them). When I open one of these directories and use the Explorer’s “Back” button right away (to go back to the FS’s root), the Explorer only lists one of my folders (instead of 90) in the root directory. With another of the affected directories, it shows me around 20 (instead of 90) folders after I browse “Back” to the root. Even stranger is that this doesn’t happen every time I open one of these directories and go back to the root right away. Sometimes it shows all folders in root. Even when it only shows one folder, a hit on F5 (Refresh) brings all folders back.
Now, I have tried everything, even locking the entire “FindFiles” routine, logging the threads that call “FindFiles” (each thread-call gets the 90 folders returned in “files” correctly) and logging the “CreateFile” routine. In the scenario above (with only one folder showing up in root), “CreateFile” only gets two calls; one for “\\” and one for the folder showing up. It seems that 89 folders have gone missing in between the system’s call to “FindFiles” and “CreateFile”.
Do you have any clue what could cause this behaviour or is the above description too confusing?
Regards,
Sebastian
P.S.: I hope I find some time tomorrow to create a test project for re-creation for you.
I’m sorry to spam
It seems like you can just ignore my problem from above. I didn’t have the latest Dokan driver version installed (the machine in question still had the one from Feb 08). Updating the driver seems to have fixed the issue!
HI
I think I found a bug. I’m using dokan on winxp and if i try to log filesystemcalls with filemon (Microsoft Sysinternals tool) my PC reboots immediately. Any Ideas?
What do you need to find this error?
Peter
Hello, Peter
In my environment (Win XP), Filemon works fine. What do you mean “reboots” ?
You got blue screen of death? If so, could send me a crash dump in C:\Windows\Minidump?
Hi Hiroki
I will send you the dump,you said you can’t reproduce this crash. So i updated to the newest Dokan version. Now, when i try to start my fs from Visual Studio it calles Dokanmain and immediately continues executing my program, it doesn’t mount anything. I can’t find any logs . What can I do?
thanks
Peter
Hi Peter,
maybe I can help….check the return value of DokanMain and compare it to the values in DokanNet.cs. This should give you a clue about what’s going wrong.
Are you running your app under Vista? If so, you need to start it with Administrator priviledges because otherwise it won’t be able to communicate with the Dokan driver.
Cheers,
Sebastian
Hi Hiroki,
first of all: thanks a lot for developing Dokan, it is pretty useful. I’m currently
using it to develop a dynamic RAM disk, which will be used for compiling Java projects
with some thousand source files.
I just want to report some issues I’ve with a C# file system implementation as they
show up with the mirror.c sample as well:
1. xcopy loops forever when recursively copying files
Setup: Simple directory structure in c:\temp\test creatable with
mkdir t1 t2 t1\d1 t1\d2
echo test >t1\d1\f1.txt
echo test >t1\d2\f2.txt
Mirror start:
mirror c:\temp\test z:
Copy:
z:
xcopy /E t1 t2 -> xcopy loops forever
2. Cygwin’s rm command is unable to delete files
Setup: Same as above.
Issue: When deleting for example f1.txt with rm, the file
simply does not get deleted:
bash-3.2$ rm -f t1/d1/f1.txt
bash-3.2$ ls t1/d1/f1.txt
t1/d1/f1.txt
3. WinNC, a norton commander clone can for whatever reason not copy files to a dokan
drive. Actually it can, but it looks like it checks something after copying the file
and fails afterwards. No idea why and I cannot provided details yet. Need to investigate
more. Just FYI.
Besides of these issues, I had problems with Java’s File#getCanonicalPath() method when
the checked file did not exists and the path pointed to a Dokan based filesystem. The
method was always failing with “java.io.IOException: There are no more files”. I traced
that down to DispatchDirectoryInformation() in directory.c, which probably should return
STATUS_NO_SUCH_FILE instead of STATUS_NO_MORE_FILES if it could not find any files and
the used pattern did not contain any wildcards. After patching it, it works at least
with Java now.
Additionally, I’ve some more general points:
1. Performance: When copying some thousand small files recursivly to the Dokan
RAM disk resp. within the disk, it takes pretty long (example: 5000 files, ~ 50Mb ->
40s), but the time spent in the C# implementation is just about 2 seconds. Any idea
where rest of the time is spent? Copying one 80Mb file is in turn very fast (2s), so
the low performance in this case seems to be related to the number of files.
Do you know why?
2. Unmounting: It looks like the Unmount() isn’t called in case computer is shut down.
Would it be possible to call Unmount() in this case as well? This would
be really helpful, as I need to persist data when stopping the file system.
Best regards,
Ronny
Hello, Ronny
I got your mail. Sorry for late replay.
* xcopy and cygwin issue
I could reproduce your problems. I took a look at then, but in this time, I could not find out why they happened.
* Java issue
Thank you very match for your information. I’ll fix DispatchDirectoryInformation in the next version.
* Performance issue
I think context switch between kernel mode and user mode seems to affect performance. Directory copies need bunch of system calls. Did you measure difference in real disk and in your RAM disk? If NTFS is faster than Dokan, I need something to do for performance. I think I could introduce same cache in kernel mode and I also mind costs of method call from C to C#.
* Unmount issue
When driver catch Windows shutdown, that information may not be send to user-mode because user mode may be already invalid at that time. I didn’t try it yet. You can also catch shutdown in user-mode using WM_ENDSESSION message or similar Window messages.
Hi Hiroki,
lately I’m seeing a lot of IndexOutOfRangeException exception being thrown in Proxy.cs::GetNewFileInfo Line 54. In the latest case info.InfoId is 4 while infoTable_ only has 2 entries.
Best regards,
Sebastian
Hi
thanks Sebastian i quickly found the issue. It was a admin priviledges problem. But I have a new strange Problem. Using Vista when i get a path of a folder the last \ is missing. in WinXp Dokan always gives me a \ in the end of the path string in Vista it seems to be missing. Is this a bug or do I have to make two cases in my methods for each os Version?
thanks a lot for your help
Peter
Hi Again
Is there a way to get rid of the running under Admin priviledges when using vista?
Peter
Hello, Sebastian
GetNewFileInfo just adds a new entry to infoTable_ so it must not throw any exceptions. I found other exception in DokanNetMirror sample code. When it calls File.Exist(path), if the path contains “*”, it throws System.ArgumentException.
Your exception rises here? infoTable_[info.InfoId] = info;
Hello, Peter
I think whether the last character of path name is “\” or not is depends on the environment. Dokan uses just the same name which is passed to Dokan from Windows.
Administrator privilege is required to communicate with driver. If possible, I want not to require that privilege, but now I don’t know how to do.
I think I may change the privilege of symbolic name of Dokan device (\\device\dokan). Someone knows about it?
Dokan uses service program to mount in system privilege, so you may also use the same technique.
Hello Hiroki,
yes that is exactly the location where the exception is thrown. I guess the problem is that in my case the function tried to access a spot in the table (position 4) that didn’t exists, since the table only had a size of 2. I’ll try to reproduce it to gain additional information.
Hi Hiroki,
sorry for the really late reply, was pretty busy last week …
>I’ll fix >DispatchDirectoryInformation in the next version.
Thanks, but the solution does not seem to be the final one. Actually it broke some other commands. Probably the return codes for DispatchDirectoryInformation need some more attention.
>Did you measure difference in real disk and in your RAM disk?
Good point. Just compared the performance of the DokanFS with another static ram disk and a hard disk (both using NTFS). Dokan is the fastest. So I was just expecting to much
>You can also catch shutdown in user-mode using WM_ENDSESSION message or similar Window messages.
I’ll try that. Thanks.
Best regards,
Ronny
Hi,
I’m looking at using Dokan for the next version of my internal virtual file system here. It’s an on demand file system to an internal asset control database. Currently I’ve worked from WinFUSE but I would like to drop WinFUSE and move over to Dokan as it seams smaller and cleaner, and as is not .NET doesn’t cause headaches of mixing managed and unmanaged code. The thing that I really want is to be able to mount a Dokan filesystem without admin rights. Admin right to install Dokan, but that’s it. Like FUSE under *nix. Doesn’t look like there is a way of doing this, am I missing it?
Joe
Hello, Joe
The next version of Dokan library doesn’t require Admin privilege to work. I want to release a new version this weekend.
Thanks,
Hiroki
Hi Hiroki!
I wounder if it is possible to retrive the original filename(s) when dropping a physical file into the virtual disk?
I’m using your .Net 0.2.0 library, and can’t find a way to
get it. Saving the bytearray works fine but right now I had to come up with a filename myself
I must say you have done a great job with your library!
With regards
jonas
Hi,
I am using Dokan.NET 0.2.0 in windows 2008. I am facing a problem, In function GetFileInformation, even though i update the values like create time,access time and modified time of out parameter(i.e. FileInformation fileinfo) with my own informations, the values i updated are not reflected on windows application. If i retrieve the informations from applications like explorer, command prompt , it gives current date and time for create, access and modified time. Why is it happening, did i missed something?
Hello, ato
Could you paste a part of your code here?
Its a c# code
In GetFileInformation function
/* code snipet */
fileinfo.CreationTime = DateTime.FromFileTime(value from my source);
fileinfo.LastAccessTime = DateTime.FromFileTime(value frm my source);
fileinfo.LastWriteTime = DateTime.FromFileTime(value from my source);
Value from my source is of type long(64 bit).
Well the thing is that i have debugged my code and checked if the values are properly assigned and i found that fileinfo.CreationTime, fileinfo.LastAccessTime and fileinfo.LastWriteTime has the values that i have assigned. So i suppose that it should reflect the values i assigned when retrieved from windows applications like explorer(right-click n click property), command prompt etc. but it gives current date and time only.
Is there any flag that i should set or something similar that i am missing ?
i tried with the sample code you distributed “DokanNetMirror” in which u mounted a local drive through dokan, and even in this case, it does not reflect the values i gave to creation, access and modified time.
/* here is the code snippet */
FileInfo f = new FileInfo(path);
DateTime d1;
long tim;
tim = 128687193710000000; /* Hard coded value i gave */
d1 = DateTime.FromFileTime(tim);
fileinfo.Attributes = f.Attributes;
fileinfo.CreationTime = d1;
fileinfo.LastAccessTime = d1;
fileinfo.LastWriteTime = d1;
fileinfo.Length = f.Length;
return 0;
The hard coded value is 10/17/2008 5:46:11pm and it properly gets stored in fileinfo.CreationTime, fileinfo.LastAccessTime and fileinfo.LastWriteTime. but when i retrieve these informations through explorer and command prompt it gives the actual time of the file and not the one i have provided.
I have written some code for Dokan operation SetFileTime, I want to test it.
Function declaration:- SetFileTime(string filename, DateTime ctime, DateTime atime, DateTime mtime, dokan fileinfo info).
I dont know how to test this operation. Can you please tell me when this dokan operation gets called and who actually uses it.
Hello, ato
I respond to the inssue. http://code.google.com/p/dokan/issues/detail?id=23
Hi, Anand
SetFileTime is called when an Windows application calls SetFileTime Windows API.
BOOL SetFileTime(
HANDLE hFile,
CONST FILETIME *lpCreationTime,
CONST FILETIME *lpLastAccessTime,
CONST FILETIME *lpLastWriteTime
);
Move File Function not working:- whenever i am trying to execute move/rename command(move/rename firstfile secondfile) on dokan file system, first call goes to createfile function which is correct behaviour.
In create file function it tries to open both files (first file as well as second file), when it tries to open second file which is in open mode, it fails as file is not present and throws an exception saying file not found and comes out of create file function. Due to this behaviour move file did not work at all, i tried a lot. I think create file should call move file function when it tries to open second file. am i missing something? please help.
Hello, Anand
I think Dokan mirror sample and Dokan SSHFS move file correctly, so Dokan library is fine with file rename funciton. Please compare your file system behavior with Dokan mirror sample.
Hi, I have downloaded dokan mirror sample from http://dokan-dev.net/en/download/. Is it the correct location? I tried to write on the drive created by this dokan mirror sample, it failed to write to this drive. I could not able to move file as well. When i browse the code i found that code for write file and move file was not there (only return -1 was written in write file function and move file function). Am i missing something? please suggest.
Hello, Anand
Sorry for the delay of response. Dokan mirror doesn’t implement any modification function. I misunderstood. I’ll provide a sample for it.
I successfully created a virtual drive and am simulating files on the drive.
In explorer, when I double click to open a file, ReadFile is never called.
Is it possible to override the ReadFile function and instead of attempting to open the file it does something else? (say, launch another process) Why isn’t ReadFile being called?
Please ignore my above post, I was able to figure it out.