windows-installer – InnoSetup MsiQueryProductState
发布时间:2020-12-14 05:31:04 所属栏目:Windows 来源:网络整理
导读:我想用Inno Setup替换VS设置.检查是否安装了旧版本我找到了’MsiQueryProductState’方法. 我发现了几个看起来像这样的例子: function MsiQueryProductState(ProductCode: string): integer; external 'MsiQueryProductStateA@msi.dll stdcall';function Ms
我想用Inno Setup替换VS设置.检查是否安装了旧版本我找到了’MsiQueryProductState’方法.
我发现了几个看起来像这样的例子: function MsiQueryProductState(ProductCode: string): integer; external 'MsiQueryProductStateA@msi.dll stdcall'; function MsiConfigureProduct(ProductCode: string; iInstallLevel: integer; eInstallState: integer): integer; external 'MsiConfigureProductA@msi.dll stdcall'; const INSTALLSTATE_DEFAULT = 5; INSTALLLEVEL_MAXIMUM = $ffff; INSTALLSTATE_ABSENT = 2; 检查产品始终返回2而不是所需的5值(INSTALLSTATE_DEFAULT) 我发现了错误,我会将其作为答案发布…… 谢谢弗雷迪 解决方法
问题是InnoSetup的Unicode版本与ANSI版本的函数原型混合在一起.用MsiQueryProductStateW替换MsiQueryProductStateA就足够了.
如果您使用此条件定义的脚本,InnoSetup编译预处理器将根据您使用ANSI或Unicode InnoSetup的时间找到函数(Unicode或ANSI)的正确版本. [Code] #IFDEF UNICODE #DEFINE AW "W" #ELSE #DEFINE AW "A" #ENDIF function MsiQueryProductState(ProductCode: string): integer; external 'MsiQueryProductState{#AW}@msi.dll stdcall'; function MsiConfigureProduct(ProductCode: string; iInstallLevel: integer; eInstallState: integer): integer; external 'MsiConfigureProduct{#AW}@msi.dll stdcall'; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |