dies ist ein HWID-Generator den ich gemacht habe.
Ich habe die Projektmappe in eine .rar Datei gepackt, somit könnt ihr
dies in euren Projekten benutzen damit andere Foren nicht versuchen
eure Programme zu releasen.
VT (Danke an al.Jay):

Updated-Source:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
using System.Net;
using System.IO;
namespace HWID
{
public class HWID
{
[Flags]
private enum DockInfo
{
DOCKINFO_DOCKED = 0x02,
DOCKINFO_UNDOCKED = 0x01,
DOCKINFO_USER_SUPPLIED = 0x04,
DOCKINFO_USER_DOCKED = 0x05,
DOCKINFO_USER_UNDOCKED = 0x06
}
[StructLayout(LayoutKind.Sequential)]
private class HW_PROFILE_INFO
{
[MarshalAs(UnmanagedType.U4)]
public Int32 dwDockInfo;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 39)]
public string szHwProfileGuid;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szHwProfileName;
}
[DllImport("advapi32.dll", SetLastError = true)]
private static extern bool GetCurrentHwProfile(IntPtr lpHwProfileInfo);
[DllImport("kernel32.dll")]
private static extern long GetVolumeInformation(string PathName, StringBuilder VolumeNameBuffer, UInt32 VolumeNameSize, ref UInt32 VolumeSerialNumber, ref UInt32 MaximumComponentLength, ref UInt32 FileSystemFlags, StringBuilder FileSystemNameBuffer, UInt32 FileSystemNameSize);
public HWID()
{
}
public string strHWID()
{
HW_PROFILE_INFO info = ProfileInfo();
string GUID = info.szHwProfileGuid.ToString();
string volumeserial = GetVolumeSerial("C");
return md5(GUID + volumeserial);
}
public static string[] GetHWID(string HWID)
{
WebRequest Request = WebRequest.Create("http://elitepvpers.com/api/hwid.php?hash=" + HWID);
Stream requeststream = Request.GetResponse().GetResponseStream();
StreamReader read = new StreamReader(requeststream);
string src = read.ReadToEnd();
string[] userid = StringBetween("<userid>", "</userid>", src, false, false);
string[] username = StringBetween("<username>", "</username>", src, false, false);
string[] joindate = StringBetween("<joindate>", "</joindate>", src, false, false);
string[] posts = StringBetween("<posts>", "</posts>", src, false, false);
string[] thanks = StringBetween("<thanks>", "</thanks>", src, false, false);
string[] usergroup = StringBetween("<usergroup>", "</usergroup>", src, false, false);
string[] result = { userid[0], username[0], joindate[0], posts[0], thanks[0], usergroup[0] };
return result;
}
//md5 func//
private string md5(string input)
{
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
//String between func//
private static string[] StringBetween(string strBegin, string strEnd, string strSource, bool includeBegin, bool includeEnd)
{
string[] result = { "", "" };
int iIndexOfBegin = strSource.IndexOf(strBegin);
if (iIndexOfBegin != -1)
{
if (includeBegin)
iIndexOfBegin -= strBegin.Length;
strSource = strSource.Substring(iIndexOfBegin + strBegin.Length);
int iEnd = strSource.IndexOf(strEnd);
if (iEnd != -1)
{
if (includeEnd)
iEnd += strEnd.Length;
result[0] = strSource.Substring(0, iEnd);
if (iEnd + strEnd.Length < strSource.Length) result[1] = strSource.Substring(iEnd + strEnd.Length);
}
}
else
result[1] = strSource;
return result;
}
//Information things//
private HW_PROFILE_INFO ProfileInfo()
{
HW_PROFILE_INFO profile;
IntPtr profilePtr = IntPtr.Zero;
try
{
profile = new HW_PROFILE_INFO();
profilePtr = Marshal.AllocHGlobal(Marshal.SizeOf(profile));
Marshal.StructureToPtr(profile, profilePtr, false);
if (!GetCurrentHwProfile(profilePtr))
{
throw new Exception("Error cant get current hw profile!");
}
else
{
Marshal.PtrToStructure(profilePtr, profile);
return profile;
}
}
catch (Exception e)
{
throw new Exception(e.ToString());
}
finally
{
if (profilePtr != IntPtr.Zero) Marshal.FreeHGlobal(profilePtr);
}
}
private string GetVolumeSerial(string strDriveLetter)
{
uint serNum = 0;
uint maxCompLen = 0;
StringBuilder VolLabel = new StringBuilder(256);
UInt32 VolFlags = new UInt32();
StringBuilder FSName = new StringBuilder(256);
strDriveLetter += ":\\";
long Ret = GetVolumeInformation(strDriveLetter, VolLabel, (UInt32)VolLabel.Capacity, ref serNum, ref maxCompLen, ref VolFlags, FSName, (UInt32)FSName.Capacity);
return Convert.ToString(serNum);
}
}
}
CAS!






