The directory name is invalid
Environment
- Windows version: Windows7 sp1
- Processor architecture: x86
- Dokany version: 0.8
- Library type (Dokany/FUSE): Dokany
Check List
- [ ] I checked my issue doesn't exist yet
- [ ] My issue is valid with mirror default sample and not specific to my user-mode driver implementation
- [ ] I can always reproduce the issue with the provided description below.
- [ ] I have updated Dokany to the latest version (https://github.com/dokan-dev/dokany/releases) and have reboot my computer after.
Description
I want to Implement a file system like this (Using "mirror" sample): When double-click any file in my dokan device,it will open the specific file(like "C:\1.txt") for me.So I changed MirrorCreateFile :
static NTSTATUS DOKAN_CALLBACK MirrorCreateFile()
{
WCHAR filePath[MAX_PATH] = L"C:\\1.txt";
...
//GetFilePath(filePath, MAX_PATH, FileName);
}
But when I open text file (double-click),Windows will popup a window like this:
(It means "The directory name is invalid ")
Now I want to know ,why Windows thinks my text file(unzlibcmpress.py) is a directoty?
Logs
Please attach in separate files: mirror output, library logs and kernel logs. In case of BSOD, please attach minidump or dump analyze output.
Hi @cpptinybird ,
I don't understand the issue, can you be more specific ?
@Liryna I'm Sorry ,My English is poor...
The only code I changed was here ,you can see it in this picture:
Then I mounted directory ("test_dokan") ,But when I open a file ,this happened:
Why Windows does not open "C:\1.txt" for me and thinks this file is a directory ?
The error on Windows MessageBox means "The directory name is invalid ".
@cpptinybird Forcing CreateFile to always open "C:\1.txt" like that is impossible, CreateFile is called on ALL files and directories listed by MirrorFindFiles.
User /d /s option to see all request made on your FS.
@Liryna Thank you for your answer ,I am still puzzled... When I use right click (edit with nopad++ )to open the file,it works. Why ? what the differences between double-click and right click?
At this moment, it is Notepad++ that directly request to open a FILE, so your code does work in your case BUT explorer is calling every file with different values to know if the file is a file OR a directory and since with your code I guess a LOT of request fail....it create a bad behaviour
@Liryna Thank you! I seem to understand. :+1:
No problem !
When I forcing CreateFile to always open "C:\1.txt" ,then MirrorGetInfomation will get a lot of wrong message.So explorer can not work.I solved this problem today.Thank you. :100:
So I had this problem, readin info from a database and creating text files from that. Basically the premise works slightly differently that is appears it might.
Basically you want your getFileInformation function to always return success. (unless file requested doesn't exist) IF the fileName requested is a directory name then return a directory attribute in a fileInformation, regardless of of info.isDirectory otherwise return the file information. I guess Windows probes "" to see if it's a file and if you return file information that ISN'T a directory it complains.