ich habe vor einigen Tagen mit VB.Net angefangen und direkt eine Frage dazu Es geht um das E*PVP HWID-System.
Dieses würde ich gerne in einem meiner Projekte einsetzen und tu dies auch schon recht erfolgreich. Warum ich schreibe ist, dass ich glaube, dass man das Ganze noch optimieren könnte Falls nicht, umso besser. Falls doch, freue ich mich über jeden Vorschlag.
Code:
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Security.Cryptography
Public Class HWID
<Flags()> _
Private Enum DockInfo
DOCKINFO_DOCKED = &H2
DOCKINFO_UNDOCKED = &H1
DOCKINFO_USER_SUPPLIED = &H4
DOCKINFO_USER_DOCKED = &H5
DOCKINFO_USER_UNDOCKED = &H6
End Enum
<StructLayout(LayoutKind.Sequential)> _
Public Class HW_PROFILE_INFO
<MarshalAs(UnmanagedType.U4)> _
Public dwDockInfo As Int32
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=39)> _
Public szHwProfileGuid As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public szHwProfileName As String
End Class
<DllImport("advapi32.dll", SetLastError:=True)> _
Private Shared Function GetCurrentHwProfile(lpHwProfileInfo As IntPtr) As Boolean
End Function
Declare Function GetVolumeInformationA Lib "kernel32" ( _
PathName As String, _
VolumeNameBuffer As StringBuilder, _
VolumeNameSize As UInt32, _
ByRef VolumeSerialNumber As UInt32, _
ByRef MaximumComponentLength As UInt32, _
ByRef FileSystemFlags As UInt32, _
FileSystemNameBuffer As StringBuilder, _
FileSystemNameSize As UInt32) As Long
Private Shared Function ProfileInfo() As HW_PROFILE_INFO
Dim profile As HW_PROFILE_INFO
Dim profilePtr As IntPtr = IntPtr.Zero
Try
profile = New HW_PROFILE_INFO()
profilePtr = Marshal.AllocHGlobal(Marshal.SizeOf(profile))
Marshal.StructureToPtr(profile, profilePtr, False)
If Not GetCurrentHwProfile(profilePtr) Then
Throw New Exception("Error cant get current hw profile!")
Else
Marshal.PtrToStructure(profilePtr, profile)
Return profile
End If
Catch e As Exception
Throw New Exception(e.ToString())
Finally
If profilePtr <> IntPtr.Zero Then
Marshal.FreeHGlobal(profilePtr)
End If
End Try
End Function
Private Shared Function GetVolumeSerial(strDriveLetter As String) As String
Dim serNum As UInteger = 0
Dim maxCompLen As UInteger = 0
Dim VolLabel As New StringBuilder(256)
Dim VolFlags As New UInt32()
Dim FSName As New StringBuilder(256)
strDriveLetter += ":\"
Dim Ret As Long = GetVolumeInformationA(strDriveLetter, VolLabel, CType(VolLabel.Capacity, UInt32), serNum, maxCompLen, VolFlags, _
FSName, CType(FSName.Capacity, UInt32))
Return Convert.ToString(serNum)
End Function
Shared Function getHWID() As String
Dim info As HW_PROFILE_INFO = ProfileInfo()
Dim GUID As String = info.szHwProfileGuid.ToString()
Dim volumeserial As String = GetVolumeSerial(Environment.SystemDirectory.Substring(0, 1))
Dim md5Hasher As MD5 = MD5.Create()
Dim data As Byte() = md5Hasher.ComputeHash(Encoding.Default.GetBytes(GUID & volumeserial))
Dim sBuilder As New StringBuilder()
For i = 0 To data.Length - 1
sBuilder.Append(data(i).ToString("x2"))
Next i
getHWID = sBuilder.ToString()
End Function
End Class
Da ich VB.net gerde erst begonnen habe, habe ich diesen Thread hier erstellt um heraus zu finden, ob man am obigen Code etwas verändern/optimieren muss/kann. Sinn und Unsinn war hier nicht gefragt. Denn dass das kein ultimativer Schutz ist, ist mir bewusst
for some reason when people use this with my updater are telling me that they get a different HWID then you zyorsddl, care to help try and get them to match
I Would but Vb2012 is saying the .dll "could not be added. Please make sure that the file is accessible,and that it is a valid assembly or COM component."
[C++] HWID System Dll 09/21/2011 - C/C++ - 7 Replies Ich versuche schon seit einigen Tagen das HWID System in einer Dll zu benutzen.
Da die Beispiele im offiziellen Thread down sind, habe ich nach weiteren Beispielen gesucht und fand diesen Thread.
http://www.elitepvpers.com/forum/warrock-hacks-bo ts-cheats-exploits/1206005-cenwr-c-hotkey-base-hwi d-system-implementierung.html#post10878552
Nun crashte die Dll aber nachdem die GetUserInformation Funktion aufgerufen wurde.
Ich bin alles durchgegangen und habe dann folgende Änderung gemacht....
HWID Generator & Dev-Tools für e*pvp's HWID System 01/28/2011 - Main - 0 Replies Hier die Downloads passend zum News-Thread, da das Attachen von Daten an News-Threads nicht möglich ist ;)
News-Thread:
http://www.elitepvpers.com/forum/e-pvp-news-de/981 343-hwid-system-f-r-entwickler.html
Credits für den 2. Generator gehen an Anfang!
Lg,
Ende!