This short blog post will show you how to recover product keys from a local computer using our licenseRecovery DLL.
This post focuses on C#, but it could just as easily be achieved in C++ or your preferred language.
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication1
{
class Program
{
[DllImport("licenseRecovery.dll", SetLastError=true)]
private static extern void getLicenseKey(ref StringBuilder name, ref StringBuilder key);
[DllImport("licenseRecovery.dll", SetLastError=true)]
private static extern int numLicenseKeys();
[DllImport("licenseRecovery.dll", SetLastError = true)]
private static extern void setScope(bool isRemote, string remoteHost);
static void Main(string[] args)
{
StringBuilder name = new StringBuilder(200);
StringBuilder key = new StringBuilder(200);
setScope(false, null);
int num = numLicenseKeys();
for (int i = 0; i < num; i++)
{
getLicenseKey(ref name, ref key);
Console.WriteLine(name + "\t" + key);
}
}
}
}
No Comments Yet!