Product Key, Serial Number

Talk2Tom11

Well-known member
Joined
Feb 22, 2004
Messages
144
Location
Westchester, NY
I was wonderinf it was at all possible to make it so that when the application starts up the user has a enter a Product key, or serial number. But once they have entered it, the next time they open the app they dont have to enter the number in ever again.
if you know how, please post.
 
Of course its possible, youll just have to decide on the best way of implementing it. Id be tempted to either use an encrpyted xml configuration file, maybe one that uses the classID of the windows installation...
 
How about if the program tries to search the key from a specific location in windows registry.
 
Last edited by a moderator:
Originally posted by DR00ME
How about if the program tries to search the key from a specific location in windows registry.

The thing is, its so easy to search the registry and delete/change items that you think may help you bypass the key...
 
Originally posted by samsmithnz
The thing is, its so easy to search the registry and delete/change items that you think may help you bypass the key...

But if you enter the right product key = application works = you know the right key. So what does it matter where or how you save it ? :)

Program just tries to find a specific key from the specific location in winreg. If the key is wrong or missing = program whine.

Am I missing a point or something but I dont know why you should crypt the key if you already know it (?)
 
Last edited by a moderator:
how about using text file?

FileOpen(1, Application.StartupPath & "/" & "Key.txt", OpenMode.Input)
Input(1, key)

if key="what you want" then
process
else
process
end if

FileClose(1)

make this file in some place where could be hidden fromthe user.
this is other way to replace registry.
 
Originally posted by DR00ME
But if you enter the right product key = application works = you know the right key. So what does it matter where or how you save it ? :)

Program just tries to find a specific key from the specific location in winreg. If the key is wrong or missing = program whine.

Am I missing a point or something but I dont know why you should crypt the key if you already know it (?)

Its not the key you have to save, its the fact that the key has been validated and doesnt need to be validated again. YOu cant persist that it your app, so you have to store it in the registry, or a encrypted (or not) text/xml/binary file.
 
Originally posted by samsmithnz
Its not the key you have to save, its the fact that the key has been validated and doesnt need to be validated again. YOu cant persist that it your app, so you have to store it in the registry, or a encrypted (or not) text/xml/binary file.

And what do you mean by store it ?, if it is not a key ?
 
Last edited by a moderator:
You could even have both, a file in the registry and some file randomly placed on the hard-drive - JUST REMEMBER TO REMOVE THEM DURING THE UNINSTALL! There is nothing worst then a programmer thinking he is so important he can clutter up your PC with leftovers.
 
This is a pretty simple example to extract your IE version from the registry. To set a value use the SetValue instead of GetValue function.

Code:
Dim myKey As Microsoft.Win32.RegistryKey        
Dim strLocation As String        
Dim strKey As String        

strLocation = "SOFTWARE\Microsoft\Internet Explorer"        
strKey = "Version"   
     
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)        
MessageBox.Show(myKey.GetValue(strKey))        
myKey.Close()
 
thank you for that code... I understand things alittle better... I have another question though... for example: if I have the registry read a value with that code... what is the code to change a value. or insert a value?
 
This code assumes that the registry items already exist, inserting new values is a new can of worms, but usually youd do this during application setup.

To set a value, like I said, use the SetValue function, so:
Code:
Dim myKey As Microsoft.Win32.RegistryKey        
Dim strLocation As String        
Dim strKey As String        

strLocation = "SOFTWARE\Microsoft\Internet Explorer"        
strKey = "Version"   
     
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)        
myKey.SetValue(strKey)  = "[value to set]"
myKey.Close()

well something like that, im doing this from memory...
 
When you open a subkey and want to write a value, you need to use the OpenSubKey with the signature:
public RegistryKey OpenSubKey(string, bool);
The boolean specifies if you want write access. You need write access to change a value (or add a new one).
 
Back
Top