C# MsiGetProductInfo返回错误\u未知\u已安装产品的产品

C# MsiGetProductInfo返回错误\u未知\u已安装产品的产品,c#,windows,registry,windows-installer,C#,Windows,Registry,Windows Installer,我试图以编程方式查询安装程序项目中的信息。这个信息是在安装程序中定义的,我不想在代码中重复它。我需要获得Publisher-installer属性(以及其他一些属性),但似乎无法使事情正常运行 我正在使用: [DllImport("msi.dll", CharSet = CharSet.Unicode)] private static extern Int32 MsiGetProductInfo( string product, string property, [O

我试图以编程方式查询安装程序项目中的信息。这个信息是在安装程序中定义的,我不想在代码中重复它。我需要获得Publisher-installer属性(以及其他一些属性),但似乎无法使事情正常运行

我正在使用:

[DllImport("msi.dll", CharSet = CharSet.Unicode)]
private static extern Int32 MsiGetProductInfo(
    string product, 
    string property, 
    [Out] StringBuilder valueBuf, 
    ref Int32 len);

使用RegEdit,我可以看到一个可卸载的产品:

{删失}

这是我的应用程序,它有一个“Publisher”键,这正是我所期望的。我不知道为什么会有“_is1”后缀。安装程序是使用Inno安装程序制作的,可能与此相关。我曾尝试在调用MsiGetProductInfo时在产品代码中添加此后缀,但没有效果

调用返回1605,这是错误产品


如何正确查询此产品的发布者?

MSI API仅对基于MSI的安装有用。Inno安装程序不创建MSI包,因此您无法使用MSI API查询Inno安装程序的安装情况。

我想是时候添加注册表项了。谢谢,鲍勃,我需要这个。
int length = 512;
StringBuilder builder = new StringBuilder(length);
var result = MsiGetProductInfo(
    "{censored}", 
    "Publisher", 
    builder, 
    ref length);