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

+ 0 - 7
ISHelp/ISHelpGen/UIsxclassesParser.pas

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

+ 1 - 21
Projects/Helper.pas

@@ -2,7 +2,7 @@ unit Helper;
 
 {
   Inno Setup
-  Copyright (C) 1997-2010 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   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
   threads simultaneously.
-
-  $jrsoftware: issrc/Projects/Helper.pas,v 1.14 2010/10/20 02:43:26 jr Exp $
 }
 
 interface
@@ -146,7 +144,6 @@ begin
 end;
 
 procedure FillWideCharBuffer(var Buf: array of WideChar; const S: String);
-{$IFDEF UNICODE}
 begin
   if High(Buf) <= 0 then
     InternalError('FillWideCharBuffer: Invalid Buf');
@@ -154,23 +151,6 @@ begin
     InternalError('FillWideCharBuffer: String too long');
   StrPLCopy(Buf, S, High(Buf));
 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 }
 

+ 0 - 12
Projects/InstFunc.pas

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

+ 1 - 27
Projects/Install.pas

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

+ 1 - 3
Projects/ScriptClasses_R.pas

@@ -24,7 +24,7 @@ implementation
 uses
   Windows, Controls, Forms, StdCtrls, Graphics,
   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,
   ExtCtrls, UIStateForm, SetupForm, Main, Wizard, SetupTypes, PasswordEdit,
   FolderTreeView, BitmapImage, NewNotebook, ScriptDlg, BidiCtrls,
@@ -370,9 +370,7 @@ begin
     RIRegisterTStringList(Cl);
     RIRegisterTHandleStream(Cl);
     RIRegisterTFileStream(Cl);
-{$IFDEF UNICODE}
     RIRegisterTStringStream(Cl);
-{$ENDIF}
 
     { Graphics }
     RIRegisterTGraphicsObject(Cl);

+ 3 - 34
Projects/ScriptRunner.pas

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

+ 0 - 28
Projects/SecurityFunc.pas

@@ -25,34 +25,6 @@ implementation
 uses
   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;
   const Entries: TGrantPermissionEntry; const EntryCount: Integer;
   const Inheritance: DWORD): DWORD;

+ 2 - 16
Projects/SimpleExpression.pas

@@ -2,7 +2,7 @@ unit SimpleExpression;
 
 {
   Inno Setup
-  Copyright (C) 1997-2013 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
@@ -68,24 +68,10 @@ implementation
 uses
   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);
 begin
-{$IFDEF UNICODE}
   VarRec.VType := vtUnicodeString;
   UnicodeString(VarRec.VUnicodeString) := S;
-{$ELSE}
-  VarRec.VType := vtAnsiString;
-  AnsiString(VarRec.VAnsiString) := S;
-{$ENDIF}
 end;
 
 {---}
@@ -252,7 +238,7 @@ begin
       Result := True; { Lazy and in lazy branch, just return something }
   finally
     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], '');
   end
 end;

+ 1 - 2
Projects/SpawnServer.pas

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

+ 7 - 49
Projects/Undo.pas

@@ -2,7 +2,7 @@ unit Undo;
 
 {
   Inno Setup
-  Copyright (C) 1997-2020 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
@@ -19,16 +19,13 @@ uses
   Windows, SysUtils, Int64Em, FileClass, CmnFunc2;
 
 const
-  HighestSupportedVersion = 48 {$IFDEF UNICODE} + 1000{$ENDIF};
+  HighestSupportedVersion = 1048;
   { Each time the format of the uninstall log changes (usually a new entry type
     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
     incompatibilities with future Inno Setup releases. It's recommended that you
     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
   TUninstallRecTyp = type Word;
@@ -375,39 +372,19 @@ procedure TUninstallLog.Add(const Typ: TUninstallRecTyp; const Data: array of St
 var
   I, L: Integer;
   S, X: AnsiString;
-{$IFDEF UNICODE}
   AData: AnsiString;
-{$ENDIF}
   NewRec: PUninstallRec;
 begin
   for I := 0 to High(Data) do begin
     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);
     S := S + AData;
-{$ELSE}
-    S := S + Data[I];
-{$ENDIF}
   end;
   S := S + AnsiChar($FF);
 
@@ -419,12 +396,6 @@ begin
 
   if Version < HighestSupportedVersion then
     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;
 
 procedure TUninstallLog.AddReg(const Typ: TUninstallRecTyp;
@@ -534,13 +505,8 @@ begin
       $FF: Break;
     end;
     if L < 0 then begin
-{$IFDEF UNICODE}
       L := -L;
       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
       SetString(Data[I], PAnsiChar(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. }
 var
   N: Integer;
-{$IFDEF UNICODE}
   I: Integer;
-{$ENDIF}
 begin
   N := Length(Source);
-{$IFDEF UNICODE}
   { Only UTF-8-encode when non-ASCII characters are present }
   for I := 1 to N do begin
     if Ord(Source[I]) > 126 then begin
@@ -1176,7 +1139,6 @@ begin
       Exit;
     end;
   end;
-{$ENDIF}
   if MaxDestBytes <> 0 then
     AnsiStrings.StrPLCopy(Dest, AnsiString(Source), MaxDestBytes - 1);
   Result := (N + 1) * SizeOf(Dest^);
@@ -1184,14 +1146,10 @@ end;
 
 class function TUninstallLog.ReadSafeHeaderString(const Source: AnsiString): String;
 begin
-{$IFDEF UNICODE}
   if (Source <> '') and (Source[1] = #1) then
     Result := UTF8ToString(Copy(Source, 2, Maxint))
   else
     Result := String(Source);
-{$ELSE}
-  Result := Source;
-{$ENDIF}
 end;
 
 procedure TUninstallLog.Save(const Filename: String;

+ 2 - 17
Projects/Uninstall.pas

@@ -2,7 +2,7 @@ unit Uninstall;
 
 {
   Inno Setup
-  Copyright (C) 1997-2020 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
@@ -48,9 +48,6 @@ var
   LogFilename: String;
   InitialProcessWnd, FirstPhaseWnd, DebugWnd: HWND;
   OldWindowProc: Pointer;
-{$IFNDEF UNICODE}
-  UninstLeadBytes: set of Char;
-{$ENDIF}
 
 procedure ShowExceptionMsg;
 var
@@ -472,11 +469,7 @@ end;
 
 function ExtractCompiledCodeText(S: String): AnsiString;
 begin
-{$IFDEF UNICODE}
   SetString(Result, PAnsiChar(Pointer(S)), Length(S)*SizeOf(S[1]));
-{$ELSE}
-  Result := S;
-{$ENDIF}
 end;
 
 procedure RunSecondPhase;
@@ -552,21 +545,13 @@ begin
     UninstDataFile := OpenUninstDataFile(faReadWrite);
 
     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');
     if DebugWnd <> 0 then
       CompiledCodeText := DebugClientCompiledCodeText
     else
       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);
 
     { Initialize install mode }

+ 1 - 1
Projects/Wizard.pas

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