[PATCH v3 0/4] MR10866: Report FILE_SUPPORTS_OPEN_BY_FILE_ID
Real NTFS volumes on Windows report `FILE_SUPPORTS_OPEN_BY_FILE_ID` in their filesystem attribute flags. MSYS2/Cygwin checks for this flag to decide whether to use `FileRenameInformationEx` with `FILE_RENAME_POSIX_SEMANTICS`. Without it, Cygwin falls back to legacy rename behavior which fails with `STATUS_ACCESS_DENIED` when the target file is still open, breaking operations like gpg's rename of `pubring.gpg` to `pubring.gpg~`. Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=59729 -- v3: mountmgr: Report FILE_SUPPORTS_OPEN_BY_FILE_ID. kernel32/tests: Add test for FILE_SUPPORTS_OPEN_BY_FILE_ID on volume handles. ntdll: Report FILE_SUPPORTS_OPEN_BY_FILE_ID. https://gitlab.winehq.org/wine/wine/-/merge_requests/10866
From: Joel Holdsworth <joel@airwebreathe.org.uk> Real NTFS volumes on Windows report FILE_SUPPORTS_OPEN_BY_FILE_ID in their filesystem attribute flags. Add a test to verify this flag is set when querying FileFsAttributeInformation on the Windows directory. --- dlls/ntdll/tests/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 69aac1506e7..7aae71b02d5 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -4873,6 +4873,8 @@ static void test_query_attribute_information_file(void) ok(ffai->FileSystemAttributes != 0, "Missing FileSystemAttributes\n"); ok(ffai->MaximumComponentNameLength != 0, "Missing MaximumComponentNameLength\n"); ok(ffai->FileSystemNameLength != 0, "Missing FileSystemNameLength\n"); + todo_wine ok(ffai->FileSystemAttributes & FILE_SUPPORTS_OPEN_BY_FILE_ID, + "expected FILE_SUPPORTS_OPEN_BY_FILE_ID to be set, got %#lx\n", ffai->FileSystemAttributes); trace("FileSystemAttributes: %lx MaximumComponentNameLength: %lx FileSystemName: %s\n", ffai->FileSystemAttributes, ffai->MaximumComponentNameLength, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10866
From: Joel Holdsworth <joel@airwebreathe.org.uk> Real NTFS volumes on Windows report FILE_SUPPORTS_OPEN_BY_FILE_ID in their filesystem attribute flags. MSYS2/Cygwin checks for this flag to decide whether to use FileRenameInformationEx with FILE_RENAME_POSIX_SEMANTICS. Without it, Cygwin falls back to legacy rename behavior which fails with STATUS_ACCESS_DENIED when the target file is still open. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59729 --- dlls/ntdll/tests/file.c | 2 +- dlls/ntdll/unix/file.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 7aae71b02d5..5ac513a6dc0 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -4873,7 +4873,7 @@ static void test_query_attribute_information_file(void) ok(ffai->FileSystemAttributes != 0, "Missing FileSystemAttributes\n"); ok(ffai->MaximumComponentNameLength != 0, "Missing MaximumComponentNameLength\n"); ok(ffai->FileSystemNameLength != 0, "Missing FileSystemNameLength\n"); - todo_wine ok(ffai->FileSystemAttributes & FILE_SUPPORTS_OPEN_BY_FILE_ID, + ok(ffai->FileSystemAttributes & FILE_SUPPORTS_OPEN_BY_FILE_ID, "expected FILE_SUPPORTS_OPEN_BY_FILE_ID to be set, got %#lx\n", ffai->FileSystemAttributes); trace("FileSystemAttributes: %lx MaximumComponentNameLength: %lx FileSystemName: %s\n", diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index b5add7aa501..a1a651b9ece 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -7535,7 +7535,8 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io memcpy(info->FileSystemName, fat32W, info->FileSystemNameLength); break; default: - info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES | FILE_PERSISTENT_ACLS; + info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES | FILE_PERSISTENT_ACLS | + FILE_SUPPORTS_OPEN_BY_FILE_ID; info->MaximumComponentNameLength = 255; info->FileSystemNameLength = min( sizeof(ntfsW), length - offsetof( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName ) ); memcpy(info->FileSystemName, ntfsW, info->FileSystemNameLength); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10866
From: Joel Holdsworth <joel@airwebreathe.org.uk> Real NTFS volumes on Windows report FILE_SUPPORTS_OPEN_BY_FILE_ID in their filesystem attribute flags. Add a test to verify this flag is set when querying volume information through a volume device handle, which exercises the mountmgr code path. --- dlls/kernel32/tests/volume.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index a0f249857e3..1ec21a8a6ef 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -2019,6 +2019,8 @@ static void test_GetVolumeInformationByHandle(void) ret = pGetVolumeInformationByHandleW( file, label, ARRAY_SIZE(label), &serial, &filename_len, &flags, fsname, ARRAY_SIZE(fsname) ); ok(ret, "got error %lu\n", GetLastError()); + todo_wine ok(flags & FILE_SUPPORTS_OPEN_BY_FILE_ID, + "expected FILE_SUPPORTS_OPEN_BY_FILE_ID to be set, got %#lx\n", flags); memset(buffer, 0, sizeof(buffer)); status = NtQueryVolumeInformationFile( file, &io, buffer, sizeof(buffer), FileFsVolumeInformation ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10866
From: Joel Holdsworth <joel@airwebreathe.org.uk> The mountmgr volume device path should also report FILE_SUPPORTS_OPEN_BY_FILE_ID in the filesystem attribute flags for NTFS volumes, matching the behavior of real Windows NTFS volumes. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59729 --- dlls/kernel32/tests/volume.c | 2 +- dlls/mountmgr.sys/device.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 1ec21a8a6ef..8b7a705e19d 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -2019,7 +2019,7 @@ static void test_GetVolumeInformationByHandle(void) ret = pGetVolumeInformationByHandleW( file, label, ARRAY_SIZE(label), &serial, &filename_len, &flags, fsname, ARRAY_SIZE(fsname) ); ok(ret, "got error %lu\n", GetLastError()); - todo_wine ok(flags & FILE_SUPPORTS_OPEN_BY_FILE_ID, + ok(flags & FILE_SUPPORTS_OPEN_BY_FILE_ID, "expected FILE_SUPPORTS_OPEN_BY_FILE_ID to be set, got %#lx\n", flags); memset(buffer, 0, sizeof(buffer)); diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 5ae4220931d..54d32ad2f15 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1756,7 +1756,8 @@ static NTSTATUS WINAPI harddisk_query_volume( DEVICE_OBJECT *device, IRP *irp ) break; default: fsname = L"NTFS"; - info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES | FILE_PERSISTENT_ACLS | FILE_SUPPORTS_REPARSE_POINTS; + info->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES | FILE_PERSISTENT_ACLS | + FILE_SUPPORTS_REPARSE_POINTS | FILE_SUPPORTS_OPEN_BY_FILE_ID; info->MaximumComponentNameLength = 255; break; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10866
sorry about that, clicked wrong button, gitlab recently redesigned and mark as draft is now where subscribe used to be -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10866#note_139447
participants (3)
-
Alfred Agrell (@Alcaro) -
Joel Holdsworth -
Joel Holdsworth (@jhol)