/MakeSFX.res |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/BuildTests.bat |
---|
1,4 → 1,5 |
@echo off |
MakeSFX helloworld.zip |
MakeSFX test.zip |
MakeSFX Tests\helloworld.zip |
MakeSFX Tests\single_file.zip |
MakeSFX Tests\test.zip |
pause. |
/ExtractorError.dfm |
---|
1,11 → 1,9 |
object ErrorForm: TErrorForm |
Left = 222 |
Top = 133 |
BorderIcons = [biSystemMenu] |
BorderStyle = bsSingle |
Caption = 'Fehler' |
ClientHeight = 365 |
ClientWidth = 355 |
ClientHeight = 363 |
ClientWidth = 353 |
Color = clBtnFace |
Font.Charset = ANSI_CHARSET |
Font.Color = clWindowText |
14,6 → 12,7 |
Font.Style = [] |
OldCreateOrder = False |
Position = poMainFormCenter |
OnResize = FormResize |
PixelsPerInch = 96 |
TextHeight = 13 |
object ErrorImg: TImage |
815,4 → 814,20 |
ParentFont = False |
TabOrder = 1 |
end |
object SaveBtn: TButton |
Left = 64 |
Top = 328 |
Width = 97 |
Height = 25 |
Caption = 'Liste speichern' |
TabOrder = 2 |
OnClick = SaveBtnClick |
end |
object SaveDialog: TSaveDialog |
DefaultExt = '.txt' |
Filter = 'Textdateien (*.txt)|*.txt|Alle Dateien (*.*)|*.*' |
Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing] |
Left = 320 |
Top = 8 |
end |
end |
/Readme.txt |
---|
15,6 → 15,14 |
458 KB (Delphi 2006) |
Cancel |
------ |
Press ESC to cancel. |
The program waits 1 second before starting extraction (Prevention of malicious |
AutoRun's, which call the creator SFX in an infinite loop) |
Structure of a ViaThinkSoft AutoSFX Archive |
------------------------------------------- |
81,7 → 89,5 |
More information about the first 5 values: |
http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx |
// It is forbidden that the AutoRun calls its own creator (the SFX again). |
(C) 2010 ViaThinkSoft |
/MakeSFX.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/MakeSFX.dpr |
---|
10,6 → 10,7 |
Windows, |
Classes, |
ZipMstr19, |
Dialogs, |
Functions in 'Functions.pas', |
SFXBehavior in 'SFXBehavior.pas'; |
19,14 → 20,12 |
ZIP_EXE = 'Tools\zip.exe'; |
RemoveSignature_EXE = 'Tools\RemoveSignature.exe'; |
procedure DoMakeSFX(AFilename: string); |
var |
Src, Dst: string; |
i: integer; |
Dst: string; |
s1, s2: TFileStream; |
x: TZipMaster19; |
resourcestring |
ImportantFileNotFound = 'Error: Important file "%s" not found!'; |
LngErrorWhileCopy = 'Error: Could not copy "%s" to "%s".'; |
LngErrorWhileExecuting = 'Error while executing "%s".'; |
SourceFileNotFound = 'Source file "%s" not found.'; |
38,46 → 37,20 |
Lng_ModifyZIPComment = 'Modify ZIP Comment...'; |
Lng_SignSfx = 'Sign the SFX...'; |
Lng_Finished = 'Finished! :-)'; |
Lng_Title = 'ViaThinkSoft AutoSFX'; |
Lng_Usage1 = 'Usage:'; |
Lng_Usage2 = 'MakeSFX [File1.zip [File2.zip...]]'; |
{$R *.res} |
begin |
WriteLn(Lng_Title); |
WriteLn(''); |
WriteLn(Lng_Usage1); |
WriteLn(Lng_Usage2); |
WriteLn(''); |
if not FileExists(ExtractFilePath(ParamStr(0)) + Extractor_EXE) then |
if not FileExists(AFilename) then |
begin |
WriteLn(Format(ImportantFileNotFound, [Extractor_EXE])); |
WriteLn(Format(SourceFileNotFound, [AFilename])); |
{$IFDEF DELAY_ON_ERROR} |
Sleep(2000); |
{$ENDIF} |
ExitCode := 2; |
ExitCode := 1; |
Exit; |
end; |
for i := 1 to ParamCount do |
begin |
Src := ParamStr(i); |
Dst := ChangeFileExt(AFilename, '.exe'); |
if not FileExists(Src) then |
begin |
WriteLn(Format(SourceFileNotFound, [Src])); |
{$IFDEF DELAY_ON_ERROR} |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
end; |
Dst := ChangeFileExt(Src, '.exe'); |
WriteLn(Format(Lng_In+#9+'%s', [Src])); |
WriteLn(Format(Lng_In+#9+'%s', [AFilename])); |
WriteLn(Format(Lng_Out+#9+'%s', [Dst])); |
WriteLn(''); |
88,7 → 61,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
end; |
// Remove the signature of Extractor first (otherwise signing will fail later) |
104,7 → 77,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
{$ENDIF} |
end; |
114,7 → 87,7 |
try |
s1.Seek(0, soEnd); |
s2 := TFileStream.Create(Src, fmOpenRead or fmShareDenyWrite); |
s2 := TFileStream.Create(AFilename, fmOpenRead or fmShareDenyWrite); |
try |
s1.CopyFrom(s2, s2.Size); |
finally |
134,7 → 107,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
end; |
WriteLn(#9 + Lng_ModifyZIPComment); |
177,7 → 150,7 |
Sleep(2000); |
{$ENDIF} |
ExitCode := 1; |
Continue; |
Exit; |
{$ENDIF} |
end; |
185,5 → 158,59 |
WriteLn(''); |
end; |
{$R *.res} |
var |
i: integer; |
od: TOpenDialog; |
resourcestring |
Lng_Title = 'ViaThinkSoft AutoSFX'; |
Lng_Usage1 = 'Usage:'; |
Lng_Usage2 = 'MakeSFX [File1.zip [File2.zip...]]'; |
ImportantFileNotFound = 'Error: Important file "%s" not found!'; |
begin |
WriteLn(Lng_Title); |
WriteLn(''); |
WriteLn(Lng_Usage1); |
WriteLn(Lng_Usage2); |
WriteLn(''); |
if not FileExists(ExtractFilePath(ParamStr(0)) + Extractor_EXE) then |
begin |
WriteLn(Format(ImportantFileNotFound, [Extractor_EXE])); |
{$IFDEF DELAY_ON_ERROR} |
Sleep(2000); |
{$ENDIF} |
ExitCode := 2; |
Exit; |
end; |
if ParamCount = 0 then |
begin |
od := TOpenDialog.Create(nil); |
try |
od.DefaultExt := '.zip'; |
od.Filter := 'ZIP-Archiv (*.zip)|*.zip|Alle Dateien (*.*)|*.*'; |
od.Options := [ofAllowMultiSelect, ofFileMustExist, ofHideReadOnly, |
ofPathMustExist, ofEnableSizing]; |
if od.Execute then |
begin |
for i := 0 to od.Files.Count - 1 do |
begin |
DoMakeSFX(od.Files.Strings[i]); |
end; |
end; |
finally |
od.Free; |
end; |
end |
else |
begin |
for i := 1 to ParamCount do |
begin |
DoMakeSFX(ParamStr(i)); |
end; |
end; |
// TODO: Es gibt bei Win2000 außerhalb des debuggers eine AV... |
end. |
/Extractor.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/MakeSFX.bdsproj |
---|
130,7 → 130,7 |
<Directories Name="UsePackages">False</Directories> |
</Directories> |
<Parameters> |
<Parameters Name="RunParams">helloworld.zip</Parameters> |
<Parameters Name="RunParams"></Parameters> |
<Parameters Name="HostApplication"></Parameters> |
<Parameters Name="Launcher"></Parameters> |
<Parameters Name="UseLauncher">False</Parameters> |
/Tools/RemoveSignature.exe |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/ExtractorError.pas |
---|
2,10 → 2,8 |
interface |
// TODO: Dialog sizeable |
uses |
Forms, StdCtrls, ExtCtrls, Controls, Graphics, Classes; |
Forms, StdCtrls, ExtCtrls, Controls, Graphics, Classes, Dialogs; |
type |
TErrorForm = class(TForm) |
13,6 → 11,10 |
ErrorImg: TImage; |
ErrorLabel: TLabel; |
OKBtn: TButton; |
SaveBtn: TButton; |
SaveDialog: TSaveDialog; |
procedure FormResize(Sender: TObject); |
procedure SaveBtnClick(Sender: TObject); |
public |
function ErrorsAvailable: boolean; |
procedure NewError(Filename: string); |
30,6 → 32,15 |
result := ErrorList.Items.Count > 0; |
end; |
procedure TErrorForm.FormResize(Sender: TObject); |
begin |
ErrorList.Width := ClientWidth - ErrorList.Left - ErrorImg.Left; |
ErrorList.Height := ClientHeight - ErrorList.Top - (2 * ErrorImg.Left + OkBtn.Height); |
OkBtn.Top := ErrorList.Top + ErrorList.Height + ErrorImg.Left; |
OkBtn.Left := ErrorList.Left + ErrorList.Width - OkBtn.Width; |
SaveBtn.Top := OkBtn.Top; |
end; |
procedure TErrorForm.NewError(Filename: string); |
begin |
// In future: Also add reason into list? |
36,4 → 47,12 |
ErrorList.Items.Add(Filename); |
end; |
procedure TErrorForm.SaveBtnClick(Sender: TObject); |
begin |
if SaveDialog.Execute then |
begin |
ErrorList.Items.SaveToFile(SaveDialog.FileName); |
end; |
end; |
end. |