Bläddra i källkod

Update for move + also fix bad unit (Msgs, directly and via InstFunc) and function (InternalError) use by Compil32's CompMsgBoxDesigner and prevent this from happening again.

Martijn Laan 1 år sedan
förälder
incheckning
23444a8bd9

+ 11 - 2
Projects/Compil32.dpr

@@ -10,7 +10,7 @@ program Compil32;
 }
 
 uses
-  SafeDLLPath in 'SafeDLLPath.pas',
+  SafeDLLPath in 'Src\SafeDLLPath.pas',
   Windows,
   SysUtils,
   Forms,
@@ -48,7 +48,16 @@ uses
   NewCheckListBox in '..\Components\NewCheckListBox.pas',
   NewNotebook in '..\Components\NewNotebook.pas',
   TaskbarProgressFunc in 'Src\TaskbarProgressFunc.pas',
-  HtmlHelpFunc in 'Src\HtmlHelpFunc.pas';
+  HtmlHelpFunc in 'Src\HtmlHelpFunc.pas',
+  UIStateForm in 'Src\UIStateForm.pas',
+  LangOptionsSectionDirectives in 'Src\LangOptionsSectionDirectives.pas',
+  MsgIDs in 'Src\MsgIDs.pas',
+  SetupSectionDirectives in 'Src\SetupSectionDirectives.pas',
+  CompTypes in 'Src\CompTypes.pas',
+  FileClass in 'Src\FileClass.pas',
+  Int64Em in 'Src\Int64Em.pas',
+  Compress in 'Src\Compress.pas',
+  TaskDialog in 'Src\TaskDialog.pas';
 
 {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SETPEOSVERSION 6.1}

+ 10 - 1
Projects/Compil32.dproj

@@ -77,7 +77,7 @@
         <DelphiCompile Include="$(MainSource)">
             <MainSource>MainSource</MainSource>
         </DelphiCompile>
-        <DCCReference Include="SafeDLLPath.pas"/>
+        <DCCReference Include="Src\SafeDLLPath.pas"/>
         <DCCReference Include="..\Components\PathFunc.pas"/>
         <DCCReference Include="Src\CompForm.pas">
             <Form>CompileForm</Form>
@@ -129,6 +129,15 @@
         <DCCReference Include="..\Components\NewNotebook.pas"/>
         <DCCReference Include="Src\TaskbarProgressFunc.pas"/>
         <DCCReference Include="Src\HtmlHelpFunc.pas"/>
+        <DCCReference Include="Src\UIStateForm.pas"/>
+        <DCCReference Include="Src\LangOptionsSectionDirectives.pas"/>
+        <DCCReference Include="Src\MsgIDs.pas"/>
+        <DCCReference Include="Src\SetupSectionDirectives.pas"/>
+        <DCCReference Include="Src\CompTypes.pas"/>
+        <DCCReference Include="Src\FileClass.pas"/>
+        <DCCReference Include="Src\Int64Em.pas"/>
+        <DCCReference Include="Src\Compress.pas"/>
+        <DCCReference Include="Src\TaskDialog.pas"/>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
         </BuildConfiguration>

+ 1 - 1
Projects/ISCC.dpr

@@ -35,7 +35,7 @@ uses
 {$R ISCC.manifest.res}
 {$R ISCC.versionandicon.res}
 
-{$I VERSION.INC}
+{$I Src\VERSION.INC}
 
 type
   PScriptLine = ^TScriptLine;

+ 14 - 1
Projects/ISCmplr.dpr

@@ -30,7 +30,20 @@ uses
   FileClass in 'Src\FileClass.pas',
   ArcFour in 'Src\ArcFour.pas',
   VerInfo in 'Src\VerInfo.pas',
-  PathFunc in '..\Components\PathFunc.pas';
+  PathFunc in '..\Components\PathFunc.pas',
+  CmnFunc2 in 'Src\CmnFunc2.pas',
+  Int64Em in 'Src\Int64Em.pas',
+  SHA1 in 'Src\SHA1.pas',
+  DebugStruct in 'Src\DebugStruct.pas',
+  LangOptionsSectionDirectives in 'Src\LangOptionsSectionDirectives.pas',
+  MsgIDs in 'Src\MsgIDs.pas',
+  SetupEnt in 'Src\SetupEnt.pas',
+  SetupSectionDirectives in 'Src\SetupSectionDirectives.pas',
+  SetupTypes in 'Src\SetupTypes.pas',
+  SimpleExpression in 'Src\SimpleExpression.pas',
+  MD5 in 'Src\MD5.pas',
+  RedirFunc in 'Src\RedirFunc.pas',
+  DotNetVersion in 'Src\DotNetVersion.pas';
 
 {$IMAGEBASE $00800000}
 {$SETPEOSVERSION 6.1}

+ 13 - 0
Projects/ISCmplr.dproj

@@ -99,6 +99,19 @@
         <DCCReference Include="Src\ArcFour.pas"/>
         <DCCReference Include="Src\VerInfo.pas"/>
         <DCCReference Include="..\Components\PathFunc.pas"/>
+        <DCCReference Include="Src\CmnFunc2.pas"/>
+        <DCCReference Include="Src\Int64Em.pas"/>
+        <DCCReference Include="Src\SHA1.pas"/>
+        <DCCReference Include="Src\DebugStruct.pas"/>
+        <DCCReference Include="Src\LangOptionsSectionDirectives.pas"/>
+        <DCCReference Include="Src\MsgIDs.pas"/>
+        <DCCReference Include="Src\SetupEnt.pas"/>
+        <DCCReference Include="Src\SetupSectionDirectives.pas"/>
+        <DCCReference Include="Src\SetupTypes.pas"/>
+        <DCCReference Include="Src\SimpleExpression.pas"/>
+        <DCCReference Include="Src\MD5.pas"/>
+        <DCCReference Include="Src\RedirFunc.pas"/>
+        <DCCReference Include="Src\DotNetVersion.pas"/>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
         </BuildConfiguration>

+ 7 - 7
Projects/ISPP/ISPP.dpr

@@ -14,7 +14,7 @@ uses
   SysUtils,
   Windows,
   Classes,
-  CompPreprocInt in '..\CompPreprocInt.pas',
+  CompPreprocInt in '..\Src\CompPreprocInt.pas',
   IsppPreprocess in 'IsppPreprocess.pas',
   IsppPreprocessor in 'IsppPreprocessor.pas',
   IsppFuncs in 'IsppFuncs.pas',
@@ -28,12 +28,12 @@ uses
   CTokenizer in 'CTokenizer.pas',
   IsppBase in 'IsppBase.pas',
   PathFunc in '..\..\Components\PathFunc.pas',
-  CmnFunc2 in '..\CmnFunc2.pas',
-  FileClass in '..\FileClass.pas',
-  Int64Em in '..\Int64Em.pas',
-  MD5 in '..\MD5.pas',
-  SHA1 in '..\SHA1.pas',
-  Struct in '..\Struct.pas';
+  CmnFunc2 in '..\Src\CmnFunc2.pas',
+  FileClass in '..\Src\FileClass.pas',
+  Int64Em in '..\Src\Int64Em.pas',
+  MD5 in '..\Src\MD5.pas',
+  SHA1 in '..\Src\SHA1.pas',
+  Struct in '..\Src\Struct.pas';
   
 {$IMAGEBASE $01800000}
 {$SETPEOSVERSION 6.1}

+ 7 - 7
Projects/ISPP/ISPP.dproj

@@ -78,7 +78,7 @@
         <DelphiCompile Include="$(MainSource)">
             <MainSource>MainSource</MainSource>
         </DelphiCompile>
-        <DCCReference Include="..\CompPreprocInt.pas"/>
+        <DCCReference Include="..\Src\CompPreprocInt.pas"/>
         <DCCReference Include="IsppPreprocess.pas"/>
         <DCCReference Include="IsppPreprocessor.pas"/>
         <DCCReference Include="IsppFuncs.pas"/>
@@ -92,12 +92,12 @@
         <DCCReference Include="CTokenizer.pas"/>
         <DCCReference Include="IsppBase.pas"/>
         <DCCReference Include="..\..\Components\PathFunc.pas"/>
-        <DCCReference Include="..\CmnFunc2.pas"/>
-        <DCCReference Include="..\FileClass.pas"/>
-        <DCCReference Include="..\Int64Em.pas"/>
-        <DCCReference Include="..\MD5.pas"/>
-        <DCCReference Include="..\SHA1.pas"/>
-        <DCCReference Include="..\Struct.pas"/>
+        <DCCReference Include="..\Src\CmnFunc2.pas"/>
+        <DCCReference Include="..\Src\FileClass.pas"/>
+        <DCCReference Include="..\Src\Int64Em.pas"/>
+        <DCCReference Include="..\Src\MD5.pas"/>
+        <DCCReference Include="..\Src\SHA1.pas"/>
+        <DCCReference Include="..\Src\Struct.pas"/>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
         </BuildConfiguration>

+ 1 - 1
Projects/ISPP/IsppFuncs.pas

@@ -12,7 +12,7 @@ unit IsppFuncs;
 
 interface
 
-{$I ..\Version.inc}
+{$I ..\Src\Version.inc}
 
 uses
   Windows, Classes, IsppVarUtils, IsppIntf, IsppPreprocessor, IsppParser;

+ 1 - 1
Projects/ISPP/IsppPreprocessor.pas

@@ -15,7 +15,7 @@ interface
 uses Windows, SysUtils, Classes, CompPreprocInt, IniFiles, Registry, IsppIntf,
   IsppBase, IsppStack, IsppIdentMan, IsppParser;
 
-{$I ..\Version.inc}
+{$I ..\Src\Version.inc}
 
 type
 

+ 1 - 1
Projects/ISPP/IsppSessions.pas

@@ -23,7 +23,7 @@ procedure QueueFileForDeletion(const FileName: string);
 
 implementation
 
-{$I ..\Version.inc}
+{$I ..\Src\Version.inc}
 
 uses SysUtils, Classes, IsppStack, Windows;
 

+ 7 - 3
Projects/Setup.dpr

@@ -30,7 +30,7 @@ uses
   InstFnc2 in 'Src\InstFnc2.pas',
   Wizard in 'Src\Wizard.pas' {WizardForm},
   ScriptFunc_R in 'Src\ScriptFunc_R.pas',
-  ScriptFunc in 'Src\Src\ScriptFunc.pas',
+  ScriptFunc in 'Src\ScriptFunc.pas',
   SetupTypes in 'Src\SetupTypes.pas',
   ScriptRunner in 'Src\ScriptRunner.pas',
   ScriptDlg in 'Src\ScriptDlg.pas',
@@ -83,7 +83,11 @@ uses
   Resample in '..\Components\Resample.pas',
   dwTaskbarList in '..\Components\dwTaskbarList.pas',
   ASMInline in '..\Components\ASMInline.pas',
-  TaskbarProgressFunc in 'Src\TaskbarProgressFunc.pas';
+  TaskbarProgressFunc in 'Src\TaskbarProgressFunc.pas',
+  DotNet in 'Src\DotNet.pas',
+  SetupEnt in 'Src\SetupEnt.pas',
+  Msi in 'Src\Msi.pas',
+  DotNetVersion in 'Src\DotNetVersion.pas';
 
 {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SETPEOSVERSION 6.1}
@@ -94,7 +98,7 @@ uses
 {$R Setup.images.res}
 {$R Setup.version.res}
 
-{$I VERSION.INC}
+{$I Src\VERSION.INC}
 
 procedure ShowExceptionMsg;
 var

+ 6 - 2
Projects/Setup.dproj

@@ -36,7 +36,7 @@
         <DCC_WriteableConstants>true</DCC_WriteableConstants>
         <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo>
         <DCC_UnitSearchPath>..\Components\UniPs\Source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
-        <DCC_Define>PS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS;$(DCC_Define)</DCC_Define>
+        <DCC_Define>SETUPPROJ;PS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS;$(DCC_Define)</DCC_Define>
         <SanitizedProjectName>Setup</SanitizedProjectName>
         <VerInfo_Locale>1043</VerInfo_Locale>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
@@ -96,7 +96,7 @@
             <Form>WizardForm</Form>
         </DCCReference>
         <DCCReference Include="Src\ScriptFunc_R.pas"/>
-        <DCCReference Include="Src\Src\ScriptFunc.pas"/>
+        <DCCReference Include="Src\ScriptFunc.pas"/>
         <DCCReference Include="Src\SetupTypes.pas"/>
         <DCCReference Include="Src\ScriptRunner.pas"/>
         <DCCReference Include="Src\ScriptDlg.pas"/>
@@ -158,6 +158,10 @@
         <DCCReference Include="..\Components\dwTaskbarList.pas"/>
         <DCCReference Include="..\Components\ASMInline.pas"/>
         <DCCReference Include="Src\TaskbarProgressFunc.pas"/>
+        <DCCReference Include="Src\DotNet.pas"/>
+        <DCCReference Include="Src\SetupEnt.pas"/>
+        <DCCReference Include="Src\Msi.pas"/>
+        <DCCReference Include="Src\DotNetVersion.pas"/>
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
         </BuildConfiguration>

+ 1 - 0
Projects/SetupLdr.dproj

@@ -47,6 +47,7 @@
         <DCC_IMPLICIT_INTEGER_CAST_LOSS>false</DCC_IMPLICIT_INTEGER_CAST_LOSS>
         <DCC_IMPLICIT_CONVERSION_LOSS>false</DCC_IMPLICIT_CONVERSION_LOSS>
         <DCC_DcuOutput>Dcu\$(MainSource)</DCC_DcuOutput>
+        <DCC_Define>SETUPLDRPROJ;$(DCC_Define)</DCC_Define>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win32)'!=''">
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>

+ 1 - 1
Projects/Src/CompMsgBoxDesigner.pas

@@ -110,7 +110,7 @@ type
 implementation
 
 uses
-  CmnFunc, CmnFunc2, CompFunc, TaskDialog, Msgs;
+  CmnFunc, CmnFunc2, CompFunc, TaskDialog, CompMsgs;
 
 {$R *.DFM}
 

+ 1 - 1
Projects/Src/CompWizard.pas

@@ -177,7 +177,7 @@ implementation
 
 uses
   SysUtils, ShlObj, ActiveX, UITypes,
-  PathFunc, CmnFunc, CmnFunc2, CompFunc, VerInfo, BrowseFunc,
+  PathFunc, CmnFunc, CmnFunc2, CompFunc, BrowseFunc,
   CompMsgs, CompWizardFile;
 
 type

+ 1 - 2
Projects/Src/DotNet.pas

@@ -29,7 +29,7 @@ unit DotNet;
 interface
 
 uses
-  Ole2, SysUtils, Windows, CmnFunc2;
+  Ole2, SysUtils, Windows, CmnFunc2, DotNetVersion;
 
 type
   IAssemblyCache = class(Ole2.IUnknown)
@@ -53,7 +53,6 @@ type
   end;
 
   TDotNetBaseVersion = (netbase11, netbase20, netbase40, netbaseHighestKnown);
-  TDotNetVersion = (net11, net20, net30, net35, net4Client, net4Full, net45, net451, net452, net46, net461, net462, net47, net471, net472, net48, net481);
 
 function GetDotNetInstallRoot(const RegView: TRegView): String;
 function GetDotNetVersionInstallRoot(const RegView: TRegView; const Version: TDotNetBaseVersion): String;

+ 6 - 4
Projects/Src/Msgs.pas

@@ -2,15 +2,17 @@ unit Msgs;
 
 {
   Inno Setup
-  Copyright (C) 1997-2007 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
-  Message file handling functions
-
-  $jrsoftware: issrc/Projects/Msgs.pas,v 1.20 2009/03/23 13:31:17 mlaan Exp $
+  Message file handling functions - only to be used by Setup(Ldr)
 }
 
+{$IF not Defined(SETUPPROJ) and not Defined(SETUPLDRPROJ) }
+  {$Message Error 'Only the Setup and SetupLdr projects should use this unit.'}
+{$IFEND}
+
 interface
 
 uses

+ 1 - 1
Projects/Src/ScriptFunc_C.pas

@@ -22,7 +22,7 @@ implementation
 uses
   Windows, SysUtils, TypInfo,
   CmnFunc2, MsgIDs, Struct,
-  SetupTypes, ScriptFunc, CompMsgs, DotNet;
+  SetupTypes, ScriptFunc, CompMsgs, DotNetVersion;
 
 { This type copied from CmnFunc.pas. We don't actually 'use' CmnFunc since
   it would cause VCL units to be linked in. }

+ 1 - 1
Projects/Src/ScriptFunc_R.pas

@@ -26,7 +26,7 @@ uses
   Struct, ScriptDlg, Main, PathFunc, CmnFunc, CmnFunc2, FileClass, RedirFunc,
   Install, InstFunc, InstFnc2, Msgs, MsgIDs, NewDisk, BrowseFunc, Wizard, VerInfo,
   SetupTypes, Int64Em, MD5, SHA1, Logging, SetupForm, RegDLL, Helper,
-  SpawnClient, UninstProgressForm, ASMInline, DotNet, Msi, BitmapImage;
+  SpawnClient, UninstProgressForm, ASMInline, DotNet, DotNetVersion, Msi, BitmapImage;
 
 var
   ScaleBaseUnitsInitialized: Boolean;

+ 14 - 4
Projects/Src/TaskDialog.pas

@@ -19,7 +19,8 @@ function TaskDialogMsgBox(const Icon, Instruction, Text, Caption: String; const
 implementation
 
 uses
-  Classes, StrUtils, Math, Forms, Dialogs, SysUtils, Commctrl, CmnFunc2, InstFunc, PathFunc;
+  Classes, StrUtils, Math, Forms, Dialogs, SysUtils,
+  Commctrl, CmnFunc2, {$IFDEF SETUPPROJ} InstFunc, {$ENDIF} PathFunc;
 
 var
   TaskDialogIndirectFunc: function(const pTaskConfig: TTaskDialogConfig;
@@ -99,6 +100,15 @@ begin
     Result := False;
 end;
 
+procedure DoInternalError(const Msg: String);
+begin
+  {$IFDEF SETUPPROJ}
+    InternalError(Msg);
+  {$ELSE}
+    raise Exception.Create(Msg);
+  {$ENDIF}
+end;
+
 function TaskDialogMsgBox(const Icon, Instruction, Text, Caption: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: array of String; const ShieldButton: Integer; const VerificationText: String = ''; const pfVerificationFlagChecked: PBOOL = nil): Integer;
 var
   IconP: PChar;
@@ -154,19 +164,19 @@ begin
     MB_ABORTRETRYIGNORE:
       begin
         if NButtonLabelsAvailable = 0 then
-          InternalError('TaskDialogMsgBox: Invalid ButtonLabels')
+          DoInternalError('TaskDialogMsgBox: Invalid ButtonLabels')
         else
           ButtonIDs := [IDRETRY, IDIGNORE, IDABORT]; { Notice the order, abort label must be last }
         TDCommonButtons := 0;
       end;
     else
       begin
-        InternalError('TaskDialogMsgBox: Invalid Buttons');
+        DoInternalError('TaskDialogMsgBox: Invalid Buttons');
         TDCommonButtons := 0; { Silence compiler }
       end;
   end;
   if Length(ButtonIDs) <> NButtonLabelsAvailable then
-    InternalError('TaskDialogMsgBox: Invalid ButtonLabels');
+    DoInternalError('TaskDialogMsgBox: Invalid ButtonLabels');
   if not DoTaskDialog(Application.Handle, PChar(Instruction), PChar(Text),
            GetMessageBoxCaption(PChar(Caption), Typ), IconP, TDCommonButtons, ButtonLabels, ButtonIDs, ShieldButton,
            GetMessageBoxRightToLeft, IfThen(Typ in [mbError, mbCriticalError], MB_ICONSTOP, 0), Result, PChar(VerificationText), pfVerificationFlagChecked) then //note that MB_ICONEXCLAMATION (used by mbError) includes MB_ICONSTOP (used by mbCriticalError)

+ 0 - 0
Projects/Version.inc → Projects/Src/Version.inc


+ 2 - 2
compile.bat

@@ -55,11 +55,11 @@ echo - ISCmplr.dpr
 if errorlevel 1 goto failed
 
 echo - SetupLdr.dpr
-"%DELPHIXEROOT%\bin\dcc32.exe" --no-config -NSsystem;system.win;winapi -Q -B -H -W %DELPHIXEDISABLEDWARNINGS% %1 -U"%DELPHIXEROOT%\lib\win32\release" -E..\Files SetupLdr.dpr
+"%DELPHIXEROOT%\bin\dcc32.exe" --no-config -NSsystem;system.win;winapi -Q -B -H -W %DELPHIXEDISABLEDWARNINGS% %1 -U"%DELPHIXEROOT%\lib\win32\release" -E..\Files SetupLdr.dpr -DSETUPLDRPROJ
 if errorlevel 1 goto failed
 
 echo - Setup.dpr
-"%DELPHIXEROOT%\bin\dcc32.exe" --no-config -NSsystem;system.win;winapi;vcl -Q -B -W %DELPHIXEDISABLEDWARNINGS% %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components\UniPs\Source" -E..\Files -DPS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS Setup.dpr
+"%DELPHIXEROOT%\bin\dcc32.exe" --no-config -NSsystem;system.win;winapi;vcl -Q -B -W %DELPHIXEDISABLEDWARNINGS% %1 -U"%DELPHIXEROOT%\lib\win32\release;..\Components\UniPs\Source" -E..\Files -DSETUPPROJ;PS_MINIVCL;PS_NOGRAPHCONST;PS_PANSICHAR;PS_NOINTERFACEGUIDBRACKETS Setup.dpr
 if errorlevel 1 goto failed
 
 echo - Renaming E32 files