From 6e7d12ef45a5d7e67199128704ebde4bfac14386 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 28 May 2014 18:39:51 +0000 Subject: [PATCH] [KERNEL32] - Directly call CopyFileExW() from CopyFileA() - ReactOSify CopyFileW() svn path=/trunk/; revision=63491 --- reactos/dll/win32/kernel32/client/file/copy.c | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/file/copy.c b/reactos/dll/win32/kernel32/client/file/copy.c index 9601e108267..99b96c19c64 100644 --- a/reactos/dll/win32/kernel32/client/file/copy.c +++ b/reactos/dll/win32/kernel32/client/file/copy.c @@ -351,18 +351,33 @@ CopyFileExA(IN LPCSTR lpExistingFileName, */ BOOL WINAPI -CopyFileA ( - LPCSTR lpExistingFileName, - LPCSTR lpNewFileName, - BOOL bFailIfExists -) +CopyFileA(IN LPCSTR lpExistingFileName, + IN LPCSTR lpNewFileName, + IN BOOL bFailIfExists) { - return CopyFileExA (lpExistingFileName, - lpNewFileName, - NULL, - NULL, - NULL, - bFailIfExists); + BOOL Result = FALSE; + UNICODE_STRING lpNewFileNameW; + PUNICODE_STRING lpExistingFileNameW; + + lpExistingFileNameW = Basep8BitStringToStaticUnicodeString(lpExistingFileName); + if (!lpExistingFileNameW) + { + return FALSE; + } + + if (Basep8BitStringToDynamicUnicodeString(&lpNewFileNameW, lpNewFileName)) + { + Result = CopyFileExW(lpExistingFileNameW->Buffer, + lpNewFileNameW.Buffer, + NULL, + NULL, + NULL, + (bFailIfExists ? COPY_FILE_FAIL_IF_EXISTS : 0)); + + RtlFreeUnicodeString(&lpNewFileNameW); + } + + return Result; } @@ -371,18 +386,16 @@ CopyFileA ( */ BOOL WINAPI -CopyFileW ( - LPCWSTR lpExistingFileName, - LPCWSTR lpNewFileName, - BOOL bFailIfExists -) +CopyFileW(IN LPCWSTR lpExistingFileName, + IN LPCWSTR lpNewFileName, + IN BOOL bFailIfExists) { - return CopyFileExW (lpExistingFileName, - lpNewFileName, - NULL, - NULL, - NULL, - bFailIfExists); + return CopyFileExW(lpExistingFileName, + lpNewFileName, + NULL, + NULL, + NULL, + (bFailIfExists ? COPY_FILE_FAIL_IF_EXISTS : 0)); } -- 2.17.1