Link to home
Start Free TrialLog in
Avatar of cybsasha
cybsasha

asked on

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.
Avatar of Luis Alonso Ramos
Luis Alonso Ramos
Flag of Mexico image

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.
Avatar of Zoppo
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
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.
Avatar of cybsasha
cybsasha

ASKER

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.
Adjusted points to 300
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.
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
Yap, I just don't get it.
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?
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.
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.
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
Will an Installation using a serial num help you out?
Install Shield, WinZip etc. both support this in one way or another.
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.
ASKER CERTIFIED SOLUTION
Avatar of migel
migel

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
What if the installation key is known to all?
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
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.
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.
I think , it's close to asked question...
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)....