Link to home
Start Free TrialLog in
Avatar of dev_j
dev_j

asked on

Launching an EXE inside an EXE (EXE Wrapper)

1. I have an Executable program which my company wishes to distribute.

2. We have some security key software which checks the parallel port for a security device. I can access the security device from either C++ or VB.

Objective: Write a simple program which checks the status of the device, if Present it launches the Executable program. I have check stuff down, I just need to launch the EXE.

I would like NOT to create a temp file because then someone could possibly copy that file and start running versions of our program with out paying for a security key.

I assume there is a way to append my checking program (EXE1)to the beginning of the distributing program (EXE2) then start the 2nd running by executing an instruction in the beginning of the (EXE2)

Any other ideas are welcome.

Thanks,

Jeffrey
Avatar of kpcapel
kpcapel

Is this a Windows program?  If so, why not a simple shell command to launch the other exe?  I sense there must be something else in play, because the solution seems simple.
Avatar of dev_j

ASKER

Yes this is a windows program,

However, I want to distribute only a single executable, I dont want the people who revieve the exe to have the ability to run this program without having the security key. I do not have the source code to the program to make it read the security key myself, other wise that would be the solution.


Jeffrey
Avatar of DanRollins
The actual launching of the EXE is trivial.
However...

There is no real security unless the 'target' PROGRAM ITSELF checks for the presence of the security device (dongle?) and refuses to run if it is not there.  Do you not have access to the target program's source code?

It may be possible to trick the Windows EXE loader into loading from a memory buffer, but I have never seen any code that does that.  Other alternatives involve writing the EXE to a temporary file.

If the "target" EXE requires the use of a particular DLL, then I suppose the "wrapper" EXE could munge that DLL to prevent the target EXE from running.

=-=-=-=-=-=-=-=-
Check with the maker of the security device. They may have an easy-to-implement solution -- after all, you are paying them money...

-- Dan
Why don't you just add the "security checks" code to the program exe? this is how it suppose to be done..
Or did I get you wrong?
yes there is a way to check a key before the program runs if u insist :)
i will have to make a virus type program which will be embedded in ur exe and will check the particular key of the user. understood?
Avatar of dev_j

ASKER

Ok I think I have not been clear in my question and situation.


1. I have an EXE to which I DO NOT have the source code. (The company who made it for us went out of business a while ago)

2. I have Security Software to which I would Like to add to this EXE.

3. I only want to Distribute 1(ONE)EXE not 2.  A wrapper program may be more descriptive .

4. I Assumed there was an easy way to Append One EXE to another. The first EXE is one I write, if conditions are correct I start executing at the address of the second in memory.(or something like that)

Background:
The people who we buy the security devices  from do have a wrapper program which is supposed to do just what I want: take an exe, wrap it with code that checks for the device. However, their software is not working with my exe.
My exe is actually a Shockwave game that has been compiled to a windows EXE. It is huge 14MB because it stand alone and does not need Flash or Director installed to run. For some reason their program has a problem with the exe.

Assumption: I thought it would be easy enough to write my own exe Wrapper.

Thanks again for your help,

Jeffrey
Avatar of dev_j

ASKER

I have increased the points on this question from 200 to 300 because I am in a hurry  and i guess its not as easy as i figured to wrap an exe.


Jeffrey
Avatar of dev_j

ASKER

Oh and another thing to keep in mind, I could use VB or C++ to access the security key, so I could use either language to code the wrapper.

Jeffrey
hello?  hello?  hello?
We understand the situation, no need to repost it.  We have already summarized your options.  

It is easy to append a second EXE to a small wrapper EXE and have it do some work (such as checking for a dongle).  But there is no way to avoid writing a temporary file of the target EXE.  Since that is one of your requirements, there is no reason to go into the details of how to do the programming of the wrapper EXE.

-- Dan
Avatar of dev_j

ASKER

>> But there is no way to avoid writing a temporary file of the target EXE

I don't mean to be argumentative here, but how can it not be possible? I have in my possession a program from the Security key manufacture which does exactly what i want. It works on most EXEs. It just does not work on mine. The manufacture is working on a fix right now. I wanted to be proactive and try to find a solution myself and maybe learn a few new things in the process.

I can under stand that it may not be as easy to do as I thought, but I would like to know why before I just give up. (which I have no intention of doing)

As info_expert eluded to, its like a virius program I want to write, so I am looking on hacker sites for more info.

Jeffrey
Avatar of dev_j

ASKER

>> But there is no way to avoid writing a temporary file of the target EXE

I don't mean to be argumentative here, but how can it not be possible? I have in my possession a program from the Security key manufacture which does exactly what i want. It works on most EXEs. It just does not work on mine. The manufacture is working on a fix right now. I wanted to be proactive and try to find a solution myself and maybe learn a few new things in the process.

I can under stand that it may not be as easy to do as I thought, but I would like to know why before I just give up. (which I have no intention of doing)

As info_expert eluded to, its like a virius program I want to write, so I am looking on hacker sites for more info.

Jeffrey
Avatar of dev_j

ASKER

>> But there is no way to avoid writing a temporary file of the target EXE

I don't mean to be argumentative here, but how can it not be possible? I have in my possession a program from the Security key manufacture which does exactly what i want. It works on most EXEs. It just does not work on mine. The manufacture is working on a fix right now. I wanted to be proactive and try to find a solution myself and maybe learn a few new things in the process.

I can under stand that it may not be as easy to do as I thought, but I would like to know why before I just give up. (which I have no intention of doing)

As info_expert eluded to, its like a virius program I want to write, so I am looking on hacker sites for more info.

Jeffrey
Avatar of dev_j

ASKER

Sorry for the Multi post, not sure how that happend. I think I hit Refresh and it posted again.

Jeffrey
I think there is no way but to make a virus to intercept the orignal exe code address and then check the password of the user of exe then i will let the exe to be run. Otherwise it will not allow the user to run the exe.
Got it or Not?
>>...not be as easy to do as I thought, but I would like to know why...

It boils down to this:  You can very easily start a program by using any of several API fns: ShellExecute, CreateProcess, WinExec, LoadLibrary, etc... But all of these APIs expect to be given the name of a file -- on disk -- to execute.  

I do believe that there may be a way around this (that is, to access some lower-level API in the exe loader) because such wrappers exist (including one that uncompresses a compressed EXE on the fly) but I have never seen code that shows how it is done.

-- Dan
Please update and finalize this old, open question. Please:

1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.

EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.

Thanks,

** Mindphaser - Community Support Moderator **

P.S.  Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
Avatar of dev_j

ASKER

Sorry for not finnishing up.
We eventually were able to contact the orginal programmer even though the company was out of business. We paid him to add the security code to check the dongle.

Even though the information did not help me achieve my goal I thank those who contrbuted so I guess I will award

200 pts to DanRollins
100 pts to info_expert


Thanks for your efforts,

Jeffrey
ASKER CERTIFIED SOLUTION
Avatar of Mindphaser
Mindphaser

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