Hello,
I am trying to retrieve the cost of an MSI package programmatically. I need this in order to be able to display the total cost of a whole "install chain" instead of only displaying the cost of the parent install.
Following Windows Installer documentation, I wrote an exe that opens the package and performs the standard costing actions on it before calling MsiEnumComponentCosts:
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
When is File Costing complete?
Started by
Matthias1967
, Dec 08 2011 10:10
2 replies to this topic
Posted 08 December 2011 - 10:10
CODE |
CoInitializeEx((void*)NULL, COINIT_APARTMENTTHREADED); nRetval=MsiOpenPackageEx(svPackagePath,MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE, &hDB); [...] nRetval=MsiDoAction(hDB,L"CostInitialize"); [...] nRetval=MsiDoAction(hDB,L"FileCost"); [...] nRetval=MsiDoAction(hDB,L"CostFinalize"); [...] nDriveBuf=16; lpDriveBuf=new WCHAR[nDriveBuf]; nRetval=MsiEnumComponentCosts(hDB,L"",0,INSTALLSTATE_LOCAL,lpDriveBuf,&nDriveBuf,piCost,piTempCost); [...] |
At this point, MsiEnumComponentCosts returns 1626 (ERROR_FUNCTION_NOT_CALLED). Windows Installer documentation says that this means that costing is not complete.
So I wonder what else I have to do in order to complete file costing before calling MsiEnumComponentCosts. Windows Installer documentation says: MsiEnumComponentCosts should only be run after the installer has completed file costing and after the CostFinalize action. But I have not found what else is needed for completing file costing.
Best regards
Matthias
Posted 08 December 2011 - 16:29
I think, given the relative quiet on this forum and the general, more generic skill-set of the participants (no offence, chaps), that your question would be better posed on the Windows Installer Team's blog on MSDN.
- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.
Posted 12 March 2012 - 15:42
Meanwhile I have found a solution:
MsiEnumComponentCosts can be called after InstallValidate. This is rather poorly documented, though.
MsiEnumComponentCosts can be called after InstallValidate. This is rather poorly documented, though.