Support Forums

Full Version: [TUT] How to protect your program using your Windows Serial Key [VB.NET]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
What is this about?

Hey Guys! In this tutorial I'm going to show you how to protect your program with your Windows Serial Key.

Original Thread (by me): http://www.hackforums.net/showthread.php?tid=727561

How does it work?

It compares two serial keys! Your serial key (you set it in the source), and the serial key of the computer (Windows OS) you're using.
If the serial of the computer doesn't match with that you chose the program won't run. Victoire

So, how do I code that?

Step 1) Add to your project 2 forms (Form1 and Form2).
Form2 will be your program and Form1 will be the protection.

Step 2) Make your form1 invisible by changing its opacity to 0, and setting the ShowInTaskbar and ShowIcon to False.

Step 3) Add a label to your form1.

Step 4) Lets make our form1 imports Management.

Code:
Imports System.Management

Step 5) Now lets declare some variables.

Code:
Dim MOS As ManagementObjectSearcher = New ManagementObjectSearcher("Select * From Win32_OperatingSystem")
Dim MO As System.Management.ManagementObject
Dim MOC As System.Management.ManagementObjectCollection = MOS.Get
Dim WindowsSerial As String = String.Empty

Step 6) Now just add the folowing code to your form1_load event.

Code:
For Each MO In MOC
WindowsSerial = MO("SerialNumber")
Next
Label1.Text = WindowsSerial
If Label1.Text = "YOUR WINDOWS SERIAL" Then
    Form2.Show()
    Me.Hide
Else
    MsgBox("Your windows serial does not match.")
    Me.close
End If

This will compare your Windows OS serial with the one you chose.

Step 7) Create your program in Form2.

Step 8) Test it! Victoire

Hope you find use for this! Thumbsup
I don't understand why you would want two forms for this, or why you would use:
Code:
Label1.Text = WindowsSerial
if you arent even using Label1.

If you used this as your Form1_Load it it would work just fine w/ one form.
Code:
Dim MOS As ManagementObjectSearcher = New ManagementObjectSearcher("Select * From Win32_OperatingSystem")
Dim MO As System.Management.ManagementObject
Dim MOC As System.Management.ManagementObjectCollection = MOS.Get
Dim WindowsSerial As String = String.Empty
For Each MO In MOC
WindowsSerial = MO("SerialNumber")
Next
If WindowsSerial = "YOUR WINDOWS SERIAL" Then
    Me.Opacity = 100
Else
    MsgBox("Your windows serial does not match.")
    Me.close
End If


Good share none the less. Thumbsup
(12-06-2010, 03:43 PM)KoBE Wrote: [ -> ]I don't understand why you would want two forms for this, or why you would use:
Code:
Label1.Text = WindowsSerial
if you arent even using Label1.

If you used this as your Form1_Load it it would work just fine w/ one form.
Code:
Dim MOS As ManagementObjectSearcher = New ManagementObjectSearcher("Select * From Win32_OperatingSystem")
Dim MO As System.Management.ManagementObject
Dim MOC As System.Management.ManagementObjectCollection = MOS.Get
Dim WindowsSerial As String = String.Empty
For Each MO In MOC
WindowsSerial = MO("SerialNumber")
Next
If WindowsSerial = "YOUR WINDOWS SERIAL" Then
    Me.Opacity = 100
Else
    MsgBox("Your windows serial does not match.")
    Me.close
End If


Good share none the less. Thumbsup

Thanks for the tips and feedback Kobe.

That label is hidden on the form ... Ninja
Nice i mite check this out looks helpful
nice tutorial dude Thanks Smile
Glad you guys liked it !

The 1* is the only thing that ruins this ;(
Thanks, really good tutorial!
Gonna use that someday!
(12-12-2010, 03:46 PM)Ɲymph Wrote: [ -> ]Thanks, really good tutorial!
Gonna use that someday!

Glad you liked it ! Thumbsup
look pretty good mate. keep it up.
Looks cool, using this as well as other stuff could make a pretty good log in system, instead of just HWID.

Problem is customers might not like the idea of you getting their serial number, so maybe just convert to MD5 right after you retrieve the serial number so you won't even know what it is (Since you can't decrypt MD5 unless you bruteforce, which takes years)
Pages: 1 2