msi: Add some registry reading macro functions.

This commit is contained in:
Mike McCormack 2006-07-14 15:19:32 +09:00 committed by Alexandre Julliard
parent 230af9d21f
commit a3c03fea58
2 changed files with 29 additions and 0 deletions

View File

@ -415,6 +415,9 @@ extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL cr
extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name );
extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val);
extern DWORD msi_version_str_to_dword(LPCWSTR p); extern DWORD msi_version_str_to_dword(LPCWSTR p);
extern LPWSTR msi_version_dword_to_str(DWORD version); extern LPWSTR msi_version_dword_to_str(DWORD version);

View File

@ -369,6 +369,32 @@ LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val
return r; return r;
} }
LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name )
{
DWORD len = 0;
LPWSTR val;
LONG r;
r = RegQueryValueExW(hkey, name, NULL, NULL, NULL, &len);
if (r != ERROR_SUCCESS)
return NULL;
len += sizeof (WCHAR);
val = msi_alloc( len );
if (!val)
return NULL;
val[0] = 0;
RegQueryValueExW(hkey, name, NULL, NULL, (LPBYTE) val, &len);
return val;
}
BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val)
{
DWORD type, len = sizeof (DWORD);
LONG r = RegQueryValueExW(hkey, name, NULL, &type, (LPBYTE) val, &len);
return r == ERROR_SUCCESS && type == REG_DWORD;
}
UINT MSIREG_OpenUninstallKey(LPCWSTR szProduct, HKEY* key, BOOL create) UINT MSIREG_OpenUninstallKey(LPCWSTR szProduct, HKEY* key, BOOL create)
{ {
UINT rc; UINT rc;