diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c index 7476f7f2166..e2daaf8afd9 100644 --- a/dlls/msi/classes.c +++ b/dlls/msi/classes.c @@ -736,38 +736,6 @@ static void mark_mime_for_install( MSIMIME *mime ) mime->InstallMe = TRUE; } -LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) -{ - DWORD len = value ? (lstrlenW(value) + 1) * sizeof (WCHAR) : 0; - return RegSetValueExW( hkey, name, 0, REG_SZ, (LPBYTE)value, len ); -} - -LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) -{ - LPCWSTR p = value; - while (*p) p += lstrlenW(p) + 1; - return RegSetValueExW( hkey, name, 0, REG_MULTI_SZ, - (LPBYTE)value, (p + 1 - value) * sizeof(WCHAR) ); -} - -LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ) -{ - return RegSetValueExW( hkey, name, 0, REG_DWORD, (LPBYTE)&val, sizeof (DWORD) ); -} - -LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ) -{ - HKEY hsubkey = 0; - LONG r; - - r = RegCreateKeyW( hkey, path, &hsubkey ); - if (r != ERROR_SUCCESS) - return r; - r = msi_reg_set_val_str( hsubkey, name, val ); - RegCloseKey( hsubkey ); - return r; -} - static UINT register_appid(MSIAPPID *appid, LPCWSTR app ) { static const WCHAR szAppID[] = { 'A','p','p','I','D',0 }; diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index bdc24c6e419..077603e7b79 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -418,6 +418,7 @@ extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL cr extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ); extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ); extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ); +extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ); /* msi dialog interface */ typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* ); diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index ff73173d46f..006551f5165 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -305,6 +305,37 @@ BOOL encode_base85_guid( GUID *guid, LPWSTR str ) return TRUE; } +LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) +{ + DWORD len = value ? (lstrlenW(value) + 1) * sizeof (WCHAR) : 0; + return RegSetValueExW( hkey, name, 0, REG_SZ, (LPBYTE)value, len ); +} + +LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) +{ + LPCWSTR p = value; + while (*p) p += lstrlenW(p) + 1; + return RegSetValueExW( hkey, name, 0, REG_MULTI_SZ, + (LPBYTE)value, (p + 1 - value) * sizeof(WCHAR) ); +} + +LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ) +{ + return RegSetValueExW( hkey, name, 0, REG_DWORD, (LPBYTE)&val, sizeof (DWORD) ); +} + +LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ) +{ + HKEY hsubkey = 0; + LONG r; + + r = RegCreateKeyW( hkey, path, &hsubkey ); + if (r != ERROR_SUCCESS) + return r; + r = msi_reg_set_val_str( hsubkey, name, val ); + RegCloseKey( hsubkey ); + return r; +} UINT MSIREG_OpenUninstallKey(LPCWSTR szProduct, HKEY* key, BOOL create) {