Commit 05e9a1fc authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Add a partial implementation of MsiDetermineApplicablePatchesW.

parent 1169aa9a
......@@ -501,7 +501,7 @@ static UINT msi_apply_substorage_transform( MSIPACKAGE *package,
return ERROR_SUCCESS;
}
static UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si )
UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si )
{
static const WCHAR szProdCode[] = { 'P','r','o','d','u','c','t','C','o','d','e',0 };
LPWSTR guid_list, *guids, product_code;
......
......@@ -489,13 +489,86 @@ UINT WINAPI MsiDetermineApplicablePatchesA(LPCSTR szProductPackagePath,
return ERROR_CALL_NOT_IMPLEMENTED;
}
static UINT MSI_ApplicablePatchW( MSIPACKAGE *package, LPCWSTR patch )
{
MSISUMMARYINFO *si;
MSIDATABASE *patch_db;
UINT r = ERROR_SUCCESS;
r = MSI_OpenDatabaseW( patch, MSIDBOPEN_READONLY, &patch_db );
if (r != ERROR_SUCCESS)
{
WARN("failed to open patch file %s\n", debugstr_w(patch));
return r;
}
si = MSI_GetSummaryInformationW( patch_db->storage, 0 );
if (!si)
{
r = ERROR_FUNCTION_FAILED;
goto done;
}
r = msi_check_patch_applicable( package, si );
if (r != ERROR_SUCCESS)
TRACE("patch not applicable\n");
done:
msiobj_release( &patch_db->hdr );
msiobj_release( &si->hdr );
return r;
}
UINT WINAPI MsiDetermineApplicablePatchesW(LPCWSTR szProductPackagePath,
DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOW pPatchInfo)
{
FIXME("(%s, %d, %p): stub!\n", debugstr_w(szProductPackagePath),
cPatchInfo, pPatchInfo);
UINT i, r, ret = ERROR_FUNCTION_FAILED;
MSIPACKAGE *package;
return ERROR_CALL_NOT_IMPLEMENTED;
TRACE("(%s, %d, %p)\n", debugstr_w(szProductPackagePath), cPatchInfo, pPatchInfo);
r = MSI_OpenPackageW( szProductPackagePath, &package );
if (r != ERROR_SUCCESS)
{
ERR("failed to open package %u\n", r);
return r;
}
for (i = 0; i < cPatchInfo; i++)
{
switch (pPatchInfo[i].ePatchDataType)
{
case MSIPATCH_DATATYPE_PATCHFILE:
{
FIXME("patch ordering not supported\n");
r = MSI_ApplicablePatchW( package, pPatchInfo[i].szPatchData );
if (r != ERROR_SUCCESS)
{
pPatchInfo[i].dwOrder = ~0u;
pPatchInfo[i].uStatus = ERROR_PATCH_TARGET_NOT_FOUND;
}
else
{
pPatchInfo[i].dwOrder = i;
pPatchInfo[i].uStatus = ret = ERROR_SUCCESS;
}
break;
}
default:
{
FIXME("patch data type %u not supported\n", pPatchInfo[i].ePatchDataType);
pPatchInfo[i].dwOrder = ~0u;
pPatchInfo[i].uStatus = ERROR_PATCH_TARGET_NOT_FOUND;
break;
}
}
TRACE(" szPatchData: %s\n", debugstr_w(pPatchInfo[i].szPatchData));
TRACE("ePatchDataType: %u\n", pPatchInfo[i].ePatchDataType);
TRACE(" dwOrder: %u\n", pPatchInfo[i].dwOrder);
TRACE(" uStatus: %u\n", pPatchInfo[i].uStatus);
}
return ret;
}
UINT WINAPI MsiDeterminePatchSequenceA(LPCSTR szProductCode, LPCSTR szUserSid,
......
......@@ -683,6 +683,8 @@ extern UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
LPCWSTR szTransformFile, int iErrorCond );
extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg );
extern UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si );
/* action internals */
extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern void ACTION_free_package_structures( MSIPACKAGE* );
......
......@@ -237,6 +237,8 @@ typedef struct tagMSIPATCHSEQUENCEINFOW
#define MAX_FEATURE_CHARS 38
#define ERROR_PATCH_TARGET_NOT_FOUND 1642
/* Strings defined in msi.h */
/* Advertised Information */
......
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