The CreateFile callback now represents ZwCreateFile() instead of CreateFile() #83#91
Conversation
…eFile() The previous implementation of CreateFile() was not passing a lot of the information that gets passed into the driver. In order to provide driver writers with as much information as possible I modified the CreateFile to more closely resemble the parameters of ZwCreateFile(). I added some interop structs for moving some kernel data to user mode. Added missing kernel mode FILE_* flags Rearranged headers to make fileinfo.h and public.h available to user mode drivers
|
Hi @Corillian , Thanks for the contribution. Is it stable in your environment ? |
|
Doh, I confess I only tested with reading as my driver doesn't do any writing (I only tested Mirror with reading as well). I'll see if I can repro on Win7 as that's all I have. |
…ser mode Removed /machine:x86 from x64 builds of dokan_fuse so that it actually builds on x64
|
Hi @Corillian , Does this last commit fix the issue ? Otherwise I just seen also that you have add "options" param. That's really great ! It will fix a request from the dokan group: |
|
Hey @Liryna yeah that should fix it! |
|
Yes, it seems to be better ! Thank you ! I just would like to test with the .net test project before merging it but I have to update the wrapper in the same times :D |
|
Hi @Corillian , After review, it is right that this pull request give more informations to the dev during createfile but it give more complexity to use dokan. What I mean, it is that in mirror.c, I agree that such informations can be usefull for advanced dev but probably we should make this convertion in kernel side ? Also, this convertion make the implementation of wrapper (C#, java,...) more complex. |
|
It's a minor increase in complexity and while I agree Dokan should make it as easy as possible that should not be at the expense of important functionality. It's impossible to write a file system driver without, on some level, understanding how a file system driver works. Mapping kernel create flags to user file attributes I consider a minor inconvenience, particularly since the documentation surrounding For C# interop the only challenging change should be accessing the SECURITY_DESCRIPTOR. For Java I have no idea. |
|
We could always add a helper function that maps the kernel create flags to user file attributes if it's a common usage case. |
|
Is it not possible to have directly FileAttributes filled by MirrorMapBit ? About CreateDisposition should we not directly convert it to CREATE_NEW,...? Is there was case where knowing CreateDisposition == FILE_CREATE is usefull ? (I ask because I do not have all the vision/knowledge of it) It just seems for me that everyuser will have to make this "translate" no ? |
|
The kernel flags contain more information than can be represented by the user mode I don't think we should make some parameters user mode and some kernel mode within the Dokan |
|
Yes, @Corillian I agree with you! Could you just add it in your PR 😢 Thanks again for your precise answers and the great work ! |
|
Hi @Liryna sorry for the delay in my response, I've got a lot going on. I'll take care of this in my PR! |
Fixed an issue with being unable to compile the sys project due to a WDK version mismatch. This may not affect everyone, more information here: https://connect.microsoft.com/VisualStudio/feedback/details/1737782/vs2015-and-the-latest-wdk-and-sdk-dont-play-nice-together
|
Alright @Liryna that should hopefully do it. Let me know if you need me to look into anything else. |
Added audit info to DOKAN_ACCESS_STATE The SECURITY_DESCRIPTOR passed to the user mode driver is now created using SeAssignSecurity(). NOTE: It does not inherit the security of its parent since the kernel mode driver doesn't keep track of that. We will likely need a callback into the user mode driver to get this information. Fixed memory corruption caused by a race condition in GetRawDeviceName()
|
Alright hopefully this takes care of everything. I don't use FUSE and only have Windows 7 so I am unable to test alternative configurations. I also fixed memory corruption caused by a race condition in |
|
Thank you @Corillian ! |
|
it work perfectly with the test I made :) Thank you @Corillian ! Do you have an exemple for testing the security context ? |
|
Hi @Corillian , It seems that there is a dead code here: https://github.com/dokan-dev/dokany/pull/91/files#diff-210b81c018cd0036b1a9abb162fb97b9R333 |
|
Hi @Liryna, Which part of the code are you referring to? |
|
How is it guaranteed to always be a success? |
|
My link has moved with last commits :( Status is equal to STATUS_SUCCESS here |
|
That part looks fine, how is it dead code? Are you assuming |
|
it is the code before |
|
Ah yes that is dead code. It's leftover from something I ended up removing. Sry :\ |
|
Oh 😢 so i remove it ? |
|
Yeah go ahead |
The previous implementation of CreateFile() was not passing a lot of the
information that gets passed into the driver. In order to provide driver
writers with as much information as possible I modified the CreateFile
to more closely resemble the parameters of ZwCreateFile().
I added some interop structs for moving some kernel data to user mode.
Added missing kernel mode FILE_* flags
Rearranged headers to make fileinfo.h and public.h available to user
mode drivers