Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future changes (TODO) #45

Closed
8 of 12 tasks
Liryna opened this issue Aug 20, 2015 · 9 comments
Closed
8 of 12 tasks

Future changes (TODO) #45

Liryna opened this issue Aug 20, 2015 · 9 comments

Comments

@Liryna
Copy link
Member

Liryna commented Aug 20, 2015

For fixing some issue and becoming more stable, Dokan need

@Liryna
Copy link
Member Author

Liryna commented Sep 15, 2015

Hi @marinkobabic,
I am currently changing NTSTATUS as plained. (https://github.com/dokan-dev/dokany/compare/NTSTATUS)
I am facing a issue with CreateFile that it seems you faced too 😃

###Create 0000
   CreateDisposition 0x00000001
CreateFile : C:\Users\autorun.inf
  AccountName: Adrien, DomainName: WIN-9RM07VT4S97
        OPEN_EXISTING
        ShareMode = 0x7
        FILE_SHARE_READ
        FILE_SHARE_WRITE
        FILE_SHARE_DELETE
        AccessMode = 0x80
        FILE_READ_ATTRIBUTES
        FlagsAndAttributes = 0x0
        error code = 2

CreateFile status = 2
error openInfo is NULL
###GetFileInfo -001
GetFileInfo : C:\Users\autorun.inf
        invalid handle
**MIRROR CRASH**

This happened since in mirror I return the error from getLastError.
https://github.com/dokan-dev/dokany/blob/NTSTATUS/dokan_mirror/mirror.c#L220

error openInfo is NULL happen here
https://github.com/dokan-dev/dokany/blob/NTSTATUS/dokan/dokan.c#L487
because openInfo is free here
https://github.com/dokan-dev/dokany/blob/NTSTATUS/dokan/create.c#L212

By removing the free like you, I was surprised to have no crash.
marinkobabic/dokanx@eeb692a#diff-d7735925422d2f0b4a057d4f1ec7a0d5R261

It seems that dokanx have chosen to fix it in a different way...
https://github.com/BenjaminKim/dokanx/blob/develop/mirrorfs/mirrorfs.cpp#L227

By the way, the comment say that Close is never called...but I get a Cleanup and close after GetFileInfo.

Do you have a reason for removing this lines ? Are they important ?

Otherwise mirror is correctly running without problem. I will run dokan-net.Test before merging it.

@marinkobabic
Copy link
Contributor

@Liryna
The comment says "Needs to free openInfo because Close is never called." The developer expected that the close will not be executed because of the status pEventInfo->Status != STATUS_SUCCESS

The fact is, that even in this case the cleanup is executed. Therefore the pOpenInfo should not be freed during create. Cleanup requires the pOpenInfo.

Here you have the mapping table Win32 to NTSTATUS https://support.microsoft.com/en-us/kb/113996

GetLastError code should not be passed directly to the driver. GetLastError is the Win32 error and not NTSTATUS.

@Liryna
Copy link
Member Author

Liryna commented Sep 15, 2015

Thank you for the clear answer 👍

Do you think we should let the user return Win32 error and we convert it in NTSTATUS (dokan.dll)?

@marinkobabic
Copy link
Contributor

No. Then you will have always a discussion of mapping. Which win32 errors do you map to which code. Please add this code as well and so on...

@Liryna
Copy link
Member Author

Liryna commented Sep 15, 2015

Ok ! I agree 😃
I remove the free and continue the changes.

@Liryna
Copy link
Member Author

Liryna commented Sep 16, 2015

@marinkobabic, I finished the NTSTATUS changes. I tested it with the mirror and it seems to work good / without crash.

I would like your review before merging it 😃 and know if it fit your request ! (and If you have the time ofc)
https://github.com/dokan-dev/dokany/compare/NTSTATUS

@marinkobabic
Copy link
Contributor

@Liryna
Wow, a lot of changes. You had also to remove a lot of code 😄 Great job! 👍

@Liryna
Copy link
Member Author

Liryna commented Sep 17, 2015

Thank @marinkobabic for your feedback and informations !
I made the changes as you suggested !

I will merge it in master when I finish to change dokan-net with NtStatus.

@Liryna
Copy link
Member Author

Liryna commented Feb 1, 2016

The todo has been split to different tickets.

@Liryna Liryna closed this as completed Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants