您正在使用 Internet Explorer 6,在本页面的显示效果可能有差异。建议您升级到 Internet Explorer 8 或以下浏览器: Firefox / Chrome / Safari / Opera
首 页 文章Inno Inno使用系统网卡MAC地址制作注册码/注册机/序列号安装

Inno使用系统网卡MAC地址制作注册码/注册机/序列号安装

本文利用上一篇讲到的 Inno纯Code获取系统网卡地址(MAC)Pascal脚本  来制作注册机,以实现需要注册才可以安装的功能。

注册码也被称为序列号,首先我们先生成机器码(一机一码),然后通过加密算法将机器码生成序列号,实现授权安装。

使用MAC+加密算法,可以制作各种各样的机器码和注册码。

当然MAC毕竟只有24位十六进制,并不能完全防止重复的发生。

但作为安装包使用的注册码,也已经够用了。

这是我制作的demo的演示

Inno网卡地址注册机demo

废话不多说,下面是注册的核心代码

GetAdapterInfo.ish 纯CODE获取MAC的脚本

XorEncrypStr.Ish //字符串加密函数

RegCode.Ish文件源码

   1 #ifndef _REGCODE_ISH_
   0  #Define _REGCODE_ISH_ __PATHFILENAME__
   1
   2  #include "GetAdapterInfo.ish"
   3  #include "XorEncrypStr.Ish"
   4
   5[Code]
   6//格式化MAC地址
   7function FormatMac(pInfo: IP_ADAPTER_INFO): string;
   8var
   9  i: Integer;
  10begin
  11  Result := '';
  12  for i := 0 to pInfo.AddressLength - 1 do begin
  13    if Result <> '' then
  14      Result := Result + '-';
  15
  16    Result := Result + Format('%.2X', [Integer(pInfo.Address[i])]);
  17  end;
  18end;
  19
  20//获取第一个真实网卡地址
  21function GetMAC: string;
  22var
  23  List: array of IP_ADAPTER_INFO;
  24  i: Integer;
  25begin
  26  List := GetRealAdpterList;
  27
  28  for i := 0 to GetArrayLength(List) - 1 do begin
  29    if List[i].AddressLength > 0 then begin
  30      Result := FormatMac(List[i]);
  31      Break;
  32    end;
  33  end;
  34end;
  35
  36//生成机器ID
  37function GetMId(Key: string): string;
  38begin
  39  Result := XorEncrypStr(GetMAC, Key);
  40end;
  41
  42//生成注册码
  43function GetRegCode(MId, Key: string): string;
  44var
  45  sId: string;
  46  I: Integer;
  47begin
  48  if MID = '' then
  49    sId := GetMAC
  50  else begin
  51    sId := XorUncrypStr(MId, Key);
  52  end;
  53
  54  Result := GetMd5OfString(sId);
  55  Result := Result[3] + Result[9];
  56  for I := Length(sId) - 1 downto do begin
  57    if sId[I] = '-' then
  58      Result := Result + sId[I]
  59    else
  60      Result := Result + sId[I] + Chr(65 + Ord(sId[I]) * 26 * I div 999)
  61  end;
  62end;
  63
  64[/Code]
  65
  66#endif
  67

文中提到的文件下载:http://dl.kngstr.com//demo/inno/macreggener.exe
返回顶部】 【打印此页】 【关闭