Стартовый пул
This commit is contained in:
23
fwzip/Demos/ZipAnalizer2/ZipAnalizer2.dpr
Normal file
23
fwzip/Demos/ZipAnalizer2/ZipAnalizer2.dpr
Normal file
@@ -0,0 +1,23 @@
|
||||
program ZipAnalizer2;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE Delphi}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
{$IFnDEF FPC}
|
||||
{$ELSE}
|
||||
Interfaces,
|
||||
{$ENDIF}
|
||||
Forms,
|
||||
uZipAnalizer2 in 'uZipAnalizer2.pas' {dlgZipAnalizer};
|
||||
|
||||
{$IFNDEF FPC}
|
||||
{$R *.res}
|
||||
{$ENDIF}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TdlgZipAnalizer, dlgZipAnalizer);
|
||||
Application.Run;
|
||||
end.
|
173
fwzip/Demos/ZipAnalizer2/ZipAnalizer2.dproj
Normal file
173
fwzip/Demos/ZipAnalizer2/ZipAnalizer2.dproj
Normal file
@@ -0,0 +1,173 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{59E61B6B-6187-41F8-947A-693BE9101356}</ProjectGuid>
|
||||
<MainSource>ZipAnalizer2.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<ProjectVersion>19.2</ProjectVersion>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||
<Base_Win64>true</Base_Win64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
|
||||
<Cfg_2_Win32>true</Cfg_2_Win32>
|
||||
<CfgParent>Cfg_2</CfgParent>
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_ImageBase>00400000</DCC_ImageBase>
|
||||
<DCC_E>false</DCC_E>
|
||||
<VerInfo_Locale>1049</VerInfo_Locale>
|
||||
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;UIDeviceFamily=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;UISupportedInterfaceOrientations=;CFBundleExecutable=;CFBundleResourceSpecification=;LSRequiresIPhoneOS=;CFBundleInfoDictionaryVersion=;CFBundleDevelopmentRegion=</VerInfo_Keys>
|
||||
<DCC_S>false</DCC_S>
|
||||
<SanitizedProjectName>ZipAnalizer2</SanitizedProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<Icon_MainIcon>ZipAnalizer_Icon.ico</Icon_MainIcon>
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
|
||||
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
<Icon_MainIcon>ZipAnalizer_Icon.ico</Icon_MainIcon>
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
|
||||
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<DCC_UnitSearchPath>../../;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="uZipAnalizer2.pas">
|
||||
<Form>dlgZipAnalizer</Form>
|
||||
</DCCReference>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType/>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">ZipAnalizer2.dpr</Source>
|
||||
</Source>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1049</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1251</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"/>
|
||||
<VersionInfoKeys Name="FileDescription"/>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"/>
|
||||
<VersionInfoKeys Name="LegalCopyright"/>
|
||||
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||
<VersionInfoKeys Name="OriginalFilename"/>
|
||||
<VersionInfoKeys Name="ProductName"/>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"/>
|
||||
<VersionInfoKeys Name="CFBundleName"/>
|
||||
<VersionInfoKeys Name="CFBundleDisplayName"/>
|
||||
<VersionInfoKeys Name="UIDeviceFamily"/>
|
||||
<VersionInfoKeys Name="CFBundleIdentifier"/>
|
||||
<VersionInfoKeys Name="CFBundleVersion"/>
|
||||
<VersionInfoKeys Name="CFBundlePackageType"/>
|
||||
<VersionInfoKeys Name="CFBundleSignature"/>
|
||||
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
|
||||
<VersionInfoKeys Name="UISupportedInterfaceOrientations"/>
|
||||
<VersionInfoKeys Name="CFBundleExecutable"/>
|
||||
<VersionInfoKeys Name="CFBundleResourceSpecification"/>
|
||||
<VersionInfoKeys Name="LSRequiresIPhoneOS"/>
|
||||
<VersionInfoKeys Name="CFBundleInfoDictionaryVersion"/>
|
||||
<VersionInfoKeys Name="CFBundleDevelopmentRegion"/>
|
||||
</VersionInfoKeys>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k270.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp270.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||
</Project>
|
88
fwzip/Demos/ZipAnalizer2/ZipAnalizer2.lpi
Normal file
88
fwzip/Demos/ZipAnalizer2/ZipAnalizer2.lpi
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="ZipAnalizer2"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="ZipAnalizer2.dpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="uZipAnalizer2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="dlgZipAnalizer"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="..\..;$(ProjOutDir)"/>
|
||||
<Libraries Value="..\..\fpc_lib"/>
|
||||
<OtherUnitFiles Value="..\.."/>
|
||||
<UnitOutputDirectory Value="."/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
BIN
fwzip/Demos/ZipAnalizer2/ZipAnalizer_Icon.ico
Normal file
BIN
fwzip/Demos/ZipAnalizer2/ZipAnalizer_Icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 290 KiB |
24
fwzip/Demos/ZipAnalizer2/clear.bat
Normal file
24
fwzip/Demos/ZipAnalizer2/clear.bat
Normal file
@@ -0,0 +1,24 @@
|
||||
rd /S /Q "%cd%\backup\"
|
||||
rd /S /Q "%cd%\ConverterBackup\"
|
||||
rd /S /Q "%cd%\lib\"
|
||||
rd /S /Q "%cd%\__history\"
|
||||
rd /S /Q "%cd%\__recovery\"
|
||||
del "%cd%\*.o"
|
||||
del "%cd%\*.a"
|
||||
del "%cd%\*.or"
|
||||
del "%cd%\*.lps"
|
||||
del "%cd%\*.obj"
|
||||
del "%cd%\*.exe"
|
||||
del "%cd%\*.ppu"
|
||||
del "%cd%\*.dcu"
|
||||
del "%cd%\*.log"
|
||||
del "%cd%\*.compiled"
|
||||
del "%cd%\*.cfg"
|
||||
del "%cd%\*.dof"
|
||||
del "%cd%\*.dproj.local"
|
||||
del "%cd%\*.identcache"
|
||||
del "%cd%\*.dsk"
|
||||
del "%cd%\*.skincfg"
|
||||
del "%cd%\*.bak"
|
||||
del "%cd%\*.rsm"
|
||||
del "%cd%\*.~*"
|
102
fwzip/Demos/ZipAnalizer2/uZipAnalizer2.dfm
Normal file
102
fwzip/Demos/ZipAnalizer2/uZipAnalizer2.dfm
Normal file
@@ -0,0 +1,102 @@
|
||||
object dlgZipAnalizer: TdlgZipAnalizer
|
||||
Left = 301
|
||||
Top = 184
|
||||
Caption = #1042#1099#1074#1086#1076' '#1087#1072#1088#1072#1084#1077#1090#1088#1086#1074' ZIP '#1072#1088#1093#1080#1074#1072
|
||||
ClientHeight = 300
|
||||
ClientWidth = 685
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
DesignSize = (
|
||||
685
|
||||
300)
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object edPath: TLabeledEdit
|
||||
Left = 8
|
||||
Top = 24
|
||||
Width = 550
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
EditLabel.Width = 124
|
||||
EditLabel.Height = 13
|
||||
EditLabel.Caption = #1059#1082#1072#1078#1080#1090#1077' '#1087#1091#1090#1100' '#1082' '#1072#1088#1093#1080#1074#1091':'
|
||||
TabOrder = 0
|
||||
OnChange = edPathChange
|
||||
end
|
||||
object btnBrowse: TButton
|
||||
Left = 560
|
||||
Top = 22
|
||||
Width = 25
|
||||
Height = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = '...'
|
||||
TabOrder = 1
|
||||
OnClick = btnBrowseClick
|
||||
end
|
||||
object btnAnalize: TButton
|
||||
Left = 591
|
||||
Top = 22
|
||||
Width = 75
|
||||
Height = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = #1057#1090#1072#1088#1090
|
||||
Enabled = False
|
||||
TabOrder = 2
|
||||
OnClick = btnAnalizeClick
|
||||
end
|
||||
object GroupBox: TGroupBox
|
||||
Left = 8
|
||||
Top = 56
|
||||
Width = 669
|
||||
Height = 233
|
||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||
Caption = #1055#1072#1088#1072#1084#1077#1090#1088#1099' '#1072#1088#1093#1080#1074#1072':'
|
||||
TabOrder = 3
|
||||
object edReport: TMemo
|
||||
Left = 2
|
||||
Top = 15
|
||||
Width = 665
|
||||
Height = 216
|
||||
Align = alClient
|
||||
Font.Charset = RUSSIAN_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
PopupMenu = PopupMenu
|
||||
ReadOnly = True
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = 'zip'
|
||||
Filter = 'ZIP '#1072#1088#1093#1080#1074#1099' (*.zip)|*.zip|'#1042#1089#1077' '#1092#1072#1081#1083#1099' (*.*)|*.*'
|
||||
Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
|
||||
Left = 48
|
||||
Top = 88
|
||||
end
|
||||
object PopupMenu: TPopupMenu
|
||||
OnPopup = PopupMenuPopup
|
||||
Left = 120
|
||||
Top = 88
|
||||
object mnuSave: TMenuItem
|
||||
Caption = #1057#1086#1093#1088#1072#1085#1080#1090#1100'...'
|
||||
ShortCut = 16467
|
||||
OnClick = mnuSaveClick
|
||||
end
|
||||
end
|
||||
object SaveDialog: TSaveDialog
|
||||
DefaultExt = 'txt'
|
||||
Filter = #1058#1077#1082#1089#1090#1086#1074#1099#1077' '#1092#1072#1081#1083#1099' (*.txt)|*.txt|'#1042#1089#1077' '#1092#1072#1081#1083#1099' (*.*)|*.*'
|
||||
Left = 208
|
||||
Top = 88
|
||||
end
|
||||
end
|
101
fwzip/Demos/ZipAnalizer2/uZipAnalizer2.lfm
Normal file
101
fwzip/Demos/ZipAnalizer2/uZipAnalizer2.lfm
Normal file
@@ -0,0 +1,101 @@
|
||||
object dlgZipAnalizer: TdlgZipAnalizer
|
||||
Left = 301
|
||||
Height = 300
|
||||
Top = 184
|
||||
Width = 685
|
||||
Caption = 'Вывод параметров ZIP архива'
|
||||
ClientHeight = 300
|
||||
ClientWidth = 685
|
||||
Color = clBtnFace
|
||||
DesignTimePPI = 144
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.2.6.0'
|
||||
object edPath: TLabeledEdit
|
||||
Left = 8
|
||||
Height = 21
|
||||
Top = 24
|
||||
Width = 550
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
EditLabel.Height = 13
|
||||
EditLabel.Width = 550
|
||||
EditLabel.Caption = 'Укажите путь к архиву:'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 0
|
||||
Text = 'E:\2\tst.zip'
|
||||
OnChange = edPathChange
|
||||
end
|
||||
object btnBrowse: TButton
|
||||
Left = 560
|
||||
Height = 25
|
||||
Top = 22
|
||||
Width = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = '...'
|
||||
OnClick = btnBrowseClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnAnalize: TButton
|
||||
Left = 591
|
||||
Height = 25
|
||||
Top = 22
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'Старт'
|
||||
Enabled = False
|
||||
OnClick = btnAnalizeClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object GroupBox: TGroupBox
|
||||
Left = 8
|
||||
Height = 233
|
||||
Top = 56
|
||||
Width = 669
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Caption = 'Параметры архива:'
|
||||
ClientHeight = 215
|
||||
ClientWidth = 665
|
||||
TabOrder = 3
|
||||
object edReport: TMemo
|
||||
Left = 0
|
||||
Height = 215
|
||||
Top = 0
|
||||
Width = 665
|
||||
Align = alClient
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
ParentFont = False
|
||||
PopupMenu = PopupMenu
|
||||
ReadOnly = True
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = '.zip'
|
||||
Filter = 'ZIP архивы (*.zip)|*.zip|Все файлы (*.*)|*.*'
|
||||
Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
|
||||
Left = 48
|
||||
Top = 88
|
||||
end
|
||||
object PopupMenu: TPopupMenu
|
||||
OnPopup = PopupMenuPopup
|
||||
Left = 120
|
||||
Top = 88
|
||||
object mnuSave: TMenuItem
|
||||
Caption = 'Сохранить...'
|
||||
ShortCut = 16467
|
||||
OnClick = mnuSaveClick
|
||||
end
|
||||
end
|
||||
object SaveDialog: TSaveDialog
|
||||
DefaultExt = '.txt'
|
||||
Filter = 'Текстовые файлы (*.txt)|*.txt|Все файлы (*.*)|*.*'
|
||||
Left = 208
|
||||
Top = 88
|
||||
end
|
||||
end
|
642
fwzip/Demos/ZipAnalizer2/uZipAnalizer2.pas
Normal file
642
fwzip/Demos/ZipAnalizer2/uZipAnalizer2.pas
Normal file
@@ -0,0 +1,642 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ****************************************************************************
|
||||
// * Project : FWZip - ZipAnalizer2
|
||||
// * Unit Name : uZipAnalizer2
|
||||
// * Purpose : Вывод параметров архива при помощи поиска сигнатур
|
||||
// * Author : Александр (Rouse_) Багель
|
||||
// * Copyright : © Fangorn Wizards Lab 1998 - 2023.
|
||||
// * Version : 2.0.0
|
||||
// * Home Page : http://rouse.drkb.ru
|
||||
// * Home Blog : http://alexander-bagel.blogspot.ru
|
||||
// ****************************************************************************
|
||||
// * Stable Release : http://rouse.drkb.ru/components.php#fwzip
|
||||
// * Latest Source : https://github.com/AlexanderBagel/FWZip
|
||||
// ****************************************************************************
|
||||
//
|
||||
// Используемые источники:
|
||||
// ftp://ftp.info-zip.org/pub/infozip/doc/appnote-iz-latest.zip
|
||||
// https://zlib.net/zlib-1.2.13.tar.gz
|
||||
// http://www.base2ti.com/
|
||||
//
|
||||
|
||||
unit uZipAnalizer2;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE Delphi}
|
||||
{$H+}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLIntf, LCLType,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Controls, Forms,
|
||||
Dialogs, StdCtrls, ComCtrls, ExtCtrls, Menus,
|
||||
FWZipConsts, FWZipZLib, FWZipUtils;
|
||||
|
||||
type
|
||||
TdlgZipAnalizer = class(TForm)
|
||||
edPath: TLabeledEdit;
|
||||
btnBrowse: TButton;
|
||||
btnAnalize: TButton;
|
||||
GroupBox: TGroupBox;
|
||||
edReport: TMemo;
|
||||
OpenDialog: TOpenDialog;
|
||||
PopupMenu: TPopupMenu;
|
||||
mnuSave: TMenuItem;
|
||||
SaveDialog: TSaveDialog;
|
||||
procedure btnBrowseClick(Sender: TObject);
|
||||
procedure edPathChange(Sender: TObject);
|
||||
procedure btnAnalizeClick(Sender: TObject);
|
||||
procedure mnuSaveClick(Sender: TObject);
|
||||
procedure PopupMenuPopup(Sender: TObject);
|
||||
private
|
||||
procedure Log(const Value: string);
|
||||
procedure Scan(const Value: string);
|
||||
function FindSing(Stream: TStream): DWORD;
|
||||
procedure ShowLocalFileHeader(Stream: TStream);
|
||||
procedure ShowDataDescryptor(Stream: TStream);
|
||||
procedure ShowCentralFileHeader(Stream: TStream);
|
||||
procedure ShowExtraFields(Stream: TStream; Size: Integer;
|
||||
FileHeader: TCentralDirectoryFileHeader);
|
||||
procedure ShowZip64(Stream: TStream);
|
||||
procedure ShowZip64Locator(Stream: TStream);
|
||||
procedure ShowEndOfCentralDir(Stream: TStream);
|
||||
procedure LoadStringValue(Stream: TStream; out Value: string;
|
||||
nSize: Cardinal; UTF: Boolean);
|
||||
end;
|
||||
|
||||
var
|
||||
dlgZipAnalizer: TdlgZipAnalizer;
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
Delim = '===================================================================';
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
function CompressionMethodToStr(Value: Integer): string;
|
||||
begin
|
||||
case Value of
|
||||
Z_NO_COMPRESSION: Result := 'NO_COMPRESSION';
|
||||
Z_DEFLATED: Result := 'DEFLATE';
|
||||
1: Result := 'Shrunk';
|
||||
2..5: Result := 'Reduced with compression factor ' + IntToStr(Value - 1);
|
||||
6: Result := 'Imploding';
|
||||
9: Result := 'DEFLATE64';
|
||||
10: Result := 'PKWARE Imploding';
|
||||
11, 13, 15..17: Result := 'Reserved by PKWARE';
|
||||
12: Result := 'BZIP2';
|
||||
14: Result := 'LZMA';
|
||||
18: Result := 'IBM TERSE';
|
||||
19: Result := 'IBM LZ77';
|
||||
97: Result := 'WavPack';
|
||||
98: Result := 'PPMd';
|
||||
else
|
||||
Result := 'unknown';
|
||||
end;
|
||||
end;
|
||||
|
||||
function GPBFToStr(Value: Word): string;
|
||||
|
||||
procedure AddValue(const S: string);
|
||||
begin
|
||||
if Result = '' then
|
||||
Result := S
|
||||
else
|
||||
Result := Result + ', ' + S;
|
||||
end;
|
||||
|
||||
begin
|
||||
if Value = 0 then
|
||||
begin
|
||||
Result := 'PBF_COMPRESS_NORMAL';
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (Value and 7) in [PBF_COMPRESS_NORMAL, PBF_CRYPTED] then
|
||||
AddValue('PBF_COMPRESS_NORMAL');
|
||||
|
||||
case Value and 6 of
|
||||
PBF_COMPRESS_MAXIMUM: AddValue('PBF_COMPRESS_MAXIMUM');
|
||||
PBF_COMPRESS_FAST: AddValue('PBF_COMPRESS_FAST');
|
||||
PBF_COMPRESS_SUPERFAST: AddValue('PBF_COMPRESS_SUPERFAST');
|
||||
end;
|
||||
|
||||
if PBF_CRYPTED and Value = PBF_CRYPTED then
|
||||
AddValue('PBF_CRYPTED');
|
||||
|
||||
if PBF_DESCRIPTOR and Value = PBF_DESCRIPTOR then
|
||||
AddValue('PBF_DESCRIPTOR');
|
||||
|
||||
if PBF_UTF8 and Value = PBF_UTF8 then
|
||||
AddValue('PBF_UTF8');
|
||||
|
||||
if PBF_STRONG_CRYPT and Value = PBF_STRONG_CRYPT then
|
||||
AddValue('PBF_STRONG_CRYPT');
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.btnAnalizeClick(Sender: TObject);
|
||||
begin
|
||||
edReport.Lines.BeginUpdate;
|
||||
try
|
||||
edReport.Clear;
|
||||
Log(edPath.Text);
|
||||
Log(Delim);
|
||||
Scan(edPath.Text);
|
||||
Log('DONE');
|
||||
finally
|
||||
edReport.Lines.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.btnBrowseClick(Sender: TObject);
|
||||
begin
|
||||
UseLongNamePrefix := False;
|
||||
OpenDialog.InitialDir :=
|
||||
PathCanonicalize(ExtractFilePath(ParamStr(0)) + '..\DemoResults');
|
||||
if OpenDialog.Execute then
|
||||
begin
|
||||
edPath.Text := OpenDialog.FileName;
|
||||
edReport.Clear;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TdlgZipAnalizer.edPathChange(Sender: TObject);
|
||||
begin
|
||||
btnAnalize.Enabled := FileExists(edPath.Text);
|
||||
end;
|
||||
|
||||
function TdlgZipAnalizer.FindSing(Stream: TStream): DWORD;
|
||||
const
|
||||
KnownSigns: array [0..5] of DWORD = (
|
||||
LOCAL_FILE_HEADER_SIGNATURE,
|
||||
DATA_DESCRIPTOR_SIGNATURE,
|
||||
CENTRAL_FILE_HEADER_SIGNATURE,
|
||||
ZIP64_END_OF_CENTRAL_DIR_SIGNATURE,
|
||||
ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE,
|
||||
END_OF_CENTRAL_DIR_SIGNATURE
|
||||
);
|
||||
|
||||
function CalcLen: Integer;
|
||||
begin
|
||||
Result := Stream.Size - Stream.Position;
|
||||
if Result > 1024 then
|
||||
Result := 1024;
|
||||
end;
|
||||
|
||||
var
|
||||
pBuff, pCursor: PByte;
|
||||
I, A, Len: Integer;
|
||||
OldPosition: Int64;
|
||||
begin
|
||||
Result := 0;
|
||||
GetMem(pBuff, 1024);
|
||||
try
|
||||
Len := CalcLen;
|
||||
while (Result = 0) and (Len > 4) do
|
||||
begin
|
||||
OldPosition := Stream.Position;
|
||||
Stream.ReadBuffer(pBuff^, Len);
|
||||
pCursor := pBuff;
|
||||
for I := 0 to Len - 4 do
|
||||
begin
|
||||
for A := 0 to 5 do
|
||||
if PCardinal(pCursor)^ = KnownSigns[A] then
|
||||
begin
|
||||
Result := KnownSigns[A];
|
||||
Break;
|
||||
end;
|
||||
if Result = 0 then
|
||||
Inc(pCursor)
|
||||
else
|
||||
begin
|
||||
Stream.Position := OldPosition + I;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if Result = 0 then
|
||||
begin
|
||||
Len := CalcLen;
|
||||
if Len > 0 then
|
||||
Stream.Position := Stream.Position - 4;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FreeMem(pBuff);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.LoadStringValue(Stream: TStream;
|
||||
out Value: string; nSize: Cardinal; UTF: Boolean);
|
||||
var
|
||||
aString: AnsiString;
|
||||
begin
|
||||
if Integer(nSize) > 0 then
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
aString := '';
|
||||
{$ENDIF}
|
||||
SetLength(aString, nSize);
|
||||
Stream.ReadBuffer(aString[1], nSize);
|
||||
if UTF then
|
||||
begin
|
||||
{$IFDEF UNICODE}
|
||||
Value := string(UTF8ToUnicodeString(aString))
|
||||
{$ELSE}
|
||||
Value := string(UTF8Decode(aString));
|
||||
Value := StringReplace(Value, '?', '_', [rfReplaceAll]);
|
||||
{$ENDIF}
|
||||
end
|
||||
else
|
||||
Value := string(ConvertFromOemString(aString));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.Log(const Value: string);
|
||||
begin
|
||||
edReport.Lines.Add(Value);
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.mnuSaveClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog.Execute then
|
||||
edReport.Lines.SaveToFile(SaveDialog.FileName);
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.PopupMenuPopup(Sender: TObject);
|
||||
begin
|
||||
mnuSave.Enabled := edReport.Lines.Count > 1;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.Scan(const Value: string);
|
||||
var
|
||||
F: TFileStream;
|
||||
Sign: DWORD;
|
||||
begin
|
||||
F := TFileStream.Create(Value, fmOpenRead or fmShareDenyWrite);
|
||||
try
|
||||
Sign := FindSing(F);
|
||||
while Sign <> 0 do
|
||||
begin
|
||||
case Sign of
|
||||
LOCAL_FILE_HEADER_SIGNATURE: ShowLocalFileHeader(F);
|
||||
DATA_DESCRIPTOR_SIGNATURE: ShowDataDescryptor(F);
|
||||
CENTRAL_FILE_HEADER_SIGNATURE: ShowCentralFileHeader(F);
|
||||
ZIP64_END_OF_CENTRAL_DIR_SIGNATURE: ShowZip64(F);
|
||||
ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE: ShowZip64Locator(F);
|
||||
END_OF_CENTRAL_DIR_SIGNATURE: ShowEndOfCentralDir(F);
|
||||
end;
|
||||
Sign := FindSing(F);
|
||||
end;
|
||||
finally
|
||||
F.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowCentralFileHeader(Stream: TStream);
|
||||
var
|
||||
Data: TCentralDirectoryFileHeader;
|
||||
FileName, Comment: string;
|
||||
begin
|
||||
Log('CENTRAL_FILE_HEADER_SIGNATURE found at offset: ' + IntToStr(Stream.Position));
|
||||
{$IFDEF FPC}
|
||||
Data := Default(TCentralDirectoryFileHeader);
|
||||
{$ENDIF}
|
||||
Stream.ReadBuffer(Data, SizeOf(TCentralDirectoryFileHeader));
|
||||
with Data do
|
||||
begin
|
||||
if CentralFileHeaderSignature <> CENTRAL_FILE_HEADER_SIGNATURE then
|
||||
Log('INVALID SIGNATURE!!!!');
|
||||
Log(Format('VersionMadeBy: %d', [VersionMadeBy]));
|
||||
Log(Format('VersionNeededToExtract: %d', [VersionNeededToExtract]));
|
||||
Log(Format('GeneralPurposeBitFlag: %d (%s)', [GeneralPurposeBitFlag,
|
||||
GPBFToStr(GeneralPurposeBitFlag)]));
|
||||
Log(Format('CompressionMethod: %d (%s)', [CompressionMethod, CompressionMethodToStr(CompressionMethod)]));
|
||||
Log(Format('LastModFileTimeTime: %d', [LastModFileTimeTime]));
|
||||
Log(Format('LastModFileTimeDate: %d', [LastModFileTimeDate]));
|
||||
Log(Format('Crc32: %d', [Crc32]));
|
||||
Log(Format('CompressedSize: %d', [CompressedSize]));
|
||||
Log(Format('UncompressedSize: %d', [UncompressedSize]));
|
||||
Log(Format('FilenameLength: %d', [FilenameLength]));
|
||||
Log(Format('ExtraFieldLength: %d', [ExtraFieldLength]));
|
||||
Log(Format('FileCommentLength: %d', [FileCommentLength]));
|
||||
Log(Format('DiskNumberStart: %d', [DiskNumberStart]));
|
||||
Log(Format('InternalFileAttributes: %d', [InternalFileAttributes]));
|
||||
Log(Format('ExternalFileAttributes: %d', [ExternalFileAttributes]));
|
||||
Log(Format('RelativeOffsetOfLocalHeader: %d', [RelativeOffsetOfLocalHeader]));
|
||||
LoadStringValue(Stream, FileName, FilenameLength,
|
||||
GeneralPurposeBitFlag and PBF_UTF8 <> 0);
|
||||
Log('>>> FileName: ' + FileName);
|
||||
Log(Delim);
|
||||
ShowExtraFields(Stream, ExtraFieldLength, Data);
|
||||
if FileCommentLength > 0 then
|
||||
begin
|
||||
LoadStringValue(Stream, Comment, FileCommentLength,
|
||||
GeneralPurposeBitFlag and PBF_UTF8 <> 0);
|
||||
Log('>>> FileComment: ' + Comment);
|
||||
Log(Delim);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowDataDescryptor(Stream: TStream);
|
||||
var
|
||||
Data: TDataDescriptor;
|
||||
StartPos: Int64;
|
||||
begin
|
||||
StartPos := Stream.Position;
|
||||
{$IFDEF FPC}
|
||||
Data := Default(TDataDescriptor);
|
||||
{$ENDIF}
|
||||
Stream.ReadBuffer(Data, SizeOf(TDataDescriptor));
|
||||
if Data.Crc32 = LOCAL_FILE_HEADER_SIGNATURE then
|
||||
begin
|
||||
Log('SPAN_DESCRIPTOR_SIGNATURE found at offset: ' + IntToStr(StartPos));
|
||||
Log(Delim);
|
||||
Stream.Position := StartPos + SizeOf(DWORD);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
Log('DATA_DESCRIPTOR_SIGNATURE found at offset: ' + IntToStr(StartPos));
|
||||
with Data do
|
||||
begin
|
||||
if DescriptorSignature <> DATA_DESCRIPTOR_SIGNATURE then
|
||||
Log('INVALID SIGNATURE!!!!');
|
||||
Log(Format('Crc32: %d', [Crc32]));
|
||||
Log(Format('CompressedSize: %d', [CompressedSize]));
|
||||
Log(Format('UncompressedSize: %d', [UncompressedSize]));
|
||||
end;
|
||||
Log(Delim);
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowEndOfCentralDir(Stream: TStream);
|
||||
var
|
||||
Data: TEndOfCentralDir;
|
||||
Comment: string;
|
||||
begin
|
||||
Log('END_OF_CENTRAL_DIR_SIGNATURE found at offset: ' + IntToStr(Stream.Position));
|
||||
{$IFDEF FPC}
|
||||
Data := Default(TEndOfCentralDir);
|
||||
{$ENDIF}
|
||||
Stream.ReadBuffer(Data, SizeOf(TEndOfCentralDir));
|
||||
with Data do
|
||||
begin
|
||||
if EndOfCentralDirSignature <> END_OF_CENTRAL_DIR_SIGNATURE then
|
||||
Log('INVALID SIGNATURE!!!!');
|
||||
Log(Format('NumberOfThisDisk: %d', [NumberOfThisDisk]));
|
||||
Log(Format('DiskNumberStart: %d', [DiskNumberStart]));
|
||||
Log(Format('TotalNumberOfEntriesOnThisDisk: %d', [TotalNumberOfEntriesOnThisDisk]));
|
||||
Log(Format('TotalNumberOfEntries: %d', [TotalNumberOfEntries]));
|
||||
Log(Format('SizeOfTheCentralDirectory: %d', [SizeOfTheCentralDirectory]));
|
||||
Log(Format('RelativeOffsetOfCentralDirectory: %d', [RelativeOffsetOfCentralDirectory]));
|
||||
Log(Format('ZipfileCommentLength: %d', [ZipfileCommentLength]));
|
||||
if ZipfileCommentLength > 0 then
|
||||
begin
|
||||
LoadStringValue(Stream, Comment, ZipfileCommentLength, False);
|
||||
Log(Format('>>> Comment: %s', [Comment]));
|
||||
end;
|
||||
end;
|
||||
Log(Delim);
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowExtraFields(Stream: TStream; Size: Integer;
|
||||
FileHeader: TCentralDirectoryFileHeader);
|
||||
var
|
||||
Buff, EOFBuff: Pointer;
|
||||
BuffCount: Integer;
|
||||
HeaderID, BlockSize: Word;
|
||||
|
||||
function GetOffset(Value: Integer): Pointer;
|
||||
begin
|
||||
Result := UIntToPtr(PtrToUInt(EOFBuff) - NativeUInt(Value));
|
||||
end;
|
||||
|
||||
function ByteToStr(Bytes: PByte; Size: Integer): string;
|
||||
const
|
||||
BytesHex: array[0..15] of char =
|
||||
('0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
Result := '';
|
||||
{$ENDIF}
|
||||
SetLength(Result, Size shl 1);
|
||||
for I := 0 to Size - 1 do
|
||||
begin
|
||||
Result[I * 2 + 1] := BytesHex[Bytes^ shr 4];
|
||||
Result[I * 2 + 2] := BytesHex[Bytes^ and $0F];
|
||||
Inc(Bytes);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
ExDataStream: TMemoryStream;
|
||||
StartPos: Int64;
|
||||
FileTime: TFileTime;
|
||||
begin
|
||||
if Size = 0 then Exit;
|
||||
StartPos := Stream.Position;
|
||||
Log('EXDATA found at offset: ' + IntToStr(StartPos));
|
||||
Log(Delim);
|
||||
GetMem(Buff, Size);
|
||||
try
|
||||
BuffCount := Size;
|
||||
Stream.ReadBuffer(Buff^, BuffCount);
|
||||
EOFBuff := UIntToPtr(PtrToUInt(Buff) + NativeUInt(BuffCount));
|
||||
while BuffCount > 0 do
|
||||
begin
|
||||
HeaderID := PWord(GetOffset(BuffCount))^;
|
||||
Dec(BuffCount, 2);
|
||||
BlockSize := PWord(GetOffset(BuffCount))^;
|
||||
Dec(BuffCount, 2);
|
||||
case HeaderID of
|
||||
SUPPORTED_EXDATA_ZIP64:
|
||||
begin
|
||||
Log('SUPPORTED_EXDATA_ZIP64 found at offset: ' +
|
||||
IntToStr(StartPos + Size - BuffCount - 4));
|
||||
if FileHeader.UncompressedSize = MAXDWORD then
|
||||
begin
|
||||
if BuffCount < 8 then Break;
|
||||
Log('UncompressedSize: ' + IntToStr(PInt64(GetOffset(BuffCount))^));
|
||||
Dec(BuffCount, 8);
|
||||
Dec(BlockSize, 8);
|
||||
end;
|
||||
if FileHeader.CompressedSize = MAXDWORD then
|
||||
begin
|
||||
if BuffCount < 8 then Break;
|
||||
Log('CompressedSize: ' + IntToStr(PInt64(GetOffset(BuffCount))^));
|
||||
Dec(BuffCount, 8);
|
||||
Dec(BlockSize, 8);
|
||||
end;
|
||||
if FileHeader.RelativeOffsetOfLocalHeader = MAXDWORD then
|
||||
begin
|
||||
if BuffCount < 8 then Break;
|
||||
Log('RelativeOffsetOfLocalHeader: ' + IntToStr(PInt64(GetOffset(BuffCount))^));
|
||||
Dec(BuffCount, 8);
|
||||
Dec(BlockSize, 8);
|
||||
end;
|
||||
if FileHeader.DiskNumberStart = MAXWORD then
|
||||
begin
|
||||
if BuffCount < 4 then Break;
|
||||
Log('DiskNumberStart: ' + IntToStr(PInt64(GetOffset(BuffCount))^));
|
||||
Dec(BuffCount, 4);
|
||||
Dec(BlockSize, 4);
|
||||
end;
|
||||
Dec(BuffCount, BlockSize);
|
||||
Log(Delim);
|
||||
end;
|
||||
|
||||
SUPPORTED_EXDATA_NTFSTIME:
|
||||
begin
|
||||
|
||||
if BuffCount < 32 then Break;
|
||||
if BlockSize <> 32 then
|
||||
begin
|
||||
Dec(BuffCount, BlockSize);
|
||||
Continue;
|
||||
end;
|
||||
Dec(BuffCount, 4);
|
||||
Dec(BlockSize, 4);
|
||||
if PWord(GetOffset(BuffCount))^ <> 1 then
|
||||
begin
|
||||
Dec(BuffCount, BlockSize);
|
||||
Continue;
|
||||
end;
|
||||
Dec(BuffCount, 2);
|
||||
Dec(BlockSize, 2);
|
||||
if PWord(GetOffset(BuffCount))^ <> SizeOf(TNTFSFileTime) then
|
||||
begin
|
||||
Dec(BuffCount, BlockSize);
|
||||
Continue;
|
||||
end;
|
||||
Dec(BuffCount, 2);
|
||||
Dec(BlockSize, 2);
|
||||
|
||||
Log('SUPPORTED_EXDATA_NTFSTIME found at offset: ' +
|
||||
IntToStr(StartPos + Size - BuffCount - 12));
|
||||
|
||||
FileTime := PFileTime(GetOffset(BuffCount))^;
|
||||
Dec(BuffCount, SizeOf(TFileTime));
|
||||
Dec(BlockSize, SizeOf(TFileTime));
|
||||
Log(Format('Last Write Time: %s', [DateTimeToStr(FileTimeToLocalDateTime(FileTime))]));
|
||||
|
||||
FileTime := PFileTime(GetOffset(BuffCount))^;
|
||||
Dec(BuffCount, SizeOf(TFileTime));
|
||||
Dec(BlockSize, SizeOf(TFileTime));
|
||||
Log(Format('Last Access Time: %s', [DateTimeToStr(FileTimeToLocalDateTime(FileTime))]));
|
||||
|
||||
FileTime := PFileTime(GetOffset(BuffCount))^;
|
||||
Dec(BuffCount, SizeOf(TFileTime));
|
||||
Dec(BlockSize, SizeOf(TFileTime));
|
||||
Log(Format('Creation Time: %s', [DateTimeToStr(FileTimeToLocalDateTime(FileTime))]));
|
||||
|
||||
Log(Delim);
|
||||
end;
|
||||
else
|
||||
Log(Format('UNKNOWN EXDATA TAG %d found at offset: %d',
|
||||
[HeaderID, StartPos + Size - BuffCount - 8]));
|
||||
ExDataStream := TMemoryStream.Create;
|
||||
try
|
||||
ExDataStream.WriteBuffer(GetOffset(BuffCount)^, BlockSize);
|
||||
ExDataStream.Position := 0;
|
||||
Log(ByteToStr(ExDataStream.Memory, ExDataStream.Size));
|
||||
finally
|
||||
ExDataStream.Free;
|
||||
end;
|
||||
Log(Delim);
|
||||
end;
|
||||
Dec(BuffCount, BlockSize);
|
||||
end;
|
||||
finally
|
||||
FreeMem(Buff);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowLocalFileHeader(Stream: TStream);
|
||||
var
|
||||
Data: TLocalFileHeader;
|
||||
FileName: string;
|
||||
begin
|
||||
Log('LOCAL_FILE_HEADER_SIGNATURE found at offset: ' + IntToStr(Stream.Position));
|
||||
{$IFDEF FPC}
|
||||
Data := Default(TLocalFileHeader);
|
||||
{$ENDIF}
|
||||
Stream.ReadBuffer(Data, SizeOf(TLocalFileHeader));
|
||||
with Data do
|
||||
begin
|
||||
if LocalFileHeaderSignature <> LOCAL_FILE_HEADER_SIGNATURE then
|
||||
Log('INVALID SIGNATURE!!!!');
|
||||
Log(Format('VersionNeededToExtract: %d', [VersionNeededToExtract]));
|
||||
Log(Format('GeneralPurposeBitFlag: %d (%s)', [GeneralPurposeBitFlag,
|
||||
GPBFToStr(GeneralPurposeBitFlag)]));
|
||||
Log(Format('CompressionMethod: %d (%s)', [CompressionMethod, CompressionMethodToStr(CompressionMethod)]));
|
||||
Log(Format('LastModFileTimeTime: %d', [LastModFileTimeTime]));
|
||||
Log(Format('LastModFileTimeDate: %d', [LastModFileTimeDate]));
|
||||
Log(Format('Crc32: %d', [Crc32]));
|
||||
Log(Format('CompressedSize: %d', [CompressedSize]));
|
||||
Log(Format('UncompressedSize: %d', [UncompressedSize]));
|
||||
Log(Format('FilenameLength: %d', [FilenameLength]));
|
||||
Log(Format('ExtraFieldLength: %d', [ExtraFieldLength]));
|
||||
LoadStringValue(Stream, FileName, FilenameLength,
|
||||
GeneralPurposeBitFlag and PBF_UTF8 <> 0);
|
||||
Log('>>> FileName: ' + FileName);
|
||||
end;
|
||||
Log(Delim);
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowZip64(Stream: TStream);
|
||||
var
|
||||
Data: TZip64EOFCentralDirectoryRecord;
|
||||
begin
|
||||
Log('ZIP64_END_OF_CENTRAL_DIR_SIGNATURE found at offset: ' + IntToStr(Stream.Position));
|
||||
{$IFDEF FPC}
|
||||
Data := Default(TZip64EOFCentralDirectoryRecord);
|
||||
{$ENDIF}
|
||||
Stream.ReadBuffer(Data, SizeOf(TZip64EOFCentralDirectoryRecord));
|
||||
with Data do
|
||||
begin
|
||||
if Zip64EndOfCentralDirSignature <> ZIP64_END_OF_CENTRAL_DIR_SIGNATURE then
|
||||
Log('INVALID SIGNATURE!!!!');
|
||||
Log(Format('SizeOfZip64EOFCentralDirectoryRecord: %d', [SizeOfZip64EOFCentralDirectoryRecord]));
|
||||
Log(Format('VersionMadeBy: %d', [VersionMadeBy]));
|
||||
Log(Format('VersionNeededToExtract: %d', [VersionNeededToExtract]));
|
||||
Log(Format('number of this disk: %d', [NumberOfThisDisk]));
|
||||
Log(Format('number of the disk with the start of the central directory: %d', [DiskNumberStart]));
|
||||
Log(Format('total number of entries in the central directory on this disk: %d', [TotalNumberOfEntriesOnThisDisk]));
|
||||
Log(Format('total number of entries in the central directory: %d', [TotalNumberOfEntries]));
|
||||
Log(Format('size of the central directory: %d', [SizeOfTheCentralDirectory]));
|
||||
Log(Format('offset of start of central directory with respect to the starting disk number: %d', [RelativeOffsetOfCentralDirectory]));
|
||||
end;
|
||||
Log(Delim);
|
||||
end;
|
||||
|
||||
procedure TdlgZipAnalizer.ShowZip64Locator(Stream: TStream);
|
||||
var
|
||||
Data: TZip64EOFCentralDirectoryLocator;
|
||||
begin
|
||||
Log('ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE found at offset: ' + IntToStr(Stream.Position));
|
||||
{$IFDEF FPC}
|
||||
Data := Default(TZip64EOFCentralDirectoryLocator);
|
||||
{$ENDIF}
|
||||
Stream.ReadBuffer(Data, SizeOf(TZip64EOFCentralDirectoryLocator));
|
||||
with Data do
|
||||
begin
|
||||
if Signature <> ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE then
|
||||
Log('INVALID SIGNATURE!!!!');
|
||||
Log(Format('NumberOfTheDisk: %d', [DiskNumberStart]));
|
||||
Log(Format('RelativeOffset: %d', [RelativeOffset]));
|
||||
Log(Format('TotalNumberOfDisks: %d', [TotalNumberOfDisks]));
|
||||
end;
|
||||
Log(Delim);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user