noah
unread,Dec 2, 2009, 11:11:13 PM12/2/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dokan
I'm just getting started with Dokan and have spent the last week just
trying to get up and running. I've got the basic gist down of how
things should work and have gotten a single feature working: directory
listing (at least on the root directory). The next feature on my list
is creating files and I'm having a hell of a time figuring it out.
I mount my Dokan drive as Z:, open notepad, click Save, and try to
save to a file named Test3.txt. I keep getting an error "There are no
more files".
I have logging enabled via Log4net, and I have an Info entry for each
method of my DokanOperations subclass that's getting called, so I can
see the flow of how things get called. The funny thing is I see no
entry for CreateFile with filename parameter "Test3.txt -- it seems
like something is failing even before it gets to that point.
Here's the last number of lines from the log (after clicking "Save"
and receiving that "There are no more files" error):
2009-12-02 23:06:10,169 CreateFile \ with mode Open options None
2009-12-02 23:06:10,169 FindFiles \
2009-12-02 23:06:10,170 File found \AutoRun.inf
2009-12-02 23:06:10,170 File found \autorun.inf
2009-12-02 23:06:10,170 File found \desktop.ini
2009-12-02 23:06:10,170 File found \test
2009-12-02 23:06:10,170 File found \test.txt
2009-12-02 23:06:10,170 File found \test2
2009-12-02 23:06:10,170 File found \test2.txt
2009-12-02 23:06:10,171 Cleanup \
2009-12-02 23:06:10,184 CloseFile \
2009-12-02 23:06:10,184 CreateFile \ with mode Open options None
2009-12-02 23:06:10,185 FindFiles \
2009-12-02 23:06:10,185 File found \AutoRun.inf
2009-12-02 23:06:10,185 File found \autorun.inf
2009-12-02 23:06:10,185 File found \desktop.ini
2009-12-02 23:06:10,185 File found \test
2009-12-02 23:06:10,185 File found \test.txt
2009-12-02 23:06:10,185 File found \test2
2009-12-02 23:06:10,382 File found \test2.txt
2009-12-02 23:06:10,383 Cleanup \
2009-12-02 23:06:10,383 CloseFile \
2009-12-02 23:06:10,384 CreateFile \ with mode Open options None
2009-12-02 23:06:10,384 FindFiles \
2009-12-02 23:06:10,384 File found \AutoRun.inf
2009-12-02 23:06:10,384 File found \autorun.inf
2009-12-02 23:06:10,384 File found \desktop.ini
2009-12-02 23:06:10,384 File found \test
2009-12-02 23:06:10,384 File found \test.txt
2009-12-02 23:06:10,582 File found \test2
2009-12-02 23:06:10,582 File found \test2.txt
2009-12-02 23:06:10,583 Cleanup \
2009-12-02 23:06:10,583 CloseFile \
Any idea what's going on here?
My implementation of Cleanup and CloseFile just return 0.
My implementation of CreateFile is the following:
public int CreateFile(string filename, System.IO.FileAccess access,
System.IO.FileShare share, System.IO.FileMode mode,
System.IO.FileOptions options, DokanFileInfo info)
{
_Log.Info(string.Format("CreateFile {0} with mode {1}
options {2}", filename, mode, options));
if (filename == "\\")
return DokanNet.DOKAN_SUCCESS;
try
{
var file = _Proxy.Create(filename, mode);
if (!info.IsDirectory)
info.IsDirectory = file.IsDirectory;
info.Context = file;
return DokanNet.DOKAN_SUCCESS;
}
catch (FileNotFoundException ex)
{
_Log.Warn("File " + filename + " not found");
return -DokanNet.ERROR_FILE_NOT_FOUND;
}
catch (PathTooLongException ex)
{
_Log.Error("Path too long " + filename, ex);
return -DokanNet.ERROR_INVALID_NAME;
}
catch (IOException ex)
{
_Log.Error("File exists", ex);
return -DokanNet.ERROR_FILE_EXISTS;
}
}