1

I have compressed my application exe file into a password protected .zip archive. Now I want to run the application from another application.

How can I let the other application run the compressed and file?

Matt Searles
  • 2,656
  • 2
  • 16
  • 18
  • 1
    What is it you are actually trying to do? Copy protection? – JonasH May 26 '20 at 12:07
  • 1
    You probably don't want to decompress to the file system, or? Then you could have a look at https://stackoverflow.com/questions/3553875/load-an-exe-file-and-run-it-from-memory what options you have to run the application from a memory buffer. – Klaus Gütter May 26 '20 at 12:08
  • @JonasH Yes, copy protection. –  May 26 '20 at 12:11

1 Answers1

0

This seem like an X Y problem. Using a password protected file for copy protection is possible, but not the best way to do it:

  1. The key for the file needs to be hardware coded into the program. There are ways to obsfucate this, but this is not guaranteed.
  2. You will either need to decompress the executable to a temporary directory, or do some extra work to decompress the application to memory and run it from there. If you decompress it from memory you use Assembly.Load to transfer execution without starting a new process. See how to load assembly from memory. Or you could try the method suggested by @Klaus Gütter and start a load an exe from memory
  3. Even if you load the assembly from memory, the user may still use an debugger or memory dump to extract the program.

To me this seem kind of complicated compared to the regular method of copy protection. i.e. Use asymmetric encryption to encode some data. Load this data on application startup and verify that it is correct. This way the user have no way of discovering the encryption key. He may still edit the program to remove the checks, but this is not possible to prevent.

You may include a machine specific id in the data to lock the license to the machine. You may also use some kind of online-activation to verify the correctness of the key. You can also use various obfucation products to make your code harder to reverse engineer.

Keep in mind that absolute protection is not possible. It is all an effort of making circumventing the copy protection more expensive than buying it. And I would say that for most products, preventing casual copying would be sufficient.

JonasH
  • 28,608
  • 2
  • 10
  • 23