Module: wine Branch: master Commit: 05e9a1fce826d9bc2ca3895dd40e42d9cba1a3ca URL: http://source.winehq.org/git/wine.git/?a=commit;h=05e9a1fce826d9bc2ca3895dd4...
Author: Hans Leidekker hans@meelstraat.net Date: Wed Sep 2 11:44:17 2009 +0200
msi: Add a partial implementation of MsiDetermineApplicablePatchesW.
---
dlls/msi/action.c | 2 +- dlls/msi/msi.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++-- dlls/msi/msipriv.h | 2 + include/msi.h | 2 + 4 files changed, 81 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 85d95a6..881c4a2 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -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; diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index be1ad93..ba9d8bf 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -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, diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index b61d7b6..23756fa 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -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* ); diff --git a/include/msi.h b/include/msi.h index 5e68fdc..2c0a37f 100644 --- a/include/msi.h +++ b/include/msi.h @@ -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 */