James Hawkins : advpack: Add the ability to set multiple keys on one line in set_ldid.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 19 06:03:43 CDT 2006


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

Author: James Hawkins <truiken at gmail.com>
Date:   Tue Apr 18 16:14:05 2006 -0500

advpack: Add the ability to set multiple keys on one line in set_ldid.

---

 dlls/advpack/advpack.c |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c
index 297dfca..3ceb70a 100644
--- a/dlls/advpack/advpack.c
+++ b/dlls/advpack/advpack.c
@@ -95,7 +95,7 @@ static void get_dest_dir(HINF hInf, PCWS
 static void set_ldids(HINF hInf, LPCWSTR pszInstallSection)
 {
     WCHAR field[MAX_FIELD_LENGTH];
-    WCHAR key[MAX_FIELD_LENGTH];
+    WCHAR line[MAX_FIELD_LENGTH];
     WCHAR dest[MAX_PATH];
     INFCONTEXT context;
     DWORD size;
@@ -114,13 +114,46 @@ static void set_ldids(HINF hInf, LPCWSTR
 
     do
     {
-        SetupGetIntField(&context, 0, &ldid);
+        LPWSTR value, ptr, key, key_copy = NULL;
+
         SetupGetLineTextW(&context, NULL, NULL, NULL,
-                          key, MAX_FIELD_LENGTH, &size);
+                          line, MAX_FIELD_LENGTH, &size);
+
+        /* SetupGetLineTextW returns the value if there is only one key, but
+         * returns the whole line if there is more than one key
+         */
+        if (!(value = strchrW(line, '=')))
+        {
+            SetupGetStringFieldW(&context, 0, NULL, 0, &size);
+            key = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
+            key_copy = key;
+            SetupGetStringFieldW(&context, 0, key, size, &size);
+            value = line;
+        }
+        else
+        {
+            key = line;
+            *(value++) = '\0';
+        }
+
+        /* remove leading whitespace from the value */
+        while (*value == ' ')
+            value++;
+
+        /* FIXME: need to check the query option */
+        ptr = strchrW(value, ',');
+        if (ptr)
+            *ptr = '\0';
 
-        get_dest_dir(hInf, key, dest, MAX_PATH);
+        get_dest_dir(hInf, value, dest, MAX_PATH);
 
-        SetupSetDirectoryIdW(hInf, ldid, dest);
+        /* set all ldids to dest */
+        while ((ptr = get_parameter(&key, ',')))
+        {
+            ldid = atolW(ptr);
+            SetupSetDirectoryIdW(hInf, ldid, dest);
+        }
+        HeapFree(GetProcessHeap(), 0, key_copy);
     } while (SetupFindNextLine(&context, &context));
 }
 




More information about the wine-cvs mailing list