Solved

Launching an EXE inside an EXE (EXE Wrapper)

Posted on 2002-03-18
19
328 Views
Last Modified: 2010-04-02
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
0
Comment
Question by:dev_j
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 3
  • 3
  • +3
19 Comments
 

Expert Comment

by:kpcapel
ID: 6878755
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.
0
 

Author Comment

by:dev_j
ID: 6878760
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
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6878772
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:lidorc
ID: 6879271
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?
0
 
LVL 5

Expert Comment

by:info_expert
ID: 6879547
yes there is a way to check a key before the program runs if u insist :)
0
 
LVL 5

Expert Comment

by:info_expert
ID: 6879551
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?
0
 

Author Comment

by:dev_j
ID: 6880357
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
0
 

Author Comment

by:dev_j
ID: 6880739
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
0
 

Author Comment

by:dev_j
ID: 6880742
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
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6881336
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
0
 

Author Comment

by:dev_j
ID: 6881388
>> 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
0
 

Author Comment

by:dev_j
ID: 6881403
>> 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
0
 

Author Comment

by:dev_j
ID: 6881404
>> 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
0
 

Author Comment

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

Jeffrey
0
 
LVL 5

Expert Comment

by:info_expert
ID: 6898718
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?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6904053
>>...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
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7036235
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.
0
 

Author Comment

by:dev_j
ID: 7039806
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
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 7039844
dev_j

Since the question wasn't answered, I refunded you rpoints and moved the question to PAQ.
I'd suggest you post a 200p and a 100p question in this Topic Area with the title "Points for xxx" and the body "For your help with http://www.experts-exchange.com/cplusprog/Q.20278539.html" This way you can award them points however you want ...

Thanks

** Mindphaser - Community Support Moderator **
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question