From 84f9ba551c4ed037f2b98e3b0426bc0cb966bd15 Mon Sep 17 00:00:00 2001 From: brandysb Date: Wed, 29 Jul 2009 14:54:48 +0000 Subject: [PATCH] InvalidCount for days code git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@923 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/onguard/examples/codegen/ONGUARD.INI | 1 + components/onguard/examples/exrgreg/exrgreg.lpi | 2 +- components/onguard/readme.txt | 9 ++++++++- components/onguard/source/onguard.pas | 11 ++++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/components/onguard/examples/codegen/ONGUARD.INI b/components/onguard/examples/codegen/ONGUARD.INI index d6be10758..0aa5e8dc7 100644 --- a/components/onguard/examples/codegen/ONGUARD.INI +++ b/components/onguard/examples/codegen/ONGUARD.INI @@ -1,2 +1,3 @@ [Keys] OnGuard demo=$E5,$8F,$84,$D6,$92,$C9,$A4,$D8,$1A,$FA,$6F,$8D,$AB,$FC,$DF,$B4 +Ck-Etykiety=$C0,$0A,$27,$C2,$93,$7B,$06,$0D,$24,$84,$DF,$A1,$1E,$B9,$0D,$AF diff --git a/components/onguard/examples/exrgreg/exrgreg.lpi b/components/onguard/examples/exrgreg/exrgreg.lpi index 0fda9bdc6..79e95548f 100644 --- a/components/onguard/examples/exrgreg/exrgreg.lpi +++ b/components/onguard/examples/exrgreg/exrgreg.lpi @@ -45,7 +45,7 @@ - + diff --git a/components/onguard/readme.txt b/components/onguard/readme.txt index b9de6b17a..30f378f23 100644 --- a/components/onguard/readme.txt +++ b/components/onguard/readme.txt @@ -7,7 +7,8 @@ Table of contents 2. Package names 3. Installation 4. Version history -4.1 Release 1.13 +4.1 Release 1.13 + ============================================== @@ -40,6 +41,12 @@ To install TurboPower OnGuard into your IDE, take the following steps: 4. Version history +4.3 July 27, 2009 + Initial addition of features: + - InvalidCount which allow limited count of valid code even if trial period is expired + (useful due to user mistakes causing incorect system date sometimes) + - instead of logical volume serial number , hardware hdd ide disk serial number is no used if available + - compilation with newest Lazarus SVN problems fixed 4.3 July 28 2009 - initial support for InvalidCount value allowing 'breaking the rules' limited , for example run program a few times if trial period expired diff --git a/components/onguard/source/onguard.pas b/components/onguard/source/onguard.pas index 1989ccf7f..61beb80ec 100644 --- a/components/onguard/source/onguard.pas +++ b/components/onguard/source/onguard.pas @@ -1989,20 +1989,26 @@ begin MixBlock(T128bit(Key), Work, False); Result := (Work.CheckValue = DaysCheckCode) and (ExpandDate(Work.LastAccess) <= Date); + if (not Result) and (Work.InvalidCount >0) then Result := true; end; procedure DecDaysCode(const Key : TKey; var Code : TCode); var X : LongInt; + Valid : Boolean; begin - if not IsDaysCodeValid(Key,Code) then DecInvalidCountCode(Key,Code); MixBlock(T128bit(Key), Code, False); + Valid := (Code.CheckValue = DaysCheckCode) and + (ExpandDate(Code.LastAccess) <= Date); + X := ShrinkDate(Date); if (Code.LastAccess <> X) then begin if Code.Days > 0 then {!!.02} Code.Days := Max(0, Code.Days - 1); {!!.02} Code.LastAccess := X; end; + if (not Valid) and (Code.InvalidCount>0) then + Code.InvalidCount := Code.InvalidCount-1; MixBlock(T128bit(Key), Code, True); end; @@ -2016,7 +2022,10 @@ begin (ExpandDate(Work.LastAccess) <= Date) then Result := Work.Days else + begin Result := 0; + if Work.InvalidCount>0 then Result := Work.Days; + end; end;