From 41ee0f405e8caf1f4468e8c061f978ff15a7fae3 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 22 Feb 2011 19:07:45 +0000 Subject: [PATCH] [KERNEL32] Don't make CopyFileExA() rely on Wine's strings conversions functions svn path=/trunk/; revision=50869 --- reactos/dll/win32/kernel32/file/copy.c | 59 +++++++++++++------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/reactos/dll/win32/kernel32/file/copy.c b/reactos/dll/win32/kernel32/file/copy.c index a55fbff84cd..30c847bacf1 100644 --- a/reactos/dll/win32/kernel32/file/copy.c +++ b/reactos/dll/win32/kernel32/file/copy.c @@ -314,37 +314,36 @@ CopyFileExW ( */ BOOL WINAPI -CopyFileExA ( - LPCSTR lpExistingFileName, - LPCSTR lpNewFileName, - LPPROGRESS_ROUTINE lpProgressRoutine, - LPVOID lpData, - BOOL *pbCancel, - DWORD dwCopyFlags - ) +CopyFileExA(IN LPCSTR lpExistingFileName, + IN LPCSTR lpNewFileName, + IN LPPROGRESS_ROUTINE lpProgressRoutine OPTIONAL, + IN LPVOID lpData OPTIONAL, + IN LPBOOL pbCancel OPTIONAL, + IN DWORD dwCopyFlags) { - PWCHAR ExistingFileNameW; - PWCHAR NewFileNameW; - BOOL Result; - - if (!(ExistingFileNameW = FilenameA2W(lpExistingFileName, FALSE))) - return FALSE; - - if (!(NewFileNameW = FilenameA2W(lpNewFileName, TRUE))) - return FALSE; - - Result = CopyFileExW (ExistingFileNameW , - NewFileNameW , - lpProgressRoutine, - lpData, - pbCancel, - dwCopyFlags); - - RtlFreeHeap (RtlGetProcessHeap (), - 0, - NewFileNameW); - - return Result; + BOOL Result = FALSE; + UNICODE_STRING lpNewFileNameW; + PUNICODE_STRING lpExistingFileNameW; + + lpExistingFileNameW = Basep8BitStringToStaticUnicodeString(lpExistingFileName); + if (!lpExistingFileName) + { + return FALSE; + } + + if (Basep8BitStringToDynamicUnicodeString(&lpNewFileNameW, lpNewFileName)) + { + Result = CopyFileExW(lpExistingFileNameW->Buffer, + lpNewFileNameW.Buffer, + lpProgressRoutine, + lpData, + pbCancel, + dwCopyFlags); + + RtlFreeUnicodeString(&lpNewFileNameW); + } + + return Result; } -- 2.17.1