[KERNEL32]
authorPierre Schweitzer <pierre@reactos.org>
Tue, 22 Feb 2011 19:07:45 +0000 (19:07 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 22 Feb 2011 19:07:45 +0000 (19:07 +0000)
Don't make CopyFileExA() rely on Wine's strings conversions functions

svn path=/trunk/; revision=50869

reactos/dll/win32/kernel32/file/copy.c

index a55fbff..30c847b 100644 (file)
@@ -314,37 +314,36 @@ CopyFileExW (
  */
 BOOL
 WINAPI
  */
 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;
 }
 
 
 }