[PATCH 4/6] kernel32: Reimplement RemoveDirectory() by setting a delete disposition.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> --- dlls/kernel32/path.c | 17 ++++++++--------- dlls/ntdll/tests/file.c | 8 +++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index 48a3e336ec..5318a94388 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -1656,11 +1656,10 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path ) { OBJECT_ATTRIBUTES attr; UNICODE_STRING nt_name; - ANSI_STRING unix_name; IO_STATUS_BLOCK io; NTSTATUS status; HANDLE handle; - BOOL ret = FALSE; + FILE_DISPOSITION_INFORMATION fdi; TRACE( "%s\n", debugstr_w(path) ); @@ -1686,19 +1685,19 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path ) return FALSE; } - status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); RtlFreeUnicodeString( &nt_name ); + + fdi.DoDeleteFile = TRUE; + status = NtSetInformationFile( handle, &io, &fdi, sizeof(fdi), FileDispositionInformation); + + NtClose( handle ); + if (status != STATUS_SUCCESS) { SetLastError( RtlNtStatusToDosError(status) ); - NtClose( handle ); return FALSE; } - - if (!(ret = (rmdir( unix_name.Buffer ) != -1))) FILE_SetDosError(); - RtlFreeAnsiString( &unix_name ); - NtClose( handle ); - return ret; + return TRUE; } diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 286873d657..e83b88e79b 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2934,16 +2934,18 @@ todo_wine fileDeleted = RemoveDirectoryA( buffer ); ok( fileDeleted, "Directory should have been deleted\n" ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -todo_wine ok( !fileDeleted, "Directory shouldn't have been deleted\n" ); res = nt_get_file_attrs( buffer, &fdi2 ); todo_wine ok( res == STATUS_DELETE_PENDING, "got %#x\n", res ); /* can't open the deleted directory */ handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); +todo_wine ok( handle2 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError()); +if (handle2 != INVALID_HANDLE_VALUE) + CloseHandle( handle2 ); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( fileDeleted, "Directory should have been deleted\n" ); @@ -2966,10 +2968,10 @@ todo_wine handle3 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); todo_wine ok( handle3 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); -if (handle3 != INVALID_HANDLE_VALUE) - CloseHandle( handle3 ); todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError()); +if (handle3 != INVALID_HANDLE_VALUE) + CloseHandle( handle3 ); /* can't open the deleted directory (wrong sharing mode) */ handle3 = CreateFileA(buffer, DELETE, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); ok( handle3 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); -- 2.17.1
Hi, While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=42775 Your paranoid android. === build (build log) === error: patch failed: dlls/ntdll/tests/file.c:3016 error: patch failed: dlls/ntdll/tests/file.c:3037 Task: Patch failed to apply === debian9 (build log) === error: patch failed: dlls/ntdll/tests/file.c:3016 error: patch failed: dlls/ntdll/tests/file.c:3037 Task: Patch failed to apply
Dmitry Timoshkov <dmitry(a)baikal.ru> writes:
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> --- dlls/kernel32/path.c | 17 ++++++++--------- dlls/ntdll/tests/file.c | 8 +++++--- 2 files changed, 13 insertions(+), 12 deletions(-)
This is still breaking tests: ../../../tools/runtest -q -P wine -T ../../.. -M kernel32.dll -p kernel32_test.exe.so change && touch change.ok change.c:312: Test failed: should be ready change.c:315: Test failed: should be ready change.c:530: Test failed: action wrong change.c:557: Test failed: should be ready change.c:587: Test failed: didn't get subdir change change.c:613: Test failed: len wrong 6 change.c:614: Test failed: name wrong Makefile:271: recipe for target 'change.ok' failed make: *** [change.ok] Error 7 -- Alexandre Julliard julliard(a)winehq.org
participants (3)
-
Alexandre Julliard -
Dmitry Timoshkov -
Marvin