Solved

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

Posted on 2001-08-01
3
132 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now