[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2001-08-01
3
Medium Priority
?
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 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