[PATCH 4/4] Run the 'in_use' tests again

Paul Vriens Paul.Vriens.Wine at gmail.com
Wed Feb 10 08:24:49 CST 2010


---
 dlls/msi/tests/install.c |   51 +++++++++++++++++++++++++++++++--------------
 1 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 3add46c..0f7dd45 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -7359,23 +7359,43 @@ static char rename_ops[]      = "PendingFileRenameOperations";
 
 static void process_pending_renames(HKEY hkey)
 {
-    char *buf, *src, *dst;
-    DWORD size;
+    char *buf, *src, *dst, *buf2, *buf2ptr;
+    DWORD size, buf2len = 0;
     LONG ret;
+    BOOL found = FALSE;
 
     ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
     buf = HeapAlloc(GetProcessHeap(), 0, size);
+    buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
     buf[0] = 0;
 
     ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
     ok(!ret, "RegQueryValueExA failed %d (%u)\n", ret, GetLastError());
-    ok(strstr(buf, "msitest\\maximus") != NULL, "Unexpected value \"%s\"\n", buf);
 
     for (src = buf; *src; src = dst + strlen(dst) + 1)
     {
         DWORD flags = MOVEFILE_COPY_ALLOWED;
 
         dst = src + strlen(src) + 1;
+
+        if (!strstr(src, "msitest"))
+        {
+            lstrcpyA(buf2ptr, src);
+            buf2len += strlen(src) + 1;
+            buf2ptr += strlen(src) + 1;
+            if (*dst)
+            {
+                lstrcpyA(buf2ptr, dst);
+                buf2ptr += strlen(dst) + 1;
+                buf2len += strlen(dst) + 1;
+            }
+            buf2ptr++;
+            buf2len++;
+            continue;
+        }
+
+        found = TRUE;
+
         if (*dst == '!')
         {
             flags |= MOVEFILE_REPLACE_EXISTING;
@@ -7390,8 +7410,19 @@ static void process_pending_renames(HKEY hkey)
         else
             ok(DeleteFileA(src), "Failed to delete file %s (%u)\n", src, GetLastError());
     }
+
+    ok(found, "Expected a 'msitest' entry\n");
+
+    if (*buf2)
+    {
+        buf2len++;
+        RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2len);
+    }
+    else
+        RegDeleteValueA(hkey, rename_ops);
+
     HeapFree(GetProcessHeap(), 0, buf);
-    RegDeleteValueA(hkey, rename_ops);
+    HeapFree(GetProcessHeap(), 0, buf2);
 }
 
 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
@@ -7415,7 +7446,6 @@ static BOOL file_matches_data(LPCSTR file, LPCSTR data)
 static void test_file_in_use(void)
 {
     UINT r;
-    DWORD size;
     HANDLE file;
     HKEY hkey;
     char path[MAX_PATH];
@@ -7427,11 +7457,6 @@ static void test_file_in_use(void)
     }
 
     RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
-    if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
-    {
-        skip("Pending file rename operations, skipping test\n");
-        return;
-    }
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
@@ -7468,7 +7493,6 @@ static void test_file_in_use(void)
 static void test_file_in_use_cab(void)
 {
     UINT r;
-    DWORD size;
     HANDLE file;
     HKEY hkey;
     char path[MAX_PATH];
@@ -7480,11 +7504,6 @@ static void test_file_in_use_cab(void)
     }
 
     RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
-    if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
-    {
-        skip("Pending file rename operations, skipping test\n");
-        return;
-    }
 
     CreateDirectoryA("msitest", NULL);
     create_file("maximus", 500);
-- 
1.6.2.5


--------------090500090706010204030806--



More information about the wine-patches mailing list