在使用PyInstaller创建的应用程序上的InnoSetup中使用GetStringFileInfo时,发生编译器错误 [英] Compiler error when using GetStringFileInfo in InnoSetup on application created with PyInstaller

查看:214
本文介绍了在使用PyInstaller创建的应用程序上的InnoSetup中使用GetStringFileInfo时,发生编译器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此处所述创建了版本信息文件-什么是版本"文件"看起来像什么? 并获得带有所有版本信息的EXE文件.

I created version info file as described here - What does a "version file" look like? and do got EXE-file with all version information.

下一个问题是,当我尝试使用InnoSetup构建安装文件时,出现错误:

My issue is next, when I try to build setup file with InnoSetup, I'm getting an error:

d:\ installation \ Source \ setup_script.iss中的第65行错误:丢失 参数名称"的右引号

Error on line 65 in d:\installation\Source\setup_script.iss: Missing closing quote on parameter "Name"

第65行:

[Icons]
Name: "{group}\{#VerInfoProductName}"; Filename: "{app}\{#ExeFileName}.exe"; WorkingDir: "{app}"

以下VerInfoProductName的定义

#define VerInfoProductName GetStringFileInfo(AddBackslash(SourcePath) + "..\..\dist\app\testapp.exe", "ProductName")

详细信息附在存档中

Details are attached in archive.

推荐答案

您的应用程序版本信息字符串中有某些内容使Inno Setup预处理程序感到困惑.您的代码可与其他应用程序一起使用.

There's something in your application version info strings that confuses the Inno Setup pre-processor. Your code works with other applications.

预处理器加载ProductName的方式是,结果变量实际上比值长,剩余空间中充满了一些垃圾,后来使编译器感到困惑.

The pre-processor loads the ProductName in a way that resulting variable is actually longer than the value, the remaining space filled with some garbage that later confuses the compiler.

您可以通过使用{#SetupSetting('AppName')}而不是{#VerInfoProductName}来解决此问题.当然,这假定AppName设置为{#VerInfoProductName}.

You can workaround it by using {#SetupSetting('AppName')} instead of {#VerInfoProductName}. This of course assumes that AppName is set to {#VerInfoProductName}.

另一种方法是通过INI文件来回处理字符串:

Another way is to round-trip the string via an INI file:

#expr WriteIni("C:\path\xxx.ini", "xxx", "xxx", VerInfoProductName)
#define VerInfoProductName ReadIni("C:\path\xxx.ini", "xxx", "xxx")


实际上,在普通Windows资源文件(.rc)中,必须显式终止版本信息字符串(请注意\0):


Actually in normal Windows resource files (.rc), one has to explicitly null-terminate the version info strings (note the \0):

VALUE "ProductName", "TestProductName\0"

结果空值(\0)字符显式存储在结果二进制文件中.因此,最后在生成的二进制文件中有两个空字符(UTF-16编码中为四个0字节).当允许多个值时,这是常见的WinAPI格式.空字符是值分隔符,双空字符终止序列.

The resulting null (\0) character is explicitly stored in the resulting binary. So in the end there are two null characters in the resulting binary (four 0 bytes in UTF-16 encoding). This is common WinAPI format when multiple values are allowed. The null character is values separator, the double-null terminates the sequence.

您的TestApp.exe缺少第二个null.我可以在十六进制转储中看到它.我很确定这是造成您问题的主要原因.

Your TestApp.exe is missing that second null. I can see that in a hex dump. I'm pretty sure that this is the primary cause of your problem.

这篇关于在使用PyInstaller创建的应用程序上的InnoSetup中使用GetStringFileInfo时,发生编译器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆