How to write to a exe-file ?


How can i read from a exe-file, and write this hole exe. Back to a new exe-file, that are the same as the exe-file read from. But the differents is that i like to change the original exefile, before i make the new one.

Hope sombody can give me source code that do this in vb6.0.

Or maby this is not possible ?

Thanks for fast answer's.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
May I ask why you are trying to achieve this task?
also, what kind of changes to you want to achieve?
Patrick MatthewsCommented:
Hi Tor,

This is not possible.


Have you tried this technique of writing to the end of the exe file?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

team2005Author Commented:

What i need is :

Have this little software, that i like to start from another exe.
Becource its only payd customers, that can start this exfile.
And thinking that i must then encode the exefile, and the decode it from
the other exe.

Hope that explane what i want.

Thanks for helping me out.

Maybe you could pass the customer id to the command line of the executable when you call it and when it begins, it verifies that the customer is indeed a paid one, if not, the application stops.  This could be encrypted and the application you are calling decrypts it and then verifies it it is paid customer.

team2005Author Commented:
Hi leclairm!

Hmmmm, not shore what you trying to explane here.
But exefile 2 can the be started from anyone. If a customer is uploading this exe to internet.
So other people can use this exe, without paying...


Thanks for helping me out here.

You can pass parameters to the executable.  In visual basic, when you want to use the parameters that were passed to it, you use the Command variable.

For instance, if you start the executable like this:

PaidCustomer.exe %$#G

Where %$#G is the encrypted customer id, your app will be able to see this using the Command variable.  It could then decrypt it and verify in the database if it is a paid customer.  If it isn't, it will exit.  Also, if no parameter is passed, it will also exit.

This is only possible if you have the source code for the executable though.  What exactly does this executable do??
team2005Author Commented:

Can't use you metod, but thanks for trying...

The executable is a small program. Can't tell you what it does...Sorry

MUST run this from the first exefile. Its the only way i think.
Isent it a way to read line by line from a exefile.
And encode the lines, and make a new file ???

Thanks for helping me out


No that can't be done (as far as I know anyways).

I was asking what it does because perhaps you could change it to a dll rather than an executable.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
team2005Author Commented:

Think that i accept your last answer. Becource maby a can make a dll-file here. :))


team2005Author Commented:
Hi jimhorn!

Why will a crack into my own software ???
Just try to protect my software....

team2005Author Commented:

I am not give hackers info on how to crack into exe files.
Trying to protext a software i am making. Try to change my program (exefile) to somthing different.
So no one can start this exefile, becource this file is encoded...
Then my second program will then decode this file.... That is what i asked for... Is that i crime ?

Accepted the asnwer from lecraim, becource its maby solve my problem. To protect my little software.


team2005Author Commented:
Guy Hengel [angelIII / a3]Billing EngineerCommented:
as from my opinion, the linked q is giving methods to do reverse engineering of programs, which is mostly used when hacking programs (which is prohibited). IMHO, that q should not have been PAQed, as it was never asked (not even by the admin/mod) for what means this operation is needed.

NOTE: it's not that we ASSUME that YOU (or someone else) is a hacker or trying to do bad things, but it's simply a matter of basic protection against such things.
It's quite simple to see from the reaction of people what their intention is/was.
team2005Author Commented:

To protect my own software is not a crime.
To crack software is a BIG crime.

I tryed to figure out how to protect my software.

Have used EE for a long time now. And have been happy for all help in here.
But when you try to say to me that i try to crack exe files, i dont know if i want to
still use EE.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
>But when you try to say to me that i try to crack exe files, i dont know if i want to still use EE.
Who SAID that YOU try to crack files? We only ASKED what you are doing, not ASSUMING that you are DOING it.
that is a BIG difference. If you don't understand that, that's a BIG problem.

>I tryed to figure out how to protect my software.
the problem will be that once you changed the exe or launch an extract of it, it is quite easy to see this for experiences hackers. They will watch all file, registry and other operations your application is doing, and can trace that activity.
once they found what the application does to protect itself, they can reverse engineer it.

>I tryed to figure out how to protect my software.
against what / whom?
you cannot (really) protect your .exe file(s) being copied.
you cannot (really) protect your .exe file(s) from being reverse-engineered. it's only machine code which can be read quite easily.

Just to give you an idea that the efforts protecting a software is a huge investment in time and money which might not be worth it. As you don't tell us what your software is about, we cannot do a statement on that.

team2005Author Commented:

I can anderstand you here in EE, becource its so many people out there that are HACKERS.
And i don't wont to give them things, so they can hack more software.

Sorry i have explaned me wrong, but my question was about protection of my own software.
Have made a solution to this, making a DLL-file. :))

So next time i ask a question, i will try to ask it in a right way.

Thanks for solving this issue.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.