James Hawkins : msi: Handle converting a value of REG_DWORD in MsiSourceListEnumMediaDisks.

Alexandre Julliard julliard at winehq.org
Fri Aug 29 07:30:33 CDT 2008


Module: wine
Branch: master
Commit: d880470dbfa1afed2a6f59e54d2f9e8a0a67e3f4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d880470dbfa1afed2a6f59e54d2f9e8a0a67e3f4

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Thu Aug 28 21:20:46 2008 -0500

msi: Handle converting a value of REG_DWORD in MsiSourceListEnumMediaDisks.

---

 dlls/msi/source.c       |   27 ++++++++++++++++++++++++---
 dlls/msi/tests/source.c |   11 ++++-------
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/dlls/msi/source.c b/dlls/msi/source.c
index d416f0f..5a714b1 100644
--- a/dlls/msi/source.c
+++ b/dlls/msi/source.c
@@ -208,9 +208,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
                                          LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
 {
     WCHAR squished_pc[GUID_SIZE];
+    WCHAR convert[11];
     LPWSTR value = NULL;
     LPWSTR data = NULL;
-    LPWSTR ptr;
+    LPWSTR ptr, ptr2;
     HKEY source, media;
     DWORD valuesz, datasz = 0;
     DWORD type;
@@ -219,6 +220,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
     UINT r;
     static int index = 0;
 
+    static const WCHAR fmt[] = {'#','%','d',0};
+
     TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode),
           debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel,
           pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
@@ -285,6 +288,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
     if (pdwDiskId)
         *pdwDiskId = atolW(value);
 
+    ptr2 = data;
     ptr = strchrW(data, ';');
     if (!ptr)
         ptr = data;
@@ -293,11 +297,19 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
 
     if (pcchVolumeLabel)
     {
-        size = lstrlenW(data);
+        if (type == REG_DWORD)
+        {
+            sprintfW(convert, fmt, *data);
+            size = lstrlenW(convert);
+            ptr2 = convert;
+        }
+        else
+            size = lstrlenW(data);
+
         if (size >= *pcchVolumeLabel)
             r = ERROR_MORE_DATA;
         else if (szVolumeLabel)
-            lstrcpyW(szVolumeLabel, data);
+            lstrcpyW(szVolumeLabel, ptr2);
 
         *pcchVolumeLabel = size;
     }
@@ -307,6 +319,15 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
         if (!*ptr)
             ptr++;
 
+        if (type == REG_DWORD)
+        {
+            sprintfW(convert, fmt, *ptr);
+            size = lstrlenW(convert);
+            ptr = convert;
+        }
+        else
+            size = lstrlenW(ptr);
+
         size = lstrlenW(ptr);
         if (size >= *pcchDiskPrompt)
             r = ERROR_MORE_DATA;
diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c
index 148ea40..30b5be0 100644
--- a/dlls/msi/tests/source.c
+++ b/dlls/msi/tests/source.c
@@ -2864,13 +2864,10 @@ static void test_MsiSourceListEnumMediaDisks(void)
                                       prompt, &promptsz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(id == 1, "Expected 1, got %d\n", id);
-    todo_wine
-    {
-        ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
-        ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
-        ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
-        ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
-    }
+    ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
+    ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
+    ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
+    ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
 
     RegDeleteValueA(media, "1");
     RegDeleteValueA(media, "2");




More information about the wine-cvs mailing list