1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Removing some unused Jcl code

Source commit: 72d2f60cf89412442d2f4029cb43ae9d02ed2636
This commit is contained in:
Martin Prikryl
2026-10-02 16:01:45 +00:00
parent ea94f08215
commit 86413f4712
5 changed files with 89 additions and 1772 deletions

View File

@@ -108,9 +108,6 @@
<DelphiCompile Include="packages\jcl\JclSysUtils.pas">
<BuildOrder>12</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\jcl\JclTD32.pas">
<BuildOrder>15</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\jcl\JclWin32.pas">
<BuildOrder>13</BuildOrder>
</DelphiCompile>

View File

@@ -357,6 +357,7 @@ function ConvertMapFileToJdbgFile(const MapFileName: TFileName; out LinkerBugUni
function ConvertMapFileToJdbgFile(const MapFileName: TFileName; out LinkerBugUnit: string;
out LineNumberErrors, MapFileSize, JdbgFileSize: Integer): Boolean; overload;
{$IFNDEF WINSCP}
function InsertDebugDataIntoExecutableFile(const ExecutableFileName,
MapFileName: TFileName; out LinkerBugUnit: string;
out MapFileSize, JclDebugDataSize: Integer): Boolean; overload;
@@ -370,6 +371,7 @@ function InsertDebugDataIntoExecutableFile(const ExecutableFileName: TFileName;
function InsertDebugDataIntoExecutableFile(const ExecutableFileName: TFileName;
BinDebug: TJclBinDebugGenerator; out LinkerBugUnit: string;
out MapFileSize, JclDebugDataSize, LineNumberErrors: Integer): Boolean; overload;
{$ENDIF}
// Source Locations
type
@@ -528,6 +530,8 @@ type
function GetAddress(const UnitName, ProcName: string): Pointer; override;
end;
{$IFNDEF WINSCP}
TJclDebugInfoBinary = class(TJclDebugInfoSource)
private
FScanner: TJclBinDebugScanner;
@@ -556,7 +560,6 @@ type
end;
{$IFDEF BORLAND}
{$IFNDEF WINSCP}
TJclDebugInfoTD32 = class(TJclDebugInfoSource)
private
FImage: TJclPeBorTD32Image;
@@ -567,7 +570,6 @@ type
function GetLocationInfo(const Addr: Pointer; out Info: TJclLocationInfo): Boolean; override;
function GetAddress(const UnitName, ProcName: string): Pointer; override;
end;
{$ENDIF ~WINSCP}
{$ENDIF BORLAND}
TJclDebugInfoSymbols = class(TJclDebugInfoSource)
@@ -580,6 +582,7 @@ type
function GetLocationInfo(const Addr: Pointer; out Info: TJclLocationInfo): Boolean; override;
function GetAddress(const UnitName, ProcName: string): Pointer; override;
end;
{$ENDIF ~WINSCP}
// Source location functions
function Caller(Level: Integer = 0; FastStackWalk: Boolean = False): Pointer;
@@ -840,8 +843,10 @@ function JclCreateExceptFrameList(AIgnoreLevels: Integer): TJclExceptFrameList;
function JclLastExceptFrameList: TJclExceptFrameList;
function JclGetExceptFrameList(ThreadID: DWORD): TJclExceptFrameList;
{$IFNDEF WINSCP}
function JclStartExceptionTracking: Boolean;
function JclStopExceptionTracking: Boolean;
{$ENDIF}
function JclExceptionTrackingActive: Boolean;
function JclTrackExceptionsFromLibraries: Boolean;
@@ -1009,8 +1014,10 @@ type
function JclDebugThreadList: TJclDebugThreadList;
{$IFNDEF WINSCP}
function JclHookThreads: Boolean;
function JclUnhookThreads: Boolean;
{$ENDIF WINSCP}
function JclThreadsHooked: Boolean;
// Miscellanuous
@@ -2665,6 +2672,7 @@ begin
end;
end;
{$IFNDEF WINSCP}
function InsertDebugDataIntoExecutableFile(const ExecutableFileName, MapFileName: TFileName;
out LinkerBugUnit: string; out MapFileSize, JclDebugDataSize: Integer): Boolean;
var
@@ -2973,6 +2981,7 @@ begin
if Result then
PeUpdateCheckSum(ExecutableFileName);
end;
{$ENDIF}
//=== { TJclBinDebugGenerator } ==============================================
@@ -4204,6 +4213,8 @@ begin
FScanner := TJclMapScanner.Create(MapFileName, Module);
end;
{$IFNDEF WINSCP}
//=== { TJclDebugInfoBinary } ================================================
destructor TJclDebugInfoBinary.Destroy;
@@ -4457,8 +4468,6 @@ end;
{$IFDEF BORLAND}
{$IFNDEF WINSCP}
//=== { TJclDebugInfoTD32 } ==================================================
destructor TJclDebugInfoTD32.Destroy;
@@ -4512,8 +4521,6 @@ begin
FImage.TD32Scanner.GenerateUnmangledNames;
end;
{$ENDIF ~WINSCP}
{$ENDIF BORLAND}
//=== { TJclDebugInfoSymbols } ===============================================
@@ -4929,6 +4936,8 @@ begin
SymGetLineFromAddrWFunc := nil;
end;
{$ENDIF ~WINSCP}
//=== Source location functions ==============================================
{$STACKFRAMES ON}
@@ -7212,6 +7221,7 @@ begin
end;
end;
{$IFNDEF WINSCP}
function JclStartExceptionTracking: Boolean;
begin
{Increment the tracking count only if exceptions are already being tracked or tracking can be started
@@ -7250,6 +7260,7 @@ begin
Result := False;
end;
end;
{$ENDIF WINSCP}
function JclExceptionTrackingActive: Boolean;
begin
@@ -7309,6 +7320,7 @@ begin
Kernel32_ExitThread(ExitCode);
end;
{$IFNDEF WINSCP}
function JclHookThreads: Boolean;
var
ProcAddrCache: Pointer;
@@ -7352,6 +7364,7 @@ begin
else
Result := True;
end;
{$ENDIF WINSCP}
function JclThreadsHooked: Boolean;
begin
@@ -8292,7 +8305,9 @@ begin
FreeAndNil(IgnoredExceptionClassNames);
FreeAndNil(IgnoredExceptionClassNamesCritSect);
{$IFNDEF WINSCP}
TJclDebugInfoSymbols.CleanupDebugSymbols;
{$ENDIF ~WINSCP}
end;
initialization
@@ -8313,10 +8328,12 @@ finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
{$IFNDEF WINSCP}
{ TODO -oPV -cInvestigate : Calling JclStopExceptionTracking causes linking of various classes to
the code without a real need. Although there doesn't seem to be a way to unhook exceptions
safely because we need to be covered by JclHookExcept.Notifiers critical section }
JclStopExceptionTracking;
{$ENDIF}
GlobalStackList.Clear;
JclDebugFinalized := True;

View File

@@ -77,12 +77,14 @@ function JclRemoveExceptNotifier(const NotifyMethod: TJclExceptNotifyMethod): Bo
procedure JclReplaceExceptObj(NewExceptObj: Exception);
// Exception hooking routines
{$IFNDEF WINSCP}
function JclHookExceptions: Boolean;
function JclUnhookExceptions: Boolean;
function JclExceptionsHooked: Boolean;
function JclHookExceptionsInModule(Module: HMODULE): Boolean;
function JclUnhookExceptionsInModule(Module: HMODULE): Boolean;
{$ENDIF}
// Exceptions hooking in libraries
type
@@ -110,7 +112,9 @@ implementation
uses
JclBase,
{$IFNDEF WINSCP}
JclPeImage,
{$ENDIF}
JclSysInfo, JclSysUtils;
type
@@ -147,7 +151,9 @@ type
end;
var
{$IFNDEF WINSCP}
ExceptionsHooked: Boolean;
{$ENDIF}
Kernel32_RaiseException: procedure (dwExceptionCode, dwExceptionFlags,
nNumberOfArguments: DWORD; lpArguments: PDWORD); stdcall;
{$IFDEF BORLAND}
@@ -606,12 +612,15 @@ begin
hooked separately, so we're covered. }
end;
{$IFNDEF WINSCP}
function HasCppRtl: Boolean;
begin
Result := GetCppRtlBase <> TJclPeMapImgHooks.SystemBase;
end;
{$ENDIF}
{$ENDIF BORLAND}
{$IFNDEF WINSCP}
function JclHookExceptions: Boolean;
var
RaiseExceptionAddressCache: Pointer;
@@ -689,6 +698,7 @@ begin
Result := ExceptionsHooked and
TJclPeMapImgHooks.ReplaceImport(Pointer(Module), kernel32, @HookedRaiseException, @Kernel32_RaiseException);
end;
{$ENDIF}
{$IFDEF HOOK_DLL_EXCEPTIONS}
// Exceptions hooking in libraries

View File

@@ -71,6 +71,7 @@ type
// Base list
EJclPeImageError = class(EJclError);
{$IFNDEF WINSCP}
TJclPeImage = class;
TJclPeImageClass = class of TJclPeImage;
@@ -312,6 +313,8 @@ type
property TotalResolveCheck: TJclPeResolveCheck read FTotalResolveCheck;
end;
{$ENDIF WINSCP}
// Resource section related classes
TJclPeResourceKind = (
rtUnknown0,
@@ -341,6 +344,8 @@ type
rtManifest,
rtUserDefined);
{$IFNDEF WINSCP}
TJclPeResourceList = class;
TJclPeResourceItem = class;
@@ -511,6 +516,8 @@ type
property Image: TJclPeImage read FImage;
end;
{$ENDIF WINSCP}
// PE Image
TJclPeHeader = (
JclPeHeader_Signature,
@@ -579,6 +586,8 @@ type
TJclPeImageStatus = (stNotLoaded, stOk, stNotPE, stNotSupported, stNotFound, stError);
TJclPeTarget = (taUnknown, taWin32, taWin64);
{$IFNDEF WINSCP}
TJclPeImage = class(TObject)
private
FAttachedImage: Boolean;
@@ -853,6 +862,8 @@ type
property OnProcessFile: TJclPeNameSearchNotifyEvent read FOnProcessFile write FOnProcessFile;
end;
{$ENDIF}
// PE Image miscellaneous functions
type
TJclRebaseImageInfo32 = record
@@ -882,7 +893,9 @@ function PeGetNtHeaders64(const FileName: TFileName; out NtHeaders: TImageNtHead
{ Image modifications }
{$IFNDEF WINSCP}
function PeCreateNameHintTable(const FileName: TFileName): Boolean;
{$ENDIF WINSCP}
// use PeRebaseImage32
//function PeRebaseImage(const ImageName: TFileName; NewBase: DWORD = 0; TimeStamp: DWORD = 0;
@@ -892,20 +905,25 @@ function PeRebaseImage32(const ImageName: TFileName; NewBase: TJclAddr32 = 0; Ti
function PeRebaseImage64(const ImageName: TFileName; NewBase: TJclAddr64 = 0; TimeStamp: DWORD = 0;
MaxNewSize: DWORD = 0): TJclRebaseImageInfo64;
{$IFNDEF WINSCP}
function PeUpdateLinkerTimeStamp(const FileName: TFileName; const Time: TDateTime): Boolean;
function PeReadLinkerTimeStamp(const FileName: TFileName): TDateTime;
{$ENDIF WINSCP}
function PeInsertSection(const FileName: TFileName; SectionStream: TStream; SectionName: string): Boolean;
{ Image Checksum }
{$IFNDEF WINSCP}
function PeVerifyCheckSum(const FileName: TFileName): Boolean;
{$ENDIF WINSCP}
function PeClearCheckSum(const FileName: TFileName): Boolean;
function PeUpdateCheckSum(const FileName: TFileName): Boolean;
// Various simple PE Image searching and listing routines
{ Exports searching }
{$IFNDEF WINSCP}
function PeDoesExportFunction(const FileName: TFileName; const FunctionName: string;
Options: TJclSmartCompOptions = []): Boolean;
@@ -955,6 +973,7 @@ function PeFindMissingImports(const FileName: TFileName; MissingImportsList: TSt
function PeFindMissingImports(RequiredImportsList, MissingImportsList: TStrings): Boolean; overload;
function PeCreateRequiredImportList(const FileName: TFileName; RequiredImportsList: TStrings): Boolean;
{$ENDIF WINSCP}
// Mapped or loaded image related routines
// use PeMapImgNtHeaders32
@@ -1003,12 +1022,16 @@ function PeMapImgFindSection(const ImageSectionHeaders: TImageSectionHeaderArray
function PeMapImgFindSectionFromModule(const BaseAddress: Pointer;
const SectionName: string): PImageSectionHeader;
{$IFNDEF WINSCP}
function PeMapImgExportedVariables(const Module: HMODULE; const VariablesList: TStrings): Boolean;
{$ENDIF WINSCP}
function PeMapImgResolvePackageThunk(Address: Pointer): Pointer;
{$IFNDEF WINSCP}
function PeMapFindResource(const Module: HMODULE; const ResourceType: PChar;
const ResourceName: string): Pointer;
{$ENDIF WINSCP}
type
TJclPeSectionStream = class(TCustomMemoryStream)
@@ -1129,7 +1152,7 @@ uses
Character,
{$ENDIF HAS_UNIT_CHARACTER}
{$ENDIF ~HAS_UNITSCOPE}
{$IFNDEF WINSCP}JclLogic,{$ELSE}Math, System.AnsiStrings, {$ENDIF ~WINSCP} JclResources, JclSysUtils, JclAnsiStrings, JclStrings{$IFNDEF WINSCP}, JclStringConversions{$ENDIF ~WINSCP}, JclTD32;
{$IFNDEF WINSCP}JclLogic,{$ELSE}Math, System.AnsiStrings, {$ENDIF ~WINSCP} JclResources, JclSysUtils, JclAnsiStrings, JclStrings{$IFNDEF WINSCP}, JclStringConversions, JclTD32{$ENDIF ~WINSCP};
const
MANIFESTExtension = '.manifest';
@@ -1199,6 +1222,8 @@ begin
Result := (StrIComp(T1, T2) = 0);
end;
{$IFNDEF WINSCP}
function CreatePeImage(const FileName: TFileName): TJclPeImage;
begin
Result := TJclPeImage.Create(True);
@@ -1254,6 +1279,8 @@ begin
end;
end;
{$ENDIF}
// Smart name compare function
function PeStripFunctionAW(const FunctionName: string): string;
var
@@ -1293,6 +1320,8 @@ begin
end;
end;
{$IFNDEF WINSCP}
//=== { TJclPeImagesCache } ==================================================
constructor TJclPeImagesCache.Create;
@@ -5003,6 +5032,8 @@ begin
{$ENDIF ~RTL210_UP}
end;
{$ENDIF WINSCP}
//=== PE Image miscellaneous functions =======================================
function IsValidPeFile(const FileName: TFileName): Boolean;
@@ -5083,6 +5114,8 @@ begin
end;
end;
{$IFNDEF WINSCP}
function PeCreateNameHintTable(const FileName: TFileName): Boolean;
var
PeImage, ExportsImage: TJclPeImage;
@@ -5179,6 +5212,8 @@ begin
end;
end;
{$ENDIF WINSCP}
function PeRebaseImage32(const ImageName: TFileName; NewBase: TJclAddr32;
TimeStamp, MaxNewSize: DWORD): TJclRebaseImageInfo32;
@@ -5260,6 +5295,8 @@ begin
end;
end;
{$IFNDEF WINSCP}
function PeUpdateLinkerTimeStamp(const FileName: TFileName; const Time: TDateTime): Boolean;
var
Mapping: TJclFileMapping;
@@ -5297,6 +5334,8 @@ begin
end;
end;
{$ENDIF WINSCP}
{ TODO -cHelp : Author: Uwe Schuster(just a generic version of JclDebug.InsertDebugDataIntoExecutableFile) }
function PeInsertSection(const FileName: TFileName; SectionStream: TStream; SectionName: string): Boolean;
procedure RoundUpToAlignment(var Value: DWORD; Alignment: DWORD);
@@ -5579,6 +5618,8 @@ begin
end;
end;
{$IFNDEF WINSCP}
function PeVerifyCheckSum(const FileName: TFileName): Boolean;
begin
with CreatePeImage(FileName) do
@@ -5589,6 +5630,8 @@ begin
end;
end;
{$ENDIF WINSCP}
function PeClearCheckSum(const FileName: TFileName): Boolean;
function PeClearCheckSum32(ModuleAddress: Pointer): Boolean;
var
@@ -5642,6 +5685,8 @@ end;
// Various simple PE Image searching and listing routines
{$IFNDEF WINSCP}
function PeDoesExportFunction(const FileName: TFileName; const FunctionName: string;
Options: TJclSmartCompOptions): Boolean;
begin
@@ -6000,6 +6045,8 @@ begin
Result := PeImportedFunctions(FileName, RequiredImportsList, '', True);
end;
{$ENDIF WINSCP}
// Mapped or loaded image related functions
function PeMapImgNtHeaders32(const BaseAddress: Pointer): PImageNtHeaders32;
@@ -6400,6 +6447,8 @@ begin
end;
end;
{$IFNDEF WINSCP}
function PeMapImgExportedVariables(const Module: HMODULE; const VariablesList: TStrings): Boolean;
var
I: Integer;
@@ -6426,6 +6475,8 @@ begin
end;
end;
{$ENDIF WINSCP}
function PeMapImgResolvePackageThunk(Address: Pointer): Pointer;
{$IFDEF BORLAND}
const
@@ -6464,6 +6515,8 @@ begin
end;
{$ENDIF FPC}
{$IFNDEF WINSCP}
function PeMapFindResource(const Module: HMODULE; const ResourceType: PChar;
const ResourceName: string): Pointer;
var
@@ -6484,6 +6537,8 @@ begin
end;
end;
{$ENDIF WINSCP}
//=== { TJclPeSectionStream } ================================================
constructor TJclPeSectionStream.Create(Instance: HMODULE; const ASectionName: string);

File diff suppressed because it is too large Load Diff