Martijn Laan пре 1 година
родитељ
комит
3e494c5965
2 измењених фајлова са 27 додато и 60 уклоњено
  1. 16 32
      Projects/Src/Setup.ScriptFunc.pas
  2. 11 28
      Projects/Src/Shared.ScriptFunc.pas

+ 16 - 32
Projects/Src/Setup.ScriptFunc.pas

@@ -114,7 +114,6 @@ end;
 
 
 {---}
 {---}
 
 
-{ ScriptDlg }
 function ScriptDlgProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 function ScriptDlgProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
@@ -312,8 +311,7 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ NewDisk }
-function NewDiskProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function NewDiskFormProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
   S: String;
   S: String;
@@ -329,7 +327,6 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ BrowseFunc }
 function BrowseFuncProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 function BrowseFuncProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
@@ -373,8 +370,7 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ CmnFunc }
-function CmnFuncProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function CommonFuncVclProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
 begin
 begin
@@ -387,8 +383,7 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ CmnFunc2 }
-function CmnFunc2Proc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function CommonFuncProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 
 
   procedure CrackCodeRootKey(CodeRootKey: HKEY; var RegView: TRegView;
   procedure CrackCodeRootKey(CodeRootKey: HKEY; var RegView: TRegView;
     var RootKey: HKEY);
     var RootKey: HKEY);
@@ -763,7 +758,6 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ Install }
 function InstallProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 function InstallProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
@@ -1018,8 +1012,7 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ InstFnc2 }
-function InstFnc2Proc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function InstFuncOleProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
 begin
 begin
@@ -1053,8 +1046,7 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ Main }
-function MainProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function MainFormProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 
 
   function CustomMessage(const MsgName: String): String;
   function CustomMessage(const MsgName: String): String;
   begin
   begin
@@ -1191,8 +1183,7 @@ begin
   Version.SuiteMask := WindowsSuiteMask;
   Version.SuiteMask := WindowsSuiteMask;
 end;
 end;
 
 
-{ Msgs }
-function MsgsProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function MessagesProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
 begin
 begin
@@ -1210,7 +1201,6 @@ begin
   Result := FmtMessage(PChar(S), Args);
   Result := FmtMessage(PChar(S), Args);
 end;
 end;
 
 
-{ System }
 function SystemProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 function SystemProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
@@ -1259,8 +1249,6 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ SysUtils }
-
 type
 type
   { *Must* keep this in synch with ScriptFunc_C }
   { *Must* keep this in synch with ScriptFunc_C }
   TFindRec = record
   TFindRec = record
@@ -1502,8 +1490,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-{ VerInfo }
-function VerInfoProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function VerInfoFuncProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
   VersionNumbers: TFileVersionNumbers;
   VersionNumbers: TFileVersionNumbers;
@@ -1580,7 +1567,6 @@ end;
 type
 type
   TDllProc = function(const Param1, Param2: Longint): Longint; stdcall;
   TDllProc = function(const Param1, Param2: Longint): Longint; stdcall;
 
 
-{ Windows }
 function WindowsProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 function WindowsProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
@@ -1641,7 +1627,6 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ Ole2 }
 function Ole2Proc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 function Ole2Proc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 begin
 begin
   Result := True;
   Result := True;
@@ -1652,8 +1637,7 @@ begin
     Result := False;
     Result := False;
 end;
 end;
 
 
-{ Logging }
-function LoggingProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
+function LoggingFuncProc(Caller: TPSExec; Proc: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
 var
 var
   PStart: Cardinal;
   PStart: Cardinal;
 begin
 begin
@@ -2082,21 +2066,21 @@ begin
   Count := 0;
   Count := 0;
   {$ENDIF}
   {$ENDIF}
   RegisterFunctionTable(ScriptFuncTables[sftScriptDlg], @ScriptDlgProc);
   RegisterFunctionTable(ScriptFuncTables[sftScriptDlg], @ScriptDlgProc);
-  RegisterFunctionTable(ScriptFuncTables[sftNewDisk], @NewDiskProc);
+  RegisterFunctionTable(ScriptFuncTables[sftNewDiskForm], @NewDiskFormProc);
   RegisterFunctionTable(ScriptFuncTables[sftBrowseFunc], @BrowseFuncProc);
   RegisterFunctionTable(ScriptFuncTables[sftBrowseFunc], @BrowseFuncProc);
-  RegisterFunctionTable(ScriptFuncTables[sftCmnFunc], @CmnFuncProc);
-  RegisterFunctionTable(ScriptFuncTables[sftCmnFunc2], @CmnFunc2Proc);
+  RegisterFunctionTable(ScriptFuncTables[sftCommonFuncVcl], @CommonFuncVclProc);
+  RegisterFunctionTable(ScriptFuncTables[sftCommonFunc], @CommonFuncProc);
   RegisterFunctionTable(ScriptFuncTables[sftInstall], @InstallProc);
   RegisterFunctionTable(ScriptFuncTables[sftInstall], @InstallProc);
   RegisterFunctionTable(ScriptFuncTables[sftInstFunc], @InstFuncProc);
   RegisterFunctionTable(ScriptFuncTables[sftInstFunc], @InstFuncProc);
-  RegisterFunctionTable(ScriptFuncTables[sftInstFnc2], @InstFnc2Proc);
-  RegisterFunctionTable(ScriptFuncTables[sftMain], @MainProc);
-  RegisterFunctionTable(ScriptFuncTables[sftMsgs], @MsgsProc);
+  RegisterFunctionTable(ScriptFuncTables[sftInstFuncOle], @InstFuncOleProc);
+  RegisterFunctionTable(ScriptFuncTables[sftMainForm], @MainFormProc);
+  RegisterFunctionTable(ScriptFuncTables[sftMessages], @MessagesProc);
   RegisterFunctionTable(ScriptFuncTables[sftSystem], @SystemProc);
   RegisterFunctionTable(ScriptFuncTables[sftSystem], @SystemProc);
   RegisterFunctionTable(ScriptFuncTables[sftSysUtils], @SysUtilsProc);
   RegisterFunctionTable(ScriptFuncTables[sftSysUtils], @SysUtilsProc);
-  RegisterFunctionTable(ScriptFuncTables[sftVerInfo], @VerInfoProc);
+  RegisterFunctionTable(ScriptFuncTables[sftVerInfoFunc], @VerInfoFuncProc);
   RegisterFunctionTable(ScriptFuncTables[sftWindows], @WindowsProc);
   RegisterFunctionTable(ScriptFuncTables[sftWindows], @WindowsProc);
   RegisterFunctionTable(ScriptFuncTables[sftOle2], @Ole2Proc);
   RegisterFunctionTable(ScriptFuncTables[sftOle2], @Ole2Proc);
-  RegisterFunctionTable(ScriptFuncTables[sftLogging], @LoggingProc);
+  RegisterFunctionTable(ScriptFuncTables[sftLoggingFunc], @LoggingFuncProc);
   RegisterFunctionTable(ScriptFuncTables[sftOther], @OtherProc);
   RegisterFunctionTable(ScriptFuncTables[sftOther], @OtherProc);
   {$IFDEF DEBUG}
   {$IFDEF DEBUG}
   if Count <> Length(ScriptFuncTables) then
   if Count <> Length(ScriptFuncTables) then

+ 11 - 28
Projects/Src/Shared.ScriptFunc.pas

@@ -12,9 +12,9 @@ unit Shared.ScriptFunc;
 interface
 interface
 
 
 type
 type
-  TScriptFuncTableID = (sftScriptDlg, sftNewDisk, sftBrowseFunc, sftCmnFunc,
-    sftCmnFunc2, sftInstall, sftInstFunc, sftInstFnc2, sftMain, sftMsgs,
-    sftSystem, sftSysUtils, sftVerInfo, sftWindows, sftOle2, sftLogging,
+  TScriptFuncTableID = (sftScriptDlg, sftNewDiskForm, sftBrowseFunc, sftCommonFuncVcl,
+    sftCommonFunc, sftInstall, sftInstFunc, sftInstFuncOle, sftMainForm, sftMessages,
+    sftSystem, sftSysUtils, sftVerInfoFunc, sftWindows, sftOle2, sftLoggingFunc,
     sftOther);
     sftOther);
   TScriptTable = array of AnsiString;
   TScriptTable = array of AnsiString;
 
 
@@ -207,7 +207,6 @@ end;
 
 
 initialization
 initialization
 
 
-  { ScriptDlg }
   ScriptFuncTables[sftScriptDlg] :=
   ScriptFuncTables[sftScriptDlg] :=
   [
   [
     'function PageFromID(const ID: Integer): TWizardPage;',
     'function PageFromID(const ID: Integer): TWizardPage;',
@@ -227,13 +226,11 @@ initialization
     'function CreateCustomForm: TSetupForm;'
     'function CreateCustomForm: TSetupForm;'
   ];
   ];
 
 
-  { NewDisk }
-  ScriptFuncTables[sftNewDisk] :=
+  ScriptFuncTables[sftNewDiskForm] :=
   [
   [
     'function SelectDisk(const DiskNumber: Integer; const AFilename: String; var Path: String): Boolean;'
     'function SelectDisk(const DiskNumber: Integer; const AFilename: String; var Path: String): Boolean;'
   ];
   ];
 
 
-  { BrowseFunc }
   ScriptFuncTables[sftBrowseFunc] :=
   ScriptFuncTables[sftBrowseFunc] :=
   [
   [
     'function BrowseForFolder(const Prompt: String; var Directory: String; const NewFolderButton: Boolean): Boolean;',
     'function BrowseForFolder(const Prompt: String; var Directory: String; const NewFolderButton: Boolean): Boolean;',
@@ -242,14 +239,12 @@ initialization
     'function GetSaveFileName(const Prompt: String; var FileName: String; const InitialDirectory, Filter, DefaultExtension: String): Boolean;'
     'function GetSaveFileName(const Prompt: String; var FileName: String; const InitialDirectory, Filter, DefaultExtension: String): Boolean;'
   ];
   ];
 
 
-  { CmnFunc }
-  ScriptFuncTables[sftCmnFunc] :=
+  ScriptFuncTables[sftCommonFuncVcl] :=
   [
   [
     'function MinimizePathName(const Filename: String; const Font: TFont; MaxLen: Integer): String;'
     'function MinimizePathName(const Filename: String; const Font: TFont; MaxLen: Integer): String;'
   ];
   ];
 
 
-   { CmnFunc2 }
-  ScriptFuncTables[sftCmnFunc2] :=
+  ScriptFuncTables[sftCommonFunc] :=
   [
   [
     'function FileExists(const Name: String): Boolean;',
     'function FileExists(const Name: String): Boolean;',
     'function DirExists(const Name: String): Boolean;',
     'function DirExists(const Name: String): Boolean;',
@@ -315,7 +310,6 @@ initialization
     'function WildcardMatch(const Text, Pattern: String): Boolean;'
     'function WildcardMatch(const Text, Pattern: String): Boolean;'
   ];
   ];
 
 
-  { Install }
   ScriptFuncTables[sftInstall] :=
   ScriptFuncTables[sftInstall] :=
   [
   [
     'procedure ExtractTemporaryFile(const FileName: String);',
     'procedure ExtractTemporaryFile(const FileName: String);',
@@ -326,7 +320,6 @@ initialization
     'procedure SetDownloadCredentials(const User, Pass: String);'
     'procedure SetDownloadCredentials(const User, Pass: String);'
   ];
   ];
 
 
-  { InstFunc }
   ScriptFuncTables[sftInstFunc] :=
   ScriptFuncTables[sftInstFunc] :=
   [
   [
     'function CheckForMutexes(Mutexes: String): Boolean;',
     'function CheckForMutexes(Mutexes: String): Boolean;',
@@ -369,8 +362,7 @@ initialization
     'function ForceDirectories(Dir: String): Boolean;'
     'function ForceDirectories(Dir: String): Boolean;'
   ];
   ];
 
 
-  { InstFnc2 }
-  ScriptFuncTables[sftInstFnc2] :=
+  ScriptFuncTables[sftInstFuncOle] :=
   [
   [
     'function CreateShellLink(const Filename, Description, ShortcutTo, Parameters, WorkingDir, IconFilename: String; const IconIndex, ShowCmd: Integer): String;',
     'function CreateShellLink(const Filename, Description, ShortcutTo, Parameters, WorkingDir, IconFilename: String; const IconIndex, ShowCmd: Integer): String;',
     'procedure RegisterTypeLibrary(const Is64Bit: Boolean; const Filename: String);',
     'procedure RegisterTypeLibrary(const Is64Bit: Boolean; const Filename: String);',
@@ -378,8 +370,7 @@ initialization
     'function UnpinShellLink(const Filename: String): Boolean;'
     'function UnpinShellLink(const Filename: String): Boolean;'
   ];
   ];
 
 
-  { Main }
-  ScriptFuncTables[sftMain] :=
+  ScriptFuncTables[sftMainForm] :=
   [
   [
     'function GetWizardForm: TWizardForm;',
     'function GetWizardForm: TWizardForm;',
     'function GetMainForm: TMainForm;',
     'function GetMainForm: TMainForm;',
@@ -415,13 +406,11 @@ initialization
     'function RegisterExtraCloseApplicationsResource(const DisableFsRedir: Boolean; const AFilename: String): Boolean;'
     'function RegisterExtraCloseApplicationsResource(const DisableFsRedir: Boolean; const AFilename: String): Boolean;'
   ];
   ];
 
 
-  { Msgs }
-  ScriptFuncTables[sftMsgs] :=
+  ScriptFuncTables[sftMessages] :=
   [
   [
     'function SetupMessage(const ID: TSetupMessageID): String;'
     'function SetupMessage(const ID: TSetupMessageID): String;'
   ];
   ];
 
 
-  { System }
   ScriptFuncTables[sftSystem] :=
   ScriptFuncTables[sftSystem] :=
   [
   [
     'function Random(const Range: Integer): Integer;',
     'function Random(const Range: Integer): Integer;',
@@ -433,7 +422,6 @@ initialization
     'function UTF8Decode(const S: AnsiString): String;'
     'function UTF8Decode(const S: AnsiString): String;'
   ];
   ];
 
 
-  { SysUtils }
   ScriptFuncTables[sftSysUtils] :=
   ScriptFuncTables[sftSysUtils] :=
   [
   [
     'procedure Beep;',
     'procedure Beep;',
@@ -463,8 +451,7 @@ initialization
     'function SysErrorMessage(ErrorCode: Integer): String;'
     'function SysErrorMessage(ErrorCode: Integer): String;'
   ];
   ];
 
 
-  { VerInfo }
-  ScriptFuncTables[sftVerInfo] :=
+  ScriptFuncTables[sftVerInfoFunc] :=
   [
   [
     'function GetVersionNumbers(const Filename: String; var VersionMS, VersionLS: Cardinal): Boolean;',
     'function GetVersionNumbers(const Filename: String; var VersionMS, VersionLS: Cardinal): Boolean;',
     'function GetVersionComponents(const Filename: String; var Major, Minor, Revision, Build: Word): Boolean;',
     'function GetVersionComponents(const Filename: String; var Major, Minor, Revision, Build: Word): Boolean;',
@@ -480,7 +467,6 @@ initialization
     'function StrToVersion(const VersionString: String; var Version: Int64): Boolean;'
     'function StrToVersion(const VersionString: String; var Version: Int64): Boolean;'
   ];
   ];
 
 
-  { Windows }
   ScriptFuncTables[sftWindows] :=
   ScriptFuncTables[sftWindows] :=
   [
   [
     'procedure Sleep(const Milliseconds: LongInt);',
     'procedure Sleep(const Milliseconds: LongInt);',
@@ -501,19 +487,16 @@ initialization
     'procedure CharToOemBuff(var S: AnsiString);'
     'procedure CharToOemBuff(var S: AnsiString);'
   ];
   ];
 
 
-  { Ole2 }
   ScriptFuncTables[sftOle2] :=
   ScriptFuncTables[sftOle2] :=
   [
   [
     'procedure CoFreeUnusedLibraries;'
     'procedure CoFreeUnusedLibraries;'
   ];
   ];
 
 
-  { Logging }
-  ScriptFuncTables[sftLogging] :=
+  ScriptFuncTables[sftLoggingFunc] :=
   [
   [
     'procedure Log(const S: String);'
     'procedure Log(const S: String);'
   ];
   ];
 
 
-  { Other }
   ScriptFuncTables[sftOther] :=
   ScriptFuncTables[sftOther] :=
   [
   [
     'procedure BringToFrontAndRestore;',
     'procedure BringToFrontAndRestore;',