Store some info in *.exe file

I need to store some info in exe file,I don't want to use registry or *.ini , because if user format disk,all info will be lost.
I want that user run program once,then program store all settings, and then user make buckup *.exe with this settings, or if user want to run this program without installation on other computer. please add only comments, I'll check the better and give you A.
LVL 1
cybsashaAsked:
Who is Participating?
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.

luisrCommented:
Open the file and store a fixed-size block of data at the very end... then you can open the file for reading and seek to the end minus n bytes and read all your data...

Remember to update the PE checksum or your modified EXE will not run on NT or Win2000.
0
ZoppoCommented:
Hi cybsasha,

I do not have a solution for this (except with WinNT you could use UpdateResource() to change/add some data to the exe's resources, but unfortunatley not with Win95/98), but I want to ask whether you're sure that it's a good idea to save setting in the exe. Here are the problems I see with this:

1. If you send a user a new version (i.e. an update) of your exe you'll need a setup program which get's all these settings from the old exe and save them into the new.

2. You have no possibility to hold any settings per user (which is possible in NT via registry key HK_CURRENT_USER or i.e. an ini file in the users profile directoy).

ZOPPO
0
shaigCommented:
If the user will format the disk, won't the exe be deleted as well?
This solution, of modifing the exe is really rarly used and has many problems. Why not create a binary to be stored in the exe's path? a binary that will always be sipped with the exe. This way you can update an modify the exe, and the ser will still have his setting saved.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

cybsashaAuthor Commented:
shaiq if user format disk of cause my exe delete, but user before save exe on floppy or zip. I need this way because my programm for modeling furniture need customize(like diff firms have diff price, names matirials,formuls to calculate price)this program help people in the store to calculate price (draw like AutoCad 3D,2D,textures), and once tune this program in one computer firm can copy this settings to others(about 15~20 computers in diff shop).I tried to store in registy , but it's a long time to set to others this setting without mistake,because to office the  shop's send ready orders, and mistake can cost very expensive.About ini, people who working with program don't have enough knowledge in computers,this is girls 20~25 . And I don't want to setup this program to diff shops in diff firms by myself , of cause i can store in database, I store orders in FoxPro, but constants user in the shop  can't change, only in office people can change. Sorry for my English.Best regards.
0
cybsashaAuthor Commented:
Adjusted points to 300
0
shaigCommented:
I see. I still don't understand why not create an additional binary file containing the data (instead od a binary portion in the exe).

Another thing, the way you store the file doesn't have nothing to do with the way you represent it the client.

Don't worry bout' the English, my English isnt that gr8 eather.
0
ZoppoCommented:
Hi cybsasha,

Why not simply implement some load/save functionality for the settings, so the users can exchange/backup/restore their settings via floppy/network?

ZOPPO
0
shaigCommented:
Yap, I just don't get it.
0
cybsashaAuthor Commented:
At first I want to know how many copies was insalled(counter increase if you run from other machine), because if client want that I modify program, if counter more than number of bought copies < I don't want to do anything, this program very special, I spent one year to write this ones, and no one analog for this price. More chiper to buy more copies, that to crack. But if I garantee new updates free, I want to be sure, that all agreement is All right.Now I'm using decoding executable code into memory from disk and prev block is key for the next, of cause CRC of blocks.I know how to share date , but how to write date to runing proccess from this proccess?
0
xu092098Commented:
You mean some kind of security reason. Like if the customer installs more than N times, your program stop working?
What if I copy the original program  before installing it? What if I set the program to read only? And if you just save some new information into the exe, it's not very hard to crack. Anyone with a file compare program can figure out which bytes you changed and change them back.
0
cybsashaAuthor Commented:
xu
I want to save modified CRC(after I write to exe) in registry and if you install not modified file program not work.If you want to run copies you need find in registry key or format disk and reinstall Win. I'm using NeoLite. If you want to see code in IDA you need to decompress file, but if you use max.compress you cant restore. About read only, I can check if program set as read only change attribute,or
say user to change attr.
0
bertpCommented:
Another problem:
  I think if you modify the exe then it is likely you will scare you customers into thinking that they have a virus ....  some virus protection schemes detect changes in excutables  and assume that the source of change is a virus
0
shaigCommented:
Will an Installation using a serial num help you out?
Install Shield, WinZip etc. both support this in one way or another.
0
cybsashaAuthor Commented:
shaiq /no this not help because if customer bought one or two copies who can know how many copies he install?In my country this  problem  very actually.
0
migelCommented:
Hi!
you can modify exe file by the another programm (file is file and nothing more :-)
I think setup program will be good app to to this,
simple schema can be like this:
1. define in  the your programm BYTE array which size will hold all needed data.
2. by default store in this array some unique string.
3. in  the install app open exe file to write abd search this string through file.
4. once found write all data to the founded offset.
5. if your app found .string. when launch it must terminate since your APP haven`t being properly installed.
0

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
shaigCommented:
What if the installation key is known to all?
0
cybsashaAuthor Commented:
shaiq , if i'm using InstallShield with serial ,I don't have garantee that this program not copy to many computers, now I create key disk and without this disk program not run, if user want to use prrogram w/o disk, he must make same action,and  this exe cant't run on other computer.Key disk contain some signature how many copies installed.And now I try miquel solution
0
Janusz CzopowikCommented:
As painful for you and customer it can be, but you can use a key that is connected to a parallel or serial port of the computer. Such a key does not prevent from using printer, but build in chip with hard-wired code would give you an indication if this were legal copy of your program.

It would also allow copying it to any number of computers but only ones with the key would actually execute program. You can then write registry with user settings each time different user is running program very first time.
If you are really trying to protect your software this would be the best way of doing it, including updates.
0
cybsashaAuthor Commented:
JohnCz yes , I know this way,in my country many software firms use HASP key,but not to hard to write vxd, which emulate this key(a few month ago I give  my friend my program with key, and one day he used to write vxd), when I ask this question , I try to find unusual solution,(I need this solution not only for my program, now I'm working on program , which can protect unlegal use of programs,I used key diskette,but you can low level duplicate disk, HASP key-emulate with vxd,register from Internet, but easy write crack to dll or exe) I will try later to find solution, three month waste.
0
cybsashaAuthor Commented:
I think , it's close to asked question...
0
cybsashaAuthor Commented:
xu, it's really very easy to find where in reg. I write (for example with Norton Registry Tracker).And now , after I try all solution , which I can , At fist I understand protection program is only for honesty people, At second I understand how to crack other programs(I see protection different programs)....
0
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
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.