function _getoptions(optsize: integer; optionsfilename: PChar; Opt: Pointer;
callkey: integer): integer; cdecl; external OptionDll name '_getoptions'; function _putoptions(optsize: integer; optionsfilename: PChar; Opt: Pointer;
callkey: integer): integer; cdecl; external OptionDll name '_putoptions'; function _activate(var sin: PAnsiChar; var sout: PAnsiChar; key: PAnsiChar)
: integer; cdecl; external OptionDll name '_activate'; function _patchoptions(optsize: integer; optionsfilename: PChar; Opt: Pointer;
callkey: integer; ipaddr: PChar; winprodid: PChar; diskid: PChar; edit: PChar)
: integer; cdecl; external OptionDll name '_patchoptions';
{$R *.dfm}
//------------------------------------------------------------------ //- Procedure PutOptions //- set Options //------------------------------------------------------------------ function TOptions.Lengthrtf(T: RTFTexte): LongInt; var
l, e: integer; begin
e := 0; for l := 0 to KeyMaxLong do if T[l] = chr(0) then
e := l;
Lengthrtf := e end;
//---------------------------------------------------------------- } //- //- //---------------------------------------------------------------- } procedure TOptions.ComboBox1Click(Sender: TObject); begin if ComboBox1.ItemIndex = 0 then
r.language := german else
r.language := english; end;
//---------------------------------------------------------------- } //function OptLen - } //set Options.R. - } //---------------------------------------------------------------- } function TOptions.OptLen(Start, Init, Ende: Pointer): LongInt; var
B1, B2, B3: LongInt;
ret: LongInt; begin
B1 := DWord(Start);
B2 := DWord(Init);
B3 := DWord(Ende);
ret := B3 - B1 + 1; with R do
ret := ret + B2 - B1;
Result := ret end;
//---------------------------------------------------------------- //function CheckSumme //set Options.R. //---------------------------------------------------------------- function TOptions.OptSum(Start, Init, Ende: Pointer): LongInt; const
max = 1000000; type
PA = array [0 .. max] ofbyte; var
P: ^PA;
i, lbd, hbd: LongInt;
CS: LongInt;
B1, B2, B3: LongInt; begin
P := Init;
B1 := DWord(Start);
B2 := DWord(Init);
B3 := DWord(Ende);
lbd := B2 - B1;
hbd := B3 - B1;
hbd := (hbd div 8 + 1) * 8; if max < hbd - lbd then
HaltProgram(771);
CS := 0; For i := lbd + 1 to hbd - 1 do
CS := (CS + P^[i]) mod largeprime;
OptSum := CS; end;
//---------------------------------------------------------------- //test if net allowed // //---------------------------------------------------------------- function TOptions.netallowed: boolean; var
bu: integer; begin ifnot(netflag or R.Netpermanentallowed) thenbegin
bu := ask(105, 'In das Internet gehen?', ' ', [mbYes, mbNo, mbYestoAll]);
netflag := bu in [mrYes, mrYesToAll]; if bu = mrYesToAll then
R.Netpermanentallowed := true; end;
Result := netflag; end;
//---------------------------------------------------------------- } //Procedure getOptions - } //set Options - } //---------------------------------------------------------------- } Procedure TOptions.GetOptions(optionsfilename: PChar); var
callkey, oplen, opsum: LongInt; begin //define secure(a,b) if (!(b==a%63)) {exit(-911);}
SavOptionsfilename := optionsfilename; with R do
oplen := OptLen(@cc, @inited, @endofopts);
callkey := (oplen div 8 + 1) * 8; //_patchoptions(callkey,optionsfilename,@R.CC,callkey mod 63,'87.16.230.129','55375-oem-0044992-91858',nil,nil);
_getoptions(callkey, optionsfilename, @R.cc, callkey mod 63); if R.OptionLen <> oplen then
HaltProgram(778); with R do
opsum := OptSum(@cc, @inited, @endofopts); if R.OptionSum <> opsum then
HaltProgram(779); end;
//---------------------------------------------------------------- } //Procedure PutOptions - } //set Options - } //---------------------------------------------------------------- } Procedure TOptions.PutOptions(optionsfilename: PChar); var
callkey, oplen: LongInt; begin //define secure(a,b) if (!(b==a%63)) {exit(-911);} with R dobegin
OptionSum := OptSum(@cc, @inited, @endofopts);
OptionLen := OptLen(@cc, @inited, @endofopts);
SavOptionsfilename := optionsfilename;
oplen := OptLen(@cc, @inited, @endofopts); end;
callkey := (oplen div 8 + 1) * 8;
_putoptions(callkey, optionsfilename, @R.cc, callkey mod 63); end;
//----------------------------------------------------------------- //Procedure getOptions - //set Options - //----------------------------------------------------------------- Procedure TOptions.InitOptions(optionsfilename: PChar); var
ODate: TDate;
OVers: String; begin
Version := getFileVersion(ParamStr(0)); ifNot FileExists(optionsfilename) thenbegin
CreateDir(ExtractFileDir(optionsfilename));
DefaultOptions();
PutOptions(optionsfilename) end elsebegin
GetOptions(optionsfilename); //check options version
ODate := getFileAge(ParamStr(0)); if DaysBetween(ODate, R.Objectdate) > 0 thenbegin
inform(97, 'Die Optionen müssen zurückgesetzt werden wegen des neuen Dateidatums ',
DateToStr(ODate));
DeleteFile(PChar(optionsfilename));
DefaultOptions();
Width := screen.Width div 2;
Height := screen.Height div 2; end;
OVers := Utilities.getFileVersion(ParamStr(0)); if OVers > R.Version thenbegin
inform(98, 'Die Optionen müssen zurückgestzt werden wegen der neuen Dateiversion ',
OVers);
DeleteFile(PChar(optionsfilename));
DefaultOptions();
Width := screen.Width div 2;
Height := screen.Height div 2; end; end; //
R.Callcount := R.Callcount + 1;
netflag := false; end;
//------------------------------------------------------------------ } //- keep track of daysused ue - } //- - } //------------------------------------------------------------------ } function TOptions.getSamplesDir(Title: String): String; var
res: String; begin //
res := R.ProgDir + trans(40, 'Beispiele') + '\'; if IsDebuggerPresent then
res := R.ProgDir + 'Testdata\';
result := res end;
//------------------------------------------------------------------ } //- keep track of daysused ue - } //- - } //------------------------------------------------------------------ } function TOptions.SetDaysUsed(Installkey: String; SK: String;
Productnumber: char): boolean; var
key: integer;
re: boolean; begin
re := true; if Installkey > ''thenbegin If DateOf(Now) >= R.FirstUse then
R.LastUse := DateOf(Now);
key := GetSecrets(Installkey, SK, Productnumber); if (key <> R.DaysUsed) thenbegin //Error(111,'Schlüssel ungleich');
re := false; end;
R.DaysUsed := DaysBetween(R.LastUse, R.FirstUse); if dayof(Now) <> dayof(R.LastUse) then
R.DaysEffectivlyUsed := R.DaysEffectivlyUsed + 1;
setsecrets(Installkey, R.DaysUsed, Productnumber); end;
SetDaysUsed := re; end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit1Change(Sender: TObject); begin if Edit1.Text > ''then
Hex2String(Edit1.Text); if Length(edit1.Text) <= 24 then
r.recordseparator := Edit1.Text else
errorn(10, 'Maximal 24 Zeichen'); end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit2Change(Sender: TObject); begin if Edit2.Text > ''then
Hex2String(Edit2.Text); if Length(edit2.Text) <= 24 then
r.lineseparator := Edit2.Text else
errorn(10, 'Maximal 24 Zeichen'); end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit3Change(Sender: TObject); begin if Edit3.Text > ''then
Hex2String(Edit3.Text); if (Edit3.Text <> opt.R.decimalpoint) then
r.fielddelimiter := Edit3.Text else
errorn(10, 'Maximal 1 Zeichen, ungleich Begrenzer'); end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit4Change(Sender: TObject); begin if Edit4.Text > ''then
Hex2String(Edit4.Text); if Length(Edit4.Text) <= 24 then
r.escapecharacter := Edit4.Text else
errorn(10, 'Maximal 1 Zeichen, ungleich Begrenzer'); end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit5Change(Sender: TObject); begin if (length(edit5.Text) = 1) and (Edit5.Text <> opt.R.fielddelimiter) then
r.decimalpoint := Edit5.Text[1] else
errorn(55, 'Nur ein Zeichen'); end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ function checkexpress(S: String): boolean; const
seq = ['0' .. '9', ',']; var
i, ll: integer;
res: boolean; begin
res := true;
ll := length(S); for i := 1 to ll do
res := res and CharInSet(S[i], seq); if (ll > 0) and ((S[ll] = ',') or (S[ll] = ',')) then
res := false; if S='0'then res:=false;
result := res end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit6Change(Sender: TObject); begin
edit6.Font.Color := clBlack; if checkexpress(edit6.Text) then
r.leftkeys := edit6.Text else
edit6.font.Color := clRed; end;
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ procedure TOptions.Edit7Change(Sender: TObject); begin
edit7.Font.Color := clBlack; if checkexpress(edit7.Text) then
r.rightkeys := edit7.Text else
edit7.font.Color := clRed; end;
//------------------------------------------------------------------------------ //externalcode from delphi.about.com -- Windows Code !! //------------------------------------------------------------------------------ function BrowseDialogCallBack(Wnd: HWND; uMsg: UINT; lParam, lpData: lParam)
: integer stdcall; var
wa, rect: TRect;
dialogPT: TPoint; begin //center in work area if uMsg = BFFM_INITIALIZED thenbegin
wa := screen.WorkAreaRect;
GetWindowRect(Wnd, rect);
dialogPT.x := ((wa.Right - wa.Left) div 2) -
((rect.Right - rect.Left) div 2);
dialogPT.Y := ((wa.Bottom - wa.Top) div 2) -
((rect.Bottom - rect.Top) div 2);
MoveWindow(Wnd, dialogPT.x, dialogPT.Y, rect.Right - rect.Left,
rect.Bottom - rect.Top, true);
SendMessage(Wnd, BFFM_SETSELECTION, 1, integer(@StartFolder[1])); end;
Result := 0; end;
//------------------------------------------------------------------------------ //externalcode from delphi.about.com -- Windows Code !! //------------------------------------------------------------------------------ function BrowseDialog(const Title: string; const Flag: integer): string; var
lpItemID: PItemIDList;
BrowseInfo: TBrowseInfo;
DisplayName: array [0 .. MAX_PATH] ofchar;
TempPath: array [0 .. MAX_PATH] ofchar; begin
Result := '';
FillChar(BrowseInfo, SizeOf(TBrowseInfo), #0); with BrowseInfo dobegin
hwndOwner := Application.Handle;
pszDisplayName := @DisplayName;
lpszTitle := PChar(Title);
ulFlags := Flag;
lpfn := BrowseDialogCallBack; end;
lpItemID := SHBrowseForFolder(BrowseInfo); if lpItemID <> nilthenbegin
SHGetPathFromIDList(lpItemID, TempPath);
Result := TempPath;
GlobalFreePtr(lpItemID); end; end;
//---------------------------------------------------------------------------- //Zurücksetzen //---------------------------------------------------------------------------- procedure TOptions.ResetClick(Sender: TObject); begin if ask(99, 'Wirklich alles löschen?', '', []) = mrYes thenbegin
screen.Cursor := crHourGlass;
DefaultOptions();
PutOptions(PChar(optionsfilename(Title)));
screen.Cursor := crDefault;
inform(100, 'Bitte starten Sie das Programm erneut.', '');
ExitProcess(711); end; end;
//----------------------------------------------------------------- //function setsecrets - //- //----------------------------------------------------------------- function TOptions.GetSecrets(Installkey: String; SK: String;
Productnumber: char): integer; var
r2: integer; begin
r2 := -1; if DiskType <> DRIVE_REMOVABLE thenbegin //r1:=GetSecretRegistryValue(Installkey,Productnumber); //r2:=GetSecretFile(Installkey,SK,Productnumber); //if r1<>r2 then //r2:=-1; end;
GetSecrets := r2 end;
//------------------------------------------------------------------ //Procedure Setl //moving of short arrays //------------------------------------------------------------------ procedure TOptions.setsecrets(Installkey: String; DaysUsed: integer;
Productnumber: char); begin //empry end;
//---------------------------------------------------------------------------- //Procedure KeyFile //set Cryptokey // //---------------------------------------------------------------------------- Function KeyFile(var key: arrayofchar): String; var
i, nu: integer;
KeyF: String; begin
KeyF := getDiskId(PChar(MidStr(GetCurrentDir, 1, 3)));
KeyF := StringReplace(KeyF, ' ', 'X', [rfReplaceAll]);
KeyF := 'O' + KeyF; for i := 1 to length(KeyF) dobegin
nu := (ord(KeyF[i]) + 7) mod 26;
nu := nu + ord('a');
KeyF[i] := chr(nu); end;
KeyFile := 'F' + KeyF + '.key'; end;
//------------------------------------------------------------------ } //- - } //- Ende dieser Quelle - } //- - } //------------------------------------------------------------------ } end.
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.7Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.