Module: wine Branch: master Commit: 59d6dcfdddda0339a71a3181e0018e79c0d3759a URL: http://source.winehq.org/git/wine.git/?a=commit;h=59d6dcfdddda0339a71a3181e0...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Oct 13 14:23:34 2010 +0200
msi: Put keys from 32-bit packages starting with HLKM\Software under Wow6432Node on 64-bit.
---
dlls/msi/action.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- dlls/msi/msipriv.h | 1 + 2 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 4cebbea..34c0ce4 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -2371,17 +2371,43 @@ static const WCHAR *get_root_key( MSIPACKAGE *package, INT root, HKEY *root_key return ret; }
+static WCHAR *get_keypath( MSIPACKAGE *package, HKEY root, const WCHAR *path ) +{ + static const WCHAR prefixW[] = {'S','O','F','T','W','A','R','E','\'}; + static const UINT len = sizeof(prefixW) / sizeof(prefixW[0]); + + if (is_64bit && package->platform == PLATFORM_INTEL && + root == HKEY_LOCAL_MACHINE && !strncmpiW( path, prefixW, len )) + { + UINT size; + WCHAR *path_32node; + + size = (strlenW( path ) + strlenW( szWow6432Node ) + 1) * sizeof(WCHAR); + path_32node = msi_alloc( size ); + if (!path_32node) + return NULL; + + memcpy( path_32node, path, len * sizeof(WCHAR) ); + path_32node[len] = 0; + strcatW( path_32node, szWow6432Node ); + strcatW( path_32node, szBackSlash ); + strcatW( path_32node, path + len ); + return path_32node; + } + + return strdupW( path ); +} + static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) { MSIPACKAGE *package = param; LPSTR value_data = NULL; HKEY root_key, hkey; DWORD type,size; - LPWSTR deformated; + LPWSTR deformated, uikey, keypath; LPCWSTR szRoot, component, name, key, value; MSICOMPONENT *comp; MSIRECORD * uirow; - LPWSTR uikey; INT root; BOOL check_first = FALSE; UINT rc; @@ -2432,14 +2458,14 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) strcpyW(uikey,szRoot); strcatW(uikey,deformated);
- if (RegCreateKeyW( root_key, deformated, &hkey)) + keypath = get_keypath( package, root_key, deformated ); + msi_free( deformated ); + if (RegCreateKeyW( root_key, keypath, &hkey )) { - ERR("Could not create key %s\n",debugstr_w(deformated)); - msi_free(deformated); + ERR("Could not create key %s\n", debugstr_w(keypath)); msi_free(uikey); return ERROR_SUCCESS; } - msi_free(deformated);
value = MSI_RecordGetString(row,5); if (value) @@ -2554,7 +2580,7 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para { MSIPACKAGE *package = param; LPCWSTR component, name, key_str, root_key_str; - LPWSTR deformated_key, deformated_name, ui_key_str; + LPWSTR deformated_key, deformated_name, ui_key_str, keypath; MSICOMPONENT *comp; MSIRECORD *uirow; BOOL delete_key = FALSE; @@ -2610,8 +2636,10 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para
deformat_string( package, name, &deformated_name );
- delete_reg_key_or_value( hkey_root, deformated_key, deformated_name, delete_key ); + keypath = get_keypath( package, hkey_root, deformated_key ); msi_free( deformated_key ); + delete_reg_key_or_value( hkey_root, keypath, deformated_name, delete_key ); + msi_free( keypath );
uirow = MSI_CreateRecord( 2 ); MSI_RecordSetStringW( uirow, 1, ui_key_str ); @@ -2629,7 +2657,7 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param { MSIPACKAGE *package = param; LPCWSTR component, name, key_str, root_key_str; - LPWSTR deformated_key, deformated_name, ui_key_str; + LPWSTR deformated_key, deformated_name, ui_key_str, keypath; MSICOMPONENT *comp; MSIRECORD *uirow; BOOL delete_key = FALSE; @@ -2682,8 +2710,10 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param
deformat_string( package, name, &deformated_name );
- delete_reg_key_or_value( hkey_root, deformated_key, deformated_name, delete_key ); + keypath = get_keypath( package, hkey_root, deformated_key ); msi_free( deformated_key ); + delete_reg_key_or_value( hkey_root, keypath, deformated_name, delete_key ); + msi_free( keypath );
uirow = MSI_CreateRecord( 2 ); MSI_RecordSetStringW( uirow, 1, ui_key_str ); diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index a785876..0361ff4 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -1150,6 +1150,7 @@ static const WCHAR szIntel[] = {'I','n','t','e','l',0}; static const WCHAR szIntel64[] = {'I','n','t','e','l','6','4',0}; static const WCHAR szX64[] = {'x','6','4',0}; static const WCHAR szWow6432NodeCLSID[] = {'W','o','w','6','4','3','2','N','o','d','e','\','C','L','S','I','D',0}; +static const WCHAR szWow6432Node[] = {'W','o','w','6','4','3','2','N','o','d','e',0};
/* memory allocation macro functions */ static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);