coa windows key

cjohnson

Well-known member
Joined
Sep 21, 2006
Messages
63
Location
WV
Programming Experience
1-3
I need to have VB.net 2005 program to check the coa windows key. I use this for software licensing. In the past, I have had my programs show the user their processor ID, send to me, encrypt, and send back to them as a software key to unlock my program. I have found computers now without a processor ID, so I want to do the same thing with the coa key. Can anyone tell me how to write the code to pull this?

Thanks,
Chris
 
Public Shared Function GetProductID() As String
Dim sAns As String
Dim sErr As String = ""

sAns = clsGlobal.RegValue(RegistryHive.LocalMachine, _
"SOFTWARE\Microsoft\Windows\CurrentVersion", _
"ProductID", sErr)
Return sAns
End Function
 
Public Shared Function RegValue(ByVal Hive As RegistryHive, _
ByVal Key As String, ByVal ValueName As String, _
Optional ByRef ErrInfo As String = "") As String



Dim objParent As RegistryKey
Dim objSubkey As RegistryKey
Dim sAns As String
Select Case Hive
Case RegistryHive.ClassesRoot
objParent = Registry.ClassesRoot
Case RegistryHive.CurrentConfig
objParent = Registry.CurrentConfig
Case RegistryHive.CurrentUser
objParent = Registry.CurrentUser
Case RegistryHive.DynData
objParent = Registry.DynData
Case RegistryHive.LocalMachine
objParent = Registry.LocalMachine
Case RegistryHive.PerformanceData
objParent = Registry.PerformanceData
Case RegistryHive.Users
objParent = Registry.Users

End Select

Try
objSubkey = objParent.OpenSubKey(Key)
'if can't be found, object is not initialized
If Not objSubkey Is Nothing Then
sAns = (objSubkey.GetValue(ValueName))
End If

Catch ex As Exception

ErrInfo = ex.Message
Finally

'if no error but value is empty, populate errinfo
If ErrInfo = "" And sAns = "" Then
ErrInfo = _
"No value found for requested registry key"
End If
End Try
Return sAns
End Function
 
You will NOtice that Regvalue in my case belongs in a class called clsglobal.

Be aware that this is not a secure method of protecting your software, and I have since abandoned this method.

This method is easy to circumvent by cloning the disk with a program such as Norton Ghost.
 
Thank you very much. This was a big help. If you don't mind my asking, what method would you recommend?
Thanks,
Chris
 
I use .NET Reactor from www.eziriz.com

It has a built in activation system, and it also means that you can obscure your compiled code to stop anybody decompiling it.

It also gives yu the ability to set a timer on your app (eg 14 days) after which your software will stop working.
 
Back
Top