Click here to Skip to main content
15,928,207 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Enumerating PATH environment variable. Pin
Anonymous4-Apr-05 16:27
Anonymous4-Apr-05 16:27 
GeneralRePost, I messed up the first one Pin
Anonymous4-Apr-05 16:30
Anonymous4-Apr-05 16:30 
GeneralDang it Pin
Anonymous4-Apr-05 16:33
Anonymous4-Apr-05 16:33 
GeneralTCP client with integers Pin
Member 8079984-Apr-05 9:27
Member 8079984-Apr-05 9:27 
GeneralTrying to understand Data Access - Never Mind! Pin
frgood4-Apr-05 9:25
frgood4-Apr-05 9:25 
GeneralHelp me ASAP. Pin
abeyphier4-Apr-05 4:05
abeyphier4-Apr-05 4:05 
GeneralRe: Help me ASAP. Pin
Christian Graus4-Apr-05 10:34
protectorChristian Graus4-Apr-05 10:34 
GeneralRe: Help me ASAP. Pin
Dave Kreskowiak4-Apr-05 14:13
mveDave Kreskowiak4-Apr-05 14:13 
GeneralRe: Help me ASAP. Pin
Christian Graus4-Apr-05 14:23
protectorChristian Graus4-Apr-05 14:23 
GeneralRe: Help me ASAP. Pin
Dave Kreskowiak4-Apr-05 16:00
mveDave Kreskowiak4-Apr-05 16:00 
GeneralAccess-- Connection String Pin
Anonymous4-Apr-05 3:30
Anonymous4-Apr-05 3:30 
GeneralRe: Access-- Connection String Pin
Jim Matthews4-Apr-05 4:47
Jim Matthews4-Apr-05 4:47 
GeneralRe: Access-- Connection String Pin
Anonymous4-Apr-05 5:10
Anonymous4-Apr-05 5:10 
GeneralRe: Access-- Connection String Pin
Jim Matthews4-Apr-05 5:30
Jim Matthews4-Apr-05 5:30 
GeneralRe: Access-- Connection String Pin
Anonymous4-Apr-05 6:16
Anonymous4-Apr-05 6:16 
GeneralRe: Access-- Connection String Pin
Jim Matthews4-Apr-05 6:50
Jim Matthews4-Apr-05 6:50 
Generalhello anybody can solve it Pin
Anonymous4-Apr-05 3:17
Anonymous4-Apr-05 3:17 
GeneralRe: hello anybody can solve it Pin
Jim Matthews4-Apr-05 4:52
Jim Matthews4-Apr-05 4:52 
GeneralRe: hello anybody can solve it Pin
Anonymous4-Apr-05 19:41
Anonymous4-Apr-05 19:41 
GeneralDataset Help Pin
nitin_ion4-Apr-05 1:56
nitin_ion4-Apr-05 1:56 
GeneralXML Didn't post Pin
Colin Angus Mackay4-Apr-05 2:32
Colin Angus Mackay4-Apr-05 2:32 
GeneralRe: XML Didn't post Pin
nitin_ion4-Apr-05 17:22
nitin_ion4-Apr-05 17:22 
GeneralCPU ID and Mac address Pin
Dile4-Apr-05 1:39
Dile4-Apr-05 1:39 
GeneralRe: CPU ID and Mac address Pin
Anonymous4-Apr-05 15:21
Anonymous4-Apr-05 15:21 
==================================
Something like this:
==================================

Imports System
Imports System.Globalization
Imports System.Threading
Imports System.Resources
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Reflection
Imports System.Text

Public Class Fingerprint

Public Function Value() As String
Return pack(cpuId() + biosId() + diskId() + baseId() + videoId() + macId())
End Function



Private Function identifier(ByVal wmiClass As String, ByVal wmiProperty As String, ByVal wmiMustBeTrue As String) As String
Dim result As String = ""
Dim mc As System.Management.ManagementClass = New System.Management.ManagementClass(wmiClass)
Dim moc As System.Management.ManagementObjectCollection = mc.GetInstances()
Dim mo As System.Management.ManagementObject
For Each mo In moc
If mo(wmiMustBeTrue).ToString() = "True" Then
If result = "" Then
Try
result = mo(wmiProperty).ToString()
Exit For
Catch

End Try
End If

End If
Next
Return result
End Function

Private Function identifier(ByVal wmiClass As String, ByVal wmiProperty As String) As String
Dim result As String = ""
Dim mc As System.Management.ManagementClass = New System.Management.ManagementClass(wmiClass)
Dim moc As System.Management.ManagementObjectCollection = mc.GetInstances()

For Each mo As System.Management.ManagementObject In moc

If (result = "") Then
Try
result = mo(wmiProperty).ToString()
Catch
End Try
End If
Next
Return result
End Function

Private Function cpuId() As String
'Uses first CPU identifier available in order of preference
'Don't get all identifiers, as very time consuming
Dim retVal As String = identifier("Win32_Processor", "UniqueId")
If retVal = "" Then
retVal = identifier("Win32_Processor", "ProcessorId")

If retVal = "" Then
retVal = identifier("Win32_Processor", "Name")


If retVal = "" Then
retVal = identifier("Win32_Processor", "Manufacturer")
End If

'Add clock speed for extra security
retVal += identifier("Win32_Processor", "MaxClockSpeed")
End If
End If

Return retVal

End Function

Private Function biosId() As String
Return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version")
End Function

Private Function diskId() As String
Return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads")
End Function

Private Function baseId() As String
Return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber")
End Function

Private Function videoId() As String
Return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name")
End Function


Private Function macId() As String
Return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled")
End Function


Private Function pack(ByVal text As String) As String
Dim retVal As String
Dim x As Integer = 0
Dim y As Integer = 0
Dim n As Char
For Each n In text
y += 1
x += (AscW(n) * y)
Next

retVal = x.ToString() + "00000000"

Return retVal.Substring(0, 8)
End Function
End Class

GeneralCustom button Pin
kurtvandoorne4-Apr-05 1:36
kurtvandoorne4-Apr-05 1:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.