Hans Leidekker : msi: Implement MsiGetFeatureCostA/W.
Alexandre Julliard
julliard at winehq.org
Fri Jun 11 09:58:34 CDT 2010
Module: wine
Branch: master
Commit: 67f15e7149e9c25c8098831e45a29c983d3e15bb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=67f15e7149e9c25c8098831e45a29c983d3e15bb
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Jun 11 15:20:46 2010 +0200
msi: Implement MsiGetFeatureCostA/W.
---
dlls/msi/install.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++-----
dlls/msi/msipriv.h | 1 -
2 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index fda49b9..fa3e4f9 100644
--- a/dlls/msi/install.c
+++ b/dlls/msi/install.c
@@ -993,13 +993,64 @@ UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature,
return rc;
}
-UINT MSI_GetFeatureCost(MSIPACKAGE *package, MSIFEATURE *feature,
- MSICOSTTREE iCostTree, INSTALLSTATE iState,
- LPINT piCost)
+static INT feature_cost( MSIFEATURE *feature )
{
- FIXME("(%s %i %i %p): not implemented yet\n",
- debugstr_w(feature->Feature), iCostTree, iState, piCost);
- if (piCost) *piCost = 0;
+ INT cost = 0;
+ MSICOMPONENT *comp;
+
+ LIST_FOR_EACH_ENTRY( comp, &feature->Components, MSICOMPONENT, entry )
+ {
+ cost += comp->Cost;
+ }
+ return cost;
+}
+
+UINT MSI_GetFeatureCost( MSIPACKAGE *package, MSIFEATURE *feature, MSICOSTTREE tree,
+ INSTALLSTATE state, LPINT cost )
+{
+ TRACE("%s, %u, %d, %p\n", debugstr_w(feature->Feature), tree, state, cost);
+
+ *cost = 0;
+ switch (tree)
+ {
+ case MSICOSTTREE_CHILDREN:
+ {
+ MSIFEATURE *child;
+
+ LIST_FOR_EACH_ENTRY( child, &feature->Children, MSIFEATURE, entry )
+ {
+ if (child->ActionRequest == state)
+ *cost += feature_cost( child );
+ }
+ break;
+ }
+ case MSICOSTTREE_PARENTS:
+ {
+ const WCHAR *feature_parent = feature->Feature_Parent;
+ for (;;)
+ {
+ MSIFEATURE *parent = get_loaded_feature( package, feature_parent );
+ if (!parent)
+ break;
+
+ if (parent->ActionRequest == state)
+ *cost += feature_cost( parent );
+
+ feature_parent = parent->Feature_Parent;
+ }
+ break;
+ }
+ case MSICOSTTREE_SELFONLY:
+ if (feature->ActionRequest == state)
+ *cost = feature_cost( feature );
+ break;
+
+ default:
+ WARN("unhandled cost tree %u\n", tree);
+ break;
+ }
+
+ *cost /= 512;
return ERROR_SUCCESS;
}
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 9f029f3..d1e8113 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -381,7 +381,6 @@ typedef struct tagMSIFEATURE
INSTALLSTATE Action;
struct list Children;
struct list Components;
- INT Cost;
} MSIFEATURE;
typedef struct tagMSICOMPONENT
More information about the wine-cvs
mailing list