Sync to Wine-0_9_2:
authorGé van Geldorp <ge@gse.nl>
Fri, 25 Nov 2005 23:12:29 +0000 (23:12 +0000)
committerGé van Geldorp <ge@gse.nl>
Fri, 25 Nov 2005 23:12:29 +0000 (23:12 +0000)
Francois Gouget <fgouget@free.fr>
- Remove spaces before '\n' in traces.
- Assorted spelling and case fixes.
Steven Edwards <winehacker@gmail.com>
- Partly implement MsiMessageBox[A/W] on top of MessageBoxEx[A/W]
YunSong Hwang <hys545@dreamwiz.com>
- Add Korean translations.
- Update Korean translations.
Aric Stewart <aric@codeweavers.com>
- Use MsiDecomposeDescriptorW in MsiProvideQualifiedComponentExW.
Mike McCormack <mike@codeweavers.com>
- Fix comparison of empty properties to numbers and add test cases.
- Only return ERROR_MORE_DATA if there's a buffer to copy a result
  into.
- Fix function prototype and spec file entry for
  MsiEnumComponentQualifiers.
- Set the Installed property if the product is already installed.
- Loop around calling RegQueryValue until we have a big enough string
  for both the name and the value.
- Convert MsiEnumComponentQualifiers to use msi_strcpy_to_awstring.
- Empty strings are not equal to any number, so all comparisons against
  them fail except for tests for non-equalness.

svn path=/trunk/; revision=19589

reactos/lib/msi/helpers.c
reactos/lib/msi/msi_Ko.rc
reactos/lib/msi/registry.c

index a47766b..a2bfb0d 100644 (file)
@@ -221,40 +221,42 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
     if (!name)
         return NULL;
 
-    /* special resolving for Target and Source root dir */
-    if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
+    /* source directories appear to always be at the root */
+    if (source)
     {
-        if (!source)
+        path = msi_dup_property( package, cszSourceDir );
+        if (!path)
         {
-            LPWSTR check_path;
-            check_path = msi_dup_property( package, cszTargetDir );
-            if (!check_path)
+            path = msi_dup_property( package, cszDatabase );
+            if (path)
             {
-                check_path = msi_dup_property( package, cszRootDrive );
-                if (set_prop)
-                    MSI_SetPropertyW(package,cszTargetDir,check_path);
+                p = strrchrW(path,'\\');
+                if (p)
+                    *(p+1) = 0;
             }
-
-            /* correct misbuilt target dir */
-            path = build_directory_name(2, check_path, NULL);
-            if (strcmpiW(path,check_path)!=0)
-                MSI_SetPropertyW(package,cszTargetDir,path);
-            msi_free(check_path);
         }
-        else
+        if (folder)
+            *folder = get_loaded_folder( package, name );
+        return path;
+    }
+
+    /* special resolving for Target and Source root dir */
+    if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
+    {
+        LPWSTR check_path;
+        check_path = msi_dup_property( package, cszTargetDir );
+        if (!check_path)
         {
-            path = msi_dup_property( package, cszSourceDir );
-            if (!path)
-            {
-                path = msi_dup_property( package, cszDatabase );
-                if (path)
-                {
-                    p = strrchrW(path,'\\');
-                    if (p)
-                        *(p+1) = 0;
-                }
-            }
+            check_path = msi_dup_property( package, cszRootDrive );
+            if (set_prop)
+                MSI_SetPropertyW(package,cszTargetDir,check_path);
         }
+
+        /* correct misbuilt target dir */
+        path = build_directory_name(2, check_path, NULL);
+        if (strcmpiW(path,check_path)!=0)
+            MSI_SetPropertyW(package,cszTargetDir,path);
+        msi_free(check_path);
         if (folder)
             *folder = get_loaded_folder( package, name );
         return path;
@@ -267,19 +269,13 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
     if (folder)
         *folder = f;
 
-    if (!source && f->ResolvedTarget)
+    if (f->ResolvedTarget)
     {
         path = strdupW( f->ResolvedTarget );
         TRACE("   already resolved to %s\n",debugstr_w(path));
         return path;
     }
-    else if (source && f->ResolvedSource)
-    {
-        path = strdupW( f->ResolvedSource );
-        TRACE("   (source)already resolved to %s\n",debugstr_w(path));
-        return path;
-    }
-    else if (!source && f->Property)
+    else if (f->Property)
     {
         path = build_directory_name( 2, f->Property, NULL );
                     
@@ -296,25 +292,13 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
         TRACE(" ! Parent is %s\n", debugstr_w(parent));
 
         p = resolve_folder(package, parent, source, set_prop, NULL);
-        if (!source)
-        {
-            TRACE("   TargetDefault = %s\n", debugstr_w(f->TargetDefault));
+        TRACE("   TargetDefault = %s\n", debugstr_w(f->TargetDefault));
 
-            path = build_directory_name( 3, p, f->TargetDefault, NULL );
-            f->ResolvedTarget = strdupW( path );
-            TRACE("   resolved into %s\n",debugstr_w(path));
-            if (set_prop)
-                MSI_SetPropertyW(package,name,path);
-        }
-        else 
-        {
-            if (f->SourceDefault && f->SourceDefault[0]!='.')
-                path = build_directory_name( 3, p, f->SourceDefault, NULL );
-            else
-                path = strdupW(p);
-            TRACE("   (source)resolved into %s\n",debugstr_w(path));
-            f->ResolvedSource = strdupW( path );
-        }
+        path = build_directory_name( 3, p, f->TargetDefault, NULL );
+        f->ResolvedTarget = strdupW( path );
+        TRACE("   resolved into %s\n",debugstr_w(path));
+        if (set_prop)
+            MSI_SetPropertyW(package,name,path);
         msi_free(p);
     }
     return path;
index 0eabd04..fb4be6b 100644 (file)
@@ -22,12 +22,12 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
 
 STRINGTABLE DISCARDABLE
 {
-       5 "path %s not found"
+       5 "%s  °æ·Î¸¦ Ã£À»¼ö ¾ø½À´Ï´Ù"
        9 "µð½ºÅ© %s »ðÀÔ"
        10 "Àý¸øµÈ ¸Å°³º¯¼ö"
-       11 "enter which folder contains %s"
-       12 "install source for feature missing"
-       13 "network drive for feature missing"
-       14 "feature from:"
-       15 "choose which folder contains %s"
+       11 "%s¸¦ Æ÷ÇÔÇϴ Æú´õ¸¦ ÀÔ·ÂÇϼ¼¿©"
+       12 "ºüÁø ºÎºÐ(feature)À» À§ÇÑ ¼³Ä¡ ¿øº»"
+       13 "ºüÁø ºÎºÐ(feature)À» À§ÇÑ ³×Æ®¿öÅ© µå¶óÀ̺ê"
+       14 "ºÎºÐ(feature)¿¡¼­:"
+       15 " %s¸¦ Æ÷ÇÔÇϴ Æú´õ ¼±ÅÃ"
 }
index 941608c..3af662b 100644 (file)
@@ -773,7 +773,7 @@ UINT WINAPI MSI_EnumComponentQualifiers( LPCWSTR szComponent, DWORD iIndex,
                 awstring *lpQualBuf, DWORD* pcchQual,
                 awstring *lpAppBuf, DWORD* pcchAppBuf )
 {
-    DWORD name_sz, val_sz, type, ofs;
+    DWORD name_sz, val_sz, name_max, val_max, type, ofs;
     LPWSTR name = NULL, val = NULL;
     UINT r, r2;
     HKEY key;
@@ -789,40 +789,57 @@ UINT WINAPI MSI_EnumComponentQualifiers( LPCWSTR szComponent, DWORD iIndex,
         return ERROR_UNKNOWN_COMPONENT;
 
     /* figure out how big the name is we want to return */
-    name_sz = 0;
-    if (pcchQual)
-    {
-        r = ERROR_OUTOFMEMORY;
-        name_sz = *pcchQual * 4;
-        name = msi_alloc( name_sz * sizeof(WCHAR) );
-        if (!name)
-            goto end;
-    }
-
-    /* figure out how big the value is */
-    type = 0;
-    val_sz = 0;
-    r = RegEnumValueW( key, iIndex, NULL, NULL,
-                       NULL, &type, NULL, &val_sz );
-    if (r != ERROR_SUCCESS)
+    name_max = 0x10;
+    r = ERROR_OUTOFMEMORY;
+    name = msi_alloc( name_max * sizeof(WCHAR) );
+    if (!name)
         goto end;
 
-    if (type != REG_MULTI_SZ)
-    {
-        ERR("component data has wrong type (%ld)\n", type);
-        goto end;
-    }
-
-    /* the value size is in bytes */
-    val_sz += sizeof(WCHAR);
-    val = msi_alloc( val_sz );
+    val_max = 0x10;
+    r = ERROR_OUTOFMEMORY;
+    val = msi_alloc( val_max );
     if (!val)
         goto end;
 
-    r = RegEnumValueW( key, iIndex, name, &name_sz,
-                       NULL, &type, (LPBYTE)val, &val_sz );
-    if (r != ERROR_SUCCESS)
+    /* loop until we allocate enough memory */
+    while (1)
+    {
+        name_sz = name_max;
+        val_sz = val_max;
+        r = RegEnumValueW( key, iIndex, name, &name_sz,
+                           NULL, &type, (LPBYTE)val, &val_sz );
+        if (r == ERROR_SUCCESS)
+            break;
+        if (r != ERROR_MORE_DATA)
+            goto end;
+        if (type != REG_MULTI_SZ)
+        {
+            ERR("component data has wrong type (%ld)\n", type);
+            goto end;
+        }
+
+        r = ERROR_OUTOFMEMORY;
+        if ((name_sz+1) >= name_max)
+        {
+            name_max *= 2;
+            msi_free( name );
+            name = msi_alloc( name_max * sizeof (WCHAR) );
+            if (!name)
+                goto end;
+            continue;
+        }
+        if (val_sz > val_max)
+        {
+            val_max = val_sz + sizeof (WCHAR);
+            val = msi_alloc( val_max * sizeof (WCHAR) );
+            if (!val)
+                goto end;
+            continue;
+        }
+        ERR("should be enough data, but isn't %ld %ld\n", name_sz, val_sz );
         goto end;
+    }
 
     ofs = 0;
     r = MsiDecomposeDescriptorW( val, NULL, NULL, NULL, &ofs );