简体   繁体   English

用可执行文件捆绑一些信息?

[英]Bundling some information with an executable?

I'm using IIS 7.5 on my webserver, and I am creating a C# WPF program that I publish to that server, so that people can download the program. 我在我的网络服务器上使用IIS 7.5,我正在创建一个我发布到该服务器的C#WPF程序,以便人们可以下载该程序。

Right now, people download the program using http://.../Software/Shapeshifter/Setup.exe 现在,人们使用http://.../Software/Shapeshifter/Setup.exe下载程序

However, I would like editors from magazines and so on to be able to make a branded copy of my program, so that they can choose to brand it. 但是,我希望杂志等的编辑能够制作我的节目的品牌副本,以便他们可以选择品牌。

For instance this link: http://.../Software/Shapeshifter/Setup.exe?brandName=test&brandImage=http://uriToImage.example.com 例如这个链接: http://.../Software/Shapeshifter/Setup.exe?brandName=test&brandImage=http://uriToImage.example.com

And then read that from my program when it starts, to brand the application properly. 然后在程序启动时从我的程序中读取,以正确地标记应用程序。

Currently I am using ClickOnce to do this, since it allows web invocation of such arguments. 目前我使用ClickOnce来执行此操作,因为它允许Web调用此类参数。 However, it only works properly in Internet Explorer. 但是,它只能在Internet Explorer中正常运行。

I've been considering the following scenario to solve it: 我一直在考虑以下场景来解决它:

  1. Make a .EXE file HttpHandler. 创建一个.EXE文件HttpHandler。
  2. When a .EXE file is requested, check the parameters. 请求.EXE文件时,请检查参数。
  3. Somehow embed the parameters into the .EXE file (how would I do this?) 以某种方式将参数嵌入到.EXE文件中(我该怎么做?)
  4. Read the parameters from the application (again, how would I do this?) 从应用程序中读取参数(再次,我将如何做到这一点?)

To make it all a bit more easy, let's just say that my my program is a single .EXE file, and that Setup.exe is actually the program's executable file itself, without any wrapper installers (even though that's not the case). 为了让这一切变得简单,让我们说我的程序是一个单独的.EXE文件,而Setup.exe实际上是程序的可执行文件本身,没有任何包装器安装程序(即使不是这样)。

Any suggestions? 有什么建议?

Honestly, I would first just compile a huge string resource in the EXE, something that can be easily identified (very specific HEX combinations), open the EXE as binary file, search for this location and put any data in there. 老实说,我首先只是在EXE中编译一个巨大的字符串资源,可以很容易地识别(非常特定的HEX组合),打开EXE作为二进制文件,搜索这个位置并将任何数据放在那里。 Not exactly beautiful, but should work. 不完美,但应该工作。

But after a deep digging around the web I finally found a resource editor that is both free and supports execution from command line. 但经过对网络的深入挖掘,我终于找到了一个免费的资源编辑器,并支持从命令行执行。

The tool is Resource Hacker . 该工具是Resource Hacker The command line usage is described in the tutorial (search for "Using Scripts in Resource Hacker") 命令行用法在教程中描述(搜索“在资源黑客中使用脚本”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM