Commit 7d3f903d authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Fix handling of REG_MULTI_SZ values in the WriteRegistryValues action.

parent 57032206
......@@ -763,6 +763,7 @@ extern string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strre
extern UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *bytes_per_strref ) DECLSPEC_HIDDEN;
extern UINT msi_get_string_table_codepage( const string_table *st ) DECLSPEC_HIDDEN;
extern UINT msi_set_string_table_codepage( string_table *st, UINT codepage ) DECLSPEC_HIDDEN;
extern WCHAR *msi_strdupW( const WCHAR *value, int len ) DECLSPEC_HIDDEN;
extern BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) DECLSPEC_HIDDEN;
extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table ) DECLSPEC_HIDDEN;
......
......@@ -156,7 +156,7 @@ static BOOL string2intW( LPCWSTR str, int *out )
return TRUE;
}
static WCHAR *msi_strdupW( const WCHAR *value, int len )
WCHAR *msi_strdupW( const WCHAR *value, int len )
{
WCHAR *ret;
......
......@@ -490,7 +490,14 @@ static const char wrv_registry_dat[] =
"regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n"
"regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n"
"regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n"
"regdata4\t2\tSOFTWARE\\Wine\\msitest\\VisualStudio\\10.0\\AD7Metrics\\Exception\\{049EC4CC-30D2-4032-9256-EE18EB41B62B}\\Common Language Runtime Exceptions\\System.Workflow.ComponentModel.Serialization\\System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationException\tlong\tkey\taugustus\n";
"regdata4\t2\tSOFTWARE\\Wine\\msitest\\VisualStudio\\10.0\\AD7Metrics\\Exception\\{049EC4CC-30D2-4032-9256-EE18EB41B62B}\\Common Language Runtime Exceptions\\System.Workflow.ComponentModel.Serialization\\System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationException\tlong\tkey\taugustus\n"
"regdata5\t2\tSOFTWARE\\Wine\\msitest\tValue1\t[~]one[~]\taugustus\n"
"regdata6\t2\tSOFTWARE\\Wine\\msitest\tValue2\t[~]two\taugustus\n"
"regdata7\t2\tSOFTWARE\\Wine\\msitest\tValue3\tone[~]\taugustus\n"
"regdata8\t2\tSOFTWARE\\Wine\\msitest\tValue4\tone[~]two\taugustus\n"
"regdata9\t2\tSOFTWARE\\Wine\\msitest\tValue5\t[~]one[~]two[~]three\taugustus\n"
"regdata10\t2\tSOFTWARE\\Wine\\msitest\tValue6\t[~]\taugustus\n"
"regdata11\t2\tSOFTWARE\\Wine\\msitest\tValue7\t[~]two\taugustus\n";
static const char cf_directory_dat[] =
"Directory\tDirectory_Parent\tDefaultDir\n"
......@@ -4719,6 +4726,30 @@ static void test_write_registry_values(void)
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
if (is_64bit)
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, NULL, 0,
KEY_ALL_ACCESS, NULL, &hkey, NULL);
else
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, NULL, 0, KEY_ALL_ACCESS,
NULL, &hkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value1", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value2", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value3", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value4", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value5", 0, REG_MULTI_SZ, (const BYTE *)"one\0two\0", 9);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value6", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(hkey, "Value7", 0, REG_SZ, (const BYTE *)"one", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
r = MsiInstallProductA(msifile, NULL);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
......@@ -4750,7 +4781,77 @@ static void test_write_registry_values(void)
res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value1", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "one\0", size), "Wrong multi-sz data\n");
ok(size == 5, "Expected 5, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value2", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
ok(size == 9, "Expected 9, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value3", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
ok(size == 9, "Expected 9, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value4", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
ok(size == 9, "Expected 9, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value5", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "one\0two\0three\0", size), "Wrong multi-sz data\n");
ok(size == 15, "Expected 15, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value6", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "", size), "Wrong multi-sz data\n");
ok(size == 1, "Expected 1, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
size = MAX_PATH;
type = 0xdeadbeef;
memset(path, 'a', MAX_PATH);
res = RegQueryValueExA(hkey, "Value7", NULL, &type, (LPBYTE)path, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!memcmp(path, "two\0", size), "Wrong multi-sz data\n");
ok(size == 5, "Expected 5, got %d\n", size);
ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
RegDeleteValueA(hkey, "Value");
RegDeleteValueA(hkey, "Value1");
RegDeleteValueA(hkey, "Value2");
RegDeleteValueA(hkey, "Value3");
RegDeleteValueA(hkey, "Value4");
RegDeleteValueA(hkey, "Value5");
RegDeleteValueA(hkey, "Value6");
RegDeleteValueA(hkey, "Value7");
RegCloseKey(hkey);
RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
......
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