[MSI] Sync with Wine Staging 2.2. CORE-12823
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 5 Mar 2017 20:45:25 +0000 (20:45 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 5 Mar 2017 20:45:25 +0000 (20:45 +0000)
fe50dbf msi: Do not sign extend after multiplying.
c659222 msi: Fix some spec file entries.
167de42 msi: Make reg_get_{multi}sz() static.
f5e4dad msi: Fix handling of NULL buffer in MsiGetProductPropertyW() (Coverity).
3b5b3ef msi: Fix MSIREG_OpenUserComponentsKey and MSIREG_DeleteUpgradeCodesKey for Wow64.
5ac0242 msi: Correctly size packagecode as it's an unsquashed guid.

svn path=/trunk/; revision=74087

reactos/dll/win32/msi/dialog.c
reactos/dll/win32/msi/msi.c
reactos/dll/win32/msi/msi.spec
reactos/dll/win32/msi/registry.c
reactos/media/doc/README.WINE

index cfc8c3f..bed62fe 100644 (file)
@@ -3165,13 +3165,13 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog )
                 MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &each_cost)))
         {
             /* each_cost is in 512-byte units */
-            total_cost += each_cost * 512;
+            total_cost += ((LONGLONG)each_cost) * 512;
         }
         if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature,
                 MSICOSTTREE_SELFONLY, INSTALLSTATE_ABSENT, &each_cost)))
         {
             /* each_cost is in 512-byte units */
-            total_cost -= each_cost * 512;
+            total_cost -= ((LONGLONG)each_cost) * 512;
         }
     }
     return total_cost;
index 4166350..b97eb13 100644 (file)
@@ -1084,7 +1084,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
     MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED;
     UINT r = ERROR_UNKNOWN_PROPERTY;
     HKEY prodkey, userdata, source;
-    WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], packagecode[SQUASHED_GUID_SIZE];
+    WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], packagecode[GUID_SIZE];
     BOOL badconfig = FALSE;
     LONG res;
     DWORD type = REG_NONE;
@@ -2690,17 +2690,17 @@ UINT WINAPI MsiGetProductPropertyW(MSIHANDLE hProduct, LPCWSTR szProperty,
 
     if (lstrlenW(val) >= *pccbValue)
     {
-        lstrcpynW(szValue, val, *pccbValue);
-        *pccbValue = lstrlenW(val);
+        if (szValue) lstrcpynW(szValue, val, *pccbValue);
         r = ERROR_MORE_DATA;
     }
     else
     {
-        lstrcpyW(szValue, val);
-        *pccbValue = lstrlenW(val);
+        if (szValue) lstrcpyW(szValue, val);
         r = ERROR_SUCCESS;
     }
 
+    *pccbValue = lstrlenW(val);
+
 done:
     if (view)
     {
@@ -3326,7 +3326,7 @@ INSTALLSTATE WINAPI MsiUseFeatureA( LPCSTR szProduct, LPCSTR szFeature )
     return MsiUseFeatureExA(szProduct, szFeature, 0, 0);
 }
 
-WCHAR *reg_get_multisz( HKEY hkey, const WCHAR *name )
+static WCHAR *reg_get_multisz( HKEY hkey, const WCHAR *name )
 {
     WCHAR *ret;
     DWORD len, type;
@@ -3335,7 +3335,7 @@ WCHAR *reg_get_multisz( HKEY hkey, const WCHAR *name )
     return ret;
 }
 
-WCHAR *reg_get_sz( HKEY hkey, const WCHAR *name )
+static WCHAR *reg_get_sz( HKEY hkey, const WCHAR *name )
 {
     WCHAR *ret;
     DWORD len, type;
index d48f08b..6f7266a 100644 (file)
@@ -7,7 +7,7 @@
 11 stdcall MsiConfigureFeatureA(str str long)
 12 stub MsiConfigureFeatureFromDescriptorA
 13 stub MsiConfigureFeatureFromDescriptorW
-14 stdcall MsiConfigureFeatureW(wstr wstr ptr)
+14 stdcall MsiConfigureFeatureW(wstr wstr long)
 15 stdcall MsiConfigureProductA(str long long)
 16 stdcall MsiConfigureProductW(wstr long long)
 17 stdcall MsiCreateRecord(long)
 64 stdcall MsiGetMode(long long)
 65 stdcall MsiGetProductCodeA(str str)
 66 stdcall MsiGetProductCodeW(wstr wstr)
-67 stdcall MsiGetProductInfoA(str str ptr long)
+67 stdcall MsiGetProductInfoA(str str ptr ptr)
 68 stub MsiGetProductInfoFromScriptA
 69 stub MsiGetProductInfoFromScriptW
-70 stdcall MsiGetProductInfoW(wstr wstr ptr long)
+70 stdcall MsiGetProductInfoW(wstr wstr ptr ptr)
 71 stdcall MsiGetProductPropertyA(long str ptr ptr)
 72 stdcall MsiGetProductPropertyW(long wstr ptr ptr)
 73 stdcall MsiGetPropertyA(ptr str ptr ptr)
@@ -82,8 +82,8 @@
 86 stub MsiInstallMissingFileW
 87 stdcall MsiInstallProductA(str str)
 88 stdcall MsiInstallProductW(wstr wstr)
-89 stdcall MsiLocateComponentA(str ptr long)
-90 stdcall MsiLocateComponentW(wstr ptr long)
+89 stdcall MsiLocateComponentA(str ptr ptr)
+90 stdcall MsiLocateComponentW(wstr ptr ptr)
 91 stdcall MsiOpenDatabaseA(str str ptr)
 92 stdcall MsiOpenDatabaseW(wstr wstr ptr)
 93 stdcall MsiOpenPackageA(str ptr)
index 7414d2e..dace181 100644 (file)
@@ -637,6 +637,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
 UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
 {
     WCHAR squashed_cc[SQUASHED_GUID_SIZE], keypath[0x200];
+    REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     UINT ret;
 
     if (!squash_guid( szComponent, squashed_cc)) return ERROR_FUNCTION_FAILED;
@@ -651,7 +652,7 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
 
     strcpyW(keypath, szInstaller_Components);
     strcatW( keypath, squashed_cc );
-    return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+    return RegOpenKeyExW( HKEY_LOCAL_MACHINE, keypath, 0, access, key );
 }
 
 UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create)
@@ -926,14 +927,18 @@ UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL creat
 
 UINT MSIREG_DeleteUpgradeCodesKey( const WCHAR *code )
 {
-    WCHAR squashed_code[SQUASHED_GUID_SIZE], keypath[0x200];
+    WCHAR squashed_code[SQUASHED_GUID_SIZE];
+    REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
+    HKEY hkey;
+    LONG ret;
 
     if (!squash_guid( code, squashed_code )) return ERROR_FUNCTION_FAILED;
     TRACE( "%s squashed %s\n", debugstr_w(code), debugstr_w(squashed_code) );
 
-    strcpyW( keypath, szInstaller_UpgradeCodes );
-    strcatW( keypath, squashed_code );
-    return RegDeleteTreeW( HKEY_LOCAL_MACHINE, keypath );
+    if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, szInstaller_UpgradeCodes, 0, access, &hkey )) return ERROR_SUCCESS;
+    ret = RegDeleteTreeW( hkey, squashed_code );
+    RegCloseKey( hkey );
+    return ret;
 }
 
 UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode)
index f4b6edf..9386ff6 100644 (file)
@@ -112,7 +112,7 @@ reactos/dll/win32/msg711.acm          # Synced to WineStaging-2.2
 reactos/dll/win32/msgsm32.acm         # Synced to WineStaging-1.9.11
 reactos/dll/win32/mshtml              # Synced to WineStaging-1.7.55
 reactos/dll/win32/mshtml.tlb          # Synced to WineStaging-1.7.55
-reactos/dll/win32/msi                 # Synced to WineStaging-1.9.23
+reactos/dll/win32/msi                 # Synced to WineStaging-2.2
 reactos/dll/win32/msimg32             # Synced to WineStaging-1.9.11
 reactos/dll/win32/msimtf              # Synced to WineStaging-1.9.23
 reactos/dll/win32/msisip              # Synced to WineStaging-1.9.11