[PATCH 1/8] scrrun: Implement MoveFolder().

Robert Wilhelm wine at gitlab.winehq.org
Wed Jun 29 10:47:02 CDT 2022


From: Robert Wilhelm <robert.wilhelm at gmx.net>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52128

Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
---
 dlls/scrrun/filesystem.c       |  7 +++----
 dlls/scrrun/tests/filesystem.c | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 35b43e2f124..dac3b9fdcf7 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -3764,12 +3764,11 @@ static HRESULT WINAPI filesys_MoveFile(IFileSystem3 *iface, BSTR source, BSTR de
     return MoveFileW(source, destination) ? S_OK : create_error(GetLastError());
 }
 
-static HRESULT WINAPI filesys_MoveFolder(IFileSystem3 *iface,BSTR Source,
-                                            BSTR Destination)
+static HRESULT WINAPI filesys_MoveFolder(IFileSystem3 *iface, BSTR source, BSTR destination)
 {
-    FIXME("%p %s %s\n", iface, debugstr_w(Source), debugstr_w(Destination));
+    TRACE("%p %s %s\n", iface, debugstr_w(source), debugstr_w(destination));
 
-    return E_NOTIMPL;
+    return MoveFileW(source, destination) ? S_OK : create_error(GetLastError());
 }
 
 static inline HRESULT copy_file(const WCHAR *source, DWORD source_len,
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index 1ba0e81a2d1..4d7692a5d1e 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -2600,6 +2600,25 @@ static void test_MoveFile(void)
     SysFreeString(str);
 }
 
+static void test_MoveFolder(void)
+{
+    BSTR src, dst;
+    WCHAR buffW1[MAX_PATH],buffW2[MAX_PATH];
+    HRESULT hr;
+
+    get_temp_path(L"foo", buffW1);
+    get_temp_path(L"bar", buffW2);
+
+    ok(CreateDirectoryW(buffW1, NULL), "CreateDirectory(%s) failed\n", wine_dbgstr_w(buffW1));
+    src = SysAllocString(buffW1);
+    dst = SysAllocString(buffW2);
+    hr = IFileSystem3_MoveFolder(fs3, src, dst);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    SysFreeString(src);
+    SysFreeString(dst);
+    ok(RemoveDirectoryW(buffW2), "can't remove %s directory\n", wine_dbgstr_w(buffW1));
+}
+
 static void test_DoOpenPipeStream(void)
 {
     static const char testdata[] = "test";
@@ -2733,6 +2752,7 @@ START_TEST(filesystem)
     test_GetExtensionName();
     test_GetSpecialFolder();
     test_MoveFile();
+    test_MoveFolder();
     test_DoOpenPipeStream();
 
     IFileSystem3_Release(fs3);
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/343



More information about the wine-devel mailing list