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
Antwort Antwort
heri

Registriert seit: 20. Mär 2006
81 Beiträge
 
Delphi 2006 Enterprise
 
#1

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

  Alt 16. Jun 2006, 18:04
Ich habe durch Zufall folgendes im BDS\4.0\source\Win32\rtl\sys\system.pas entdeckt:

Delphi-Quellcode:
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;
nur aus reiner Neugier - hat jemand eine Idee was das "used to hack the result to force a failure" bedeutet?
schon interessant was man so alles im source von delphi entdeckt :)

[edit=r_kerber]Delphi-Tags eingefügt. Das nächste Mal bitte selbst daran denken. Mfg, r_kerber[/edit]
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#2

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

  Alt 16. Jun 2006, 18:11
Vielleicht erhofften die sich, einen Overflow zu produzieren um Lücken Int64-Mul-Code zu finden
  Mit Zitat antworten Zitat
Benutzerbild von Union
Union

Registriert seit: 18. Mär 2004
Ort: Luxembourg
3.487 Beiträge
 
Delphi 7 Enterprise
 
#3

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

  Alt 17. Jun 2006, 10:30
Die Kommentare zu der Funktion solltest Du auch lesen - Diese wird nur bei der Trial-Version mitcompiliert und sorgt dafür, dass die damit erstellten Anwendungen nur für eine bestimmte Dauer lauffähig sind.
Delphi-Quellcode:
SExpiredMsg =
  'Dieses Modul wurde mit Demo-Version von Delphi compiliert.'+#10+
  'Die Demo-Version ist abgelaufen.'+#10;
Ibi fas ubi proxima merces
sudo /Developer/Library/uninstall-devtools --mode=all
  Mit Zitat antworten Zitat
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
Sascha L

Registriert seit: 4. Jun 2004
Ort: Hamm
390 Beiträge
 
Delphi 2006 Professional
 
#5

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

  Alt 18. Jun 2006, 08:01
Eine der sinnvollsten Code-Zeilen, die ich seit langem gesehen habe:

Delphi-Quellcode:
// used to hack the result to force a failure for testing:
  Days := 1000000000 div 100;
Sascha
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.132 Beiträge
 
Delphi 12 Athens
 
#6

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

  Alt 18. Jun 2006, 08:19
Es hat doch keiner behauptet, daß diese Zeilen "sinnvoll" sein sollen, die sollen halt nur (irgendwie) nach 'ner Weile 'nen Fehler auslösen, in den mit 'ner Trial-Version erstellten Programmen.

Ich kann zwar an diesen paar Zeilen nicht erkennen, wie/wann/was/wo da irgendwann mal ein Fehler auftreten sollte.

PS: konnte bisher nur derartig

Zitat von Amnon82:
Ich würd mal nach 'TRIAL_EDITION' in den Sources suchen ...
Du meinst dat in System und SysInit?

Na ja, 's war ja och wahrscheinlich, dat "nur" darin was ist ... dies sind ja die einzigen Units, welche immer eingebunden werden ^^
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Antwort Antwort


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 11:40 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz