msi: Move some registry helper functions to registry.c.

This commit is contained in:
Mike McCormack 2006-07-14 15:18:35 +09:00 committed by Alexandre Julliard
parent 78f59dd7e9
commit 9917250863
3 changed files with 32 additions and 32 deletions

View File

@ -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 };

View File

@ -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* );

View File

@ -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)
{