Signed-off-by: Dmitry Timoshkov dmitry@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 41f0d34aa4..b6faa6e0bf 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -1696,11 +1696,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) );
@@ -1726,19 +1725,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 67a211c803..4ad2142c51 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2935,16 +2935,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" ); @@ -2967,10 +2969,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" );