通过更改可执行ILASM图标 [英] Change executable icon through ilasm

查看:209
本文介绍了通过更改可执行ILASM图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个嵌入式.resx文件的一些信息,如服务器名称,端口,密码等一个安装程序的应用程序... 我生成这个安装程序(这个过程是自动的,并通过我们的网站的完成)为每一个客户。这是工作的罚款 我使用反汇编作为拆装和更换RESX文件,然后我使用 ILASM ,以使.EXE了。 但这个过程后,该.exe失去了我们的图标,把默认的在它的地方。

I have a installer app with a embedded .resx file with some information, like server name, port, password etc... I have to generate this installer (this process is automated, and is done through our website) for each customer. This is working fine I use ildasm for disassembler and replace the resx file, and then I use ilasm to make .exe again. But after this process the .exe lost our icon, putting the default one in it's place.

我不能找到一种方法来改变默认的图标。

I cannot find a way to change the default icon.

感谢

推荐答案

您错过了一个相当不起眼的细节在C#程序。编译器还可以生成可执行文件中包含的非托管资源。必须的,因为Windows不知道管理的资源什么。这是你可以使用Visual Studio看看。使用文件+打开+文件,并选择由C#编译器生成一个.exe文件。 RTM版的要求,它并不适用于防爆preSS工作。

You are missing out on a fairly obscure detail in a C# program. The executable the compiler generates also contains unmanaged resources. Required because Windows doesn't know anything about managed resources. This is something you can see with Visual Studio. Use File + Open + File and select a .exe generated by the C# compiler. RTM edition required, it doesn't work for Express.

您将看到至少3个节点的程序:

You'll see at least 3 nodes for your program:

  • RT_MANIFEST包含清单的可执行文件。 非常的在以后的Windows版本的重要,它声明的程序与UAC兼容。它prevents Windows无法处理你的程序一样,需要被欺骗,当它UAC较早的Windows程序的禁止的的东西就像试图将文件写入到受保护的目录,并试图创建HKLM注册表项。该清单的内容是大多数程序中默认的,你可以得到一个自定义的应用程序清单文件项目项模板。

  • RT_MANIFEST contains the manifest for the executable. Very important on later Windows versions, it declares the program compatible with UAC. It prevents Windows from treating your program like an earlier Windows program that needs to be lied to when it does UAC verboten things like trying to write files to protected directories and trying to create registry keys in HKLM. The content of the manifest is a default one in most programs, you can get a custom one with the "Application Manifest File" project item template.

版本包含可执行文件的版本资源。它包含了当你在使用Windows资源管理器可执行文件的属性,你看到的信息。其内容是自动生成的[总成:]属性在你的AssemblyInfo.cs源$ C ​​$ C文件

"Version" contains the version resource for the executable. It contains the info you see when you look at the properties of the executable with Windows Explorer. Its content is auto-generated from the [assembly:] attributes in your AssemblyInfo.cs source code file.

图标包含你的程序的图标资源。一个你没有了。

"Icon" contains the icon resource for your program. The one you don't have anymore.

您需要使用/资源选项ilasm.exe嵌入这些非托管资源投入到修补的可执行文件。这需要一个.RES文件,非托管资源的编译版本,由RC.EXE的Windows SDK工具生成的。请注意这是如何也暴露在项目+属性,应用程序选项卡,资源文件单选按钮。

You'll need to use the /resource option for ilasm.exe to embed those unmanaged resources into the patched executable. That requires a .res file, the compiled version of the unmanaged resources, produced by the rc.exe Windows SDK tool. Note how this is also exposed in the Project + Properties, Application tab, Resource file radio button.

您不能忽略这个要求,你生活中可以没有图标的资源,但不是明显的,尤其的不是一个安装程序。获取.RES文件出原始的可执行的将是困难的,相当肯定程序Ildasm.exe不支持反编译它。如果像资源黑客工具不这样做,那么你需要创建一个.RES文件为你的程序。或审查使用程序Ildasm.exe做你想做的事的智慧。

You cannot ignore this requirement, you can live without the Icon resource but not the manifest, especially not in an installer program. Getting the .res file out of the original executable is going to be difficult, fairly sure that ildasm.exe doesn't support decompiling it. If a tool like Resource Hacker doesn't do it then you'll need to create a .res file for your program. Or review the wisdom of using ildasm.exe to do what you wanted to do.

这篇关于通过更改可执行ILASM图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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