using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show(LicenseCDKey64bit.ToString()+LicenseCDKey32bit.ToString());
}
public static string LicenseCDKey64bit
{
get
{
try
{
RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine,
RegistryView.Registry64);
string keyPath = @"Software\Microsoft\Windows NT\CurrentVersion";
byte[] rpk = (byte[])key.OpenSubKey(keyPath).GetValue("DigitalProductId");
string serial = "";
const string possible = "BCDFGHJKMPQRTVWXY2346789";
for (int i = 0; i < 25; i++)
{
int accu = 0;
for (int a = 0; a < 15; a++)
{
accu <<= 8;
accu += rpk[66 - a];
rpk[66 - a] = (byte)(accu / 24 & 0xff);
accu %= 24;
}
serial = possible[accu] + serial;
if (i % 5 == 4 && i < 24)
{
serial = "-" + serial;
}
}
return serial;
}
catch
{
string ErrorString = "";
return ErrorString;
}
}
}
public static string LicenseCDKey32bit
{
get
{
try
{
byte[] rpk = (byte[])Registry.LocalMachine
.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion")
.GetValue("DigitalProductId");
string serial = "";
const string possible = "BCDFGHJKMPQRTVWXY2346789";
for (int i = 0; i < 25; i++)
{
int accu = 0;
for (int a = 0; a < 15; a++)
{
accu <<= 8;
accu += rpk[66 - a];
rpk[66 - a] = (byte)(accu / 24 & 0xff);
accu %= 24;
}
serial = possible[accu] + serial;
if (i % 5 == 4 && i < 24)
{
serial = "-" + serial;
}
}
return serial;
}
catch
{
string ErrorString = "";
return ErrorString;
}
}
}
}
}
20 Mart 2016 Pazar
c# windows product key
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder