Commit d08378a0 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Fix parsing of patch product codes (valgrind).

parent 94f4c0f0
......@@ -465,8 +465,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
return ERROR_SUCCESS;
}
static LPWSTR* msi_split_string( LPCWSTR str, WCHAR sep )
WCHAR **msi_split_string( const WCHAR *str, WCHAR sep )
{
LPCWSTR pc;
LPWSTR p, *ret = NULL;
......
......@@ -299,7 +299,8 @@ done:
return r;
}
static UINT get_patch_product_codes( LPCWSTR szPatchPackage, WCHAR **product_codes )
static UINT get_patch_product_codes( LPCWSTR szPatchPackage, WCHAR ***product_codes )
{
MSIHANDLE patch, info = 0;
UINT r, type;
......@@ -332,23 +333,22 @@ static UINT get_patch_product_codes( LPCWSTR szPatchPackage, WCHAR **product_cod
}
r = MsiSummaryInfoGetPropertyW( info, PID_TEMPLATE, &type, NULL, NULL, codes, &size );
if (r != ERROR_SUCCESS)
msi_free( codes );
else
*product_codes = codes;
if (r == ERROR_SUCCESS)
*product_codes = msi_split_string( codes, ';' );
done:
MsiCloseHandle( info );
MsiCloseHandle( patch );
msi_free( codes );
return r;
}
static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWSTR szCommandLine)
{
UINT r;
UINT r, i;
DWORD size;
LPCWSTR cmd_ptr = szCommandLine;
LPWSTR beg, end, cmd, codes = NULL;
LPWSTR cmd, *codes = NULL;
BOOL succeeded = FALSE;
static const WCHAR fmt[] = {'%','s',' ','P','A','T','C','H','=','"','%','s','"',0};
......@@ -376,17 +376,14 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
r = MsiConfigureProductExW(szProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
else
{
beg = codes;
while ((end = strchrW(beg, '}')))
for (i = 0; codes[i]; i++)
{
*(end + 1) = '\0';
r = MsiConfigureProductExW(beg, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
r = MsiConfigureProductExW(codes[i], INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
if (r == ERROR_SUCCESS)
{
TRACE("patch applied\n");
succeeded = TRUE;
}
beg = end + 2;
}
if (succeeded)
......
......@@ -958,6 +958,7 @@ extern void msi_feature_set_state(MSIPACKAGE *, MSIFEATURE *, INSTALLSTATE);
extern MSIASSEMBLY *load_assembly(MSIPACKAGE *, MSICOMPONENT *);
extern UINT install_assembly(MSIPACKAGE *, MSICOMPONENT *);
extern WCHAR *font_version_from_file(const WCHAR *);
extern WCHAR **msi_split_string(const WCHAR *, WCHAR);
/* media */
......
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