Solved

How do I allow my exe to modify it's own resource?

Posted on 2001-08-01
3
165 Views
Last Modified: 2013-11-20
I basically want to be able to modify a resource in my executable as a way of copy-protecting my programs. When the program first runs, I want it to modify a resource, giving it the serial number of the user's C: drive.

Is this possible? I know how to retrieve serial number - I only want to know how to modify "self".

0
Comment
Question by:jhattingh
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6340166
>>I want it to modify a resource

This is possible using e.g. 'UpdateReposurce()' (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/hh/winui/resource_2crp.asp) - see also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/hh/winui/resource_05yr.asp ('Adding, Deleting, and Replacing Resources'). However, there are some restrictions:

  Windows NT/2000 or later: Requires Windows NT 3.1 or later.
  Windows 95/98/Me: Unsupported.
0
 
LVL 12

Expert Comment

by:migel
ID: 6340571
Hi!
Why resource ???
you can write serial id indirect into the EXE file just make sure where serial located in the exe and write nwe value to the founded offset
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 100 total points
ID: 6341211
Easier than migel's suggestion...
Write say, four bytes to the end of the EXE program:

1) at runtime, open the EXE file.  
2) Seek to the end less 4 bytes.
3) Read the next 4 bytes.
4a) If the first two are some special codes (e.g. "jH') then the signature-stamping has already been done.  So verify that the next two bytes match the signature of the executing computer.
4b) If the first two bytes are *NOT* 'jH', calculate the signature stamp and write 'jHxx' to the end of the file -- where xx is your signature stamp.

Note that this will trigger most virus protection software to complain.  One way around that is to rename the EXE to Myprog.Tmp before doing this, then name it back later.  If this is not possible from the EXE, then do it in an installation/setup program.  

Also, the best way *IS* to write to a resource -- but so many users continue to use Win98 that it is not possible to use that as a sole method -- unless you restrict users to Win2K

-- Dan
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Importing Special Characters in Dynamics GP Through Integration Manager 3 89
how to monitor remote shell execution on linux 9 107
no14 challenge 14 73
Thin secure Windows 10 5 107
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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