msi: Fix and simplify handling of REG_MULTI_SZ strings in the WriteRegistryValues action.
This commit is contained in:
parent
b532c0c306
commit
21b4af1b46
|
@ -2322,7 +2322,6 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
|
||||||
{
|
{
|
||||||
static const WCHAR szMulti[] = {'[','~',']',0};
|
static const WCHAR szMulti[] = {'[','~',']',0};
|
||||||
LPCWSTR ptr;
|
LPCWSTR ptr;
|
||||||
LPWSTR newdata;
|
|
||||||
*type=REG_SZ;
|
*type=REG_SZ;
|
||||||
|
|
||||||
if (value[0]=='#')
|
if (value[0]=='#')
|
||||||
|
@ -2350,19 +2349,8 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
|
||||||
/* add double NULL terminator */
|
/* add double NULL terminator */
|
||||||
if (*type == REG_MULTI_SZ)
|
if (*type == REG_MULTI_SZ)
|
||||||
{
|
{
|
||||||
*size += sizeof(WCHAR);
|
*size += 2 * sizeof(WCHAR); /* two NULL terminators */
|
||||||
newdata = msi_alloc(*size);
|
data = msi_realloc_zero(data, *size);
|
||||||
if (!newdata)
|
|
||||||
{
|
|
||||||
msi_free(data);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(newdata, data, *size - 1);
|
|
||||||
newdata[*size] = '\0';
|
|
||||||
|
|
||||||
msi_free(data);
|
|
||||||
data = (LPSTR)newdata;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
@ -2503,10 +2491,6 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
|
||||||
|
|
||||||
deformat_string(package, name, &deformated);
|
deformat_string(package, name, &deformated);
|
||||||
|
|
||||||
/* get the double nulls to terminate SZ_MULTI */
|
|
||||||
if (type == REG_MULTI_SZ)
|
|
||||||
size +=sizeof(WCHAR);
|
|
||||||
|
|
||||||
if (!check_first)
|
if (!check_first)
|
||||||
{
|
{
|
||||||
TRACE("Setting value %s of %s\n",debugstr_w(deformated),
|
TRACE("Setting value %s of %s\n",debugstr_w(deformated),
|
||||||
|
|
Loading…
Reference in New Issue