Module: wine Branch: master Commit: 152580cefeb4ec63a2560fe76aad98dc674dcced URL: https://gitlab.winehq.org/wine/wine/-/commit/152580cefeb4ec63a2560fe76aad98d...
Author: Jinoh Kang jinoh.kang.kr@gmail.com Date: Tue Feb 20 00:45:16 2024 +0900
ntdll: Implement NtQueryInformationFile FileStatInformation.
---
dlls/ntdll/tests/file.c | 2 +- dlls/ntdll/unix/file.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 3ea5eeea01f..9dd49c925b7 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -4372,7 +4372,7 @@ static void test_file_stat_information(void) status = pNtQueryInformationFile( h, &io, &fsd, sizeof(fsd), FileStatInformation ); if (status == STATUS_NOT_IMPLEMENTED || status == STATUS_INVALID_INFO_CLASS) { - skip( "FileStatInformation not supported\n" ); + win_skip( "FileStatInformation not supported\n" ); CloseHandle( h ); return; } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index ee68e4dee9b..d292d934efa 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -4334,7 +4334,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, 0, /* FileRenameInformationEx */ 0, /* FileRenameInformationExBypassAccessCheck */ 0, /* FileDesiredStorageClassInformation */ - 0, /* FileStatInformation */ + sizeof(FILE_STAT_INFORMATION), /* FileStatInformation */ 0, /* FileMemoryPartitionInformation */ 0, /* FileStatLxInformation */ 0, /* FileCaseSensitiveInformation */ @@ -4549,6 +4549,34 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, info->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; } break; + case FileStatInformation: + if (fd_get_file_info( fd, options, &st, &attr ) == -1) status = errno_to_status( errno ); + else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) + status = STATUS_INVALID_INFO_CLASS; + else + { + FILE_STAT_INFORMATION *info = ptr; + FILE_BASIC_INFORMATION basic; + FILE_STANDARD_INFORMATION std; + + fill_file_info( &st, attr, &basic, FileBasicInformation ); + fill_file_info( &st, attr, &std, FileStandardInformation ); + + info->FileId.QuadPart = st.st_ino; + info->CreationTime = basic.CreationTime; + info->LastAccessTime = basic.LastAccessTime; + info->LastWriteTime = basic.LastWriteTime; + info->ChangeTime = basic.ChangeTime; + info->AllocationSize = std.AllocationSize; + info->EndOfFile = std.EndOfFile; + info->FileAttributes = attr; + info->ReparseTag = 0; /* FIXME */ + if ((options & FILE_OPEN_REPARSE_POINT) && fd_is_mount_point( fd, &st )) + info->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; + info->NumberOfLinks = std.NumberOfLinks; + info->EffectiveAccess = FILE_ALL_ACCESS; /* FIXME */ + } + break; default: FIXME("Unsupported class (%d)\n", class); status = STATUS_NOT_IMPLEMENTED;