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

📄 unit5.pas

📁 安全芯加密狗 安全芯加密狗
💻 PAS
字号:
unit Unit5;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, sChip;

type
  TForm5 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
    hKey: THANDLE;
    Index: WORD;
    Value: WORD;
    szReadPswd: PassArray;
    szWritePswd: PassArray;
  end;

var
  Form5: TForm5;

implementation

{$R *.dfm}

procedure TForm5.FormCreate(Sender: TObject);
begin
    Index := 0;
    Value := 0;
end;

procedure TForm5.FormActivate(Sender: TObject);
begin
    Edit1.Text := IntToStr(Integer(Index));
    Edit2.Text := IntToStr(Integer(Value));
end;

procedure TForm5.Button1Click(Sender: TObject);
Var
    i:Integer;
    info: String;
    rc : Boolean;
begin
    try
        i :=  StrToInt(Edit1.Text);
    except
        on E: EConvertError do
        begin
            MessageBox(Handle, 'Wrong format of Index.', 'R/W Error', MB_OK);
            Exit;
        end;
    end;
    Index := i;

    rc := ReadsChipMem(hKey, @szReadPswd, Index, @Value);
    if( rc ) then
	begin
        Edit2.Text := IntToStr(Integer(Value));
        Exit;
	end
	else
    begin
        info := Format('Error: Read Word Memory on index %d', [Index]);
        MessageBox(Handle, PChar(info), 'R/W Error', MB_OK);
    end;
end;

procedure TForm5.Button2Click(Sender: TObject);
Var
    i:Integer;
    info: String;
    rc : Boolean;
begin
    try
        i :=  StrToInt(Edit1.Text);
    except
        on E: EConvertError do
        begin
            MessageBox(Handle, 'Wrong format of Index.', 'R/W Error', MB_OK);
            Exit;
        end;
    end;
    Index := i;

    try
        i :=  StrToInt(Edit2.Text);
    except
        on E: EConvertError do
        begin
            MessageBox(Handle, 'Wrong format of Value.', 'R/W Error', MB_OK);
            Exit;
        end;
    end;
    Value := i;

    rc := WritesChipMem(hKey, @szWritePswd, Index, Value);
    if( not rc ) then
    begin
        info := Format('Error: Write Memory on index %d', [Index]);
        MessageBox(Handle, PChar(info), 'R/W Error', MB_OK);
    end;

end;

end.
 

⌨️ 快捷键说明

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