这是我的inno设置脚本(inno setup key generator脚本)
我想将输入查询设置为 mac地址和私钥,并且无法编辑。
inno setup key generator下载(sample2.iky,ISID.dll)
www.mjfreelancing.com/index.php?option=com_content&view=article&id=11&Itemid=13
inno setup download
www.jrsoftware.org/isdl.php
http://i49.tinypic.com/nbodif.jpg
Picture2 http://i49.tinypic.com/22iaub.jpg http://i49.tinypic.com/22iaub.jpg
抱歉我的英文
请帮助我
谢谢
[_ISTool]
EnableISX=true
Use7zip=false
[Files]
Source: sample2.iky; DestDir: {tmp}; Flags: ignoreversion
Source: ISID.dll; DestDir: {sys}\ISID; Flags: ignoreversion
[Setup]
AppName=Inno Key Generator2
AppVerName=Inno Key Generator 1.0.2.1 2
DefaultDirName={pf}\MJ Freelancing\IKG
InfoBeforeFile=readme.txt
DefaultGroupName=Inno Key Generator
OutputDir=output
AppCopyright=Copyright © Oct 2002 - 2006 MJ Freelancing
OutputBaseFilename=IKGSetup
[ThirdParty]
CompileLogMethod=append
[Code]
function ValidateSerialNumber(InnoKeyFile, User, Orgn, ProdCode, HDD, MAC, PrivateKey, Serial: AnsiString): Boolean;
external 'ValidateSerialNumber@files:ISID.dll stdcall';
function GetMACAddress(output: AnsiString): Boolean;
external 'GetMACAddress@files:ISID.dll stdcall';
var
UserPage: TInputQueryWizardPage;
UserValues: TArrayOfString;
procedure InitializeWizard();
begin
{ create the custom page }
UserPage := CreateInputQueryPage(wpInfoBefore, //wpWelcome,
'Enter Registration Details', 'You need to be a registered user to be able to proceed',
'Enter your registration details exactly (case sensitive), then click Next.');
UserPage.Add('MAC Address:', true);
UserPage.Add('Unlock Code:', False);
UserPage.Add('Private Key:', False);
{ Set default values }
SetArrayLength(UserValues, 3);
RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\Hitman', 'Hitman', UserValues[0]);
RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\Hitman', 'Hitman', UserValues[1]);
if (UserValues[0] = '') and (UserValues[1] = '') then begin
RegQueryStringValue(HKCU, 'Software\Microsoft\ND\User2', 'md', UserValues[0]);
RegQueryStringValue(HKCU, 'Software\Microsoft\ND\User2', 'MD2', UserValues[1]);
end;
{ Try to find the settings that were stored last time (also see below). }
UserPage.Values[0] := GetPreviousData('MAC', UserValues[0]);
UserPage.Values[1] := GetPreviousData('Unlock', UserValues[1]);
UserPage.Values[2] := GetPreviousData('Private', UserValues[2]);
end;
procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
{ Store the settings so we can restore them next time }
SetPreviousData(PreviousDataKey, 'MAC', UserPage.Values[0]);
SetPreviousData(PreviousDataKey, 'Unlock', UserPage.Values[1]);
SetPreviousData(PreviousDataKey, 'Private', UserPage.Values[2]);
end;
function ScriptDlgPages(CurPage: Integer; BackClicked: Boolean): Boolean;
var
ExpPath: String;
begin
Result := True;
if (CurPage = UserPage.ID) then
begin
ExtractTemporaryFile('sample2.iky'); { the public key file }
ExpPath := ExpandConstant('{tmp}\sample2.iky');
Result := False;
UserValues[0] := UserPage.Values[0];
UserValues[1] := UserPage.Values[1];
UserValues[2] := UserPage.Values[2];
if (UserValues[0] = '') or (UserValues[1] = '') or (UserValues[2] = '') then
MsgBox('No fields can be blank !', mbError, MB_OK)
else
begin
//UserPage.Values[0] := GetPreviousData('MAC', UserValues[0]);
//UserPage.Values[1] := GetPreviousData('Unlock', UserValues[1]);
//UserPage.Values[2] := GetPreviousData('Private', UserValues[2]);
//function ValidateSerialNumber(InnoKeyFile, User, Orgn, PCe,HDD,MAC,PrivateKey, Serial: AnsiString): Boolean;
Result := ValidateSerialNumber( ExpPath,'','','','',UserValues[0],UserValues[2],UserValues[1] );
if (not Result) then
MsgBox('Invalid Entry !', mbError, MB_OK);
end
end
end;
function NextButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, False);
end;
function BackButtonClick(CurPage: Integer): Boolean;
begin
Result := True;//ScriptDlgPages(CurPage, True);
end;
function HasHtmlHelp(): Boolean;
begin
{ HHCTRL.OCX GUID }
Result := RegValueExists(HKCR, 'CLSID\{4662DAB0-D393-11D0-9A56-00C04FB68B66}\InprocServer32', '');
end;
function HasNoHtmlHelp(): Boolean;
begin
Result := not HasHtmlHelp;
end;
答案 0 :(得分:0)
要让编辑框不可编辑,只需使用其属性ReadOnly。
您已经创建了3个编辑框(类TPasswordEdit),所以现在只将其ReadOnly设置为true:
UserPage.Values[0].ReadOnly := True;
UserPage.Values[1].ReadOnly := True;
UserPage.Values[2].ReadOnly := True;
将此代码放在过程InitializeWizard()的末尾。
答案 1 :(得分:0)
function GetMacAddress(output:string): Integer;
external 'GetMACAddress@files:ISID.dll stdcall';
//创建此函数后
function GetMacAdd(Output: string): string;
var
ClassName: String;
Ret: Integer;
begin
SetLength(ClassName, 256);
Ret := GetMacAddress(PChar(ClassName));
Result := Copy(ClassName, 1 , Ret);
end;
//并将其命名为
UserPage.Values[0]:=(GetMACAdd(''));
希望它有所帮助。