gpt4 book ai didi

c++ - 使用 UPX 压缩 Windows 可执行文件有什么缺点吗?

转载 作者:IT老高 更新时间:2023-10-28 12:31:37 27 4
gpt4 key购买 nike

我用过UPX之前减少我的 Windows 可执行文件的大小,但我必须承认我对这可能产生的任何负面影响都很天真。所有这些打包/拆包的缺点是什么?

在某些情况下,是否有人会建议不要对可执行文件进行 UPX 处理(例如,在编写 DLL、Windows 服务或针对 Vista 或 Win7 时)?我的大部分代码都是用 Delphi 编写的,但我也使用 UPX 来压缩 C/C++ 可执行文件。

附带说明,我运行 UPX 是为了保护我的 exe 免受反汇编程序的攻击,只是为了减小可执行文件的大小并防止粗略的篡改。

最佳答案

... there are downsides tousing EXE compressors. Most notably:

  • Upon startup of a compressed EXE/DLL, all of the code isdecompressed from the disk image intomemory in one pass, which can causedisk thrashing if the system is low onmemory and is forced to access theswap file. In contrast, withuncompressed EXE/DLLs, the OSallocates memory for code pages ondemand (i.e. when they are executed).

  • Multiple instances of a compressed EXE/DLL create multipleinstances of the code in memory. Ifyou have a compressed EXE thatcontains 1 MB of code (beforecompression) and the user starts 5instances of it, approximately 4 MB ofmemory is wasted. Likewise, if youhave a DLL that is 1 MB and it is usedby 5 running applications,approximately 4 MB of memory iswasted. With uncompressed EXE/DLLs,code is only stored in memory once andis shared between instances.

http://www.jrsoftware.org/striprlc.php#execomp

关于c++ - 使用 UPX 压缩 Windows 可执行文件有什么缺点吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/353634/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com