473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Change/recompile my .exe at runtime

I am creating a program that will be sold as a subscription. I am trying to decide how to prevent users from passing the program to others without purchasing it. I was thinking that on the very first run, the program could pull the MAC address from the computer it is run on, and create a constant at run time. This constant is then hard wired into the program and is used for comparison every time the program is run thereafter. If the MAC address do not match, it is on a different computer.

How do I recompile my .exe to include a globally declared constant used for comparison? And how do I use this variable throughout my program?

Or is there a simpler way to create my program to require Key Codes for renewal once per year?
Apr 24 '11 #1
5 2433
!NoItAll
297 100+
node locking a program is the best approach - and I will tell you that the MAC address is a lousy way to do that. First off - if the customer changed their nic the program would no longer run. If the customer switched their wireless adapter on - your program would have a 50/50 chance of no longer running as the wireless nic MAC would now possibly be first...
There are a number of ways to do this, including getting the serial number of the disk drive, the motherboard, etc. You can even hash them together or allow one, but not both to change. A much better approach.
Expand|Select|Wrap|Line Numbers
  1. Dim mos As New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
  2.  
  3. For Each mo As ManagementObject In mos.Get()
  4.     Dim serial As String = mo("SerialNumber").ToString()
  5. Next
  6.  
May 3 '11 #2
How do I node lock the program? I am not familiar with this and cannot find anything googling. Could you point me in the right direction?
May 4 '11 #3
!NoItAll
297 100+
Node lock is really just a term, not a method or function you can call.
It means something like this in your startup code where:
MySecretlyStoredNodeNumber
is a function that fetches the nodeserial from a secret hiding place (typically some nether region of the registry)
and
GetNodeNumber
is your function that returns a serial number hashed from some hardware serial numbers you either concatenate, or add, or divide, or run some super-secret algorithm you determine will be difficult to hack.
Expand|Select|Wrap|Line Numbers
  1. If MySecretlyStoredNodeNumber = 0 then
  2.    SaveMyNodeNumber
  3. Else
  4.    Dim NodeSerialNumber as Integer = GetNodeNumber
  5.    If NodeSerialNumber <> MySecretlyStoredNodeNumber then
  6.       End
  7.    End if
  8. End if
  9.  
Calling End is drastic and fast and will often confuse the user so you will likely want to put up a message that tells them why you are about to end the program.

Warning:
I wrote a program many years ago for viewing images from Sony Mavica cameras and used a key to unlock the software. It took people about 5 days to post a hack on the internet so anyone could get it free.
There are enough decompilers out there that it's not that difficult to do. If you truly need to lock your program then you need to look into dongles from a company like WIBU - where an actual portion of your code resides inside the encrypted dongle so the program cannot run without it plugged into the USB drive. Cracking/Hacking that is truly impossible (ok - well NEARLY impossible). They even opened their dongles to the hacking community and offer decent prizes to anyone who can hack it. One person in the past was only able to get a program to run for a short time - that's all. They are expensive - but as you can see - well worth it if you are distributing an expensive application in China or Russia (for example).
May 4 '11 #4
The problem with that is that if the OS is removed, the registry is removed losing the nodeserial. If the Hard Disk is formatted, the nodeserial is lost. This method also allows the .exe file to be redistributed. Is there a way to take this hashed nodeserial and make it static in the .exe file once the file is on the users computer? Or another way to go about achieving the desired result?
May 4 '11 #5
kadghar
1,295 Expert 1GB
What we do in my company is this:

When you open an unregistered software, it shows you a 16 digit number (hex) that is nothing but the 3 first digits of your HDD's serial number, encrypted with 3DES and the key is a truncated hash of a text made with today's date and 'my secret numbers'

The user sends us those 16 digits, and we decrypt them, and encrypt them back, now using a truncated hash of today's date and another set of 'my secret numbers'

When the software recieves the 'Confirmation Code' it decrypts it and checks it vs the HDD's serial number. If it's a match, the software writes the HDD's serial number and some confirmation stuff into a class that will be converted into an XLM (using XmlSerializer), strong encrypted with Rinjindaels and stored somewere in user's hdd.

Each time the software is loaded, it checks for the 'security stuff' and for the HDD's serial number.

The problem here is that each 'security file' will work in one of each 4096 HDDs (lucky we dont have that many clients) (unlucky will say the sales guy.)

Since we trust our clients, if somehow he or she changed his or her computer, we'll send him or her as many confirmation codes as he or she wants.
May 12 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Kasper Heftholm Kristensen | last post by:
Hi. I want to change the used namespace at runtime depending on another variable, but I'm not sure how to does this, if possible. The code below will not compile, but I hope it gives you an...
3
by: Roberto Castro | last post by:
Hello! I have been assigned for the first time an adp Access project and so far I have managed to make the changes needed for some requirements. However, I am struggling to find the place where...
0
by: Dan Neely | last post by:
Winform labels, buttons, etc don't respond to the normal/large/extra large font settings that can be specified in display properties. Is there an easy way to do an appwide detection+change at...
0
by: tshad | last post by:
I am trying to figure out how to handle a couple of problem using multiple events tied to the same button. Following is the button: <asp:button ID="submitAnswer" CommandName="SubmitAnswer"...
1
by: Fernando | last post by:
Is there a way to change the sieze of the buttons on a toolstrip at runtime? I want to give my users the option of using either small (normal) or large (32X32) buttons. Thank you, Fernando
1
by: Iwan Petrow | last post by:
Hi, I have dynamic properties (for checkboxes Checked property which I use in Option dialog box) . After I change checkboxes check properties I use DOM to save the changed values in the config...
3
by: Michael Moreno | last post by:
Hi, We have an app that is made of many exes (WinForms and Win32 app). All those exes share and read their DB connection string from the registry. This guarantees that all the exes use the...
26
by: Protoman | last post by:
I've written this program that simulates a 36 character, 10 rotor reciprocal rotor cipher, w/ a plugboard. Any way I can make the plugboard function more compact and/or be able to change the...
13
by: tarantula3 | last post by:
How can I detect a change of text at runtime in a text box. As for example how can i detect if someone has changed the text in the calculator, so that i can disable or enable the "=" button.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.