Rebase against 262e4ab9e0eeb126dde5cb4cba13fbf7f1d1cef0.

This commit is contained in:
Zebediah Figura
2020-07-08 20:46:51 -05:00
parent 553c1cff5a
commit f6954e6e77
19 changed files with 164 additions and 2260 deletions

View File

@@ -1,4 +1,4 @@
From 67cacb66b16c354aa30f4c94bba9da44f7e45619 Mon Sep 17 00:00:00 2001
From 3473ccddec5c67bbfe1d477ce36f537493fae54b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:02:11 -0700
Subject: [PATCH] kernel32,ntdll: Add support for deleting junction points with
@@ -6,55 +6,14 @@ Subject: [PATCH] kernel32,ntdll: Add support for deleting junction points with
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/kernel32/path.c | 19 +++++++++++++------
dlls/ntdll/tests/file.c | 34 +++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 7 deletions(-)
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index db2c1fb0240..6b7912359cf 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -233,6 +233,7 @@ BOOL WINAPI CreateDirectoryExA( LPCSTR template, LPCSTR path, LPSECURITY_ATTRIBU
*/
BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
{
+ FILE_BASIC_INFORMATION info;
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nt_name;
ANSI_STRING unix_name;
@@ -264,15 +265,21 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
}
status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN );
- RtlFreeUnicodeString( &nt_name );
- if (!set_ntstatus( status ))
+ if (status == STATUS_SUCCESS)
{
- NtClose( handle );
- return FALSE;
+ status = NtQueryAttributesFile( &attr, &info );
+ if (status == STATUS_SUCCESS && (info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
+ (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ ret = (unlink( unix_name.Buffer ) != -1);
+ else
+ ret = (rmdir( unix_name.Buffer ) != -1);
+ if (!ret) FILE_SetDosError();
+ RtlFreeAnsiString( &unix_name );
}
+ else
+ set_ntstatus( status );
+ RtlFreeUnicodeString( &nt_name );
- if (!(ret = (rmdir( unix_name.Buffer ) != -1))) FILE_SetDosError();
- RtlFreeAnsiString( &unix_name );
NtClose( handle );
return ret;
}
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index c7107500939..5b71f6f658b 100644
index 6b3071f4095..1d5e0ce95b0 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5009,7 +5009,7 @@ static void test_reparse_points(void)
@@ -5010,7 +5010,7 @@ static void test_reparse_points(void)
REPARSE_GUID_DATA_BUFFER guid_buffer;
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
@@ -63,7 +22,7 @@ index c7107500939..5b71f6f658b 100644
INT buffer_len, string_len;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5098,6 +5098,38 @@ static void test_reparse_points(void)
@@ -5099,6 +5099,38 @@ static void test_reparse_points(void)
"Junction point folder's access time does not match.\n");
CloseHandle(handle);

View File

@@ -1,48 +0,0 @@
From 95288f8fe17bf7c8f772c863fe49a85c117a71eb Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sat, 30 Mar 2019 12:01:50 -0600
Subject: kernel32: Set error code when attempting to delete file symlinks as
directories.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/kernel32/path.c | 5 ++++-
dlls/ntdll/tests/file.c | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 5ef66b5913..227473f71a 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1738,7 +1738,10 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
ret = (unlink( unix_name.Buffer ) != -1);
else
ret = (rmdir( unix_name.Buffer ) != -1);
- if (!ret) FILE_SetDosError();
+ if (status == STATUS_SUCCESS && (info.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
+ !(info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ SetLastError( ERROR_DIRECTORY );
+ else if (!ret) FILE_SetDosError();
RtlFreeAnsiString( &unix_name );
}
else
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index fbd824fd10..0041a41b6d 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5067,9 +5067,9 @@ static void test_reparse_points(void)
bret = RemoveDirectoryW(reparse_path);
ok(!bret, "Succeeded in deleting file symlink as a directory!\n");
err = GetLastError();
- todo_wine ok(err == ERROR_DIRECTORY,
- "Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
- ERROR_DIRECTORY, err);
+ ok(err == ERROR_DIRECTORY,
+ "Expected last error 0x%x for RemoveDirectory on file symlink (actually 0x%x)!\n",
+ ERROR_DIRECTORY, err);
dwret = GetFileAttributesW(reparse_path);
ok(dwret != (DWORD)~0, "Symlink doesn't exist (attributes: 0x%x)!\n", dwret);
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a symlink! (attributes: 0x%x)\n", dwret);
--
2.17.1

View File

@@ -2,4 +2,5 @@ Fixes: [12401] NET Framework 2.0, 3.0, 4.0 installers and other apps that make u
Fixes: [44948] Multiple apps (Spine (Mod starter for Gothic), MS Office 365 installer) need CreateSymbolicLinkW implementation
# FIXME: patch 0006 was broken by e36a9c459d. We really want to get that information from ntdll instead, but the how is not trivial...
# FIXME 2: patch 0019 needs to call RemoveDirectoryW() from kernelbase, but it's stuck in kernel32 for now...
# FIXME 3: RemoveDirectory() doesn't work anymore, I think.
Depends: ntdll-DOS_Attributes