AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi aus system.pas: used to hack the result to force a failure..
Thema durchsuchen
Ansicht
Themen-Optionen

aus system.pas: used to hack the result to force a failure..

Ein Thema von heri · begonnen am 16. Jun 2006 · letzter Beitrag vom 18. Jun 2006
 
Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#4

Re: aus system.pas: used to hack the result to force a failu

  Alt 17. Jun 2006, 23:08
@Heri: Wer nur die Hälfte rauskopiert, verstehts selber nicht

Delphi-Quellcode:
{***********************************************************}
{$IFDEF TRIAL_EDITION}
{
   This code is used as part of the timeout test for
   applications built with trial editions of the product.  It provides
    the current local time in a format native to the platform in question.

    The linker will generate a checksum of _InitUnitPrep that it will
    place into linked units.  The code generated for _InitUnitPrep must
    not contain fixups actually in the image, as this could alter the
    code at load time, invalidating the checksum.  Take great care to
    make sure that this code is entirely position independent on all
    platforms and circumstances to avoid a serious problem!
}

{$IFDEF MSWINDOWS}
type
  TSystemTime = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;
  TFileTime = record
        LowTime: Integer;
        HighTime: Integer;
  end;


procedure GetLocalTime(var lpSystemTime: TSystemTime); stdcall; external 'kernel32.dllname 'GetLocalTime';
procedure SystemTimeToFileTime(const lpSystemTime: TSystemTime; var Dest: TFileTime); stdcall; external 'kernel32.dllname 'SystemTimeToFileTime';

function _InitUnitPrep: Int64;
var
  SystemTime: TSystemTime;
  FileTime: TFileTime;
  Days: Int64;
begin
  GetLocalTime(SystemTime);
  SystemTimeToFileTime(SystemTime, FileTime);

    // used to hack the result to force a failure for testing:
  Days := 1000000000 div 100;
  Days := Days * 3600;
  Days := Days * 24;
  Days := Days * 31;
  Days := 0;

  Result := Int64(FileTime) + Days;
// Dec(InitContext.InitTable^.UnitCount);
end;
{$ENDIF}
{$IFDEF LINUX}

function _InitUnitPrep: Integer;
var
  Days: Integer;
begin
  Days := 0; // used to hack the result to force a failure for testing
    Result := _time(nil) + Days;
end;
{$ENDIF}

resourcestring
{$IFDEF LINUX}
  SExpiredMsg =
  'This module was compiled with a trial version of Kylix.'+#10+
  'The trial period has expired.'+#10;
{$ENDIF}
{$IFDEF MSWINDOWS}
  SExpiredMsg =
  'This module was compiled with a trial version of Delphi.'+#13+#10+
  'The trial period has expired.'+#13+#10;
{$ENDIF}
var
  ExpiredMsg: String;

procedure _Expired;
{$IFDEF MSWINDOWS}
var
  Dummy: Cardinal;
begin
  ExpiredMsg := LoadResString(@SExpiredMsg);
  if IsConsole then
    WriteFile(GetStdHandle(STD_ERROR_HANDLE), PChar(ExpiredMsg), Length(ExpiredMsg), Dummy, nil)
  else
    MessageBox(0, PChar(ExpiredMsg), errCaption, 0);
{$ENDIF}
{$IFDEF LINUX}
begin
  ExpiredMsg := LoadResString(@SExpiredMsg);
  __write(2, PChar(ExpiredMsg), Length(ExpiredMsg));
{$ENDIF}
  Halt(232);
end;

{$ENDIF}   //TRIAL_EDITION
btw. Die Trial- und Personal-Versionen haben nur die compilte System.dcu

Zitat:
This code is used as part of the timeout test for
applications built with trial editions of the product.
... as part of ... anscheinend hat sich Borland noch was anderes einfallen lassen

Ich würd mal nach 'TRIAL_EDITION' in den Sources suchen ...
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:43 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz