[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

generating machine id

Posted on 2004-10-26
7
Medium Priority
?
279 Views
Last Modified: 2012-08-14
hello, i just made a small point of sale program, with an access database...
to fully test and debug the program, i will install it in a small grocery store... (for free)
i just want to add a small protection to it...

the access database is password protected

what i need is:
when i first install the software, i will run an executable that will generate a key based on the computer hardware...
and will store it in the database

then, everytime the program runs, it will regenerate the same key based on the same computer hardware... the generated key will then be compared to the one in the database...
if there's no match, then the program was copied to another machine... and it will block...

so i need a function that will generate a key based on the specific computer:
ex: network card mac address, hard drive serial number, number of devices, name to which windows is registered....

the principle is something similar to microsoft's activation machine id...

i appreciate any help

Dan
0
Comment
Question by:Dany Balian
[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
7 Comments
 
LVL 8

Assisted Solution

by:Ashutosh Vyas
Ashutosh Vyas earned 1000 total points
ID: 12410228
To retrieve Mother Board's serial number :
http://www.freevbcode.com/ShowCode.Asp?ID=2664

To retrieve Hard Disk Serial Number
http://www.freevbcode.com/ShowCode.Asp?ID=430
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12410471
>>the access database is password protected

it is really easy to break. Don't save any import info into.



Why don't you just create your own program based on the network card mac address to create your serial number.

You can get mac address from ipconfig.

During installation, you can check to see whether the mac address same as the computer that installed
0
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 12410530
You can use the Crypt... Windows APIs to construct/hash a serial from the information you provide.  You might like to check out the API-Guide (www.allapi.net) for more details...

J.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Accepted Solution

by:
Shiju Sasidharan earned 1000 total points
ID: 12412842
Hi mrdany

'Try this Function to get Serial No of the Hard Drive
'This function will return the Serial No of the First
' fixed Drive found in Hexa Decimal Format
'  ( Dont forget to add Refererence to  scrrun.dll
'                   Microsoft Scripting Runtime )
'-------------------------------------------------------------------------------
Private Function GetSerialNo() as String

Dim objFso As New FileSystemObject
Dim objDrs As Drives
Dim objDr As Drive
Dim sSlNo as String

    Set objDrs = objFso.Drives
    For Each objDr In objDrs
        If objDr.DriveType = Fixed Then
           sSlNo = Hex(objDr.SerialNumber)
           Exit For
        End If
    Next
   GetSerialNo= sSlNo
End Function
'-----------------------------------------------------------------
;-)
Shiju
0
 
LVL 11

Author Comment

by:Dany Balian
ID: 12413377
just one more question...
cant this hard drive serial number be spoofed?

because i once had adsl connection restrictions from my isp on my mac address, but i wanted to use the same connection on another machine, so i spoofed the mac address on the other machine... i bet that there are spoofers for hard drives...

and do you know how to md5(the serial number) in visual basic?
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 12415791
Hi
Thanks for the points

Follow this link, here u will get lots of implemented alogorithms in VB
( Watch out the sample of author David Midkiff its a nice and good one)

http://www.a1vbcode.com/code.asp?type=security&intPage=6

;-)
Shiju

0
 
LVL 28

Expert Comment

by:Ark
ID: 12417227
Hi
Just to make this PAQ more usefull -
>>this Function to get Serial No of the Hard Drive<<
Above function have NOTHING with HDD serial (as well as #430 FreeVBCode sample) - it returns VOLUME serial. This is NOT a hardware info, this number can be change manually and change automatically every time you format/revormat the drive, chnage partitons etc. Also, solution, based only on 1 unique number is dangerous - if user change, say, his HDD your up won't work though user have all rights. Better solution should be based on a number of unique numbers and if, say, 75% of them match - it's OK. If you're planing your app for w2K/XP - you can use WMI object:

'=======collect system hardware info using WMI object sample====
Private Sub Command1_Click()
   Dim WMI As Object
   Dim wmiCollection As Object
   Dim wmiMember As Object
   Dim oTemp As Object
   Dim sOut As String, sTemp As String
   Dim i As Integer
   Set WMI = GetObject("winmgmts:\\")
   
   Set wmiCollection = WMI.InstancesOf("Win32_BIOS")
   For Each wmiMember In wmiCollection
       sOut = "Serial number: " & CheckValue(wmiMember.SerialNumber)
       sOut = sOut & vbCrLf & "Manufacturer: " & CheckValue(wmiMember.Manufacturer)
       sOut = sOut & vbCrLf & "Manufacturer's identifier: " & CheckValue(wmiMember.IdentificationCode)
       sOut = sOut & vbCrLf & "BIOS version: " & wmiMember.version
       sTemp = Trim(wmiMember.ReleaseDate)
       sOut = sOut & vbCrLf & "Release date: " & DateSerial(Left(sTemp, 4), Mid(sTemp, 5, 2), Mid(sTemp, 7, 2))
       If Mid(sTemp, 9, 1) <> "*" Then
          sOut = sOut & "  " & TimeSerial(Mid(sTemp, 9, 2), Mid(sTemp, 11, 2), Mid(sTemp, 13, 2))
       End If
       MsgBox sOut, vbInformation, wmiMember.Caption & " info"
   Next
   
   Set wmiCollection = WMI.InstancesOf("Win32_BaseBoard")
   For Each wmiMember In wmiCollection
       sOut = "Description: " & CheckValue(wmiMember.Description)
       sOut = sOut & vbCrLf & "Manufacturer: " & CheckValue(wmiMember.Manufacturer)
       sOut = sOut & vbCrLf & "Model: " & CheckValue(wmiMember.Model)
       sOut = sOut & vbCrLf & "Manufacturer's identifier: " & CheckValue(wmiMember.SKU)
       sOut = sOut & vbCrLf & "System name: " & CheckValue(wmiMember.Tag)
       sOut = sOut & vbCrLf & "Version: " & CheckValue(wmiMember.version)
       sOut = sOut & vbCrLf & "Width x Height x Weight: " & CheckValue(wmiMember.Width) & " x " & CheckValue(wmiMember.Height) & " x " & CheckValue(wmiMember.Weight)
       sOut = sOut & vbCrLf & "Serial number: " & CheckValue(wmiMember.SerialNumber)
       sOut = sOut & vbCrLf & "Product number: " & wmiMember.Product
       MsgBox sOut, vbInformation, wmiMember.Caption & " info"
   Next
   
   Set wmiCollection = WMI.InstancesOf("Win32_MotherboardDevice")
   For Each wmiMember In wmiCollection
       sOut = "Description: " & CheckValue(wmiMember.Description)
       sOut = sOut & vbCrLf & "DeviceID: " & CheckValue(wmiMember.DeviceID)
       sOut = sOut & vbCrLf & "Name: " & CheckValue(wmiMember.Name)
       sOut = sOut & vbCrLf & "Install date: " & CheckValue(wmiMember.InstallDate)
       sOut = sOut & vbCrLf & "Revision number: " & CheckValue(wmiMember.RevisionNumber)
       sOut = sOut & vbCrLf & "System name: " & CheckValue(wmiMember.systemname)
       MsgBox sOut, vbInformation, wmiMember.Caption & " info"
   Next
   
   Set wmiCollection = WMI.InstancesOf("Win32_Processor")
   For Each wmiMember In wmiCollection
       sOut = "Description: " & CheckValue(wmiMember.Description)
       sOut = sOut & vbCrLf & "DeviceID: " & CheckValue(wmiMember.DeviceID)
       sOut = sOut & vbCrLf & "Manufacturer: " & CheckValue(wmiMember.Manufacturer)
       sOut = sOut & vbCrLf & "Name: " & CheckValue(wmiMember.Name)
       sOut = sOut & vbCrLf & "ProcessorID: " & CheckValue(wmiMember.ProcessorID)
       sOut = sOut & vbCrLf & "System name: " & CheckValue(wmiMember.systemname)
       sOut = sOut & vbCrLf & "UniqueID: " & CheckValue(wmiMember.UniqueID)
       sOut = sOut & vbCrLf & "Install date: " & CheckValue(wmiMember.InstallDate)
       sOut = sOut & vbCrLf & "Revision number: " & CheckValue(wmiMember.Revision)
       MsgBox sOut, vbInformation, wmiMember.Caption & " info"
   Next
   
   Set wmiCollection = WMI.InstancesOf("Win32_PhysicalMemory")
   For Each wmiMember In wmiCollection
       sOut = "Description: " & CheckValue(wmiMember.Description)
       sOut = sOut & vbCrLf & "Bank label: " & CheckValue(wmiMember.BankLabel)
       sOut = sOut & vbCrLf & "Capacity: " & CheckValue(wmiMember.Capacity)
       sOut = sOut & vbCrLf & "Manufacturer: " & CheckValue(wmiMember.Manufacturer)
       sOut = sOut & vbCrLf & "Model: " & CheckValue(wmiMember.Model)
       sOut = sOut & vbCrLf & "Manufacturer's identifier: " & CheckValue(wmiMember.SKU)
       sOut = sOut & vbCrLf & "System name: " & CheckValue(wmiMember.Tag)
       sOut = sOut & vbCrLf & "Version: " & CheckValue(wmiMember.version)
       sOut = sOut & vbCrLf & "Install date: " & CheckValue(wmiMember.InstallDate)
       sOut = sOut & vbCrLf & "Serial number: " & CheckValue(wmiMember.SerialNumber)
       MsgBox sOut, vbInformation, wmiMember.Caption & " info"
   Next
   
   Set wmiCollection = WMI.InstancesOf("Win32_DiskDrive")
   For Each wmiMember In wmiCollection
       sOut = "Description: " & CheckValue(wmiMember.Description)
       sOut = sOut & vbCrLf & "DeviceID: " & CheckValue(wmiMember.DeviceID)
       sOut = sOut & vbCrLf & "Install date: " & CheckValue(wmiMember.InstallDate)
       sOut = sOut & vbCrLf & "Model: " & CheckValue(wmiMember.Model)
       sOut = sOut & vbCrLf & "Signature: 0x" & Hex(wmiMember.Signature)
       Set oTemp = WMI.Get("Win32_PhysicalMedia.Tag='\\.\PHYSICALDRIVE0'")
       sOut = sOut & vbCrLf & "Serial number: " & CheckValue(oTemp.SerialNumber)
       MsgBox sOut, vbInformation, wmiMember.Caption & " info"
   Next
   
   Set wmiCollection = WMI.InstancesOf("Win32_NetworkAdapter")
   sOut = ""
   For Each wmiMember In wmiCollection
       sOut = sOut & "Name: " & wmiMember.Caption & " - MAC Address: " & CheckValue(wmiMember.MACAddress) & vbCrLf
   Next
   MsgBox sOut, vbInformation, "Network adapters info"
   
   Set wmiMember = Nothing
   Set wmiCollection = Nothing
   Set WMI = Nothing
End Sub

Private Function CheckValue(ByVal s As Variant) As String
   If VarType(s) = vbNull Then s = ""
   s = Trim(s)
   If s = "" Then CheckValue = "Not available" Else CheckValue = s
End Function

Private Sub Form_Load()
   Command1.Caption = "Show system info"
End Sub
'========end WMI sample=========
Some other samples not using WMI:
***Get REAL HDD Serial (aka VendorID)***
http://freevbcode.com/ShowCode.Asp?ID=3380
'Note - works with IDE drives only. I have a code for SCSI drives, but it works on NT platform (NT/2K/XP) only.

*** Get BIOS Info ***
http://freevbcode.com/ShowCode.Asp?ID=3292
'Note - NT platform doesn't support direct memory access to system memory area, so bios unique number is not available on NT, though all other info is available

*** MAC Address ***
http://vbnet.mvps.org/code/network/macaddress.htm
'Note - code doesn't work on laptop winXP systems. To get MAC address on XP you shoud use GetIFEntry fro iphlpapi.dll
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

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