Commit 99172508 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

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

parent 78f59dd7
......@@ -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 };
......
......@@ -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* );
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment