下载后修改可执行文件(Like Ninite) [英] Modifying executable upon download (Like Ninite)

查看:194
本文介绍了下载后修改可执行文件(Like Ninite)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个应用程序(Windows),需要在下载时进行内部修改。
此外,我使用Linux主机提供它,所以,不能按要求编译建议。


Ninite 如何处理?

在Ninite.com中,每次选择不同的选项时,您都会得到相同的.exe,但在其中进行少量修改。

I'm currently developing an application (Windows) that needs internal modifications upon download time. Also, I'm delivering it using a Linux host, so, can't compile on demand as proposed.
How does Ninite deal with it?
In Ninite.com, each time you select different options, you get the same .exe, however, with minor modifications inside.

选项1

使用预定义数据编译程序(在Windows中)。

使用PHP fseek文件并替换我的自定义字符串。

Option 1
Compile the program with predefined data (in Windows).
Use PHP to fseek the file and replace my custom strings.

选项2

使用其他资源文件附加原始.EXE

Option 2
Append the original .EXE with a different resource file

其他?

有没有人这样做?什么是最好的方法?

谢谢。

Has someone developed something like this? What would be the best approach?
Thank you.

推荐答案

的原始可执行文件。 Windows PE文件格式足够强大,这不会使可执行文件本身无效。 (但是,它会使任何现有的数字签名失效。)

You can just append data to the back of your original executable. The Windows PE file format is robust enough that this does not invalidate the executable itself. (It will however invalidate any existing digital signatures.)

如果其大小未知,则查找此数据的开始可能是一个挑战。在这种情况下,可能需要附加可变长度数据,然后附加数据长度(本身为固定长度字段 - 4个字节应该做)。要读取额外数据,请读取最后4个字节以获取数据长度。获取文件长度,将长度字段减去4,然后减去变量长度以获取数据的开始。

Finding the start of this data can be a challenge if its size isn't known up front. In that case, it may be necessary to append the variable-length data, and then append the data length (itself a fixed length field - 4 bytes should do). To read the extra data, read the last 4 bytes to get the data length. Get the file length, subtract 4 for the length field, then subtract the variable length to get the start of the data.

这篇关于下载后修改可执行文件(Like Ninite)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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