Getting the UpgradeCode (or any property) from an MSI file is fairly
straightforward with code. I found my old generic C++ function:

UINT GetProperty (MSIHANDLE dbHand, LPCTSTR propname, LPTSTR strVal)

{

PMSIHANDLE viewH = NULL;

WCHAR qry [100] = {0};

StringCchCat (qry, 100, L"Select `Value` from `Property` where
`Property`='" );

StringCchCat (qry, 100, propname);

StringCchCat (qry, 100, L"'");

UINT res = MsiDatabaseOpenView (dbHand, qry, &viewH);

if (ERROR_SUCCESS!=res)

return res;

res = MsiViewExecute (viewH, 0);

if (ERROR_SUCCESS!=res)

{

MsiCloseHandle (viewH);

return res;

}

PMSIHANDLE recH=NULL;

res = MsiViewFetch (viewH, &recH);

if (ERROR_SUCCESS!=res)

{

MsiCloseHandle (viewH);

return res;

}

WCHAR buff [50] = {0};

DWORD dwlen = 50;

res = MsiRecordGetString (recH, 1, buff, &dwlen);

if (ERROR_SUCCESS!=res)

{

MsiCloseHandle (viewH);

MsiCloseHandle (recH);

return res;

}

StringCchCopy (strVal, dwlen+1, buff);

MsiViewClose (viewH);

MsiCloseHandle (recH);

return (ERROR_SUCCESS);

}

Phil W


On Fri, Aug 16, 2013 at 10:42 PM, dave <d...@swordfishsoftware.co.nz> wrote:

> Hi,
>
> I'm creating some automatic updating code and would like to check the
> UpgradeCode for a bundle is correct before running it. Is there any way to
> retrieve the UpgradeCode from a bundle installation file?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Retrieve-the-UpgradeCode-from-a-bundle-exe-tp7588140.html
> Sent from the wix-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to