diff --git a/components/onguard/examples/codegen/codegen.lpi b/components/onguard/examples/codegen/codegen.lpi index bbad514ff..ad5bc8af9 100644 --- a/components/onguard/examples/codegen/codegen.lpi +++ b/components/onguard/examples/codegen/codegen.lpi @@ -39,7 +39,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -124,10 +124,9 @@ - - + @@ -199,11 +198,10 @@ - + - @@ -213,19 +211,17 @@ - + - - + - @@ -237,133 +233,102 @@ - + - + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + diff --git a/components/onguard/examples/codegen/codegenu.pas b/components/onguard/examples/codegen/codegenu.pas index 47ad30384..7092e8c14 100644 --- a/components/onguard/examples/codegen/codegenu.pas +++ b/components/onguard/examples/codegen/codegenu.pas @@ -54,8 +54,7 @@ begin OgMakeCodes1.SetKey(CKey); if OgMakeCodes1.Execute then begin {get the code} - Work := Default(TCode); - OgMakeCodes1.GetCode(Work); + OgMakeCodes1.GetCode(Work{%H-}); {display the code} CodeEd.Text := OgUtil.BufferToHex(Work, SizeOf(Work)); end; diff --git a/components/onguard/examples/exdmod/exdmod.lpi b/components/onguard/examples/exdmod/exdmod.lpi index 75fbcf557..bba2e9831 100644 --- a/components/onguard/examples/exdmod/exdmod.lpi +++ b/components/onguard/examples/exdmod/exdmod.lpi @@ -59,8 +59,8 @@ - - + + @@ -73,6 +73,7 @@ + @@ -158,123 +159,123 @@ - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - + - + - + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - + + - + - - + + - - + + - + - + - + - - + + - - + + - + - - + + diff --git a/components/onguard/examples/exdmod/exdmodu1.pas b/components/onguard/examples/exdmod/exdmodu1.pas index 4c31dc523..9514fe363 100644 --- a/components/onguard/examples/exdmod/exdmodu1.pas +++ b/components/onguard/examples/exdmod/exdmodu1.pas @@ -89,7 +89,7 @@ end; procedure TfrmMain.OgSerialNumberCode1GetCode(Sender: TObject; var Code: TCode); var S1 : string; - L : integer; + {%H-}L : integer; begin {force the INI file to be in the same directory as the application} TheDir := ExtractFilePath(ParamStr(0)); @@ -140,7 +140,7 @@ function TfrmMain.GetSNData(var S : string) : integer; var TC : TCode; SNC : string; - L : longint; + L : longint = 0; Key : TKey; begin Application.CreateForm(TSNEntryDlg, SNEntryDlg); @@ -163,8 +163,7 @@ begin OgSerialNumberCode1.Modifier := SNEntryDlg.ModString.Text; HexToBuffer(SNEntryDlg.ModString.Text, L, SizeOf(L)); - - HexToBuffer(SNEntryDlg.CodeText.Text, TC, SizeOf(TCode)); + HexToBuffer(SNEntryDlg.CodeText.Text, TC{%H-}, SizeOf(TCode)); ApplyModifierToKeyPrim(L, Key, SizeOf(TKey)); if not (IsSerialNumberCodeValid(Key, TC)) then begin diff --git a/components/onguard/examples/exdtp21/exdtp21.lpi b/components/onguard/examples/exdtp21/exdtp21.lpi index 3a947ce77..6c2b9cf91 100644 --- a/components/onguard/examples/exdtp21/exdtp21.lpi +++ b/components/onguard/examples/exdtp21/exdtp21.lpi @@ -59,8 +59,8 @@ - - + + @@ -74,7 +74,7 @@ - + @@ -143,6 +143,10 @@ + + + + diff --git a/components/onguard/examples/exdtp21/exdtp21u.pas b/components/onguard/examples/exdtp21/exdtp21u.pas index 3cdb98bd8..87e219902 100644 --- a/components/onguard/examples/exdtp21/exdtp21u.pas +++ b/components/onguard/examples/exdtp21/exdtp21u.pas @@ -66,7 +66,6 @@ var IniFile : TIniFile; S : string; SD, ED : TDateTime; - L : integer; begin {force the INI file to be in the same directory as the application} TheDir := ExtractFilePath(ParamStr(0)); diff --git a/components/onguard/examples/exdtreg/exdtreg.lpi b/components/onguard/examples/exdtreg/exdtreg.lpi index 20a45b501..06b38d64b 100644 --- a/components/onguard/examples/exdtreg/exdtreg.lpi +++ b/components/onguard/examples/exdtreg/exdtreg.lpi @@ -61,8 +61,8 @@ - - + + @@ -84,127 +84,123 @@ - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - - - - diff --git a/components/onguard/examples/exdtreg/exdtregu.pas b/components/onguard/examples/exdtreg/exdtregu.pas index b13e3c008..3c940fb3c 100644 --- a/components/onguard/examples/exdtreg/exdtregu.pas +++ b/components/onguard/examples/exdtreg/exdtregu.pas @@ -97,8 +97,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the date code in the ini file if it looks OK} - Work := Default(TCode); - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'DateCode', S); CodeLbl.Caption := S; diff --git a/components/onguard/examples/exdyreg/exdyreg.lpi b/components/onguard/examples/exdyreg/exdyreg.lpi index b130834e2..3866108f6 100644 --- a/components/onguard/examples/exdyreg/exdyreg.lpi +++ b/components/onguard/examples/exdyreg/exdyreg.lpi @@ -56,8 +56,6 @@ - - @@ -103,7 +101,7 @@ - + @@ -156,6 +154,14 @@ + + + + + + + + diff --git a/components/onguard/examples/exdyreg/exdyregu.pas b/components/onguard/examples/exdyreg/exdyregu.pas index acb995cf2..53092ae93 100644 --- a/components/onguard/examples/exdyreg/exdyregu.pas +++ b/components/onguard/examples/exdyreg/exdyregu.pas @@ -99,8 +99,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the date code in the ini file if it looks OK} - Work := Default(TCode); - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'DaysCode', S); CodeLbl.Caption := S; diff --git a/components/onguard/examples/exnet/exnet.lpi b/components/onguard/examples/exnet/exnet.lpi index ba9bec4e5..4ebbe970a 100644 --- a/components/onguard/examples/exnet/exnet.lpi +++ b/components/onguard/examples/exnet/exnet.lpi @@ -58,8 +58,8 @@ - - + + @@ -83,7 +83,7 @@ - + @@ -104,6 +104,21 @@ + + + + + + + + + + + + + + + diff --git a/components/onguard/examples/exnet/exnetu.pas b/components/onguard/examples/exnet/exnetu.pas index 9ece4d418..68da24484 100644 --- a/components/onguard/examples/exnet/exnetu.pas +++ b/components/onguard/examples/exnet/exnetu.pas @@ -101,8 +101,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the code in the ini file if it looks OK} - Work := Default(TCode); - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'NetCode', S); CodeLbl.Caption := S; @@ -162,8 +161,7 @@ var Code : TCode; begin {force code label to update} - Code := Default(TCode); - GetCode(Self, Code); + GetCode(Self, Code{%H-}); end; diff --git a/components/onguard/examples/exprot/exprot.lpi b/components/onguard/examples/exprot/exprot.lpi index 63fc7cb65..59acdd07a 100644 --- a/components/onguard/examples/exprot/exprot.lpi +++ b/components/onguard/examples/exprot/exprot.lpi @@ -57,19 +57,19 @@ - - - + + + - - + + @@ -81,7 +81,7 @@ - + @@ -94,6 +94,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/onguard/examples/exprot/exprotu.pas b/components/onguard/examples/exprot/exprotu.pas index 69ca307a3..e20879d64 100644 --- a/components/onguard/examples/exprot/exprotu.pas +++ b/components/onguard/examples/exprot/exprotu.pas @@ -4,7 +4,7 @@ interface uses SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, - ogutil, ogproexe; + ogproexe; type @@ -31,18 +31,8 @@ implementation {$R *.lfm} procedure TForm1.OgProtectExe1Checked(Sender: TObject; Status: TExeStatus); -var - S : string; begin - case Status of - exeSuccess : S := 'EXE file is OK'; - exeSizeError : S := 'EXE file size has changed'; - exeIntegrityError : S := 'EXE Integrity Error'; - exeNotStamped : S := 'EXE file is not stamped'; - else - S := 'Unknown error'; - end; - StatusLbl.Caption := S; + StatusLbl.Caption := ExeStatusToStr(Status); end; diff --git a/components/onguard/examples/exreg/exreg.lpi b/components/onguard/examples/exreg/exreg.lpi index 17220de74..84bfa56f8 100644 --- a/components/onguard/examples/exreg/exreg.lpi +++ b/components/onguard/examples/exreg/exreg.lpi @@ -58,8 +58,8 @@ - - + + @@ -111,120 +111,119 @@ - + - + - + - + - + - + - + - - + - + - + - + - + - + + - + - + - + - + - + - + - + - + - + - + - + - - + diff --git a/components/onguard/examples/exreg/exreg1.pas b/components/onguard/examples/exreg/exreg1.pas index 3998cc0d7..87f4f4fc6 100644 --- a/components/onguard/examples/exreg/exreg1.pas +++ b/components/onguard/examples/exreg/exreg1.pas @@ -72,8 +72,7 @@ begin Key := EncryptionKey; Modifier := StringHashELF(edtUserName1.Text); ApplyModifierToKeyPrim(Modifier, Key, SizeOf(Key)); - Code := Default(TCode); - InitRegCode(Key, '', D, Code); + InitRegCode(Key, '', D, Code{%H-}); edtRegCode1.Text := BufferToHex(Code, SizeOf(Code)); end; diff --git a/components/onguard/examples/exrgreg/exrgreg.lpi b/components/onguard/examples/exrgreg/exrgreg.lpi index 7bb533b16..1e16cc7c6 100644 --- a/components/onguard/examples/exrgreg/exrgreg.lpi +++ b/components/onguard/examples/exrgreg/exrgreg.lpi @@ -58,13 +58,13 @@ - + - + @@ -89,6 +89,17 @@ + + + + + + + + + + + diff --git a/components/onguard/examples/exrgreg/exrgregu.pas b/components/onguard/examples/exrgreg/exrgregu.pas index 25e11d81b..b7a41ba59 100644 --- a/components/onguard/examples/exrgreg/exrgregu.pas +++ b/components/onguard/examples/exrgreg/exrgregu.pas @@ -102,8 +102,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the code in the ini file if it looks OK} - Work := Default(TCode); - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'RegistrationCode', S); Ini.WriteString('Codes', 'RegistrationStr', RegStr); diff --git a/components/onguard/examples/exrgstr/exrgstr.lpi b/components/onguard/examples/exrgstr/exrgstr.lpi index 7df0b6b4b..dff64993f 100644 --- a/components/onguard/examples/exrgstr/exrgstr.lpi +++ b/components/onguard/examples/exrgstr/exrgstr.lpi @@ -59,14 +59,14 @@ - - + + - + @@ -129,6 +129,17 @@ + + + + + + + + + + + diff --git a/components/onguard/examples/exrgstr/exrgstru.pas b/components/onguard/examples/exrgstr/exrgstru.pas index c167c412f..302e08ce3 100644 --- a/components/onguard/examples/exrgstr/exrgstru.pas +++ b/components/onguard/examples/exrgstr/exrgstru.pas @@ -82,8 +82,7 @@ begin case Status of ogValidCode : begin - TC := Default(TCode); - InitRegCode(CKey, ARegStr, ED, TC); + InitRegCode(CKey, ARegStr, ED, TC{%H-}); C1 := BufferToHex(TC, SizeOf(TC)); if (CompareText(C1, CodeStr) <> 0) then begin diff --git a/components/onguard/examples/exselapi/exselapi.lpi b/components/onguard/examples/exselapi/exselapi.lpi index bcbf5e843..170910884 100644 --- a/components/onguard/examples/exselapi/exselapi.lpi +++ b/components/onguard/examples/exselapi/exselapi.lpi @@ -59,8 +59,8 @@ - - + + @@ -108,7 +108,7 @@ - + @@ -146,12 +146,23 @@ - + - + + + + + + + + + + + + diff --git a/components/onguard/examples/exselect/exselect.lpi b/components/onguard/examples/exselect/exselect.lpi index d3b6fa13a..3cb807d55 100644 --- a/components/onguard/examples/exselect/exselect.lpi +++ b/components/onguard/examples/exselect/exselect.lpi @@ -58,8 +58,8 @@ - - + + @@ -70,7 +70,7 @@ - + @@ -87,6 +87,17 @@ + + + + + + + + + + + diff --git a/components/onguard/examples/exslcode/exslcod1.pas b/components/onguard/examples/exslcode/exslcod1.pas index 9a53e82cd..a09312794 100644 --- a/components/onguard/examples/exslcode/exslcod1.pas +++ b/components/onguard/examples/exslcode/exslcod1.pas @@ -87,8 +87,7 @@ begin Value := Value + FaxMask; If GoodiesFeat.Checked then Value := Value + GoodiesMask; - Code := Default(TCode); - InitSpecialCode(Key, Value, Expires, Code); + InitSpecialCode(Key, Value, Expires, Code{%H-}); CodeDisplay.Text := BufferToHex(Code, SizeOf(Code)); end; diff --git a/components/onguard/examples/exslcode/exslcode.lpi b/components/onguard/examples/exslcode/exslcode.lpi index 335cb4c37..09ea4e76d 100644 --- a/components/onguard/examples/exslcode/exslcode.lpi +++ b/components/onguard/examples/exslcode/exslcode.lpi @@ -40,7 +40,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -71,8 +71,16 @@ + + + + + + + + - + @@ -101,6 +109,17 @@ + + + + + + + + + + + diff --git a/components/onguard/examples/exsnreg/exsnreg.lpi b/components/onguard/examples/exsnreg/exsnreg.lpi index f626ec407..3f602366a 100644 --- a/components/onguard/examples/exsnreg/exsnreg.lpi +++ b/components/onguard/examples/exsnreg/exsnreg.lpi @@ -60,13 +60,14 @@ - + + - + @@ -91,6 +92,10 @@ + + + + diff --git a/components/onguard/examples/exsnreg/exsnregu.pas b/components/onguard/examples/exsnreg/exsnregu.pas index c587ac2a3..07fe871c6 100644 --- a/components/onguard/examples/exsnreg/exsnregu.pas +++ b/components/onguard/examples/exsnreg/exsnregu.pas @@ -97,8 +97,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the code in the ini file if it looks OK} - Work := Default(TCode); - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'SerialNumberCode', S); CodeLbl.Caption := S; diff --git a/components/onguard/examples/exspname/exspname.lpi b/components/onguard/examples/exspname/exspname.lpi index 684a445a6..5ed03c889 100644 --- a/components/onguard/examples/exspname/exspname.lpi +++ b/components/onguard/examples/exspname/exspname.lpi @@ -56,8 +56,8 @@ - - + + @@ -76,7 +76,7 @@ - + @@ -93,6 +93,21 @@ + + + + + + + + + + + + + + + diff --git a/components/onguard/examples/exspname/exspnamu.pas b/components/onguard/examples/exspname/exspnamu.pas index 1db2f5845..65b7ce456 100644 --- a/components/onguard/examples/exspname/exspnamu.pas +++ b/components/onguard/examples/exspname/exspnamu.pas @@ -52,8 +52,7 @@ var Code : TCode; begin HashValue := StringHashElf(edtUserName1.Text); - Code := Default(TCode); - InitSpecialCode(Key, HashValue, Now + 30, Code); + InitSpecialCode(Key, HashValue, Now + 30, Code{%H-}); edtCode1.Text := BufferToHex(Code, SizeOf(Code)); end; @@ -62,8 +61,7 @@ procedure TForm1.btnCheckCodeClick(Sender: TObject); var Code : TCode; begin - Code := Default(TCode); - HexToBuffer(edtCode2.Text, Code, SizeOf(Code)); + HexToBuffer(edtCode2.Text, Code{%H-}, SizeOf(Code)); if not IsSpecialCodeValid(Key, Code) then begin lblCheckResult.Caption := 'Code Invalid'; Exit; diff --git a/components/onguard/examples/exspreg/exspreg.lpi b/components/onguard/examples/exspreg/exspreg.lpi index d464301b8..1ad9e7cfd 100644 --- a/components/onguard/examples/exspreg/exspreg.lpi +++ b/components/onguard/examples/exspreg/exspreg.lpi @@ -58,14 +58,12 @@ - - - + @@ -120,6 +118,21 @@ + + + + + + + + + + + + + + + diff --git a/components/onguard/examples/exspreg/exspregu.pas b/components/onguard/examples/exspreg/exspregu.pas index d11b9a2d3..507603434 100644 --- a/components/onguard/examples/exspreg/exspregu.pas +++ b/components/onguard/examples/exspreg/exspregu.pas @@ -100,8 +100,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the code in the ini file if it looks OK} - Work := Default(TCode); - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'SpecialCode', S); CodeLbl.Caption := S; diff --git a/components/onguard/examples/exsrnm1/exsrnm1.lpi b/components/onguard/examples/exsrnm1/exsrnm1.lpi index a8a345694..2a6c1854d 100644 --- a/components/onguard/examples/exsrnm1/exsrnm1.lpi +++ b/components/onguard/examples/exsrnm1/exsrnm1.lpi @@ -60,7 +60,7 @@ - + diff --git a/components/onguard/examples/exsrnm1/exsrnmu1.pas b/components/onguard/examples/exsrnm1/exsrnmu1.pas index 61224bdbe..eaff2a59c 100644 --- a/components/onguard/examples/exsrnm1/exsrnmu1.pas +++ b/components/onguard/examples/exsrnm1/exsrnmu1.pas @@ -129,8 +129,7 @@ begin end; {Check that Release Code was entered correctly} - TC := Default(TCode); - HexToBuffer(SNEntryDlg.CodeText.Text, TC, SizeOf(TCode)); + HexToBuffer(SNEntryDlg.CodeText.Text, TC{%H-}, SizeOf(TCode)); if not (IsSerialNumberCodeValid(CKey, TC)) then begin S := 'Release code not entered correctly'; Result := mrCancel; diff --git a/components/onguard/examples/exusg1/exusg1.lpi b/components/onguard/examples/exusg1/exusg1.lpi index c0f65882a..4680ec9f6 100644 --- a/components/onguard/examples/exusg1/exusg1.lpi +++ b/components/onguard/examples/exusg1/exusg1.lpi @@ -56,14 +56,14 @@ - - + + - + @@ -92,6 +92,13 @@ + + + + + + + diff --git a/components/onguard/examples/exusg1/exusg1u.pas b/components/onguard/examples/exusg1/exusg1u.pas index 2df32cc69..df0ea0ee3 100644 --- a/components/onguard/examples/exusg1/exusg1u.pas +++ b/components/onguard/examples/exusg1/exusg1u.pas @@ -56,8 +56,7 @@ end; procedure TForm1.OgUsageCode1GetCode(Sender: TObject; var Code: TCode); var - S : string; - L : integer; + S: string; begin TheDir := ExtractFilePath(ParamStr(0)); diff --git a/components/onguard/examples/exusg2/exusg2.lpi b/components/onguard/examples/exusg2/exusg2.lpi index 96c7bb743..c9185a9b7 100644 --- a/components/onguard/examples/exusg2/exusg2.lpi +++ b/components/onguard/examples/exusg2/exusg2.lpi @@ -57,13 +57,13 @@ - + - + @@ -84,6 +84,17 @@ + + + + + + + + + + + diff --git a/components/onguard/examples/exusg2/exusg2u.pas b/components/onguard/examples/exusg2/exusg2u.pas index 439d0dfca..37419798b 100644 --- a/components/onguard/examples/exusg2/exusg2u.pas +++ b/components/onguard/examples/exusg2/exusg2u.pas @@ -60,8 +60,7 @@ end; procedure TForm1.OgUsageCode2GetCode(Sender: TObject; var Code: TCode); var - S : string; - L : integer; + S: string; begin TheDir := ExtractFilePath(ParamStr(0)); @@ -102,7 +101,7 @@ begin if not (FileExists(TheDir + 'Usage2.ini')) then begin S := ''; if (InputQuery('Call Vendor NOW', 'Code', S)) then begin - if HexToBuffer(S, Code, SizeOf(Code)) then begin + if HexToBuffer(S, Code{%H-}, SizeOf(Code)) then begin IniFile := TIniFile.Create(TheDir + 'Usage2.ini'); try IniFile.WriteString('Codes', 'Uses', S); diff --git a/components/onguard/examples/exusreg/exusreg.lpi b/components/onguard/examples/exusreg/exusreg.lpi index feca955bc..3ab6f370c 100644 --- a/components/onguard/examples/exusreg/exusreg.lpi +++ b/components/onguard/examples/exusreg/exusreg.lpi @@ -37,7 +37,7 @@ - + @@ -56,14 +56,22 @@ - - + + + + + + + + + + - + @@ -80,6 +88,14 @@ + + + + + + + + diff --git a/components/onguard/examples/exusreg/exusregu.pas b/components/onguard/examples/exusreg/exusregu.pas index 3b0794bf0..8f9975bd5 100644 --- a/components/onguard/examples/exusreg/exusregu.pas +++ b/components/onguard/examples/exusreg/exusregu.pas @@ -100,7 +100,7 @@ begin Ini := TIniFile.Create('ONGUARD.INI'); try {store the date code in the ini file if it looks OK} - if HexToBuffer(S, Work, SizeOf(Work)) then begin + if HexToBuffer(S, Work{%H-}, SizeOf(Work)) then begin {save the value} Ini.WriteString('Codes', 'UsageCode', S); CodeLbl.Caption := S; diff --git a/components/onguard/examples/fixnaf/fixnaf.lpi b/components/onguard/examples/fixnaf/fixnaf.lpi index c505f0788..fe1bd7ce1 100644 --- a/components/onguard/examples/fixnaf/fixnaf.lpi +++ b/components/onguard/examples/fixnaf/fixnaf.lpi @@ -37,12 +37,12 @@ - + - + @@ -93,9 +93,11 @@ - - + + + + @@ -112,7 +114,7 @@ - + @@ -121,83 +123,179 @@ - + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/onguard/examples/fixnaf/fixnaf.lpr b/components/onguard/examples/fixnaf/fixnaf.lpr index 636a96145..44e65a042 100644 --- a/components/onguard/examples/fixnaf/fixnaf.lpr +++ b/components/onguard/examples/fixnaf/fixnaf.lpr @@ -4,7 +4,7 @@ program FixNAF; uses Interfaces, Forms, - ogfirst, + ogfirst in '..\..\source\ogfirst.pas', // ogfirst is windows-only and not included in the package. FIXNAF1 in 'FIXNAF1.pas' {MainFrm}; {$R *.res} diff --git a/components/onguard/examples/nafmgr/nafmgr.lpi b/components/onguard/examples/nafmgr/nafmgr.lpi index 8ea63a947..f5e7876af 100644 --- a/components/onguard/examples/nafmgr/nafmgr.lpi +++ b/components/onguard/examples/nafmgr/nafmgr.lpi @@ -40,13 +40,12 @@ - + - - + @@ -58,9 +57,10 @@ + - - + + @@ -85,8 +85,16 @@ + + + + + + + + - + @@ -108,33 +116,44 @@ - - - - + + + + - + - + - + - + - + + + + + + + + + + + + diff --git a/components/onguard/examples/nafmgr/nafmgr.lpr b/components/onguard/examples/nafmgr/nafmgr.lpr index 78c857232..e5dca0ffc 100644 --- a/components/onguard/examples/nafmgr/nafmgr.lpr +++ b/components/onguard/examples/nafmgr/nafmgr.lpr @@ -5,7 +5,7 @@ program NAFMgr; uses Interfaces, Forms, - ogfirst, + ogfirst in '..\..\source\ogfirst.pas', NAFMGR1 in 'NAFMGR1.pas' {NafFrm}; {$R *.res} diff --git a/components/onguard/examples/nafmgr/nafmgr1.pas b/components/onguard/examples/nafmgr/nafmgr1.pas index e65a4e8f2..e1c86eaee 100644 --- a/components/onguard/examples/nafmgr/nafmgr1.pas +++ b/components/onguard/examples/nafmgr/nafmgr1.pas @@ -57,9 +57,6 @@ implementation {$R *.lfm} -uses - IniFiles; - const {this applications' key} CKey : TKey = ($E5,$8F,$84,$D6,$92,$C9,$A4,$D8,$1A,$FA,$6F,$8D,$AB,$FC,$DF,$B4); diff --git a/components/onguard/examples/regdemo/frm_main.lfm b/components/onguard/examples/regdemo/frm_main.lfm index c583f65f7..f260ef826 100644 --- a/components/onguard/examples/regdemo/frm_main.lfm +++ b/components/onguard/examples/regdemo/frm_main.lfm @@ -1,4 +1,10 @@ object frmMain: TfrmMain + Left = 383 + Height = 143 + Top = 289 + Width = 367 + HorzScrollBar.Page = 366 + VertScrollBar.Page = 142 ActiveControl = Button1 Caption = 'Hello World' ClientHeight = 143 @@ -6,14 +12,12 @@ object frmMain: TfrmMain Font.Height = -13 Font.Name = 'Arial' OnCreate = FormCreate - PixelsPerInch = 96 - HorzScrollBar.Page = 366 - VertScrollBar.Page = 142 - Left = 383 - Height = 143 - Top = 289 - Width = 367 + LCLVersion = '2.3.0.0' object Label1: TLabel + Left = 4 + Height = 41 + Top = 16 + Width = 359 Alignment = taCenter AutoSize = False Caption = 'Hello World!' @@ -21,29 +25,26 @@ object frmMain: TfrmMain Font.Height = -33 Font.Name = 'Arial' ParentColor = False - Left = 4 - Height = 41 - Top = 16 - Width = 359 + ParentFont = False end object Button1: TButton - BorderSpacing.InnerBorder = 4 - Caption = 'Close' - OnClick = Button1Click - TabOrder = 0 Left = 280 Height = 25 Top = 88 Width = 75 + BorderSpacing.InnerBorder = 4 + Caption = 'Close' + OnClick = Button1Click + TabOrder = 0 end object btnReadme: TButton - BorderSpacing.InnerBorder = 4 - Caption = 'Readme...' - OnClick = btnReadmeClick - TabOrder = 1 Left = 16 Height = 25 Top = 88 Width = 75 + BorderSpacing.InnerBorder = 4 + Caption = 'Readme...' + OnClick = btnReadmeClick + TabOrder = 1 end end diff --git a/components/onguard/examples/regdemo/frm_main.pas b/components/onguard/examples/regdemo/frm_main.pas index 82b30c569..29575879e 100644 --- a/components/onguard/examples/regdemo/frm_main.pas +++ b/components/onguard/examples/regdemo/frm_main.pas @@ -36,8 +36,8 @@ uses procedure TfrmMain.FormCreate(Sender: TObject); var - ReleaseCodeString: string; - var SerialNumber : longint; + ReleaseCodeString: string = ''; + SerialNumber: longint = 0; begin GetRegistrationInformation (ReleaseCodeString, SerialNumber); if not IsReleaseCodeValid (ReleaseCodeString, SerialNumber) then diff --git a/components/onguard/examples/regdemo/helloworld.lpi b/components/onguard/examples/regdemo/helloworld.lpi index 4b7fa8554..5eb39db70 100644 --- a/components/onguard/examples/regdemo/helloworld.lpi +++ b/components/onguard/examples/regdemo/helloworld.lpi @@ -1,26 +1,31 @@ - + - + + - - - + + + - - - - - + + + + + + + + + @@ -32,11 +37,11 @@ + - - + @@ -45,19 +50,20 @@ - - - + + + + + - - - - + + + @@ -67,39 +73,34 @@ - - + + - - - + + - - - - + - - - - + + + - + @@ -108,13 +109,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + @@ -135,9 +199,6 @@ - - - diff --git a/components/onguard/examples/regdemo/rcg_main.lfm b/components/onguard/examples/regdemo/rcg_main.lfm index 9b2a03df8..89f7d5176 100644 --- a/components/onguard/examples/regdemo/rcg_main.lfm +++ b/components/onguard/examples/regdemo/rcg_main.lfm @@ -1,16 +1,16 @@ object rcgMain: TrcgMain Left = 354 - Height = 322 + Height = 308 Top = 246 - Width = 363 + Width = 344 HorzScrollBar.Page = 362 VertScrollBar.Page = 321 ActiveControl = edtAppKey AutoSize = True BorderStyle = bsDialog Caption = 'Release Code Generator' - ClientHeight = 322 - ClientWidth = 363 + ClientHeight = 308 + ClientWidth = 344 ShowHint = True LCLVersion = '2.3.0.0' object lblAppKey: TLabel @@ -144,7 +144,7 @@ object rcgMain: TrcgMain Left = 8 Height = 23 Top = 241 - Width = 299 + Width = 295 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 8 BorderSpacing.Top = 2 @@ -250,11 +250,12 @@ object rcgMain: TrcgMain AnchorSideTop.Control = edtReleaseCode AnchorSideTop.Side = asrCenter AnchorSideRight.Control = edtMachineMod - Left = 311 + AnchorSideRight.Side = asrBottom + Left = 307 Height = 26 Top = 239 Width = 30 - Anchors = [akTop] + Anchors = [akTop, akRight] Glyph.Data = { 26040000424D2604000000000000360000002800000012000000120000000100 180000000000F003000000000000000000000000000000000000FFFFFFFFFFFF diff --git a/components/onguard/examples/regdemo/registration.lpi b/components/onguard/examples/regdemo/registration.lpi index 132c62a87..867f2addb 100644 --- a/components/onguard/examples/regdemo/registration.lpi +++ b/components/onguard/examples/regdemo/registration.lpi @@ -59,8 +59,6 @@ - - @@ -96,7 +94,7 @@ - + @@ -117,6 +115,10 @@ + + + + diff --git a/components/onguard/examples/regdemo/uni_regcommon.pas b/components/onguard/examples/regdemo/uni_regcommon.pas index 1409e3510..8904c1094 100644 --- a/components/onguard/examples/regdemo/uni_regcommon.pas +++ b/components/onguard/examples/regdemo/uni_regcommon.pas @@ -34,7 +34,7 @@ begin System.Delete(ReleaseCodeString, pos(' ', ReleaseCodeString), 1); // Calculate the release code based on the serial number and the calculated machine modifier - InitSerialNumberCode(MachineKey, SerialNumber, Expires, CalculatedReleaseCode); + InitSerialNumberCode(MachineKey, SerialNumber, Expires, CalculatedReleaseCode{%H-}); // Compare the two release codes result := AnsiUpperCase(ReleaseCodeString) = AnsiUpperCase(BufferToHex(CalculatedReleaseCode, sizeof(CalculatedReleaseCode))); diff --git a/components/onguard/examples/stampexe/stampexe.lpi b/components/onguard/examples/stampexe/stampexe.lpi index 2c1363a4c..bcc23801d 100644 --- a/components/onguard/examples/stampexe/stampexe.lpi +++ b/components/onguard/examples/stampexe/stampexe.lpi @@ -39,7 +39,7 @@ - + @@ -57,9 +57,6 @@ - - - @@ -71,9 +68,11 @@ - - + + + + @@ -99,12 +98,133 @@ + + + + + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/onguard/source/ogfirst.pas b/components/onguard/source/ogfirst.pas index 88f0ce77e..d97882b22 100644 --- a/components/onguard/source/ogfirst.pas +++ b/components/onguard/source/ogfirst.pas @@ -147,8 +147,6 @@ end; {$ENDIF} - - {$IFDEF WINDOWS} function GetMutexName : string; var diff --git a/components/onguard/source/ogproexe.pas b/components/onguard/source/ogproexe.pas index ebe8aac2f..f16070da0 100644 --- a/components/onguard/source/ogproexe.pas +++ b/components/onguard/source/ogproexe.pas @@ -101,7 +101,7 @@ type {property methods} function GetAbout : string; {!!.08} - procedure SetAbout(const Value : string); {!!.08} + procedure SetAbout(const {%H-}Value : string); {!!.08} protected procedure DoOnChecked(Status : TExeStatus); @@ -143,6 +143,8 @@ type end; +function ExeStatusToStr(AStatus: TExeStatus): String; + function IsExeTampered(CheckSize : Boolean) : TExeStatus; {-return one of the possible TExeResult states} function ProtectExe(const FileName : string ; EraseMarker : Boolean) : Boolean; @@ -207,6 +209,18 @@ const $b3667a2e, $c4614ab8, $5d681b02, $2a6f2b94, $b40bbe37, $c30c8ea1, $5a05df1b, $2d02ef8d); +function ExeStatusToStr(AStatus: TExeStatus): String; +begin + case AStatus of + exeSuccess : Result := 'EXE file is OK'; + exeSizeError : Result := 'EXE file size has changed'; + exeIntegrityError : Result := 'EXE Integrity Error'; + exeNotStamped : Result := 'EXE file is not stamped'; + else + Result := 'Unknown error'; + end; +end; + {*** TOgProtectExe ***} constructor TOgProtectExe.Create(AOwner : TComponent); diff --git a/components/onguard/source/onguard.pas b/components/onguard/source/onguard.pas index 828a2e9ca..3743b4a16 100644 --- a/components/onguard/source/onguard.pas +++ b/components/onguard/source/onguard.pas @@ -105,7 +105,6 @@ type TKeyType = (ktRandom, ktMessageDigest, ktMessageDigestCS); {order must match order for key generation combobox string list} -type {contexts} TTMDContext = array [0..279] of Byte; @@ -178,7 +177,7 @@ type function GetAbout : string; {!!.08} procedure SetCode(const Value : string); procedure SetModifier(const Value : string); - procedure SetAbout(const Value : string); {!!.08} + procedure SetAbout(const {%H-}Value : string); {!!.08} protected procedure Loaded; @@ -263,7 +262,7 @@ type {property methods} function GetAbout : string; {!!.08} - procedure SetAbout(const Value : string); {!!.08} + procedure SetAbout(const {%H-}Value : string); {!!.08} public constructor Create(AOwner : TComponent); @@ -312,7 +311,7 @@ type {property methods} function GetAbout : string; {!!.08} - procedure SetAbout(const Value : string); {!!.08} + procedure SetAbout(const {%H-}Value : string); {!!.08} public constructor Create(AOwner : TComponent); @@ -538,7 +537,6 @@ type function GetInvalidCountValue(const Key : TKey; const Code : TCode) : LongInt; procedure DecInvalidCountCode(const Key : TKey; var Code : TCode); - function GetCodeType(const Key : TKey; const Code : TCode) : TCodeType; {-return the type of code} function GetExpirationDate(const Key : TKey; const Code : TCode) : TDateTime; @@ -729,7 +727,7 @@ type end; TBlock2048 = array [0..255] of Byte; -procedure InitTMD(var Context : TTMDContext); +procedure InitTMD(out Context : TTMDContext); var ContextEx : TMDContextEx absolute Context; begin @@ -815,7 +813,6 @@ procedure HashTMD(var Digest; DigestSize : LongInt; const Buf; BufSize : LongInt var Context : TTMDContext; begin - Context := Default(TTMDContext); InitTMD(Context); UpdateTMD(Context, Buf, BufSize); FinalizeTMD(Context, Digest, DigestSize); @@ -848,7 +845,7 @@ var hRPCTR4 : THandle; {!!.11} UuidCreateSequential : TUuidCreateSequential; {!!.11} I : DWord; - RegKey : HKEY; + RegKey : HKEY = 0; GUID1 : TGUID; GUID2 : TGUID; Drive : AnsiChar; @@ -859,6 +856,8 @@ var iController, iDrive, maxController : Integer; BufStr : AnsiString; begin + Result := 0; + InitTMD(Context); {include user specific information} @@ -1137,7 +1136,7 @@ end; function GenerateStringModifierPrim(const S : string) : LongInt; var I : Integer; {!!.06} - Sig : array [0..4] of AnsiChar; + Sig : array [0..4] of AnsiChar = (#0, #0, #0, #0, #0); S2 : string; {!!.06} begin FillChar(Sig, SizeOf(Sig), 0); @@ -1202,7 +1201,6 @@ end; function TOgCodeBase.DoOnGetCode : TCode; begin - Result := Default(TCode); if FStoreCode then Result := FCode else begin @@ -1254,7 +1252,6 @@ var Work : TCode; begin Result := '$' + BufferToHex(FCode, SizeOf(FCode)); - Work := Default(TCode); if not HexToBuffer(Result, Work, SizeOf(Work)) then Result := ''; @@ -1314,12 +1311,11 @@ end; function TOgDateCode.CheckCode(Report : Boolean) : TCodeStatus; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin Result := ogValidCode; - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1342,10 +1338,9 @@ end; function TOgDateCode.GetValue : TDateTime; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1357,10 +1352,9 @@ end; function TOgDateCode.GetInvalidCount: LongInt; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1375,12 +1369,11 @@ end; function TOgDaysCode.CheckCode(Report : Boolean) : TCodeStatus; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin Result := ogValidCode; - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1398,8 +1391,6 @@ begin if GetInvalidCountValue(Key,ACode)=1 then Result := ogCodeExpired; end; - - if Report then DoOnChecked(Result); end; @@ -1415,10 +1406,9 @@ procedure TOgDaysCode.Decrease; var ACode : TCode; Work : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; Work := ACode; @@ -1444,10 +1434,9 @@ end; function TOgDaysCode.GetValue : LongInt; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1460,10 +1449,9 @@ end; function TOgDaysCode.GetInvalidCount : LongInt; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1648,14 +1636,13 @@ end; function TOgRegistrationCode.CheckCode(Report : Boolean) : TCodeStatus; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; {RegStr : string;} {!!.02} begin Result := ogValidCode; FRegString := DoOnGetRegString; {!!.02} - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1693,12 +1680,11 @@ end; function TOgSerialNumberCode.CheckCode(Report : Boolean) : TCodeStatus; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin Result := ogValidCode; - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1716,10 +1702,9 @@ end; function TOgSerialNumberCode.GetValue : LongInt; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1734,12 +1719,11 @@ end; function TOgSpecialCode.CheckCode(Report : Boolean) : TCodeStatus; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin Result := ogValidCode; - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1757,10 +1741,9 @@ end; function TOgSpecialCode.GetValue : LongInt; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -1775,11 +1758,10 @@ end; function TOgUsageCode.CheckCode(Report : Boolean) : TCodeStatus; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin Result := ogValidCode; - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; @@ -1814,11 +1796,10 @@ end; procedure TOgUsageCode.Decrease; var ACode : TCode; - Work : TCode; - Key : TKey; + Work : TCode; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; Work := ACode; @@ -1842,10 +1823,9 @@ end; function TOgUsageCode.GetValue : LongInt; var ACode : TCode; - Key : TKey; + Key : TKey = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); AModifier : LongInt; begin - Key := Default(TKey); DoOnGetKey(Key); ACode := DoOnGetCode; AModifier := DoOnGetModifier; @@ -2235,7 +2215,6 @@ end; - initialization {record our baseline date} BaseDate := Trunc(EncodeDate(1996, 1, 1)); diff --git a/components/onguard/source/qonguard4.pas b/components/onguard/source/qonguard4.pas index 440222f37..22501ef18 100644 --- a/components/onguard/source/qonguard4.pas +++ b/components/onguard/source/qonguard4.pas @@ -96,9 +96,8 @@ end; procedure TEditProductFrm.InfoChanged(Sender: TObject); var - Work : TKey; + Work : TKey = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); begin - Work := Default(TKey); OKBtn.Enabled := (Length(ProductEd.Text) > 0) and (HexToBuffer(KeyEd.Text, Work, SizeOf(Work))); end;