|
You last visited: Today at 00:37
Advertisement
Suche HWID für C#
Discussion on Suche HWID für C# within the General Coding forum part of the Coders Den category.
05/23/2013, 22:14
|
#16
|
elite*gold: 47
Join Date: Feb 2010
Posts: 385
Received Thanks: 1,528
|
I coded recently, have fun ^^
|
|
|
05/28/2013, 19:54
|
#17
|
elite*gold: 280
Join Date: Nov 2009
Posts: 2,005
Received Thanks: 26,683
|
Quote:
Originally Posted by arkade
I coded recently, have fun ^^

|
dein Teil zeigt nicht die richtige HWID an,
das hier sollte helfen.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Management;
using System.Runtime.InteropServices;
using System.Net;
using System.IO;
namespace WindowsFormsApplication188
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[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 static 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://www.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;
}
private static 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();
}
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;
}
private static 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 static 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);
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show(new Form { TopMost = true }, strHWID());// zeigt HWID an
string[] HWID = GetHWID(strHWID());
MessageBox.Show(new Form { TopMost = true }, HWID[0]);// zeigt zb Userid von epvp an
MessageBox.Show(new Form { TopMost = true }, HWID[1]);// zeigt zb User Name von epvp an
}
}
}
lg Dr.bob
|
|
|
All times are GMT +1. The time now is 00:37.
|
|