From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/ntdll/tests/file.c | 3 ++- dlls/ntdll/unix/file.c | 11 +++++++---- server/fd.c | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 6e628fa44a8..837fd0adecc 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3002,7 +3002,6 @@ static void test_file_disposition_information(void) ok( res == STATUS_SUCCESS, "unexpected FileDispositionInformation result (expected STATUS_SUCCESS, got %lx)\n", res ); res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); - todo_wine ok(fsi.DeletePending, "Handle should be marked for deletion\n"); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -3437,6 +3436,7 @@ static void test_file_disposition_information(void) ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); CloseHandle(handle); CloseHandle(handle2); @@ -3469,6 +3469,7 @@ static void test_file_disposition_information(void) CloseHandle(handle2); res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); CloseHandle(handle); res = GetFileAttributesA( buffer ); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 6b73d9dc7e8..7c64938c478 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -4344,12 +4344,13 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, case FileStandardInformation: { FILE_STANDARD_INFORMATION *info = ptr; + FILE_DISPOSITION_INFORMATION fdi;
if (fd_get_file_info( fd, options, &st, &attr ) == -1) status = errno_to_status( errno ); - else + else if (!(status = server_get_file_info( handle, io, &fdi, sizeof(fdi), FileDispositionInformation))) { fill_file_info( &st, attr, info, class ); - info->DeletePending = FALSE; /* FIXME */ + info->DeletePending = fdi.DoDeleteFile; } } break; @@ -4378,17 +4379,19 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, case FileAllInformation: { FILE_ALL_INFORMATION *info = ptr; + FILE_DISPOSITION_INFORMATION fdi; char *unix_name;
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 if (!(status = server_get_unix_name( handle, &unix_name ))) + else if (!(status = server_get_unix_name( handle, &unix_name )) && + !(status = server_get_file_info( handle, io, &fdi, sizeof(fdi), FileDispositionInformation))) { LONG name_len = len - FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName);
fill_file_info( &st, attr, info, FileAllInformation ); - info->StandardInformation.DeletePending = FALSE; /* FIXME */ + info->StandardInformation.DeletePending = fdi.DoDeleteFile; info->EaInformation.EaSize = 0; info->AccessInformation.AccessFlags = 0; /* FIXME */ info->PositionInformation.CurrentByteOffset.QuadPart = lseek( fd, 0, SEEK_CUR ); diff --git a/server/fd.c b/server/fd.c index eaebe044f37..e11a66ce625 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2391,6 +2391,24 @@ void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int set_reply_data( &info, sizeof(info) ); break; } + /* Wine internal, not bound to a direct request from NtQueryInformationFile */ + case FileDispositionInformation: + { + FILE_DISPOSITION_INFORMATION info; + if (get_reply_max_size() < sizeof(info)) + { + set_error( STATUS_INFO_LENGTH_MISMATCH ); + return; + } + if (!fd->closed) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + info.DoDeleteFile = fd->closed->unlink != 0; + set_reply_data( &info, sizeof(info) ); + break; + } default: set_error( STATUS_NOT_IMPLEMENTED ); }