shell32: Handle a few cases in FO_COPY that arise from not double-NULL terminating the input

Paul Vriens paul.vriens.wine at gmail.com
Wed Apr 2 03:18:07 CDT 2008


James Hawkins wrote:
> Hi,
> 
> Fix for bug 9809.
> 
> Changelog:
> * Handle a few cases in FO_COPY that arise from not double-NULL
> terminating the input.
> 
>  dlls/shell32/shlfileop.c       |   11 +++-
>  dlls/shell32/tests/shlfileop.c |  122 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 130 insertions(+), 3 deletions(-)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
Hi James,

+    /* no double-NULL terminator for pTo */
+    memset(to, 'a', MAX_PATH);
+    lstrcpyA(to, "two.txt");
+    shfo.pFrom = "one.txt\0";
+    shfo.pTo = to;
+    shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
+    retval = SHFileOperation(&shfo);
+    ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+    ok(DeleteFileA("one.txt"), "Expected file to exist\n");
+    ok(DeleteFileA("two.txt"), "Expected file to exist\n");
+
+    createTestFile("one.txt");
+
+    /* no FOF_MULTIDESTFILES, two files in pTo */
+    shfo.pFrom = "one.txt\0";
+    shfo.pTo = "two.txt\0three.txt\0";
+    shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
+    retval = SHFileOperation(&shfo);
+    ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+    ok(DeleteFileA("one.txt"), "Expected file to exist\n");
+    ok(DeleteFileA("two.txt"), "Expected file to exist\n");
+
+    createTestFile("one.txt");
+
+    /* no double-NULL terminator for pTo */
+    memset(to, 'a', MAX_PATH);
+    lstrcpyA(to, "two.txt");
+    shfo.pFrom = "one.txt\0";
+    shfo.pTo = to;
+    shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
+    retval = SHFileOperation(&shfo);
+    ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+    ok(DeleteFileA("one.txt"), "Expected file to exist\n");
+    ok(DeleteFileA("two.txt"), "Expected file to exist\n");

Isn't the last test the same as the first (in the above piece of code) ?

-- 
Cheers,

Paul.



More information about the wine-devel mailing list