Compiler error when using GetStringFileInfo in InnoSetup on application created with PyInstaller

南楼画角 提交于 2019-12-10 10:38:45

问题


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

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

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

line 65:

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

Definition of VerInfoProductName below

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

Details are attached in archive.


回答1:


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

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.

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

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")

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

VALUE "ProductName", "TestProductName\0"

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.

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.



来源:https://stackoverflow.com/questions/29341371/compiler-error-when-using-getstringfileinfo-in-innosetup-on-application-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!