Commit 4777a3a3 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Simplify ExpandAnyPath.

parent ce6e84c0
...@@ -466,8 +466,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, LPWSTR *appValue, ...@@ -466,8 +466,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, LPWSTR *appValue,
static void ACTION_ExpandAnyPath(MSIPACKAGE *package, WCHAR *src, WCHAR *dst, static void ACTION_ExpandAnyPath(MSIPACKAGE *package, WCHAR *src, WCHAR *dst,
size_t len) size_t len)
{ {
WCHAR *ptr; WCHAR *ptr, *deformatted;
size_t copied = 0;
if (!src || !dst || !len) if (!src || !dst || !len)
{ {
...@@ -475,46 +474,24 @@ static void ACTION_ExpandAnyPath(MSIPACKAGE *package, WCHAR *src, WCHAR *dst, ...@@ -475,46 +474,24 @@ static void ACTION_ExpandAnyPath(MSIPACKAGE *package, WCHAR *src, WCHAR *dst,
return; return;
} }
/* Ignore the short portion of the path, don't think we can use it anyway */ dst[0] = '\0';
/* Ignore the short portion of the path */
if ((ptr = strchrW(src, '|'))) if ((ptr = strchrW(src, '|')))
ptr++; ptr++;
else else
ptr = src; ptr = src;
while (*ptr && copied < len - 1)
{
WCHAR *prop = strchrW(ptr, '[');
if (prop)
{
WCHAR *propEnd = strchrW(prop + 1, ']');
if (!propEnd)
{
WARN("Unterminated property name in AnyPath: %s\n",
debugstr_w(prop));
break;
}
else
{
DWORD propLen;
*propEnd = 0; deformat_string(package, ptr, &deformatted);
propLen = len - copied - 1; if (!deformatted || lstrlenW(deformatted) > len - 1)
MSI_GetPropertyW(package, prop + 1, dst + copied, &propLen); {
ptr = propEnd + 1; msi_free(deformatted);
copied += propLen; return;
}
}
else
{
size_t toCopy = min(strlenW(ptr) + 1, len - copied - 1);
memcpy(dst + copied, ptr, toCopy * sizeof(WCHAR));
ptr += toCopy;
copied += toCopy;
}
} }
*(dst + copied) = '\0';
lstrcpyW(dst, deformatted);
dst[lstrlenW(deformatted)] = '\0';
msi_free(deformatted);
} }
/* Sets *matches to whether the file (whose path is filePath) matches the /* Sets *matches to whether the file (whose path is filePath) matches the
......
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