Reputation: 4184
I'm trying to get the installed version number of my win fomrs application using the MsiGetProductInfo function. I am try to alter code i found on this post, but all I get is wing ding looking text when I alter my call to the function like so
MsiGetProductInfo("{9806C9BE-59D4-4DEE-802F-0E492023DE8A}", "INSTALLPROPERTY_VERSIONSTRING", builder, ref len);
Its a 4.0 c# Winforms project that is installed with a standard vs2010 setup project. The client machines are win 7 and win XP
Upvotes: 0
Views: 2533
Reputation: 1265
I know this is very old, but I recently had a similar issue, the fix is to change "INSTALLPROPERTY_VERSIONSTRING" to "VersionString"
Upvotes: 2
Reputation: 917
Have you checked the return value of the function? If it returns an error, it's possible that the buffer is filled with garbage.
This is a list of the possible returns, from the MSDN page here
Return Value
ERROR_BAD_CONFIGURATION The configuration data is corrupt.
ERROR_INVALID_PARAMETER An invalid parameter was passed to the function.
ERROR_MORE_DATA A buffer is too small to hold the requested data.
ERROR_SUCCESS The function completed successfully.
ERROR_UNKNOWN_PRODUCT The product is unadvertised or uninstalled.
ERROR_UNKNOWN_PROPERTY The property is unrecognized.
Note The MsiGetProductInfo function returns ERROR_UNKNOWN_PROPERTY if the application being queried is advertised and not installed.
Upvotes: 0