![]() |
aus system.pas: used to hack the result to force a failure..
Ich habe durch Zufall folgendes im BDS\4.0\source\Win32\rtl\sys\system.pas entdeckt:
Delphi-Quellcode:
nur aus reiner Neugier - hat jemand eine Idee was das "used to hack the result to force a failure" bedeutet?
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; 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] |
Re: aus system.pas: used to hack the result to force a failu
Vielleicht erhofften die sich, einen Overflow zu produzieren um Lücken Int64-Mul-Code zu finden :)
|
Re: aus system.pas: used to hack the result to force a failu
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; |
Re: aus system.pas: used to hack the result to force a failu
@Heri: Wer nur die Hälfte rauskopiert, verstehts selber nicht ;)
Delphi-Quellcode:
btw. Die Trial- und Personal-Versionen haben nur die compilte System.dcu
{***********************************************************}
{$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.dll' name 'GetLocalTime'; procedure SystemTimeToFileTime(const lpSystemTime: TSystemTime; var Dest: TFileTime); stdcall; external 'kernel32.dll' name '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 Zitat:
Ich würd mal nach 'TRIAL_EDITION' in den Sources suchen ... :coder2: |
Re: aus system.pas: used to hack the result to force a failu
Eine der sinnvollsten Code-Zeilen, die ich seit langem gesehen habe:
Delphi-Quellcode:
:D
// used to hack the result to force a failure for testing:
Days := 1000000000 div 100; |
Re: aus system.pas: used to hack the result to force a failu
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:
Na ja, 's war ja och wahrscheinlich, dat "nur" darin was ist ... dies sind ja die einzigen Units, welche immer eingebunden werden ^^ |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:26 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