Link to home
Start Free TrialLog in
Avatar of kurian2z5
kurian2z5Flag for India

asked on

Encrypt an EXE

I want to encrypt an exe file. There should be a launcher application that checks for a password or something and decrypts and executes the encrypted exe file. The decrypted file should not be saved to disk, other wise the user can copy the decrypted exe while the program is running. Im using an algorithm for encryption, but my problem is I dont know how to execute the decrypted file without saving it to a file. How do i do this ?
Avatar of hes
hes
Flag of United States of America image

Why ?
Avatar of Yrag1
Yrag1

Exactly WHY?
no one will be able to read your code, if you want to limit access to the prog just password protect the program, so a user has to enter a password to run it.

Gary
The only way this is going to work is if you save the
decrypted file to disk. If you dont want to do that,
then have a launcher program.

Working Example:

Launcher:
   Command1_Click()
     Shell "Project1.exe Mypass"
   End Sub
 
Program:
   Form_Load()
     If Command$ <> "Mypass" Then End
   End Sub

That will create a program that can not be opened without
a password. Also will save a lot of time with getting rid of
the need for encryption.
Avatar of kurian2z5

ASKER

I need to encrypt a third party exe so i cant use your method List244.

I want to implement a harddisk lock for a third party exe using a launcher program. The launcher should decrypt and execute the third party exe if the user provides the correct key.

Actually i made a program for which i lost the source and so i cant implement the protection in the program itself. But this method can be extended to any other program using the launcher.

This is how SafeDisc 1 CD protection works isnt it ?

The program's exe is encrypted and saved as a .icd file.

The launcher progam verifies the Disc and decrypts the .icd file and executes it WITHOUT saving it to disc. If you check the running processes it shows the progam.icd file and not an .exe file.
ASKER CERTIFIED SOLUTION
Avatar of List244
List244

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just need to make a harddisk lock for a program without modifying the exe of the program.

The user should not be able to run the program on another computer, unless he obtains the original exe of the program.

If i save the decrypted exe to a file, it can be copied while the program is running, if you view the running processes to see where the file is running from.

How do i go about it ?
Why not just use activelock

http://www.activelock.com/
I need to protect a third party exe, so i cant modify its source and hence i cant use activelock.

List244
I would have used your method but if i decrypt the exe to a new location or in some cases even rename it the program amy not work because it wont find its files etc..
Im going to use ur method List, (except for programs that dont run with exe renamed) Ill save the exe under a different name in the same folder, probably readme.txt or something, so most of them should work.

I need to know how to detect if a program is running (by its exe name - not caption) and wait for it to close before deleting the exe.
i was waiting for list244 to reply. id give him 30 points for a near complete answer.
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=33724&lngWId=1

I would suggest something like this. If you can find the running processes you can
check if the certain exe is running.
this lists all the processes. if i keep refreshing the list and checking if the program's name has been removed, then i presume it has closed. but this is rather inefficiend and CPU usage goes up. there has to be a way to check for a specific process running. like if AppActivate(window title) returns false then the progam with the window title u passes is not running..
As far as I am aware, the only way to do this, is to enumerate the running
processes. However, if you want another way of going about it:

https://www.experts-exchange.com/questions/21130332/Detect-running-exe.html?query=exe+running&topics=93

But, other than enumerating processes, I do not know how to do this. Sorry.