Eric Pouech : msi: Fixed bogus A -> W conversion.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 9 13:57:55 CST 2006


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

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Wed Nov  8 21:47:04 2006 +0100

msi: Fixed bogus A -> W conversion.

---

 dlls/msi/registry.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 5ad5059..bb50ae0 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -618,13 +618,8 @@ UINT WINAPI MsiDecomposeDescriptorW( LPC
     len = (p - &szDescriptor[20]);
     if( len > MAX_FEATURE_CHARS )
         return ERROR_INVALID_PARAMETER;
-    if (szFeature)
-    {
-        memcpy( szFeature, &szDescriptor[20], len*sizeof(WCHAR) );
-        szFeature[len] = 0;
-    }
 
-    TRACE("feature %s\n", debugstr_w( &szDescriptor[20] ));
+    TRACE("feature %s\n", debugstr_wn( &szDescriptor[20], len ));
 
     r = decode_base85_guid( p+1, &component );
     if( !r )
@@ -636,6 +631,11 @@ UINT WINAPI MsiDecomposeDescriptorW( LPC
         StringFromGUID2( &product, szProduct, MAX_FEATURE_CHARS+1 );
     if (szComponent)
         StringFromGUID2( &component, szComponent, MAX_FEATURE_CHARS+1 );
+    if (szFeature)
+    {
+        memcpy( szFeature, &szDescriptor[20], len*sizeof(WCHAR) );
+        szFeature[len] = 0;
+    }
     len = ( &p[21] - szDescriptor );
 
     TRACE("length = %d\n", len);
@@ -669,12 +669,15 @@ UINT WINAPI MsiDecomposeDescriptorA( LPC
 
     r = MsiDecomposeDescriptorW( str, p, f, c, pUsed );
 
-    WideCharToMultiByte( CP_ACP, 0, p, MAX_FEATURE_CHARS+1,
-                         szProduct, MAX_FEATURE_CHARS+1, NULL, NULL );
-    WideCharToMultiByte( CP_ACP, 0, f, MAX_FEATURE_CHARS+1,
-                         szFeature, MAX_FEATURE_CHARS+1, NULL, NULL );
-    WideCharToMultiByte( CP_ACP, 0, c, MAX_FEATURE_CHARS+1,
-                         szComponent, MAX_FEATURE_CHARS+1, NULL, NULL );
+    if (r == ERROR_SUCCESS)
+    {
+        WideCharToMultiByte( CP_ACP, 0, p, -1,
+                             szProduct, MAX_FEATURE_CHARS+1, NULL, NULL );
+        WideCharToMultiByte( CP_ACP, 0, f, -1,
+                             szFeature, MAX_FEATURE_CHARS+1, NULL, NULL );
+        WideCharToMultiByte( CP_ACP, 0, c, -1,
+                             szComponent, MAX_FEATURE_CHARS+1, NULL, NULL );
+    }
 
     msi_free( str );
 




More information about the wine-cvs mailing list