具有iimg和iicon选项的WinRar存档已损坏 [英] WinRar archive with iimg and iicon options becomes corrupted

查看:154
本文介绍了具有iimg和iicon选项的WinRar存档已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个自解压(SFX)rar存档,其中将同时包含图标和图像.我正在使用以下命令行:

I'm trying to create a self-extractable (SFX) rar archive, which will have both icon and image. I'm using the following command line:

winrar.exe a -r0 -sfx -ibck -z"MyConfFile.conf" -iimg"MyImage.bmp" -iicon"MyIcon.ico" MyPackage.exe @"MyFileList.txt"

问题是-无法解压缩生成的.exe.而是显示档案格式不明或已损坏".如果我只设置图标或图像,那么一切都很好.但是,如果我都设置了,那我就有麻烦了.最奇怪的事情.

Trouble is - the resulting .exe can't be unpacked. Instead it says "The archive is either in unknown format or damaged". If I set only icon or only image, then everything is fine. But if I set both, I'm in trouble. Strangest thing.

推荐答案

首先将SFX模块的代码+位图文件的数据+图标文件的数据+ SFX注释文件+其他数据(签名)写入SFX存档文件,然后将带有压缩数据的实际存档附加到该文件中.

The code of the SFX module + the data of the bitmap file + data of the icon file + SFX comment file + other data (signature) are written first to the SFX archive file and next the actual archive with the compressed data is appended to the file.

根据 RAR 5.0存档格式技术说明文档.

可能的解决方案:

  • 通过减小位图文件的宽度/高度来减小其大小.
  • 通过将颜色从真实颜色减少到256种颜色来减小位图文件的大小.
  • 通过从实际上不需要的图标文件中删除图标来减小图标文件的大小,因为尺寸为16x16、24x24、32x32和48x48的单个图标就足够了.某些* .ico文件包含各种尺寸的多个图标.标准尺寸中的单个图标足以用于SFX存档.甚至可以删除一些尺寸,例如24x24和48x48,以便图标文件仅包含一个尺寸为16x16和32x32的图标.
  • 通过使用自定义调色板将文件中的所有真彩色图标减少到只有256种颜色的图标,或者如果可能的话减少到16种颜色,从而减小图标文件的大小.
  • 减小注释文件的大小(如果可以的话),例如在安装前使用通配符删除文件或在执行SFX时向用户显示较短的文本.
  • 例如通过使用 UPX 压缩它来减小SFX模块的大小.
  • Reduce the size of the bitmap file by making it smaller in width/height.
  • Reduce the size of the bitmap file by decreasing the colors from true color to 256 colors.
  • Reduce the size of the icon file by removing icons from icon file not really needed as a single icon in the dimensions 16x16, 24x24, 32x32 and 48x48 is enough. Some *.ico files contain multiple icons in various dimensions. A single icon in the standard dimensions is enough for an SFX archive. It is even possible to remove some sizes like 24x24 and 48x48 so that the icon file contains only one icon in dimensions 16x16 and 32x32.
  • Reduce the size of the icon file by decreasing all true color icons in the file to icons with only 256 colors using a customized palette or even to 16 colors if that is possible.
  • Reduce the size of the comment file if that is somehow possible like using wildcards for files to delete before installation or shorter text displayed to user on SFX execution.
  • Reduce the size of the SFX module for example by compressing it with UPX.

但是要考虑到,压缩SFX模块本身后,位图和图标必须位于SFX模块本身的资源中,而不是单独附加.

But take into account that with compression of the SFX module itself the bitmap and the icon must be in the resources of the SFX module itself instead of being appended separately.

诸如资源黑客之类的工具可用于通过自己的位图和标准来替换标准位图.自己的图标,以及更改对话框的布局.即使不使用UPX之类的运行时打包程序压缩SFX模块,也可以减小存档数据之前的数据总大小.

A tool like Resource Hacker can be used to replace the standard bitmap by own bitmap and the standard icons by own icons as well as changing dialog layout. That reduces the total size of the data preceding the archive data even without compressing the SFX module with a runtime packer like UPX.

WinRAR 的版权所有者允许使用 Resource Hacker 之类的工具来自定义 WinRAR 的标准SFX模块之一的资源. .通过 Index 查看 WinRAR (winrar.chm)标题为 GUI RAR和ZIP SFX模块(Default.SFX和Zip.SFX)的页面. em>标签或通过 Contents 标签(自解压模块的第一项)获得帮助.

Using tools like Resource Hacker to customize the resources of one of the standard SFX modules of WinRAR is permitted by the copyright owners of WinRAR. See in help of WinRAR (winrar.chm) the page with title GUI RAR and ZIP SFX modules (Default.SFX and Zip.SFX) via Index tab or via Contents tab (first entry of Self-extracting modules) of help.

这篇关于具有iimg和iicon选项的WinRar存档已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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