Martijn Laan 1 år sedan
förälder
incheckning
2c226c77d1

+ 0 - 7
ISHelp/ISHelpGen/UIsxclassesParser.pas

@@ -23,13 +23,6 @@ uses
   Windows,
   Windows,
   SysUtils;
   SysUtils;
 
 
-{$IFNDEF UNICODE}
-function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean;
-begin
-  Result := C in CharSet;
-end;
-{$ENDIF}
-
 constructor TIsxclassesParser.Create();
 constructor TIsxclassesParser.Create();
 begin
 begin
   inherited;
   inherited;

+ 1 - 21
Projects/Helper.pas

@@ -2,7 +2,7 @@ unit Helper;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2010 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -10,8 +10,6 @@ unit Helper;
 
 
   NOTE: These functions are NOT thread-safe. Do not call them from multiple
   NOTE: These functions are NOT thread-safe. Do not call them from multiple
   threads simultaneously.
   threads simultaneously.
-
-  $jrsoftware: issrc/Projects/Helper.pas,v 1.14 2010/10/20 02:43:26 jr Exp $
 }
 }
 
 
 interface
 interface
@@ -146,7 +144,6 @@ begin
 end;
 end;
 
 
 procedure FillWideCharBuffer(var Buf: array of WideChar; const S: String);
 procedure FillWideCharBuffer(var Buf: array of WideChar; const S: String);
-{$IFDEF UNICODE}
 begin
 begin
   if High(Buf) <= 0 then
   if High(Buf) <= 0 then
     InternalError('FillWideCharBuffer: Invalid Buf');
     InternalError('FillWideCharBuffer: Invalid Buf');
@@ -154,23 +151,6 @@ begin
     InternalError('FillWideCharBuffer: String too long');
     InternalError('FillWideCharBuffer: String too long');
   StrPLCopy(Buf, S, High(Buf));
   StrPLCopy(Buf, S, High(Buf));
 end;
 end;
-{$ELSE}
-var
-  SourceLen, DestLen: Integer;
-begin
-  if High(Buf) <= 0 then
-    InternalError('FillWideCharBuffer: Invalid Buf');
-  SourceLen := Length(S);
-  if SourceLen = 0 then
-    DestLen := 0
-  else begin
-    DestLen := MultiByteToWideChar(CP_ACP, 0, PChar(S), SourceLen, Buf, High(Buf));
-    if DestLen <= 0 then
-      InternalError('FillWideCharBuffer: MultiByteToWideChar failed');
-  end;
-  Buf[DestLen] := #0;
-end;
-{$ENDIF}
 
 
 { THelper }
 { THelper }
 
 

+ 0 - 12
Projects/InstFunc.pas

@@ -72,19 +72,13 @@ function GetFileDateTime(const DisableFsRedir: Boolean; const Filename: String;
   var DateTime: TFileTime): Boolean;
   var DateTime: TFileTime): Boolean;
 function GetMD5OfFile(const DisableFsRedir: Boolean; const Filename: String): TMD5Digest;
 function GetMD5OfFile(const DisableFsRedir: Boolean; const Filename: String): TMD5Digest;
 function GetMD5OfAnsiString(const S: AnsiString): TMD5Digest;
 function GetMD5OfAnsiString(const S: AnsiString): TMD5Digest;
-{$IFDEF UNICODE}
 function GetMD5OfUnicodeString(const S: UnicodeString): TMD5Digest;
 function GetMD5OfUnicodeString(const S: UnicodeString): TMD5Digest;
-{$ENDIF}
 function GetSHA1OfFile(const DisableFsRedir: Boolean; const Filename: String): TSHA1Digest;
 function GetSHA1OfFile(const DisableFsRedir: Boolean; const Filename: String): TSHA1Digest;
 function GetSHA1OfAnsiString(const S: AnsiString): TSHA1Digest;
 function GetSHA1OfAnsiString(const S: AnsiString): TSHA1Digest;
-{$IFDEF UNICODE}
 function GetSHA1OfUnicodeString(const S: UnicodeString): TSHA1Digest;
 function GetSHA1OfUnicodeString(const S: UnicodeString): TSHA1Digest;
-{$ENDIF}
 function GetSHA256OfFile(const DisableFsRedir: Boolean; const Filename: String): String;
 function GetSHA256OfFile(const DisableFsRedir: Boolean; const Filename: String): String;
 function GetSHA256OfAnsiString(const S: AnsiString): String;
 function GetSHA256OfAnsiString(const S: AnsiString): String;
-{$IFDEF UNICODE}
 function GetSHA256OfUnicodeString(const S: UnicodeString): String;
 function GetSHA256OfUnicodeString(const S: UnicodeString): String;
-{$ENDIF}
 function GetRegRootKeyName(const RootKey: HKEY): String;
 function GetRegRootKeyName(const RootKey: HKEY): String;
 function GetSpaceOnDisk(const DisableFsRedir: Boolean; const DriveRoot: String;
 function GetSpaceOnDisk(const DisableFsRedir: Boolean; const DriveRoot: String;
   var FreeBytes, TotalBytes: Integer64): Boolean;
   var FreeBytes, TotalBytes: Integer64): Boolean;
@@ -745,24 +739,20 @@ begin
   Result := MD5Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
   Result := MD5Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
 end;
 end;
 
 
-{$IFDEF UNICODE}
 function GetMD5OfUnicodeString(const S: UnicodeString): TMD5Digest;
 function GetMD5OfUnicodeString(const S: UnicodeString): TMD5Digest;
 begin
 begin
   Result := MD5Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
   Result := MD5Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
 end;
 end;
-{$ENDIF}
 
 
 function GetSHA1OfAnsiString(const S: AnsiString): TSHA1Digest;
 function GetSHA1OfAnsiString(const S: AnsiString): TSHA1Digest;
 begin
 begin
   Result := SHA1Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
   Result := SHA1Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
 end;
 end;
 
 
-{$IFDEF UNICODE}
 function GetSHA1OfUnicodeString(const S: UnicodeString): TSHA1Digest;
 function GetSHA1OfUnicodeString(const S: UnicodeString): TSHA1Digest;
 begin
 begin
   Result := SHA1Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
   Result := SHA1Buf(Pointer(S)^, Length(S)*SizeOf(S[1]));
 end;
 end;
-{$ENDIF}
 
 
 function GetSHA256OfAnsiString(const S: AnsiString): String;
 function GetSHA256OfAnsiString(const S: AnsiString): String;
 var
 var
@@ -778,7 +768,6 @@ begin
   end;
   end;
 end;
 end;
 
 
-{$IFDEF UNICODE}
 function GetSHA256OfUnicodeString(const S: UnicodeString): String;
 function GetSHA256OfUnicodeString(const S: UnicodeString): String;
 var
 var
   M: TMemoryStream;
   M: TMemoryStream;
@@ -792,7 +781,6 @@ begin
     M.Free;
     M.Free;
   end;
   end;
 end;
 end;
-{$ENDIF}
 
 
 var
 var
   SFCInitialized: Boolean;
   SFCInitialized: Boolean;

+ 1 - 27
Projects/Install.pas

@@ -395,7 +395,6 @@ var
   end;
   end;
 
 
   function PackCompiledCodeTextIntoString(const CompiledCodeText: AnsiString): String;
   function PackCompiledCodeTextIntoString(const CompiledCodeText: AnsiString): String;
-{$IFDEF UNICODE}
   var
   var
     N: Integer;
     N: Integer;
   begin
   begin
@@ -404,10 +403,6 @@ var
       Inc(N); { This will lead to 1 extra byte being moved but that's ok since it is the #0 }
       Inc(N); { This will lead to 1 extra byte being moved but that's ok since it is the #0 }
     N := N div 2;
     N := N div 2;
     SetString(Result, PChar(Pointer(CompiledCodeText)), N);
     SetString(Result, PChar(Pointer(CompiledCodeText)), N);
-{$ELSE}
-  begin
-    Result := CompiledCodeText;
-{$ENDIF}
   end;
   end;
 
 
   procedure RecordCompiledCode;
   procedure RecordCompiledCode;
@@ -438,7 +433,7 @@ var
     { Record [Code] even if empty to 'overwrite' old versions }
     { Record [Code] even if empty to 'overwrite' old versions }
     UninstLog.Add(utCompiledCode, [PackCompiledCodeTextIntoString(SetupHeader.CompiledCodeText),
     UninstLog.Add(utCompiledCode, [PackCompiledCodeTextIntoString(SetupHeader.CompiledCodeText),
       LeadBytesStr, ExpandedApp, ExpandedGroup, WizardGroupValue,
       LeadBytesStr, ExpandedApp, ExpandedGroup, WizardGroupValue,
-      ExpandConst('{language}'), CustomMessagesStr], SetupBinVersion {$IFDEF UNICODE} or Longint($80000000) {$ENDIF});
+      ExpandConst('{language}'), CustomMessagesStr], SetupBinVersion or Longint($80000000));
   end;
   end;
 
 
   type
   type
@@ -898,11 +893,7 @@ var
       anti-spyware programs that catch all unins*.exe files with certain MD5
       anti-spyware programs that catch all unins*.exe files with certain MD5
       sums just because some piece of spyware was deployed with Inno Setup and
       sums just because some piece of spyware was deployed with Inno Setup and
       had the unins*.exe file in its directory. }
       had the unins*.exe file in its directory. }
-{$IFDEF UNICODE}
     UniqueValue := GetSHA1OfUnicodeString(ExpandedAppId);
     UniqueValue := GetSHA1OfUnicodeString(ExpandedAppId);
-{$ELSE}
-    UniqueValue := GetSHA1OfAnsiString(ExpandedAppId);
-{$ENDIF}
     F.WriteBuffer(UniqueValue, SizeOf(UniqueValue));
     F.WriteBuffer(UniqueValue, SizeOf(UniqueValue));
 
 
     UninstallerMsgTail.ID := UninstallerMsgTailID;
     UninstallerMsgTail.ID := UninstallerMsgTailID;
@@ -1953,14 +1944,10 @@ var
           'IconIndex=' + IntToStr(IconIndex) + SNewLine;
           'IconIndex=' + IntToStr(IconIndex) + SNewLine;
       F := TTextFileWriter.Create(Filename, fdCreateAlways, faWrite, fsNone);
       F := TTextFileWriter.Create(Filename, fdCreateAlways, faWrite, fsNone);
       try
       try
-{$IFDEF UNICODE}
         if SameText(S, String(AnsiString(S))) then
         if SameText(S, String(AnsiString(S))) then
           F.WriteAnsi(AnsiString(S))
           F.WriteAnsi(AnsiString(S))
         else
         else
           F.Write(S);
           F.Write(S);
-{$ELSE}
-        F.Write(S);
-{$ENDIF}
       finally
       finally
         F.Free;
         F.Free;
       end;
       end;
@@ -2281,10 +2268,8 @@ var
     NeedToRetry, DidDeleteKey: Boolean;
     NeedToRetry, DidDeleteKey: Boolean;
     ErrorCode: Longint;
     ErrorCode: Longint;
     QV: Integer64;
     QV: Integer64;
-{$IFDEF UNICODE}
     I: Integer;
     I: Integer;
     AnsiS: AnsiString;
     AnsiS: AnsiString;
-{$ENDIF}
   begin
   begin
     for CurRegNumber := 0 to Entries[seRegistry].Count-1 do begin
     for CurRegNumber := 0 to Entries[seRegistry].Count-1 do begin
       with PSetupRegistryEntry(Entries[seRegistry][CurRegNumber])^ do begin
       with PSetupRegistryEntry(Entries[seRegistry][CurRegNumber])^ do begin
@@ -2456,16 +2441,11 @@ var
                             RegError(reRegSetValueEx, RK, S, ErrorCode);
                             RegError(reRegSetValueEx, RK, S, ErrorCode);
                         end;
                         end;
                       rtBinary: begin
                       rtBinary: begin
-{$IFDEF UNICODE}
                           AnsiS := '';
                           AnsiS := '';
                           for I := 1 to Length(ValueData) do
                           for I := 1 to Length(ValueData) do
                             AnsiS := AnsiS + AnsiChar(Ord(ValueData[I]));
                             AnsiS := AnsiS + AnsiChar(Ord(ValueData[I]));
                           ErrorCode := RegSetValueEx(K, PChar(N), 0, REG_BINARY,
                           ErrorCode := RegSetValueEx(K, PChar(N), 0, REG_BINARY,
                             PAnsiChar(AnsiS), Length(AnsiS));
                             PAnsiChar(AnsiS), Length(AnsiS));
-{$ELSE}
-                          ErrorCode := RegSetValueEx(K, PChar(N), 0, REG_BINARY,
-                            PChar(ValueData), Length(ValueData));
-{$ENDIF}
                           if (ErrorCode <> ERROR_SUCCESS) and
                           if (ErrorCode <> ERROR_SUCCESS) and
                              not(roNoError in Options) then
                              not(roNoError in Options) then
                             RegError(reRegSetValueEx, RK, S, ErrorCode);
                             RegError(reRegSetValueEx, RK, S, ErrorCode);
@@ -3351,13 +3331,7 @@ procedure ExtractTemporaryFile(const BaseName: String);
       if Result[I] = '{' then begin
       if Result[I] = '{' then begin
         Insert('{', Result, I);
         Insert('{', Result, I);
         Inc(I);
         Inc(I);
-  {$IFDEF UNICODE}
       end;
       end;
-  {$ELSE}
-      end
-      else if Result[I] in ConstLeadBytes^ then
-        Inc(I);
-  {$ENDIF}
       Inc(I);
       Inc(I);
     end;
     end;
   end;
   end;

+ 1 - 3
Projects/ScriptClasses_R.pas

@@ -24,7 +24,7 @@ implementation
 uses
 uses
   Windows, Controls, Forms, StdCtrls, Graphics,
   Windows, Controls, Forms, StdCtrls, Graphics,
   uPSR_std, uPSR_classes, uPSR_graphics, uPSR_controls, uPSR_forms,
   uPSR_std, uPSR_classes, uPSR_graphics, uPSR_controls, uPSR_forms,
-  uPSR_stdctrls, uPSR_extctrls, uPSR_comobj, {$IFNDEF UNICODE} uPSUtils, {$ENDIF}
+  uPSR_stdctrls, uPSR_extctrls, uPSR_comobj,
   NewStaticText, NewCheckListBox, NewProgressBar, RichEditViewer,
   NewStaticText, NewCheckListBox, NewProgressBar, RichEditViewer,
   ExtCtrls, UIStateForm, SetupForm, Main, Wizard, SetupTypes, PasswordEdit,
   ExtCtrls, UIStateForm, SetupForm, Main, Wizard, SetupTypes, PasswordEdit,
   FolderTreeView, BitmapImage, NewNotebook, ScriptDlg, BidiCtrls,
   FolderTreeView, BitmapImage, NewNotebook, ScriptDlg, BidiCtrls,
@@ -370,9 +370,7 @@ begin
     RIRegisterTStringList(Cl);
     RIRegisterTStringList(Cl);
     RIRegisterTHandleStream(Cl);
     RIRegisterTHandleStream(Cl);
     RIRegisterTFileStream(Cl);
     RIRegisterTFileStream(Cl);
-{$IFDEF UNICODE}
     RIRegisterTStringStream(Cl);
     RIRegisterTStringStream(Cl);
-{$ENDIF}
 
 
     { Graphics }
     { Graphics }
     RIRegisterTGraphicsObject(Cl);
     RIRegisterTGraphicsObject(Cl);

+ 3 - 34
Projects/ScriptRunner.pas

@@ -2,7 +2,7 @@ unit ScriptRunner;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2019 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -147,7 +147,6 @@ begin
           Param := CreateHeapVariant(FPSExec.FindType2(btString));
           Param := CreateHeapVariant(FPSExec.FindType2(btString));
           PPSVariantAString(Param).Data := AnsiString(Parameters[I].vAnsiString);
           PPSVariantAString(Param).Data := AnsiString(Parameters[I].vAnsiString);
         end;
         end;
-{$IFDEF UNICODE}
       vtWideString:
       vtWideString:
         begin
         begin
           Param := CreateHeapVariant(FPSExec.FindType2(btWideString));
           Param := CreateHeapVariant(FPSExec.FindType2(btWideString));
@@ -158,7 +157,6 @@ begin
           Param := CreateHeapVariant(FPSExec.FindType2(btUnicodeString));
           Param := CreateHeapVariant(FPSExec.FindType2(btUnicodeString));
           PPSVariantUString(Param).Data := UnicodeString(Parameters[I].VUnicodeString);
           PPSVariantUString(Param).Data := UnicodeString(Parameters[I].VUnicodeString);
         end;
         end;
-{$ENDIF}
       vtInteger:
       vtInteger:
         begin
         begin
           Param := CreateHeapVariant(FPSExec.FindType2(btS32));
           Param := CreateHeapVariant(FPSExec.FindType2(btS32));
@@ -190,7 +188,6 @@ end;
 
 
 {---}
 {---}
 
 
-{$IFDEF UNICODE}
 function EncodeDLLFilenameForROPS(const Filename: String): AnsiString;
 function EncodeDLLFilenameForROPS(const Filename: String): AnsiString;
 begin
 begin
   Result := '';
   Result := '';
@@ -203,7 +200,6 @@ begin
   UnloadDLL(Caller, EncodeDLLFilenameForROPS(Stack.GetString(-1)));
   UnloadDLL(Caller, EncodeDLLFilenameForROPS(Stack.GetString(-1)));
   Result := True;
   Result := True;
 end;
 end;
-{$ENDIF}
 
 
 function PSExecOnSpecialProcImport(Sender: TPSExec; p: TPSExternalProcRec; Tag: Pointer): Boolean;
 function PSExecOnSpecialProcImport(Sender: TPSExec; p: TPSExternalProcRec; Tag: Pointer): Boolean;
 const
 const
@@ -248,30 +244,17 @@ begin
   FunctionName := Copy(S, 1, I-1);
   FunctionName := Copy(S, 1, I-1);
 
 
   ScriptRunner.LogFmt('Function name: %s', [FunctionName]);
   ScriptRunner.LogFmt('Function name: %s', [FunctionName]);
-{$IFDEF UNICODE}
   UnicodeDllName := UTF8ToString(DllName);
   UnicodeDllName := UTF8ToString(DllName);
   ScriptRunner.LogFmt('DLL name: %s', [UnicodeDllname]);
   ScriptRunner.LogFmt('DLL name: %s', [UnicodeDllname]);
-{$ELSE}
-  ScriptRunner.LogFmt('DLL name: %s', [DllName]);
-{$ENDIF}
 
 
   if Assigned(ScriptRunner.FOnDllImport) then begin
   if Assigned(ScriptRunner.FOnDllImport) then begin
-{$IFDEF UNICODE}
     ScriptRunner.FOnDllImport(UnicodeDllName, ForceDelayLoad);
     ScriptRunner.FOnDllImport(UnicodeDllName, ForceDelayLoad);
     DllName := EncodeDLLFilenameForROPS(UnicodeDllName);
     DllName := EncodeDLLFilenameForROPS(UnicodeDllName);
-{$ELSE}
-    ScriptRunner.FOnDllImport(DllName, ForceDelayLoad);
-{$ENDIF}
-
     p.Decl := AnsiString('dll:') + DllName + Copy(p.Decl, Pos(AnsiString(#0), p.Decl), MaxInt);
     p.Decl := AnsiString('dll:') + DllName + Copy(p.Decl, Pos(AnsiString(#0), p.Decl), MaxInt);
   end;
   end;
 
 
   if DllName <> '' then begin
   if DllName <> '' then begin
-{$IFDEF UNICODE}
     ScriptRunner.LogFmt('Dest DLL name: %s', [UnicodeDllName]);
     ScriptRunner.LogFmt('Dest DLL name: %s', [UnicodeDllName]);
-{$ELSE}
-    ScriptRunner.LogFmt('Dest DLL name: %s', [DllName]);
-{$ENDIF}
     ScriptRunner.Log('Importing the DLL function.');
     ScriptRunner.Log('Importing the DLL function.');
   end else
   end else
     ScriptRunner.Log('Skipping.'); { We're actually still going to call ProcessDllImport but this doesn't matter to the user. }
     ScriptRunner.Log('Skipping.'); { We're actually still going to call ProcessDllImport but this doesn't matter to the user. }
@@ -341,12 +324,8 @@ begin
   FPSExec.OnSourceLine := PSExecOnSourceLine;
   FPSExec.OnSourceLine := PSExecOnSourceLine;
   FPSExec.OnException := PSExecOnException;
   FPSExec.OnException := PSExecOnException;
 
 
-{$IFNDEF UNICODE}
-  RegisterDLLRuntimeEx(FPSExec, False);
-{$ELSE}
   RegisterDLLRuntimeEx(FPSExec, False, False);
   RegisterDLLRuntimeEx(FPSExec, False, False);
   FPSExec.RegisterFunctionName('UNLOADDLL', NewUnloadDLLProc, nil, nil);
   FPSExec.RegisterFunctionName('UNLOADDLL', NewUnloadDLLProc, nil, nil);
-{$ENDIF}
   FClassImporter := ScriptClassesLibraryRegister_R(FPSExec);
   FClassImporter := ScriptClassesLibraryRegister_R(FPSExec);
   ScriptFuncLibraryRegister_R(FPSExec);
   ScriptFuncLibraryRegister_R(FPSExec);
 end;
 end;
@@ -391,7 +370,7 @@ begin
         if Proc.Attributes.Count > 0 then begin
         if Proc.Attributes.Count > 0 then begin
           Attr := Proc.Attributes.FindAttribute(AnsiString(FNamingAttribute));
           Attr := Proc.Attributes.FindAttribute(AnsiString(FNamingAttribute));
           if (Attr <> nil) and (Attr.ValueCount = 1) and
           if (Attr <> nil) and (Attr.ValueCount = 1) and
-             ({$IFDEF UNICODE} ((Attr.Value[0].FType.BaseType = btUnicodeString) and (CompareText(PPSVariantUString(Attr.Value[0]).Data, Name) = 0)) or {$ENDIF}
+             (((Attr.Value[0].FType.BaseType = btUnicodeString) and (CompareText(PPSVariantUString(Attr.Value[0]).Data, Name) = 0)) or
               ((Attr.Value[0].FType.BaseType = btString) and (CompareText(PPSVariantAString(Attr.Value[0]).Data, Name) = 0))) then begin
               ((Attr.Value[0].FType.BaseType = btString) and (CompareText(PPSVariantAString(Attr.Value[0]).Data, Name) = 0))) then begin
             if ProcNos <> nil then
             if ProcNos <> nil then
               ProcNos.Add(Pointer(ProcNo));
               ProcNos.Add(Pointer(ProcNo));
@@ -584,20 +563,12 @@ begin
         Params := TPSList.Create();
         Params := TPSList.Create();
         try
         try
           SetPSExecParameters(Parameters, Params);
           SetPSExecParameters(Parameters, Params);
-{$IFDEF UNICODE}
           SetPSExecReturnValue(Params, btUnicodeString, Res);
           SetPSExecReturnValue(Params, btUnicodeString, Res);
-{$ELSE}
-          SetPSExecReturnValue(Params, btString, Res);
-{$ENDIF}
           FPSExec.RunProc(Params, Cardinal(ProcNos[I]));
           FPSExec.RunProc(Params, Cardinal(ProcNos[I]));
           WriteBackParameters(Parameters, Params);
           WriteBackParameters(Parameters, Params);
-
+          
           RaisePSExecException;
           RaisePSExecException;
-{$IFDEF UNICODE}
           Result := PPSVariantUString(Res).Data;
           Result := PPSVariantUString(Res).Data;
-{$ELSE}
-          Result := PPSVariantAString(Res).Data;
-{$ENDIF}
           if (Result <> '') and (BreakCondition = bcNonEmpty) then
           if (Result <> '') and (BreakCondition = bcNonEmpty) then
             Exit;
             Exit;
         finally
         finally
@@ -628,7 +599,6 @@ function TScriptRunner.EvaluateUsedVariable(const Param1, Param2, Param3: LongIn
 
 
   function VariantToString(const p: TPSVariantIFC; const ClassProperties: AnsiString): String;
   function VariantToString(const p: TPSVariantIFC; const ClassProperties: AnsiString): String;
   begin
   begin
-{$IFDEF UNICODE}
     //PSVariantToString isn't Unicode enabled, handle strings ourselves
     //PSVariantToString isn't Unicode enabled, handle strings ourselves
     //doesn't handle more complex types as records, arrays and objects
     //doesn't handle more complex types as records, arrays and objects
     if p.Dta <> nil then begin
     if p.Dta <> nil then begin
@@ -640,7 +610,6 @@ function TScriptRunner.EvaluateUsedVariable(const Param1, Param2, Param3: LongIn
         Result := PSVariantToString(p, ClassProperties);
         Result := PSVariantToString(p, ClassProperties);
       end;
       end;
     end else
     end else
-{$ENDIF}
     Result := PSVariantToString(p, ClassProperties);
     Result := PSVariantToString(p, ClassProperties);
   end;
   end;
 
 

+ 0 - 28
Projects/SecurityFunc.pas

@@ -25,34 +25,6 @@ implementation
 uses
 uses
   PathFunc, Msgs, InstFunc, Logging, RedirFunc, Helper;
   PathFunc, Msgs, InstFunc, Logging, RedirFunc, Helper;
 
 
-{$IFNDEF UNICODE}
-function AllocWideCharStr(const S: String): PWideChar;
-{ Allocates a null-terminated Unicode copy of S on the heap. Use FreeMem to
-  free the returned pointer. } 
-var
-  SourceLen, DestLen: Integer;
-begin
-  SourceLen := Length(S);
-  if SourceLen = 0 then
-    DestLen := 0
-  else begin
-    DestLen := MultiByteToWideChar(CP_ACP, 0, PChar(S), SourceLen, nil, 0);
-    if (DestLen <= 0) or (DestLen >= High(Integer) div SizeOf(WideChar)) then
-      InternalError('AllocWideCharStr: MultiByteToWideChar failed');
-  end;
-  GetMem(Result, (DestLen + 1) * SizeOf(WideChar));
-  try
-    if DestLen <> 0 then
-      if MultiByteToWideChar(CP_ACP, 0, PChar(S), SourceLen, Result, DestLen) <> DestLen then
-        InternalError('AllocWideCharStr: MultiByteToWideChar failed');
-    Result[DestLen] := #0;
-  except
-    FreeMem(Result);
-    raise;
-  end;
-end;
-{$ENDIF}
-
 function InternalGrantPermission(const ObjectType: DWORD; const ObjectName: String;
 function InternalGrantPermission(const ObjectType: DWORD; const ObjectName: String;
   const Entries: TGrantPermissionEntry; const EntryCount: Integer;
   const Entries: TGrantPermissionEntry; const EntryCount: Integer;
   const Inheritance: DWORD): DWORD;
   const Inheritance: DWORD): DWORD;

+ 2 - 16
Projects/SimpleExpression.pas

@@ -2,7 +2,7 @@ unit SimpleExpression;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2013 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -68,24 +68,10 @@ implementation
 uses
 uses
   SysUtils;
   SysUtils;
 
 
-{$IFNDEF UNICODE}
-type
-  TSysCharSet = set of AnsiChar;
-function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean;
-begin
-  Result := C in CharSet;
-end;
-{$ENDIF}
-
 procedure AssignStringToVarRec(var VarRec: TVarRec; const S: String);
 procedure AssignStringToVarRec(var VarRec: TVarRec; const S: String);
 begin
 begin
-{$IFDEF UNICODE}
   VarRec.VType := vtUnicodeString;
   VarRec.VType := vtUnicodeString;
   UnicodeString(VarRec.VUnicodeString) := S;
   UnicodeString(VarRec.VUnicodeString) := S;
-{$ELSE}
-  VarRec.VType := vtAnsiString;
-  AnsiString(VarRec.VAnsiString) := S;
-{$ENDIF}
 end;
 end;
 
 
 {---}
 {---}
@@ -252,7 +238,7 @@ begin
       Result := True; { Lazy and in lazy branch, just return something }
       Result := True; { Lazy and in lazy branch, just return something }
   finally
   finally
     for I := High(Parameters) downto Low(Parameters) do
     for I := High(Parameters) downto Low(Parameters) do
-      if Parameters[I].VType = {$IFDEF UNICODE} vtUnicodeString {$ELSE} vtAnsiString {$ENDIF} then
+      if Parameters[I].VType = vtUnicodeString then
         AssignStringToVarRec(Parameters[I], '');
         AssignStringToVarRec(Parameters[I], '');
   end
   end
 end;
 end;

+ 1 - 2
Projects/SpawnServer.pas

@@ -179,8 +179,7 @@ function GetFinalFileName(const Filename: String): String;
 const
 const
   FILE_SHARE_DELETE = $00000004;
   FILE_SHARE_DELETE = $00000004;
 var
 var
-  GetFinalPathNameByHandleFunc: function(hFile: THandle;
-    lpszFilePath: {$IFDEF UNICODE} PWideChar {$ELSE} PAnsiChar {$ENDIF};
+  GetFinalPathNameByHandleFunc: function(hFile: THandle; lpszFilePath: PWideChar;
     cchFilePath: DWORD; dwFlags: DWORD): DWORD; stdcall;
     cchFilePath: DWORD; dwFlags: DWORD): DWORD; stdcall;
   Attr, FlagsAndAttributes: DWORD;
   Attr, FlagsAndAttributes: DWORD;
   H: THandle;
   H: THandle;

+ 7 - 49
Projects/Undo.pas

@@ -2,7 +2,7 @@ unit Undo;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2020 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -19,16 +19,13 @@ uses
   Windows, SysUtils, Int64Em, FileClass, CmnFunc2;
   Windows, SysUtils, Int64Em, FileClass, CmnFunc2;
 
 
 const
 const
-  HighestSupportedVersion = 48 {$IFDEF UNICODE} + 1000{$ENDIF};
+  HighestSupportedVersion = 1048;
   { Each time the format of the uninstall log changes (usually a new entry type
   { Each time the format of the uninstall log changes (usually a new entry type
     is added), HighestSupportedVersion and the file version number of Setup
     is added), HighestSupportedVersion and the file version number of Setup
     are incremented to match (51.x). Do NOT do this yourself; doing so could cause
     are incremented to match (51.x). Do NOT do this yourself; doing so could cause
     incompatibilities with future Inno Setup releases. It's recommended that you
     incompatibilities with future Inno Setup releases. It's recommended that you
     use the "utUserDefined" log entry type if you wish to implement your own
     use the "utUserDefined" log entry type if you wish to implement your own
-    custom uninstall log entries; see below for more information.
-
-    Note: the non Unicode HighestSupportedVersion may never become greater than
-    or equal to 1000. }
+    custom uninstall log entries; see below for more information. }
 
 
 type
 type
   TUninstallRecTyp = type Word;
   TUninstallRecTyp = type Word;
@@ -375,39 +372,19 @@ procedure TUninstallLog.Add(const Typ: TUninstallRecTyp; const Data: array of St
 var
 var
   I, L: Integer;
   I, L: Integer;
   S, X: AnsiString;
   S, X: AnsiString;
-{$IFDEF UNICODE}
   AData: AnsiString;
   AData: AnsiString;
-{$ENDIF}
   NewRec: PUninstallRec;
   NewRec: PUninstallRec;
 begin
 begin
   for I := 0 to High(Data) do begin
   for I := 0 to High(Data) do begin
     L := Length(Data[I])*SizeOf(Data[I][1]);
     L := Length(Data[I])*SizeOf(Data[I][1]);
 
 
-{$IFNDEF UNICODE}
-    if L < $FD then
-      S := S + AnsiChar(L)
-    else if L <= $FFFF then begin
-      SetLength(X, SizeOf(Byte) + SizeOf(Word));
-      X[1] := AnsiChar($FD);
-      Word((@X[2])^) := Word(L);
-      S := S + X;
-    end
-    else begin
-{$ENDIF}
-      SetLength(X, SizeOf(Byte) + SizeOf(Integer));
-      X[1] := AnsiChar($FE);
-      Integer((@X[2])^) := Integer({$IFDEF UNICODE}-{$ENDIF}L);
-      S := S + X;
-{$IFNDEF UNICODE}
-    end;
-{$ENDIF}
+    SetLength(X, SizeOf(Byte) + SizeOf(Integer));
+    X[1] := AnsiChar($FE);
+    Integer((@X[2])^) := Integer(-L);
+    S := S + X;
 
 
-{$IFDEF UNICODE}
     SetString(AData, PAnsiChar(Pointer(Data[I])), L);
     SetString(AData, PAnsiChar(Pointer(Data[I])), L);
     S := S + AData;
     S := S + AData;
-{$ELSE}
-    S := S + Data[I];
-{$ENDIF}
   end;
   end;
   S := S + AnsiChar($FF);
   S := S + AnsiChar($FF);
 
 
@@ -419,12 +396,6 @@ begin
 
 
   if Version < HighestSupportedVersion then
   if Version < HighestSupportedVersion then
     Version := HighestSupportedVersion;
     Version := HighestSupportedVersion;
-{$IFNDEF UNICODE}
-  { If the version is in Unicode range, bump it there too if needed. }
-  if (Version >= 1000) and
-     (Version < 1000 + HighestSupportedVersion) then
-    Version := 1000 + HighestSupportedVersion;
-{$ENDIF}
 end;
 end;
 
 
 procedure TUninstallLog.AddReg(const Typ: TUninstallRecTyp;
 procedure TUninstallLog.AddReg(const Typ: TUninstallRecTyp;
@@ -534,13 +505,8 @@ begin
       $FF: Break;
       $FF: Break;
     end;
     end;
     if L < 0 then begin
     if L < 0 then begin
-{$IFDEF UNICODE}
       L := -L;
       L := -L;
       SetString(Data[I], PChar(X), L div SizeOf(Char));
       SetString(Data[I], PChar(X), L div SizeOf(Char));
-{$ELSE}
-      { Should not be possible to get here, but check anyway for safety. }
-      InternalError('ExtractRecData: Unicode data unsupported by this build');
-{$ENDIF}
     end else
     end else
       SetString(Data[I], PAnsiChar(X), L);
       SetString(Data[I], PAnsiChar(X), L);
     Inc(X, L);
     Inc(X, L);
@@ -1158,12 +1124,9 @@ class function TUninstallLog.WriteSafeHeaderString(Dest: PAnsiChar;
   #1 marker. If MaxDestBytes = 0 it returns the amount of bytes needed. }
   #1 marker. If MaxDestBytes = 0 it returns the amount of bytes needed. }
 var
 var
   N: Integer;
   N: Integer;
-{$IFDEF UNICODE}
   I: Integer;
   I: Integer;
-{$ENDIF}
 begin
 begin
   N := Length(Source);
   N := Length(Source);
-{$IFDEF UNICODE}
   { Only UTF-8-encode when non-ASCII characters are present }
   { Only UTF-8-encode when non-ASCII characters are present }
   for I := 1 to N do begin
   for I := 1 to N do begin
     if Ord(Source[I]) > 126 then begin
     if Ord(Source[I]) > 126 then begin
@@ -1176,7 +1139,6 @@ begin
       Exit;
       Exit;
     end;
     end;
   end;
   end;
-{$ENDIF}
   if MaxDestBytes <> 0 then
   if MaxDestBytes <> 0 then
     AnsiStrings.StrPLCopy(Dest, AnsiString(Source), MaxDestBytes - 1);
     AnsiStrings.StrPLCopy(Dest, AnsiString(Source), MaxDestBytes - 1);
   Result := (N + 1) * SizeOf(Dest^);
   Result := (N + 1) * SizeOf(Dest^);
@@ -1184,14 +1146,10 @@ end;
 
 
 class function TUninstallLog.ReadSafeHeaderString(const Source: AnsiString): String;
 class function TUninstallLog.ReadSafeHeaderString(const Source: AnsiString): String;
 begin
 begin
-{$IFDEF UNICODE}
   if (Source <> '') and (Source[1] = #1) then
   if (Source <> '') and (Source[1] = #1) then
     Result := UTF8ToString(Copy(Source, 2, Maxint))
     Result := UTF8ToString(Copy(Source, 2, Maxint))
   else
   else
     Result := String(Source);
     Result := String(Source);
-{$ELSE}
-  Result := Source;
-{$ENDIF}
 end;
 end;
 
 
 procedure TUninstallLog.Save(const Filename: String;
 procedure TUninstallLog.Save(const Filename: String;

+ 2 - 17
Projects/Uninstall.pas

@@ -2,7 +2,7 @@ unit Uninstall;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2020 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -48,9 +48,6 @@ var
   LogFilename: String;
   LogFilename: String;
   InitialProcessWnd, FirstPhaseWnd, DebugWnd: HWND;
   InitialProcessWnd, FirstPhaseWnd, DebugWnd: HWND;
   OldWindowProc: Pointer;
   OldWindowProc: Pointer;
-{$IFNDEF UNICODE}
-  UninstLeadBytes: set of Char;
-{$ENDIF}
 
 
 procedure ShowExceptionMsg;
 procedure ShowExceptionMsg;
 var
 var
@@ -472,11 +469,7 @@ end;
 
 
 function ExtractCompiledCodeText(S: String): AnsiString;
 function ExtractCompiledCodeText(S: String): AnsiString;
 begin
 begin
-{$IFDEF UNICODE}
   SetString(Result, PAnsiChar(Pointer(S)), Length(S)*SizeOf(S[1]));
   SetString(Result, PAnsiChar(Pointer(S)), Length(S)*SizeOf(S[1]));
-{$ELSE}
-  Result := S;
-{$ENDIF}
 end;
 end;
 
 
 procedure RunSecondPhase;
 procedure RunSecondPhase;
@@ -552,21 +545,13 @@ begin
     UninstDataFile := OpenUninstDataFile(faReadWrite);
     UninstDataFile := OpenUninstDataFile(faReadWrite);
 
 
     if not UninstLog.ExtractLatestRecData(utCompiledCode,
     if not UninstLog.ExtractLatestRecData(utCompiledCode,
-         SetupBinVersion {$IFDEF UNICODE} or Longint($80000000) {$ENDIF}, CompiledCodeData) then
+         SetupBinVersion or Longint($80000000), CompiledCodeData) then
       InternalError('Cannot find utCompiledCode record for this version of the uninstaller');
       InternalError('Cannot find utCompiledCode record for this version of the uninstaller');
     if DebugWnd <> 0 then
     if DebugWnd <> 0 then
       CompiledCodeText := DebugClientCompiledCodeText
       CompiledCodeText := DebugClientCompiledCodeText
     else
     else
       CompiledCodeText := ExtractCompiledCodeText(CompiledCodeData[0]);
       CompiledCodeText := ExtractCompiledCodeText(CompiledCodeData[0]);
 
 
-{$IFNDEF UNICODE}
-    { Initialize ConstLeadBytes }
-    if Length(CompiledCodeData[1]) <> SizeOf(UninstLeadBytes) then
-      InternalError('utCompiledCode[1] is invalid');
-    Move(Pointer(CompiledCodeData[1])^, UninstLeadBytes, SizeOf(UninstLeadBytes));
-    ConstLeadBytes := @UninstLeadBytes;
-{$ENDIF}
-
     InitializeAdminInstallMode(ufAdminInstallMode in UninstLog.Flags);
     InitializeAdminInstallMode(ufAdminInstallMode in UninstLog.Flags);
 
 
     { Initialize install mode }
     { Initialize install mode }

+ 1 - 1
Projects/Wizard.pas

@@ -2999,5 +2999,5 @@ end;
 
 
 initialization
 initialization
   SHPathPrepareForWriteFunc := GetProcAddress(SafeLoadLibrary(AddBackslash(GetSystemDir) + shell32,
   SHPathPrepareForWriteFunc := GetProcAddress(SafeLoadLibrary(AddBackslash(GetSystemDir) + shell32,
-    SEM_NOOPENFILEERRORBOX), {$IFDEF UNICODE}'SHPathPrepareForWriteW'{$ELSE}'SHPathPrepareForWriteA'{$ENDIF});
+    SEM_NOOPENFILEERRORBOX), 'SHPathPrepareForWriteW');
 end.
 end.