草庐IT

MsiGetProductInfo

全部标签

windows - 从 Windows 服务调用 MSIGetProductInfo 返回垃圾值

我有两个正在开发的应用程序,这两个应用程序都依赖于MSIGetProductInfo调用来检索用户在安装过程中输入的序列号(标准的visualstudio设置和部署项目)。这是我用来检索序列号的代码:Int32len=512;varbuilder=newStringBuilder(len);MsiGetProductInfo("{98A0A10F-5E78-4FA6-83F6-6B356D75ADD4}","ProductId",builder,reflen);returnbuilder.ToString();第一个应用程序是一个可视化C#窗体应用程序,它按我的预期返回(当我输入111

c# - 使用 windows api 读取应用程序的当前安装版本

我试图使用WindowsAPI来查找已安装应用程序的版本信息。我使用升级代码通过MsiEnumRelatedProductsapi找出产品代码,但是当我尝试使用产品代码使用MsiGetProductInfo时,版本信息作为垃圾返回。这是我的MsiGetProductInfoapi:[DllImport("msi.dll",CharSet=CharSet.Unicode)]privatestaticexternInt32MsiGetProductInfo(stringproduct,stringproperty,[Out]StringBuildervalueBuf,refInt32len