From: Bernhard Ubelacker bernhardu@mailbox.org
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51813 ---- 1016195.340:0114:0118:Call KERNEL32.GetFileType(00000014) ret=1022e621 1016195.340:0114:0118:Call ntdll.NtQueryVolumeInformationFile(00000014,0060f598,0060f590,00000008,00000004) ret=7b01f4a5 1016195.340:0114:0118:Ret ntdll.NtQueryVolumeInformationFile() retval=00000000 ret=7b01f4a5 1016195.340:0114:0118:Ret KERNEL32.GetFileType() retval=00000001 ret=1022e621 1016195.340:0114:0118:Call KERNEL32.GetFileInformationByHandle(00000014,0060f608) ret=1022e6ac 1016195.340:0114:0118:Call ntdll.NtQueryInformationFile(00000014,0060f508,0060f528,00000068,00000012) ret=7b01eacc 1016195.340:0114:0118:trace:file:NtQueryInformationFile (0x14,0x60f508,0x60f528,0x00000068,0x00000012) 1016195.340:0114:0118:Ret ntdll.NtQueryInformationFile() retval=c0000024 ret=7b01eacc 1016195.340:0114:0118:Call ntdll.RtlNtStatusToDosError(c0000024) ret=7b01eae3 1016195.340:0114:0118:Ret ntdll.RtlNtStatusToDosError() retval=00000006 ret=7b01eae3 1016195.340:0114:0118:Ret KERNEL32.GetFileInformationByHandle() retval=00000000 ret=1022e6ac
Allocation of the fd structure, fd->unix_name is set to NULL: 1697 fd->unix_name = NULL;
Because unix_name is not set no file information get returned: 2780 if (fd->unix_name) ... ...
https://github.com/python/cpython/blob/99fcf1505218464c489d419d4500f126b6d6d... https://github.com/python/cpython/blob/99fcf1505218464c489d419d4500f126b6d6d... --- dlls/kernelbase/file.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index ac04388acde..badb769edcd 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -2926,9 +2926,16 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetFileInformationByHandle( HANDLE file, BY_HANDLE FILE_ALL_INFORMATION all_info; IO_STATUS_BLOCK io; NTSTATUS status; + DWORD mode;
status = NtQueryInformationFile( file, &io, &all_info, sizeof(all_info), FileAllInformation ); if (status == STATUS_BUFFER_OVERFLOW) status = STATUS_SUCCESS; + if (status == STATUS_OBJECT_TYPE_MISMATCH && GetFileType(file) == FILE_TYPE_DISK && !GetConsoleMode(file, &mode)) + { + ERR("Workaround for redirection at unix side. Bug#51813\n"); + memset(info, 0, sizeof(*info)); + return TRUE; + } if (!set_ntstatus( status )) return FALSE;
info->dwFileAttributes = all_info.BasicInformation.FileAttributes;