Recent

Author Topic: OnGuard troubles with TOgDateCode and Machine Modifier  (Read 675 times)

tatamata

  • Hero Member
  • *****
  • Posts: 804
    • ZMSQL - SQL enhanced in-memory database
Re: OnGuard troubles with TOgDateCode and Machine Modifier
« Reply #15 on: February 17, 2025, 07:36:50 pm »
Well, yes, it works, being called from another form unit...
It doesn't require init it seems...working with high-level OnGuard components, rather than low-level routines.
Fuck me, I don't know why, but it works!  :D

wp

  • Hero Member
  • *****
  • Posts: 12695
Re: OnGuard troubles with TOgDateCode and Machine Modifier
« Reply #16 on: February 17, 2025, 07:55:28 pm »
So, the task is to merge the official sources into the ccr fork, then send this update to the official site and hope that there is still somebody who can update it. And even if this is does not happen OPM should be updated to the then newest version.
No - I think I stop this. I get the impression that nobody has compiled the Lazarus packages in https://sourceforge.net/p/tponguard/code/HEAD/tree/ recently...

tatamata

  • Hero Member
  • *****
  • Posts: 804
    • ZMSQL - SQL enhanced in-memory database
Re: OnGuard troubles with TOgDateCode and Machine Modifier
« Reply #17 on: February 17, 2025, 08:06:01 pm »
Well, yes, it works, being called from another form unit...
It doesn't require init it seems...working with high-level OnGuard components, rather than low-level routines.
Fuck me, I don't know why, but it works!  :D
@rvk I think I am starting to understand what are you speaking about. It seems init is needed for volatile code types, such as "Days" and "Uses".
I first need to learn how it works...

rvk

  • Hero Member
  • *****
  • Posts: 6693
Re: OnGuard troubles with TOgDateCode and Machine Modifier
« Reply #18 on: February 17, 2025, 08:14:32 pm »
@rvk I think I am starting to understand what are you speaking about. It seems init is need for volatile code types, such as "Days" and "Uses".
I first need to learn how it works...
Yes. Look in the onguard.pas. The types of guard types are grouped together. Each one has its own InitXXX procedure. You can use that one on the buffer in which you create the data (with one or multiple ApplyModifierToKeyPrim calls).

There is a manual here
https://sourceforge.net/projects/tponguard/files/tponguard_docs/1.13/

I've only ever used the low level functions. Never the components.

tatamata

  • Hero Member
  • *****
  • Posts: 804
    • ZMSQL - SQL enhanced in-memory database
Re: OnGuard troubles with TOgDateCode and Machine Modifier
« Reply #19 on: February 23, 2025, 05:52:13 pm »
Attaching (see attachment ulicensemanager.pas) my ULicenseManager unit, intended for validation and activation of license code being generated by OnGuard demo program for license codes generation (check in CodeOcean).
It works with CodeTyphon 8.50.
You will see some terrible hacks inside, for example for proper interpretation of encoded dates. It should be probably much better to debug the OnGuard itself. But, hey, it works! :-)

It can be used something like this:

Code: Pascal  [Select][+][-]
  1. procedure TAboutForm.CheckLicense;
  2. var
  3.   LM: TLicenseManager;
  4.   Details: string;
  5.   NewCode: string;
  6. begin
  7.   LM := TLicenseManager.Create(Self);
  8.   try
  9.     if LM.ActivateLicense(EditLicenseCode.Text, EditMachineCode.Text, Details) then
  10.     begin
  11.       LabelLicenseStatus.Caption := 'License: VALID';
  12.       MemoLicenseStatusDetails.Lines.Text := Details;
  13.       MainForm.IsLicenseActive := True;
  14.  
  15.       // Critical update: Refresh license code from storage
  16.       NewCode := ReadLicenseCode;  // Or use LM's method if available
  17.       EditLicenseCode.Text := NewCode;  // Update UI with new license code
  18.       {$IFDEF DebuggingMode}
  19.       DebugLog('🔄 UI License Code Updated: ' + NewCode);
  20.       {$ENDIF}
  21.     end
  22.     else
  23.     begin
  24.       LabelLicenseStatus.Caption := 'License: INVALID';
  25.       MemoLicenseStatusDetails.Lines.Text :=
  26.         'Activation Failed' + sLineBreak + Details;
  27.       MainForm.IsLicenseActive := False;
  28.     end;
  29.   finally
  30.     LM.Free;
  31.   end;
  32. end;
       
« Last Edit: February 23, 2025, 05:54:02 pm by tatamata »

 

TinyPortal © 2005-2018