⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reg.pas

📁 本文将介绍 JDesktop Integration Components (JDIC)
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{
------------------------------------------------------------------
=  Reg.dll ---- 共享软件加密函数库                               =
=  Copyright (c) 2002-2003 liangs Studio, All rights reserved    =
=  Created 2004/04/24 by liangs                                  =
=  Version: 3.4                                                  =
=  Homepage: http://liangs99.yeah.net                         =
=  Email: liang_sheng@163.net                                    =
------------------------------------------------------------------

------------------------------------------------------------------
=  Reg.pas ---- 共享软件加密函数库Delphi调用模块                 =
=  Copyright (c) 2002-2003 DreamRing Studio, All rights reserved =
=  Created 2003/09/04 by dingdangy(梦叮当)                       =
=  Version: 3.2                                                  =
=  Homepage: http://www.dreamring.9126.com                       =
=  Email: dingdangy@163.com(梦叮当)                              =
------------------------------------------------------------------
}

unit Reg;

interface

uses
  Windows, Messages, Classes, Graphics, Controls, Dialogs;

type
  myCharArray = array of Char;

procedure GetHardDiskId();
procedure MD5Encrypt(lpInBuffer:PChar; length:Integer);
procedure BlowFishEncrypt(lpInBuffer:PChar; lpKey:PChar);
procedure BlowFishDecrypt(lpInBuffer:PChar; lpKey:PChar);
procedure SHAEncrypt(lpInBuffer:PChar; length:Integer);
procedure Secret16Encrypt(lpInBuffer:PChar; lpKey:PChar);
procedure EncryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
procedure DecryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
procedure EncryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
procedure DecryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
procedure RSAEncrypt(lpInBuffer:PChar; lpDdata:PChar; lpNdata:PChar; Mode:Integer);
procedure RSADecrypt(lpInBuffer:PChar; lpNdata:PChar; Mode:Integer);
procedure CRCFileCheck(FileNameStr:PChar);
procedure FileEncrypt(lpInputFileName:PChar; lpOutputFileName:PChar; lpKey:PChar);
procedure FileDecrypt(lpInputFileName:PChar; lpOutputFileName:PChar; lpKey:PChar);
procedure Base64Encode(lpInBuffer:PChar);
procedure Base64Decode(lpInBuffer:PChar);
procedure CRC32(lpInBuffer:PChar; length:Integer);
procedure GetDllVersion();
procedure GetMainBoardId();
procedure DesEncrypt(lpInBuffer:PChar; lpKey:PChar);
procedure DesDecrypt(lpInBuffer:PChar; lpKey:PChar);

var
  hlib: HMODULE;
  lpRegisterCode: PChar;
  Return: String;
implementation
  
procedure Initialize;
begin
  hlib:= LoadLibrary('Reg.dll');
  lpRegisterCode:= 'user-123456';
end;

procedure GetHardDiskId();
{获取磁盘物理序列号}
var
  GetHardDiskId: function(lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  DiskID: array [0..30] of Char;
begin
  FillChar(DiskID, SizeOf(DiskID), #0);
  Initialize;
  if hlib <> 0 then begin
    @GetHardDiskId := GetProcAddress(hLib, 'GetHardDiskId');
    if @GetHardDiskId <> nil then begin
      if GetHardDiskId(DiskID, lpRegisterCode) then
        Return := DiskID
      else
        Return := '函数调用错误!'
    end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hLib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure MD5Encrypt(lpInBuffer:PChar; length:Integer);
{MD5 加密}
var
  MD5Encrypt: function(lpInBuffer:PChar; lpOutBuffer:PChar; length:Integer; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..32] of Char;
begin
  FillChar(OutputStr, SizeOf(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @MD5Encrypt := GetProcAddress(hlib, 'MD5Encrypt');
    if @MD5Encrypt <> nil then begin
      if MD5Encrypt(lpInBuffer, OutputStr, length, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
    end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure BlowFishEncrypt(lpInBuffer:PChar; lpKey:PChar);
{BlowFish 加密}
var
  BlowFishEncrypt: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..200] of Char;//输出长度请参考帮助文件
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @BlowFishEncrypt := GetProcAddress(hlib, 'BlowFishEncrypt');
    if @BlowFishEncrypt <> nil then begin
      if BlowFishEncrypt(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure BlowFishDecrypt(lpInBuffer:PChar; lpKey:PChar);
{BlowFish 解密}
var
  BlowFishDecrypt: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..200] of Char;//输出长度请参考帮助文件
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @BlowFishDecrypt := GetProcAddress(hlib, 'BlowFishDecrypt');
    if @BlowFishDecrypt <> nil then begin
      if BlowFishDecrypt(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure SHAEncrypt(lpInBuffer:PChar; length:Integer);
{SHA 加密}
var
  SHAEncrypt: function(lpInBuffer:PChar; lpOutBuffer:PChar; length:Integer; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..129] of Char;
begin
  FillChar(OutputStr, SizeOf(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @SHAEncrypt := GetProcAddress(hlib, 'SHAEncrypt');
    if @SHAEncrypt <> nil then begin
      if SHAEncrypt(lpInBuffer, OutputStr, length, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
    end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure Secret16Encrypt(lpInBuffer:PChar; lpKey:PChar);
{Secret16 加密}
var
  Secret16Encrypt: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..16] of Char;
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @Secret16Encrypt := GetProcAddress(hlib, 'Secret16Encrypt');
    if @Secret16Encrypt <> nil then begin
      if Secret16Encrypt(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure EncryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
{String 加密1}
var
  EncryptStringFun1: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..8192] of Char;//此处定义了输出缓冲允许的最大范围,您可以根据自己的实际情况定义范围。
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @EncryptStringFun1 := GetProcAddress(hlib, 'EncryptStringFun1');
    if @EncryptStringFun1 <> nil then begin
      if EncryptStringFun1(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure DecryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
{String 解密1}
var
  DecryptStringFun1: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..4096] of Char;//此处定义了输出缓冲允许的最大范围,您可以根据自己的实际情况定义范围。
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @DecryptStringFun1 := GetProcAddress(hlib, 'DecryptStringFun1');
    if @DecryptStringFun1 <> nil then begin
      if DecryptStringFun1(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure EncryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
{String 加密2}
var
  EncryptStringFun2: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..32] of Char;
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @EncryptStringFun2 := GetProcAddress(hlib, 'EncryptStringFun2');
    if @EncryptStringFun2 <> nil then begin
      if EncryptStringFun2(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

    FreeLibrary(hlib);
  end
  else
    ShowMessage('无法加载DLL!');
end;

procedure DecryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
{String 解密2}
var
  DecryptStringFun2: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean;  stdcall;
  OutputStr: array [0..16] of Char;
begin
  FillChar(OutputStr, Sizeof(OutputStr), #0);
  Initialize;
  if hlib <> 0 then begin
    @DecryptStringFun2 := GetProcAddress(hlib, 'DecryptStringFun2');
    if @DecryptStringFun2 <> nil then begin
      if DecryptStringFun2(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
        Return := OutputStr
      else
        Return := '函数调用错误!'
      end
    else
      ShowMessage('加载功能模块出错!');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -