Added patch to implement support for SP_COPY_IN_USE_NEEDS_REBOOT in do_file_copyW.

This commit is contained in:
Sebastian Lackner 2016-09-18 23:11:45 +02:00
parent a358f0984b
commit 1e2b0d3e0c
3 changed files with 70 additions and 0 deletions

View File

@ -297,6 +297,7 @@ patch_enable_all ()
enable_setupapi_DiskSpaceList="$1"
enable_setupapi_Display_Device="$1"
enable_setupapi_HSPFILEQ_Check_Type="$1"
enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT="$1"
enable_setupapi_SetupDiGetDeviceInterfaceDetail="$1"
enable_setupapi_SetupPromptForDisk="$1"
enable_sfc_SfcGetNextProtectedFile="$1"
@ -1073,6 +1074,9 @@ patch_enable ()
setupapi-HSPFILEQ_Check_Type)
enable_setupapi_HSPFILEQ_Check_Type="$2"
;;
setupapi-SP_COPY_IN_USE_NEEDS_REBOOT)
enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT="$2"
;;
setupapi-SetupDiGetDeviceInterfaceDetail)
enable_setupapi_SetupDiGetDeviceInterfaceDetail="$2"
;;
@ -6279,6 +6283,21 @@ if test "$enable_setupapi_HSPFILEQ_Check_Type" -eq 1; then
) >> "$patchlist"
fi
# Patchset setupapi-SP_COPY_IN_USE_NEEDS_REBOOT
# |
# | This patchset fixes the following Wine bugs:
# | * [#36059] Implement support for SP_COPY_IN_USE_NEEDS_REBOOT in do_file_copyW
# |
# | Modified files:
# | * dlls/setupapi/queue.c
# |
if test "$enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT" -eq 1; then
patch_apply setupapi-SP_COPY_IN_USE_NEEDS_REBOOT/0001-setupapi-Implement-SP_COPY_IN_USE_NEEDS_REBOOT.patch
(
echo '+ { "Michael Müller", "setupapi: Implement SP_COPY_IN_USE_NEEDS_REBOOT.", 1 },';
) >> "$patchlist"
fi
# Patchset setupapi-SetupDiGetDeviceInterfaceDetail
# |
# | Modified files:

View File

@ -0,0 +1,50 @@
From 9d2e0955b8f2b4e4e73a929757f0b34cd03d3439 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 18 Sep 2016 22:59:13 +0200
Subject: setupapi: Implement SP_COPY_IN_USE_NEEDS_REBOOT.
---
dlls/setupapi/queue.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c
index 5c2e4c7..9c63242 100644
--- a/dlls/setupapi/queue.c
+++ b/dlls/setupapi/queue.c
@@ -1101,7 +1101,7 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
}
}
if (style & (SP_COPY_NODECOMP | SP_COPY_LANGUAGEAWARE | SP_COPY_FORCE_IN_USE |
- SP_COPY_IN_USE_NEEDS_REBOOT | SP_COPY_NOSKIP | SP_COPY_WARNIFSKIP))
+ SP_COPY_NOSKIP | SP_COPY_WARNIFSKIP))
{
ERR("Unsupported style(s) 0x%x\n",style);
}
@@ -1110,6 +1110,24 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
{
rc = CopyFileW(source,target,FALSE);
TRACE("Did copy... rc was %i\n",rc);
+
+ if (!rc && GetLastError() == ERROR_SHARING_VIOLATION &&
+ (style & SP_COPY_IN_USE_NEEDS_REBOOT))
+ {
+ static const WCHAR prefixW[] = {'S','E','T',0};
+ WCHAR temp_file[MAX_PATH];
+ WCHAR temp[MAX_PATH];
+
+ if (GetTempPathW(MAX_PATH, temp) &&
+ GetTempFileNameW(temp, prefixW, 0, temp_file))
+ {
+ rc = CopyFileW(source, temp_file, FALSE);
+ if (rc)
+ rc = MoveFileExW(temp_file, target, MOVEFILE_DELAY_UNTIL_REBOOT);
+ else
+ DeleteFileW(temp_file);
+ }
+ }
}
/* after copy processing */
--
2.9.0

View File

@ -0,0 +1 @@
Fixes: [36059] Implement support for SP_COPY_IN_USE_NEEDS_REBOOT in do_file_copyW