【这是和谐向fpc官方提交的】lazarus中构建带VersionInfo的windows程序(win32/win64)的exe文件, 在windows查看文件属性 VersionInfo 字符串条目不能显示完整的unicode字符串。
【2025-01-09上传的lazarus36绿色版是修复后的版本】
修复方法:
1、打开fpcsrc/packages/fcl-res/src/versionresource.pp b/packages/fcl-res/src/versionresource.pp
找到procedure TVersionResource.WriteStringEntry(const aKey, aValue: string);
将
block.vallength:=length(aValue)+1;
改为:
block.vallength:=length(Widestring(aValue))+1;
完整的如下:
procedure TVersionResource.WriteStringEntry(const aKey, aValue: string); var block : TVerBlockHeader; before: int64; begin before:=RawData.Position; block.length:=0; block.vallength:=length(Widestring(aValue))+1; block.valtype:=1; block.key:=aKey; {$IFDEF ENDIAN_BIG} block.vallength:=SwapEndian(block.vallength); block.valtype:=SwapEndian(block.valtype); {$ENDIF} RawData.WriteBuffer(block,6); WriteWideString(block.key); AlignDWordWriting; WriteWideString(aValue); AlignDWordWriting; WriteFixedBlockLength(before); end;
2、重新编译fpc、lazarus(建议用fpcupdeluxe)和应用
如果用fpcupdeluxe请按以下步骤操作,一定要勾上FPC/Lazarus rebuild only


修复后:


浙公网安备 33010602011771号