Module: wine Branch: refs/heads/master Commit: 9917250863068b4b8867dd6ebbba91d4c5d127f5 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9917250863068b4b8867dd6e...
Author: Mike McCormack mike@codeweavers.com Date: Fri Jul 14 15:18:35 2006 +0900
msi: Move some registry helper functions to registry.c.
---
dlls/msi/classes.c | 32 -------------------------------- dlls/msi/msipriv.h | 1 + dlls/msi/registry.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c index 7476f7f..e2daaf8 100644 --- a/dlls/msi/classes.c +++ b/dlls/msi/classes.c @@ -736,38 +736,6 @@ static void mark_mime_for_install( MSIMI 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 bdc24c6..077603e 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -418,6 +418,7 @@ extern UINT MSIREG_OpenUserUpgradeCodesK 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 ff73173..006551f 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -305,6 +305,37 @@ BOOL encode_base85_guid( GUID *guid, LPW 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) {