On Sat Nov 2 11:18:47 2024 +0000, Jinoh Kang wrote:
I believe this causes regression for some drivers that handle `IRP_MJ_CREATE` and may return `STATUS_FILE_IS_A_DIRECTORY` from there. `NtCreateFile()` is ***not*** just a wrapper for `open()`. For custom devices like `\.\MyCustomDriver`, it delegates to the third-party driver. The third-party driver might return `STATUS_FILE_IS_A_DIRECTORY` *but* still expect it to be translated to `ERROR_ACCESS_DENIED` even with the trailing slash. I suspect the real culprit is that `NtCreateFile()` is incorrectly translating Unix `EISDIR` to `STATUS_FILE_IS_A_DIRECTORY` *unconditionally*. In this case, the bug needs to be fixed in ntdll, not kernelbase.
I created a testcase here: https://bugs.winehq.org/attachment.cgi?id=77355
On windows, NtCreateFile returns `STATUS_FILE_IS_A_DIRECTORY` in both cases, same as Wine.
Not 100% sure how to best approach that driver issue, maybe check if the path starts with `\??\C:`?
Also, AFAIK we don't need to skip tests on wine, and on windows I got a false positive that I missed, so I tried improving the tests a bit.