简体   繁体   中英

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.

Right now, people download the program using 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

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. However, it only works properly in Internet Explorer.

I've been considering the following scenario to solve it:

  1. Make a .EXE file HttpHandler.
  2. When a .EXE file is requested, check the parameters.
  3. Somehow embed the parameters into the .EXE file (how would I do this?)
  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).

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. 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 . The command line usage is described in the tutorial (search for "Using Scripts in Resource Hacker")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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